Investigate UnsupportedClassVersionError issue when running `ant coverage`
We started discussing an issue with Cobertura on legacy/trac#31194 (moved) which wasn't really related to that ticket. Moving that issue here:
irl wrote:
You're right, it is
/usr/share/java/cobertura-2.1.1.jar
but for some reason I didn't have that file in my system. An apt remove and apt install later and it was back, and nowant coverage
does something that looks more like expected.
[cobertura-report] Cobertura 2.1.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
[cobertura-report] Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/oro/text/regex/MalformedPatternException has been compiled by a more recent version of the Java Runtime (class file version 54.0), this version of the Java Runtime only recognizes class file versions up to 52.0
[cobertura-report] at java.lang.ClassLoader.defineClass1(Native Method)
[cobertura-report] at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
[cobertura-report] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
[cobertura-report] at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
[cobertura-report] at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
[cobertura-report] at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
[cobertura-report] at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
[cobertura-report] at java.security.AccessController.doPrivileged(Native Method)
[cobertura-report] at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
[cobertura-report] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[cobertura-report] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
[cobertura-report] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[cobertura-report] at net.sourceforge.cobertura.dsl.Cobertura.<init>(Cobertura.java:61)
[cobertura-report] at net.sourceforge.cobertura.reporting.ReportMain.parseArgumentsAndReport(ReportMain.java:91)
[cobertura-report] at net.sourceforge.cobertura.reporting.ReportMain.generateReport(ReportMain.java:141)
[cobertura-report] at net.sourceforge.cobertura.reporting.ReportMain.main(ReportMain.java:151)
...but it fails
karsten wrote:
Hmm, random thought: can you try installing a newer Java version (as in: JRE,
java
command, not necessarily JDK/javac
)? In theory, it shouldn't hurt to use a newer Java version, because we're still building for 1.8 compatibility insrc/build/java/base.xml
. Maybe you could do the upgrade in a way that allows a downgrade again, just in case this wasn't it.