eclipse-cs icon indicating copy to clipboard operation
eclipse-cs copied to clipboard

plugin version throws 8.28.0.202001092018 allowMissingThrowsTags does not exist exception

Open yilativs opened this issue 5 years ago • 9 comments

When checkstyle config contains allowMissingThrowsTags e.g.

<module name="JavadocMethod">
      <property name="allowMissingThrowsTags" value="true" />
</module>

an exception is thrown:

allowMissingThrowsTags is 
!ENTRY net.sf.eclipsecs.core 4 0 2020-01-14 13:25:03.959
!MESSAGE Checkstyle-Plugin: cannot initialize module TreeWalker - cannot initialize module JavadocMethod - Property 'allowMissingThrowsTags' does not exist, please check the documentation
!STACK 0
com.puppycrawl.tools.checkstyle.api.CheckstyleException: cannot initialize module TreeWalker - cannot initialize module JavadocMethod - Property 'allowMissingThrowsTags' does not exist, please check the documentation
	at com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:473)


yilativs avatar Jan 14 '20 11:01 yilativs

https://checkstyle.org/config_javadoc.html#JavadocMethod_Properties allowMissingThrowsTags does not exist anymore and was removed. You should remove the property from your config.

See https://github.com/checkstyle/checkstyle/issues/7329#issue-534289686

rnveach avatar Jan 14 '20 11:01 rnveach

I don't think the bug was closed. This TAG did exist and it's normal that there are projects that still have it. The plugin should return WARNING, instead it crashes eclipse.

yilativs avatar Jan 19 '20 09:01 yilativs

This is not a matter of the eclipse plugin. The exception happens in checkstyle core, which cannot deal with mismatching configuration files after upgrades. I'm completely with you however, that this should be changed in the core project, to make it less fragile.

Bananeweizen avatar Feb 01 '20 06:02 Bananeweizen

@Bananeweizen, is it enough for plugins to review exception cause and report problem in friendly message. What you think will be good to be done by library ?

romani avatar Feb 01 '20 15:02 romani

I reopen issue as reminder to continue discussion, if some ideas appear, we should create new issue

romani avatar Feb 01 '20 15:02 romani

I believe the plugin should catch RuntimeExceptions and return the message to the user, even if it is an Exception inside Check Style. or JDK.

yilativs avatar Feb 01 '20 16:02 yilativs

Library throw checked exception com.puppycrawl.tools.checkstyle.api.CheckstyleException , we can make such exception more distinctive from other exceptions to let plugin make exception handling. Plugin can make run of config on empty file, so it will test config to be valid or not, in such case all exceptions can be delivered to user.

romani avatar Feb 01 '20 18:02 romani

It's not accurate to say that the CheckstyleException "crashes Eclipse". It's reported as a user-friendly error. I admit the generic message is not very helpful. It just says: Checkstyle execution failed due to an internal error. Please check the error log for details... What do you think about changing it to report the message of the original exception to the user? So it would say something like this instead, depending on the error?

cannot initialize module TreeWalker - cannot initialize module UnnecessarySemicolonAfterOuterTypeDeclarationn - Unable to instantiate [...]

Calixte avatar Apr 27 '20 00:04 Calixte

Yes, at least it shows what Check is trouble maker, so user can disable it and google on error message and find main repo issue with migration notes

romani avatar Apr 27 '20 01:04 romani