Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 846782 - dev-java/ant-core-1.10.9-r4 cannot build packages on JDK 8: org/apache/tools/ant/launch/Launcher has been compiled by a more recent version of the Java Runtime
Summary: dev-java/ant-core-1.10.9-r4 cannot build packages on JDK 8: org/apache/tools/...
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Java team
URL:
Whiteboard:
Keywords:
: 831290 (view as bug list)
Depends on:
Blocks: 847304
  Show dependency tree
 
Reported: 2022-05-21 18:00 UTC by Yuan Liao (Leo3418)
Modified: 2024-03-15 22:28 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
dev-java/jna-4.2.2-r3 build.log (dev-java:jna-4.2.2-r3:20220521-054931.log,3.73 KB, text/plain)
2022-05-21 18:00 UTC, Yuan Liao (Leo3418)
Details
dev-java/commons-lang-2.6-r2 build.log (dev-java:commons-lang-2.6-r2:20220521-054213.log,3.35 KB, text/plain)
2022-05-21 18:01 UTC, Yuan Liao (Leo3418)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yuan Liao (Leo3418) 2022-05-21 18:00:04 UTC
The Java class files installed by dev-java/ant-core-1.10.9-r4 are on version 53.0 because the package depends on >=virtual/jdk-1.9:* rather than >=1.8.

This will cause the following error when merging ebuilds that strictly depend on virtual/jdk:1.8 (instead of >=virtual/jdk-1.8:*) and rely on dev-java/ant-core for the build process.  These ebuilds always use JDK 1.8 as the build VM.  JDK 1.8 only supports class file versions up to 52.0, so in this situation, Ant cannot run properly to build the project:


Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/tools/ant/launch/Launcher has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:473)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:601)


Example ebuilds that depend on virtual/jdk:1.8 (instead of >=virtual/jdk-1.8:*) and dev-java/ant-core, and cannot be built by dev-java/ant-core-1.10.9-r4 include:
- dev-java/jna-4.2.2-r3
- dev-java/commons-lang-2.6-r2
The build log for each ebuild will be attached below in separate comments.
Comment 1 Yuan Liao (Leo3418) 2022-05-21 18:00:34 UTC
Created attachment 779693 [details]
dev-java/jna-4.2.2-r3 build.log
Comment 2 Yuan Liao (Leo3418) 2022-05-21 18:01:00 UTC
Created attachment 779696 [details]
dev-java/commons-lang-2.6-r2 build.log
Comment 3 Larry the Git Cow gentoo-dev 2022-05-21 18:19:58 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b24498c7e502a18bac9b4f42e94bf479bb96a34c

commit b24498c7e502a18bac9b4f42e94bf479bb96a34c
Author:     Florian Schmaus <flow@gentoo.org>
AuthorDate: 2022-05-21 18:17:55 +0000
Commit:     Florian Schmaus <flow@gentoo.org>
CommitDate: 2022-05-21 18:17:55 +0000

    dev-java/ant-core: lower min Java to 8 again
    
    Turns out that raising ant-core's min Java requirement to 9, while
    fixing bug #831290, renders ant unable to build pure Java 8 packages (of
    which we have a few, most prominently jna), see bug #846782.
    
    We go back to Java 8 again, until we find a better solution.
    
    Bug: https://bugs.gentoo.org/846782
    Bug: https://bugs.gentoo.org/831290
    Signed-off-by: Florian Schmaus <flow@gentoo.org>

 .../ant-core/{ant-core-1.10.9-r4.ebuild => ant-core-1.10.9-r5.ebuild}   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 4 Volkmar W. Pogatzki 2024-03-10 21:46:37 UTC
*** Bug 831290 has been marked as a duplicate of this bug. ***
Comment 5 Volkmar W. Pogatzki 2024-03-11 19:30:50 UTC
~dev-java/ant-core-1.10.5 is gone. 

re-tested with dev-java/ant-1.10.14-r3, compiled with jdk:21
then changed system-vm to openjdk-bin:8
and emerged dev-lang/tuprolog-3.2.0-r1 without errors.

Closing.