-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'Cannot delegate to an abstract method' for scoped bean with complex interfaces #17755
Comments
/cc @mkouba |
Ok, so there are some limitations when invoking methods from within a bean's no-args constructor. First of all, keep in mind that this constructor is called twice for normal scoped beans. First time, when the client proxy instance is created. In your example, there is a class I'd really recommend to avoid having initialization logic in the constructor and use a That said, the reason why we currently don't call A workaround exists for the time being - just override the public class MyBean extends Component implements HasSize {
@Override
public Object getElement() {
return super.getElement();
}
} |
Is the fix come with 2.0 or will it be waiting until 2.1? |
It should be backported in 2.0. But as I said above, users are encouraged to switch to a more idiomatic approach instead ;-). |
The Vaadin framework has this issue with the components. |
- resolves quarkusio#17755 (cherry picked from commit a761ecd)
Describe the bug
For a scoped bean with the setup:
MyBean extends Component implements HasSize
constructor callsHasSize::setSize
interface
HasSize extends HasElement
has a default implementationsetSize
that callsHasElement::getElement
interface
HasElement
class
Component implements HasElement
This has the actual implementationExpected behavior
Bean can be instantiated and injected.
Actual behavior
Bean instantiation throws
Cannot delegate to an abstract method
To Reproduce
https://github.com/caalador/quarkus-scoped-bean
Steps to reproduce the behavior:
mvn clean package -Dquarkus.debug.generated-sources-dir=gen
gen/org/acme/MyBean_ClientProxy.zig
forMethod getElement
and see that it hasIllegalStateException
for if bean not instantiatedTo have a successful build with tests change
@ApplicationScoped
to@Singleton
or implement inMyBean
Environment (please complete the following information):
windows 10
Output of
java -version
Java version: 1.8.0_222 & Java version: 11.0.4
Quarkus version or git rev
1.10.5.Final, 1.13.6.Final, 2.0.0.CR3
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.8.1
The text was updated successfully, but these errors were encountered: