Skip to content

Conversation

gsmet
Copy link
Member

@gsmet gsmet commented Jun 27, 2025

Using the common signatures that were preexisting for a start.

And add some more.

Copy link

quarkus-bot bot commented Jun 27, 2025

/cc @brunobat (opentelemetry), @radcortez (opentelemetry)


@SuppressForbidden(reason = "Type.toString() is what we need here")
public static Name from(Type type) {
return new Name(type.toString(), createSimpleName(type));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mkouba @manovotn @Ladicek My understanding is that type.toString() could contain unwanted output such as annotations so I'm not sure it's the right choice here. But then going to the name() would drop the potential type variables info?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name seems to be used for things like beans, scopes, qualifiers etc. where type annotations are not common. (Note that Type.toString() only contains type annotations.) So this seems good enough to me.

(Using Type.name() here would drop more than just type variables; it would turn List<String> to List for example.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where type annotations are not common

I've never seen any type annotations in any CDI code. So I'd say it's pretty rare and not uncommon ;-).

So this seems good enough to me.

+1

return (boolean) Console.class.getMethod("isTerminal").invoke(console);
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "Failed to invoke System.console().isTerminal() via Reflection API", e);
LOGGER.error("Failed to invoke System.console().isTerminal() via Reflection API", e);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@phillip-kruger I wasn't sure if the use of java.util.logging here was something you actually wanted (maybe you need low level things?).

Copy link

github-actions bot commented Jun 27, 2025

🎊 PR Preview 1a01fee has been successfully built and deployed to https://quarkus-pr-main-48655-preview.surge.sh/version/main/guides/

  • Images of blog posts older than 3 months are not available.
  • Newsletters older than 3 months are not available.

@gsmet gsmet marked this pull request as ready for review June 30, 2025 07:14

This comment has been minimized.

gsmet added 3 commits July 2, 2025 18:27
Using the common signatures that were preexisting.
And drop our custom annotations.
@gsmet gsmet force-pushed the generalize-forbidden-apis branch from 45f3db7 to 190c4ac Compare July 2, 2025 16:28
@gsmet
Copy link
Member Author

gsmet commented Jul 2, 2025

Pushed something that should fix the first CI issue that happened very early. Let's see how it goes with the rest.

Copy link

quarkus-bot bot commented Jul 2, 2025

Status for workflow Quarkus Documentation CI

This is the status report for running Quarkus Documentation CI on commit 190c4ac.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

Warning

There are other workflow runs running, you probably need to wait for their status before merging.

Copy link

quarkus-bot bot commented Jul 2, 2025

Status for workflow Quarkus CI

This is the status report for running Quarkus CI on commit 190c4ac.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

You can consult the Develocity build scans.

@gsmet gsmet requested a review from gastaldi July 3, 2025 15:38
@gsmet
Copy link
Member Author

gsmet commented Jul 3, 2025

@gastaldi I would appreciate if you could have a look as this will unblock a PR by @holly-cummins too.

Comment on lines +24 to +27
LOG.debug("available exporters: " + exporters.stream()
.map(e -> e.getClass().getName())
.reduce((a, b) -> a + ", " + b)
.orElse("none"));
Copy link
Contributor

@gastaldi gastaldi Jul 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe avoid concatenating strings. I'm always confused with what parameter to use here ({}, {0}, %s)? I think it's %s given the other examples in the code

Suggested change
LOG.debug("available exporters: " + exporters.stream()
.map(e -> e.getClass().getName())
.reduce((a, b) -> a + ", " + b)
.orElse("none"));
LOG.debugf("available exporters: %s", exporters.stream()
.map(e -> e.getClass().getName())
.reduce((a, b) -> a + ", " + b)
.orElse("none"));

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in this case, having the call protected with isDebugEnabled() is better.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how that relates to my suggestion, as it's a simple enhancement to minimize String pooling/creation

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's related because, before my change, this code was always executed, it's not now.

Feel free to adjust this further if you want, I didn't want a full CI run for something that is now good given it won't be executed if not in debug.

If you do it in a small PR, CI will be a lot more focused.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, the idea is not to avoid the code from being executed, more than to minimize the String concatenation cost. I'll submit a separate PR for that. Thanks

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'm just saying you only pay the cost in debug so you don't really care :).

But I'm fine with a follow-up PR, I agree the *f versions are cleaner.

Copy link
Contributor

@gastaldi gastaldi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gsmet gsmet merged commit 3476772 into quarkusio:main Jul 3, 2025
59 checks passed
@quarkus-bot quarkus-bot bot added this to the 3.25 - main milestone Jul 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants