1

In reference to this bug from Sonar: http://jira.codehaus.org/browse/SONAR-1865

and this one (which cross references the one above): http://jira.codehaus.org/browse/SONAR-1637

I am still seeing this issue.

I am using Sonar server version 2.12.
I am using Hudson, version 2.2.0.
I have installed the Sonar plugin in Hudson, version 1.7.2.

and, most importantly, I have the Flex plugin installed in the Sonar server. Flex plugin version is 0.4.

When I run mvn sonar:sonar -Pflex on a flex project, i get this error in the stack trace:

Caused by: java.lang.IllegalArgumentException: Java inner classes are not supported : EntityEnums$ReportParameterName
    at org.sonar.plugins.flex.FlexFile.<init>(FlexFile.java:79)
    at org.sonar.plugins.flex.FlexFile.fromIOFile(FlexFile.java:165)
    at org.sonar.plugins.flex.FlexSourceImporter.createResource(FlexSourceImporter.java:37)
    at org.sonar.api.batch.AbstractSourceImporter.parseDirs(AbstractSourceImporter.java:75)
    at org.sonar.api.batch.AbstractSourceImporter.analyse(AbstractSourceImporter.java:69)
    at org.sonar.api.batch.AbstractSourceImporter.analyse(AbstractSourceImporter.java:60)
    at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:64)

Here is what my class looks like, that it is complaining about:

This is an Actionscript class, file name: EntityEnums$ReportParameterName.as. It was auto-generated from java to Actionscript using GraniteDS.

package com.digabit.core.db.entity.util {
    [Bindable]
    public class EntityEnums$ReportParameterName {

        public static const tnid:String = "tnid";
        public static const uname:String = "uname";
        public static const lc:String = "lc";
        public static const tnkey:String = "tnkey";
        public static const oid:String = "oid";

        public function EntityEnums$ReportParameterName()
        {
            super();
        }
   }
}

So, according the bug reports, this has been fixed in an earlier version of Sonar that I have; but I'm still seeing it in version 2.12. And why would the error show "java inner classes..." when this is a flex/actionscript class? Is anyone still seeing this bug behavior?

Edward Thomson
  • 74,857
  • 14
  • 158
  • 187
742626
  • 23
  • 3
  • Hi don't have an answer for you either, but my guess about the bad error is just that this FlexFile.java:79 is copied from, oh I don't know JavaFile :). This is probably a copy paste error. I couldn't find the exact rules for Class names but does this cause a problem if you remove the dollar sign from the name? I don't see anything else that would cause this error. My only guess is that the parser it's using isn't working correctly (does this code compile with mxmlc?) – shaunhusain Jan 17 '12 at 22:43
  • I'm not familiar with sonar but use maven and flexmojos for compilation (sometimes we get random errors but luckily the source is out there to inspect). My guess is they copied a lot of the Java parser code for AS3 since they're pretty similar languages but hence the error. – shaunhusain Jan 17 '12 at 22:46
  • Ha yup found it: http://grepcode.com/file/repo1.maven.org/maven2/org.codehaus.sonar-plugins/sonar-flex-plugin/0.4/org/sonar/plugins/flex/FlexFile.java – shaunhusain Jan 17 '12 at 22:50
  • And here's the file that was probably copied: http://grepcode.com/file/repo1.maven.org/maven2/org.codehaus.sonar/sonar-plugin-api/2.7-RC3/org/sonar/api/resources/JavaFile.java – shaunhusain Jan 17 '12 at 22:51
  • Ah ok, that explains the text in the error. But the fix didn't seem to get applied to the FlexFile.java, from the referenced bugs.My code and project compiles just fine, using maven and flexmojos. my application works fine. This is only happening when I run Sonar on my flex project. I have Sonar running on my java projects too, and those work fine. Its just the flex project that Sonar throws this error. – 742626 Jan 17 '12 at 23:09
  • I would probably just grab the source here for the plugin: http://repo1.maven.org/maven2/org/codehaus/sonar-plugins/sonar-flex-plugin/0.4/sonar-flex-plugin-0.4-sources.jar then just remove that condition and error throwing and re-compile it, I don't see any reason to have that check in the plugin? – shaunhusain Jan 17 '12 at 23:30

1 Answers1

1

Issue has been created on Sonar Flex Plugin side ( http://jira.codehaus.org/browse/SONARPLUGINS-1623 ) and most probably would be fixed in next release.

Godin
  • 9,801
  • 2
  • 39
  • 76