Skip to content
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

Make ArC add the no-arg constructor or raise better error message when no-arg constructor is not present #549

Closed
emmanuelbernard opened this issue Jan 17, 2019 · 1 comment
Assignees
Labels
kind/bug Something isn't working
Milestone

Comments

@emmanuelbernard
Copy link
Member

@ApplicationScoped
public class BookService {

    final Validator validator;


    @Inject
    public BookService(Validator validator) {
        this.validator = validator;
    }

    public void validateBook(@Valid Book book) {
        // your business logic here
    }
}

java.lang.NoSuchMethodError: org.jboss.shamrock.example.beanvalidation.GreetingService: method <init>()V not found
    at org.jboss.shamrock.example.beanvalidation.GreetingService_ClientProxy.<init>(Unknown Source)
    at org.jboss.shamrock.example.beanvalidation.GreetingService_Bean$$function$$3.get(Unknown Source)
    at org.jboss.protean.arc.LazyValue.get(LazyValue.java:42)
    at org.jboss.shamrock.example.beanvalidation.GreetingService_Bean.get(Unknown Source)
    at org.jboss.shamrock.example.beanvalidation.GreetingService_Bean.get(Unknown Source)

We should in decreasing order of preference

  1. Bytecode enhance to add the noarg constructor
  2. Raise a proper error message
@emmanuelbernard emmanuelbernard added the kind/bug Something isn't working label Jan 17, 2019
@mkouba
Copy link
Contributor

mkouba commented Jan 17, 2019

I'd go with 2 for now but I'll investigate the bytecode enhancement. It shouldn't be a problem for simple classes but I'm not sure about the more complex ones... need to think a little ;-)

@cescoffier cescoffier added this to the 0.7.0 milestone Jan 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants