hilla icon indicating copy to clipboard operation
hilla copied to clipboard

feat: improved endpoint detection

Open tepi opened this issue 9 months ago • 3 comments

Fixes https://github.com/vaadin/flow/issues/20983

tepi avatar Feb 19 '25 07:02 tepi

When tested this together with Flow counterpart, the following error is thrown for me:

Caused by: java.lang.IllegalArgumentException: Unexpected class name interface com.vaadin.hilla.BrowserCallable. Implementation error: the class finder instance is not aware of this class. Fix @HandlesTypes annotation value for com.vaadin.base.devserver.startup.DevModeStartupListener
        at com.vaadin.base.devserver.startup.DevModeInitializer$DevModeClassFinder.ensureImplementation(DevModeInitializer.java:125) ~[vaadin-dev-server-24.7-SNAPSHOT.jar:na]
        at com.vaadin.base.devserver.startup.DevModeInitializer$DevModeClassFinder.getAnnotatedClasses(DevModeInitializer.java:109) ~[vaadin-dev-server-24.7-SNAPSHOT.jar:na]
        at com.vaadin.flow.server.frontend.scanner.ClassFinder$CachedClassFinder.lambda$getAnnotatedClasses$0(ClassFinder.java:154) ~[flow-server-24.7-SNAPSHOT.jar:24.7-SNAPSHOT]
        at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1229) ~[na:na]
        at com.vaadin.flow.server.frontend.scanner.ClassFinder$CachedClassFinder.getAnnotatedClasses(ClassFinder.java:153) ~[flow-server-24.7-SNAPSHOT.jar:24.7-SNAPSHOT]
        at com.vaadin.hilla.internal.EndpointGeneratorTaskFactoryImpl.lambda$hasBrowserCallables$0(EndpointGeneratorTaskFactoryImpl.java:100) ~[hilla-engine-runtime-24.7-SNAPSHOT.jar:na]
        at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[na:na]
        at com.vaadin.hilla.internal.EndpointGeneratorTaskFactoryImpl.hasBrowserCallables(EndpointGeneratorTaskFactoryImpl.java:99) ~[hilla-engine-runtime-24.7-SNAPSHOT.jar:na]
        at com.vaadin.flow.internal.hilla.EndpointRequestUtil.areHillaEndpointsUsed(EndpointRequestUtil.java:105) ~[flow-server-24.7-SNAPSHOT.jar:24.7-SNAPSHOT]
        at com.vaadin.flow.server.frontend.NodeTasks.addEndpointServicesTasks(NodeTasks.java:322) ~[flow-server-24.7-SNAPSHOT.jar:24.7-SNAPSHOT]
        at com.vaadin.flow.server.frontend.NodeTasks.<init>(NodeTasks.java:237) ~[flow-server-24.7-SNAPSHOT.jar:24.7-SNAPSHOT]
        at com.vaadin.base.devserver.startup.DevModeInitializer.initDevModeHandler(DevModeInitializer.java:331) ~[vaadin-dev-server-24.7-SNAPSHOT.jar:na]
        at com.vaadin.base.devserver.DevModeHandlerManagerImpl.initDevModeHandler(DevModeHandlerManagerImpl.java:106) ~[vaadin-dev-server-24.7-SNAPSHOT.jar:na]
        at com.vaadin.flow.spring.VaadinServletContextInitializer$DevModeServletContextListener.failFastContextInitialized(VaadinServletContextInitializer.java:601) ~[vaadin-spring-24.7-SNAPSHOT.jar:na]
        at com.vaadin.flow.spring.VaadinServletContextInitializer$FailFastServletContextListener.contextInitialized(VaadinServletContextInitializer.java:202) ~[vaadin-spring-24.7-SNAPSHOT.jar:na]
        ... 44 common frames omitted

that means the class finder needs endpoint annotations in Flow's context initializer, but we cannot add them as Flow does not depend on Hilla.

mshabarov avatar Feb 24 '25 10:02 mshabarov

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 86.99%. Comparing base (c431cbb) to head (0e082fc).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3255   +/-   ##
=======================================
  Coverage   86.99%   86.99%           
=======================================
  Files         118      118           
  Lines        8292     8292           
  Branches     1269     1269           
=======================================
  Hits         7214     7214           
  Misses       1064     1064           
  Partials       14       14           
Flag Coverage Δ
unittests 86.99% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Feb 25 '25 08:02 codecov[bot]