quarkus icon indicating copy to clipboard operation
quarkus copied to clipboard

ArC: imprecise check for abstract methods in decorators

Open Ladicek opened this issue 4 weeks ago • 2 comments

Describe the bug

The check for abstract methods declared in decorators, as present in Decorators.createDecorator(), is imprecise. We check that decorators do not declare any abstract methods, but the spec says that decorators may not declare abstract methods that do not belong to a decorated type. Also, we only check methods declared on the decorator class itself, not inherited methods. (We can probably ignore abstract methods inherited from interfaces, because those are decorated types, but a decorator can inherit abstract methods from a superclass, and those do not necessarily have to be present on decorated types.)

That doesn't cause any TCK failures, because decorators are not present in CDI Lite (plus I'm not sure this is actually tested by the TCK), and so far there hasn't been any issues filed about this, so this is purely of a theoretical concern (I only stumbled upon this by writing test cases for various corner cases). Still, it is a deviation from the specification, so I believe we should fix it. It's a lower priority kind of thing, though.

Expected behavior

Only fail when an abstract method that doesn't belong to a decorated type is explicitly declared on a decorator or inherited (and not implemented!) from a supertype.

Actual behavior

Fail whenever an abstract method is explicitly declared on a decorator; abstract methods declared on supertypes are ignored.

How to Reproduce?

N/A

Output of uname -a or ver

No response

Output of java -version

No response

Quarkus version or git rev

No response

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

Ladicek avatar Nov 24 '25 09:11 Ladicek

/cc @manovotn (arc), @mkouba (arc)

quarkus-bot[bot] avatar Nov 24 '25 09:11 quarkus-bot[bot]

I have made a PR You can get the file case in my github: https://raw.githubusercontent.com/quarkusio/quarkus/a7ec8d6187b96f0c88888ed65045b63329aa7fbe/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Decorators.java

fabriciolima avatar Dec 07 '25 14:12 fabriciolima

@Ladicek I think now is working. Man, this was fun

fabriciolima avatar Dec 18 '25 20:12 fabriciolima

@Ladicek I think now is working. Man, this was fun

I have triggered the CI run but you may have to wait for proper review until after Christmas as some (many?) of us are already gone for this year :)

manovotn avatar Dec 19 '25 10:12 manovotn