Cannot initialize TreeWalker module - unable to instantiate SuppressWarningsHolder

I have maven-checkstyle-plugin (v2.5) and configured maven-eclipse-plugin (v2.8).

Everything worked as expected, but as soon as I entered,

module name = "SuppressWarningsHolder" AND / OR module name = "SuppressWarningsFilter"

in my checkstyle-config.xml, I am having problems creating a project.

Here is what I get:

[ERROR] BUILD ERROR 1> [INFO] ------------------------------------------------------------------------ 1> [INFO] Failed during checkstyle configuration 1> 1>EXEC : Embedded error : cannot initialize module TreeWalker - Unable to instantiate SuppressWarningsHolder 1> Unable to instantiate SuppressWarningsHolderCheck 

If I remove SuppressWarningsHolderCheck, I get the same error for SuppressWarningsFilter.

Any ideas?

thanks

+6
source share
1 answer

You seem to have two problems:

  • You are using maven-checkstyle-plugin v2.5 which is based on Checkstyle 5.0. In Checkstyle 5.0, SuppressWarningsHolderCheck and SuppressWarningsFilter did not exist yet, as they were introduced in 5.7. Therefore, you must first update your maven-checkstyle plugin.
  • SuppressWarningsFilter should be configured directly under the Checker , and not under the TreeWalker . The documentation does not make this part very explicit, although it does. Note that the SuppressWarnings Holder runs under TreeWalker .

If you do mutual work, we hopefully will begin to work.

+6
source

Source: https://habr.com/ru/post/973012/


All Articles