Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 1.4
-
Component/s: None
-
Labels:None
Description
The annotation @SupressWarning is often used directly inside a method. It induces problems on the JavaNCSS plugin, which is very critical.
The problem is from the JavaNCSS library, but not from the maven plugin (see http://jira.codehaus.org/browse/MJNCSS-16). The core library is not a lot supported, so can we use an equivalent plugin ?
Activity
According to http://jira.codehaus.org/browse/MJNCSS-16?focusedCommentId=137473#action_137473, the issue was fixed in JavaNCSS Version 29.50.
You're right. We were waiting for JavaNcss maven plugin 2.0-beta-3 that upgrades to 29.50, but it is still not released : http://jira.codehaus.org/browse/MJNCSS/fixforversion/13131.
Fortunately a workaround is possible :
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>javancss-maven-plugin</artifactId>
<version>2.0-beta-2</version>
<dependencies>
<dependency>
<groupId>javancss</groupId>
<artifactId>javancss</artifactId>
<version>29.50</version>
</dependency>
</dependencies>
</plugin>
</plugins>
So we fix this issue on the next 1.4RC1. Thank you Seb for the reminder.
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>javancss-maven-plugin</artifactId>
<version>2.0-beta-2</version>
<dependencies>
<dependency>
<groupId>javancss</groupId>
<artifactId>javancss</artifactId>
<version>29.50</version>
</dependency>
</dependencies>
</plugin>
</plugins>
After changing version of sonar to 1.4RC1 I got the following error:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Cannot execute the command org.codehaus.mojo:javancss-maven-plugin:2.0-beta-2:report
Embedded error: An error has occurred in JavaNCSS Report report generation.
Encountered "public static final String ACTION_PARAM =" at line 9, column 3.
Was expecting one of:
"boolean" ...
"byte" ...
"char" ...
"double" ...
"float" ...
"int" ...
"long" ...
"short" ...
"@" ...
"." ...
"(" ...
"public" "public" ...
"public" "static" "public" ...
"public" "static" "static" ...
"public" "static" "protected" ...
"public" "static" "private" ...
"public" "static" "final" "public" ...
"public" "static" "final" "static" ...
"public" "static" "final" "protected" ...
"public" "static" "final" "private" ...
"public" "static" "final" "final" ...
"public" "static" "final" "abstract" ...
"public" "static" "final" "synchronized" ...
"public" "static" "final" "native" ...
"public" "static" "final" "transient" ...
"public" "static" "final" "volatile" ...
"public" "static" "final" "strictfp" ...
"public" "static" "final" "@" ...
"public" "static" "final" "enum" ...
"public" "protected" ...
"public" "private" ...
"public" "static" "abstract" ...
"public" "static" "final" "<" ...
"public" "static" "final" "void" ...
"public" "static" "final" "boolean" ...
"public" "static" "final" "char" ...
"public" "static" "final" "byte" ...
"public" "static" "final" "short" ...
"public" "static" "final" "int" ...
"public" "static" "final" "long" ...
"public" "static" "final" "float" ...
"public" "static" "final" "double" ...
"public" "static" "final" <IDENTIFIER> "<" ...
"public" "static" "final" <IDENTIFIER> "." ...
"public" "static" "final" <IDENTIFIER> "[" ...
"public" "static" "final" <IDENTIFIER> <IDENTIFIER> "(" ...
<IDENTIFIER> ...
It's caused probably by my interface:
public interface RequestParamMarkers {
public static final String PLUGIN_PARAM = "__plugin_name_param";
//public static final String LOCATION_URL_PARAM = "__location_url_param";
public static final String LOCATION_PARAM = "__location_id_param";
@Deprecated
public static final String ACTION_PARAM = "__action_id_param";
}
Sadly Sonar is still useless.
Hi,
I can't reproduce your issue. Could you check that target/sonar/sonar-pom.xml contains the following :
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>javancss-maven-plugin</artifactId>
<version>2.0-beta-2</version>
<dependencies>
<dependency>
<groupId>javancss</groupId>
<artifactId>javancss</artifactId>
<version>29.50</version>
<scope>compile</scope>
</dependency>
</dependencies>
<configuration>
<linkXRef>false</linkXRef>
</configuration>
</plugin>
It seems that the maven plugin still uses the old javancss version. Could you attach your pom.xml please ?
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>javancss-maven-plugin</artifactId>
<version>2.0-beta-2</version>
<dependencies>
<dependency>
<groupId>javancss</groupId>
<artifactId>javancss</artifactId>
<version>29.50</version>
<scope>compile</scope>
</dependency>
</dependencies>
<configuration>
<linkXRef>false</linkXRef>
</configuration>
</plugin>
sonar-pom.xml contains exactly what you've pasted. I'll attach it to the issue.
I cannot add an attachment. But you can see sonar-pom.xml here:
http://ds5.agh.edu.pl/~avatar/sonar/sonar-pom.xml
Wojciech, which version of maven do you use ? Do you execute mvn from a command line or from a continuous integration tool ?
mvn -v
Maven version: 2.0.9
Java version: 1.6.0_02
OS name: "linux" version: "2.6.18-8.1.8.el5xen" arch: "amd64" Family: "unix"
I execute builds in continuous integration tool - Atlassian Bamboo 2.0.3
But Bamboo probably uses maven-2.0.7, java version the same.
When running from command line (with maven-2.0.9) result is exactly the same - exception from ncss plugin.
Can you send the sonar-pom.xml of the module that fails please ? And can you also send the result of mvn dependency:list executed from that module ?
sonar-pom.xml of the module that fails can be found here:
http://ds5.agh.edu.pl/~avatar/sonar/ui-core/sonar-pom.xml
dependency:list executed there prints:
[INFO] [dependency:list]
[INFO]
[INFO] The following files have been resolved:
[INFO] cglib:cglib-nodep:jar:2.1_3:test
[INFO] com.comarch.p7:spec:jar:0.4-SNAPSHOT:compile
[INFO] com.comarch.p7:wicket-core:jar:0.4-SNAPSHOT:compile
[INFO] com.comarch.p7bundles:cglib-nodep:jar:2.1.3.014:compile
[INFO] com.comarch.p7bundles:commons-beanutils:jar:1.7.0.014:compile
[INFO] com.comarch.p7bundles:commons-collections:jar:3.2.0.014:compile
[INFO] com.comarch.p7bundles:commons-lang:jar:2.2.0.014:compile
[INFO] com.comarch.p7bundles:findbugs-annotations:jar:1.3.3.014:compile
[INFO] com.comarch.p7bundles:jsr305:jar:1.3.3.014:compile
[INFO] com.comarch.p7bundles:pax-logging-api:jar:1.1.1:compile
[INFO] com.comarch.p7bundles:pax-web-service:jar:0.5.0.014:compile
[INFO] com.comarch.p7bundles:spring-beans:jar:2.5.5:compile
[INFO] com.comarch.p7bundles:spring-context:jar:2.5.5:compile
[INFO] com.comarch.p7bundles:spring-core:jar:2.5.5:compile
[INFO] com.comarch.p7bundles:spring-osgi-core:jar:1.1.0:compile
[INFO] com.comarch.p7bundles:spring-web:jar:2.5.5:compile
[INFO] com.comarch.p7bundles:wicket-all:jar:1.3.4.014:compile
[INFO] com.comarch.p7tools:unit-test-support:jar:0.14:test
[INFO] jdepend:jdepend:jar:2.9.1:test
[INFO] junit:junit:jar:4.4:test
[INFO] org.aspectj:org.aspectj.osgi:jar:1.1.0.200803102211:compile
[INFO] org.easymock:easymock:jar:2.3:test
[INFO] org.easymock:easymockclassextension:jar:2.3:test
[INFO] org.eclipse:osgi:jar:3.3.2.R33x_v20080105:compile
I cleaned my local maven2 repository, and after executing sonar:
javancss:javancss is downloaded in version 29.50 only
org.codehaus.mojo:javancss-maven-plugin is downloaded in version 2.0-beta-2 only
hope this helps
That sounds incredible. I'm sure that JavaNcss 29.50 resolves this bug. It works for us when parsing the class http://svn.codehaus.org/sonar/trunk/samples/utf8-sample/src/main/java/org/sonar/samples/utf8/HelloSwiss.java. It 's exactly the same use of @Deprecated tag.
Can you also check versions of javancss/jhbasic and javancss/ccl from your local repository ?
javancss:jhbasic and javancss:ccl were downloaded in version 29.50 only.
Notice one difference: HelloSwiss is a class and RequestParamMarkers is an interface. Maybe this matters?
You're right. The problem is only on interfaces. This is unfortunatly a JavaNCSS bug. So it will be long before getting a fix... I contact the javancss team.
Another issue is created for this problem : SONAR-312.
I think, we just need to update the java 5 grammar used by JavaNCSS (that is to say by Javacc) to correct this issue. The lastest java grammar is available on javacc web site.