-
Notifications
You must be signed in to change notification settings - Fork 55
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
feat: add endpoint detection #2938
base: main
Are you sure you want to change the base?
Conversation
Needs to be tested along with vaadin/flow#20567 in order to compile |
return !classFinder.getAnnotatedClasses(Endpoint.class).isEmpty() | ||
|| !classFinder.getAnnotatedClasses(BrowserCallable.class) | ||
.isEmpty(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check should probably exclude Hilla internal annotated classes, like SignalsHandler
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent point, indeed, without this Flow would always try to generate the endpoints unless one completely excludes Hilla.
Something similar is needed:
ClassFinder classFinder = options.getClassFinder();
return Stream.concat(
classFinder.getAnnotatedClasses(Endpoint.class).stream(),
classFinder.getAnnotatedClasses(BrowserCallable.class).stream())
.anyMatch(annotatedClass -> !annotatedClass.getPackage().getName()
.startsWith("com.vaadin.hilla"));
Assertions.fail("Class " + clazz.getName() | ||
+ " is annotated with @BrowserCallable or @Endpoint, but missing @InternalBrowserCallable."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the assertion message is not correct here: in this case, all annotatedClasses
will have @InternalBrowserCallable
annotation, but they might miss @BrowserCallable
or @Endpoint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably the messages in the two tests are inverted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, they are inverted indeed, thanks for noticing it 👍
ed89b41
to
5e2e68c
Compare
Quality Gate passedIssues Measures |
This should be ready for review now, trying locally and it seems to pass on existing tests and new ones. |
Add check for if endpoint generator needs to run
Fixes vaadin/flow#20289
Fixes vaadin/flow#18800