hilla icon indicating copy to clipboard operation
hilla copied to clipboard

Make it easier to debug an empty @Endpoint class

Open Legioth opened this issue 5 years ago • 2 comments

If you e.g. forget to mark your endpoint method as public, then there will not be any generated .ts file for your @Endpoint class. This may lead you towards investigating whether the file is detected at all or whether the whole code generation is somehow not working.

If there would instead be an empty generated .ts file, then it would be easier to pinpoint the source of the problem. It would be even better if the generated file would contain a comment that points out that there aren't any public methods in the Java class.

Another alternative would be that the generator fails with a clear error in this kind of situation.

Legioth avatar Feb 26 '20 09:02 Legioth

Hi, just a comment regarding this. It happened to me twice that I had to waste time investigating why the endpoint was not being generated because there were no logs and no ts file generated without methods. I think that just stress that endpoint methods should be public in the documentation is not enough (probably that is why this issue is still opened). IMHO, adding a warning in the logs that no public methods where found while scanning an @Endpoint annotated class would be enough, given that it would make no sense to have it like that.

mlopezFC avatar Jul 12 '21 13:07 mlopezFC

adding a warning in the logs that no public methods where found

It has occasionally happened that some users have noticed log messages, but I wouldn't count on it. Since there isn't really any reason to have an annotated class without public methods, it could just as well throw an error.

Legioth avatar Jul 26 '21 11:07 Legioth

Throwing an error seems good in this case.

platosha avatar Nov 29 '22 12:11 platosha