Uploaded image for project: 'Tools (JBoss Tools)'
  1. Tools (JBoss Tools)
  2. JBIDE-17551

Duplicate full class name causing jacoco to fail

    Details

      Description

      Jacoco reports are failing for webservices. When in verbose, the error is

      /home/mistria/git/jbosstools-webservices/jacoco/jacoco-reports.xml:13: Error while creating report
      	at org.jacoco.ant.ReportTask.execute(ReportTask.java:498)
      	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
      	at org.apache.tools.ant.Task.perform(Task.java:348)
      	at org.apache.tools.ant.Target.execute(Target.java:390)
      	at org.apache.tools.ant.Target.performTasks(Target.java:411)
      	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
      	at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
      	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
      	at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
      	at org.apache.tools.ant.Main.runBuild(Main.java:809)
      	at org.apache.tools.ant.Main.startAnt(Main.java:217)
      	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
      	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
      Caused by: java.io.IOException: Error while analyzing class tests/org.jboss.tools.ws.jaxrs.ui.test/target/classes/org/jboss/tools/ws/jaxrs/ui/internal/utils/Logger$1.class.
      	at org.jacoco.core.analysis.Analyzer.analyzerError(Analyzer.java:139)
      	at org.jacoco.core.analysis.Analyzer.analyzeClass(Analyzer.java:133)
      	at org.jacoco.core.analysis.Analyzer.analyzeAll(Analyzer.java:164)
      	at org.jacoco.ant.ReportTask.createBundle(ReportTask.java:570)
      	at org.jacoco.ant.ReportTask.createReport(ReportTask.java:545)
      	at org.jacoco.ant.ReportTask.createReport(ReportTask.java:542)
      	at org.jacoco.ant.ReportTask.execute(ReportTask.java:492)
      	... 17 more
      Caused by: java.lang.IllegalStateException: Can't add different class with same name: org/jboss/tools/ws/jaxrs/ui/internal/utils/Logger$1
      	at org.jacoco.core.analysis.CoverageBuilder.visitCoverage(CoverageBuilder.java:89)
      	at org.jacoco.core.analysis.Analyzer$1.visitEnd(Analyzer.java:81)
      

      Jacoco (and life in general) doesn't like having different classes with same full name.
      Here are the culprits in that case:

      mistria@mistria--rh:~/git/jbosstools-webservices$ find . -name Logger\$1.class
      ./plugins/org.jboss.tools.ws.jaxrs.ui/target/classes/org/jboss/tools/ws/jaxrs/ui/internal/utils/Logger$1.class
      [...]
      ./tests/org.jboss.tools.ws.jaxrs.ui.test/target/classes/org/jboss/tools/ws/jaxrs/ui/internal/utils/Logger$1.class

      You should consider either having the test directly consuming the Logger from the non-test bundle, or at least change the package when duplicating a class.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                xcoulon Xavier Coulon
                Reporter:
                mickael_istria Mickael Istria
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: