Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot initialize module TreeWalker - Unable to instantiate SuppressWarningsHolder

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

Everything worked as expected but as soon as I introduced,

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

to my checkstyle-config.xml, I started to have problems building the 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

like image 432
ecthelion84 Avatar asked Jul 29 '14 06:07

ecthelion84


1 Answers

It appears you have two problems:

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

If you do both things, stuff should hopefully start working.

like image 85
barfuin Avatar answered Oct 14 '22 18:10

barfuin