Skip to content

Conversation

@Ladicek
Copy link
Contributor

@Ladicek Ladicek commented Nov 21, 2025

Fixes #50947
Fixes #50948
Fixes #50950

@Ladicek Ladicek requested review from manovotn and mkouba November 21, 2025 14:35
@Ladicek Ladicek added the area/arc Issue related to ARC (dependency injection) label Nov 21, 2025
@Ladicek Ladicek changed the title Arc fix decorators ArC: decorators fixes Nov 21, 2025
@Ladicek
Copy link
Contributor Author

Ladicek commented Nov 21, 2025

This PR doesn't include a fix for #50950, because:

1. I'm still working on it
2. I imagine it will provoke some discussion, while the 2 fixes present in this PR should be relatively non-controversial.

This PR now includes a fix for #50950.

@quarkus-bot

This comment has been minimized.

}

if (Modifier.isAbstract(decoratorClass.flags())) {
// TODO this check is not precise: we check that decorators do not declare _any_ abstract methods,
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have a follow-up issue for this TODO?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't; good point. Filed #51196.

Copy link
Contributor

@mkouba mkouba left a comment

Choose a reason for hiding this comment

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

Looks good.

Copy link
Contributor

@manovotn manovotn left a comment

Choose a reason for hiding this comment

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

LGTM

Particularly the solution in the second commit is really nice 👍

Originally, we only looked at methods declared directly in the decorator
class, but that's not enough. Decorators may inherit implementations
of decorated methods from superclasses and superinterfaces.

Note we make sure we don't include non-`public` methods. It is possible
to inherit `protected` and package-private methods in the same package,
but since all decorated types are interfaces, and interfaces may only
declare `public` and `private` methods, and `private` methods are never
inherited, inherited decorated methods must be `public`. Attempting to
inherit a `protected` decorated method or a package-private decorated
method in the same package would fail compilation.
In case multiple decorated types of a single decorator declare the same
method (it may have the same signature, but in presence of generic types,
it doesn't have to), we used to remember all of them, which later lead
to an error when generating the decorating subclass.

This commit fixes that: we really only need to remember _one_ method
from each decorator, and it doesn't really matter which exact one it is,
because all decorated methods are virtual and we invoke them as such.
@Ladicek
Copy link
Contributor Author

Ladicek commented Nov 28, 2025

Rebased in order to rerun, and added a fix for #50950.

@Ladicek Ladicek requested review from manovotn and mkouba November 28, 2025 08:03
@quarkus-bot

This comment has been minimized.

@github-actions
Copy link

github-actions bot commented Nov 28, 2025

🎊 PR Preview d2bb1ce has been successfully built and deployed to https://quarkus-pr-main-51166-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.

Copy link
Contributor

@manovotn manovotn left a comment

Choose a reason for hiding this comment

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

Initially I thought the third commit will be problematic for a non-normal scoped non-app bean decorated with an app bean decorator but that seems to somehow just work, so I think we're good :)

@Ladicek
Copy link
Contributor Author

Ladicek commented Nov 28, 2025

Initially I thought the third commit will be problematic for a non-normal scoped non-app bean decorated with an app bean decorator but that seems to somehow just work, so I think we're good :)

I'll add a test for this case soon.

A while ago, we turned generated `_Bean`, `_Subclass` and `_ClientProxy`
classes pertaining to non-app beans into app classes to allow decoration
by app decorators. This in turn made injection into non-`public` IPs
impossible.

We fix it in this commit by a bytecode transformation that makes these IPs
`public`. However, this might break subclasses (albeit in relatively rare
cases), so in case the bean class has subclasses, we error out.

Also, this commit turns the generated `_ClientProxy` classes back into
non-app, because that allows invoking non-`public` methods. Turning
the generated `_ClientProxy` class into app class was arguably a mistake.

Finally, this commit removes the `<scope>test</scope>` on 2 dependencies
in the `extensions/arc/deployment` module, because when test-scoped
dependencies are used in `QuarkusUnitTest.setForcedDependencies()`,
they are treated as application archives. If they have the default scope,
they are treated as non-app archives, which is exactly what we need
in all tests in this module that use `setForcedDependencies()`. To make
sure we don't regress again, a comment is added in the POM and all tests
that use this feature also assert that the classes from the external
archives are indeed loaded by the base runtime CL (and not runtime CL).
@Ladicek
Copy link
Contributor Author

Ladicek commented Nov 28, 2025

Added the test to the top commit.

@quarkus-bot
Copy link

quarkus-bot bot commented Nov 28, 2025

Status for workflow Quarkus Documentation CI

This is the status report for running Quarkus Documentation CI on commit 709c1d6.

✅ 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.

@quarkus-bot
Copy link

quarkus-bot bot commented Nov 28, 2025

Status for workflow Quarkus CI

This is the status report for running Quarkus CI on commit 709c1d6.

✅ 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.


Flaky tests - Develocity

⚙️ JVM Tests - JDK 21

📦 extensions/smallrye-reactive-messaging/deployment

io.quarkus.smallrye.reactivemessaging.hotreload.ConnectorChangeTest.testUpdatingConnector - History

  • Expecting actual: ["-6","-7","-9","-10","-11","-12","-13","-14"] to start with: ["-6", "-7", "-8", "-9"] - java.lang.AssertionError
java.lang.AssertionError: 

Expecting actual:
  ["-6","-7","-9","-10","-11","-12","-13","-14"]
to start with:
  ["-6", "-7", "-8", "-9"]

	at io.quarkus.smallrye.reactivemessaging.hotreload.ConnectorChangeTest.testUpdatingConnector(ConnectorChangeTest.java:41)

⚙️ MicroProfile TCKs Tests

📦 tcks/microprofile-lra

org.eclipse.microprofile.lra.tck.TckRecoveryTests.testCancelWhenParticipantIsUnavailable - History

  • Expecting the metric Compensated callback was called Expected: a value equal to or greater than <1> but: <0> was less than <1> - java.lang.AssertionError
java.lang.AssertionError: 
Expecting the metric Compensated callback was called
Expected: a value equal to or greater than <1>
     but: <0> was less than <1>
	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
	at org.eclipse.microprofile.lra.tck.TckRecoveryTests.assertMetricCallbackCalled(TckRecoveryTests.java:210)
	at org.eclipse.microprofile.lra.tck.TckRecoveryTests.testCancelWhenParticipantIsUnavailable(TckRecoveryTests.java:195)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/arc Issue related to ARC (dependency injection) triage/flaky-test

Projects

None yet

3 participants