Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

junit-4.13.2 compilation error with java 21 #1766

Open
vaukai opened this issue Nov 5, 2023 · 4 comments
Open

junit-4.13.2 compilation error with java 21 #1766

vaukai opened this issue Nov 5, 2023 · 4 comments

Comments

@vaukai
Copy link

vaukai commented Nov 5, 2023

From https://bugs.gentoo.org/916398

�[32m * �[39;49;00mPackage:    dev-java/junit-4.13.2:4
�[32m * �[39;49;00mRepository: gentoo
�[32m * �[39;49;00mMaintainer: [email protected]
�[32m * �[39;49;00mUSE:        abi_x86_64 amd64 elibc_glibc kernel_linux
�[32m * �[39;49;00mFEATURES:   network-sandbox preserve-libs sandbox userpriv usersandbox
debug:   eclass exists: /var/db/repos/vaukai/eclass/java-pkg-2.eclass
debug: inherit: java-pkg-2 -> /var/db/repos/vaukai/eclass/java-pkg-2.eclass
debug: *** Multiple Inheritance (Level: 2)
debug:   eclass exists: /var/db/repos/vaukai/eclass/java-utils-2.eclass
debug: inherit: java-utils-2 -> /var/db/repos/vaukai/eclass/java-utils-2.eclass
debug: EXPORT_FUNCTIONS: pkg_setup -> java-pkg-2_pkg_setup
debug: EXPORT_FUNCTIONS: src_prepare -> java-pkg-2_src_prepare
debug: EXPORT_FUNCTIONS: src_compile -> java-pkg-2_src_compile
debug: EXPORT_FUNCTIONS: pkg_preinst -> java-pkg-2_pkg_preinst
debug:   eclass exists: /var/db/repos/vaukai/eclass/java-pkg-simple.eclass
debug: inherit: java-pkg-simple -> /var/db/repos/vaukai/eclass/java-pkg-simple.eclass
debug: *** Multiple Inheritance (Level: 2)
debug:   eclass exists: /var/db/repos/vaukai/eclass/java-utils-2.eclass
debug: inherit: java-utils-2 -> /var/db/repos/vaukai/eclass/java-utils-2.eclass
debug: EXPORT_FUNCTIONS: src_compile -> java-pkg-simple_src_compile
debug: EXPORT_FUNCTIONS: src_install -> java-pkg-simple_src_install
debug: EXPORT_FUNCTIONS: src_test -> java-pkg-simple_src_test
�[32m * �[39;49;00mPackage:    dev-java/junit-4.13.2:4
�[32m * �[39;49;00mRepository: gentoo
�[32m * �[39;49;00mMaintainer: [email protected]
�[32m * �[39;49;00mUSE:        abi_x86_64 amd64 elibc_glibc kernel_linux
�[32m * �[39;49;00mFEATURES:   network-sandbox preserve-libs sandbox userpriv usersandbox
debug:   eclass exists: /var/db/repos/vaukai/eclass/java-pkg-2.eclass
debug: inherit: java-pkg-2 -> /var/db/repos/vaukai/eclass/java-pkg-2.eclass
debug: *** Multiple Inheritance (Level: 2)
debug:   eclass exists: /var/db/repos/vaukai/eclass/java-utils-2.eclass
debug: inherit: java-utils-2 -> /var/db/repos/vaukai/eclass/java-utils-2.eclass
debug: EXPORT_FUNCTIONS: pkg_setup -> java-pkg-2_pkg_setup
debug: EXPORT_FUNCTIONS: src_prepare -> java-pkg-2_src_prepare
debug: EXPORT_FUNCTIONS: src_compile -> java-pkg-2_src_compile
debug: EXPORT_FUNCTIONS: pkg_preinst -> java-pkg-2_pkg_preinst
debug:   eclass exists: /var/db/repos/vaukai/eclass/java-pkg-simple.eclass
debug: inherit: java-pkg-simple -> /var/db/repos/vaukai/eclass/java-pkg-simple.eclass
debug: *** Multiple Inheritance (Level: 2)
debug:   eclass exists: /var/db/repos/vaukai/eclass/java-utils-2.eclass
debug: inherit: java-utils-2 -> /var/db/repos/vaukai/eclass/java-utils-2.eclass
debug: EXPORT_FUNCTIONS: src_compile -> java-pkg-simple_src_compile
debug: EXPORT_FUNCTIONS: src_install -> java-pkg-simple_src_install
debug: EXPORT_FUNCTIONS: src_test -> java-pkg-simple_src_test
debug: java-pkg_init: entering function, parameters: 
debug: java-pkg_switch-vm: entering function, parameters: 
debug: java-pkg_needs-vm: entering function, parameters: 
debug: depend-java-query:  NV_DEPEND:	
	>=virtual/jdk-1.8:*
	test? (
		dev-java/hamcrest-library:1.3
	)
	
	dev-java/hamcrest-core:1.3
 >=dev-java/java-config-2.2.0-r3 source? ( app-arch/zip )
debug: Using: openjdk-21
debug: java-pkg_setup-vm: entering function, parameters: 
debug: java-pkg_get-vm-vendor: entering function, parameters: 
debug: java-pkg_javac-args: entering function, parameters: 
debug: want source: 1.8
debug: want target: 1.8
debug: java-pkg_append_: entering function, parameters: LD_LIBRARY_PATH /usr/lib64/openjdk-21/lib/:/usr/lib64/openjdk-21/lib/server/
 �[32m*�[0m Using: openjdk-21
>>> Unpacking source...
>>> Unpacking junit-4.13.2.tar.gz to /var/tmp/portage/dev-java/junit-4.13.2/work
>>> Source unpacked in /var/tmp/portage/dev-java/junit-4.13.2/work
>>> Preparing source in /var/tmp/portage/dev-java/junit-4.13.2/work ...
./junit4-r4.13.2/lib/hamcrest-core-1.3.jar
./junit4-r4.13.2/lib/hamcrest-core-1.3-sources.jar
./junit4-r4.13.2/.mvn/wrapper/maven-wrapper.jar
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/dev-java/junit-4.13.2/work ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/dev-java/junit-4.13.2/work ...
debug: java-pkg_gen-cp: entering function, parameters: JAVA_GENTOO_CLASSPATH
debug: java-pkg-simple_getclasspath: entering function, parameters: 
debug: java-pkg_getjars: entering function, parameters: --with-dependencies hamcrest-core-1.3
debug: hamcrest-core-1.3:/usr/share/hamcrest-core-1.3/lib/hamcrest-core.jar
debug: java-pkg_ensure-dep: entering function, parameters: hamcrest-core-1.3
debug: Matching against: /hamcrest-core(-1\.3(-[^:]+)?:0|(-[^:]+)?:1\.3)\b
debug: java-pkg_record-jar_: entering function, parameters: hamcrest-core-1.3
debug: CLASSPATH=/usr/share/hamcrest-core-1.3/lib/hamcrest-core.jar
debug: java-pkg-simple_prepend_resources: entering function, parameters: target/classes junit4-r4.13.2/src/main/resources
debug: ejavac: entering function, parameters: -d target/classes -encoding ISO-8859-1 -classpath /usr/share/hamcrest-core-1.3/lib/hamcrest-core.jar @sources.lst
debug: java-pkg_get-javac: entering function, parameters: 
debug: java-pkg_init-compiler_: entering function, parameters: 
debug: Read "" from /etc/java-config-2/build/compilers.conf
debug: java-pkg_javac-args: entering function, parameters: 
debug: want source: 1.8
debug: want target: 1.8
 �[32m*�[0m Verbose logging for "ejavac" function
 �[32m*�[0m Compiler executable: javac
 �[32m*�[0m Extra arguments: -source 1.8 -target 1.8
 �[32m*�[0m Complete command:
 �[32m*�[0m javac -source 1.8 -target 1.8 -d target/classes -encoding ISO-8859-1 -classpath /usr/share/hamcrest-core-1.3/lib/hamcrest-core.jar @sources.lst
javac -source 1.8 -target 1.8 -d target/classes -encoding ISO-8859-1 -classpath /usr/share/hamcrest-core-1.3/lib/hamcrest-core.jar @sources.lst
warning: [options] bootstrap class path not set in conjunction with -source 8
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
junit4-r4.13.2/src/main/java/org/junit/runner/Result.java:192: error: unreported exception ClassNotFoundException; must be caught or declared to be thrown
            fCount = (AtomicInteger) fields.get("fCount", null);
                                               ^
junit4-r4.13.2/src/main/java/org/junit/runner/Result.java:193: error: unreported exception ClassNotFoundException; must be caught or declared to be thrown
            fIgnoreCount = (AtomicInteger) fields.get("fIgnoreCount", null);
                                                     ^
junit4-r4.13.2/src/main/java/org/junit/runner/Result.java:194: error: unreported exception ClassNotFoundException; must be caught or declared to be thrown
            assumptionFailureCount = (AtomicInteger) fields.get("assumptionFailureCount", null);
                                                               ^
junit4-r4.13.2/src/main/java/org/junit/runner/Result.java:195: error: unreported exception ClassNotFoundException; must be caught or declared to be thrown
            fFailures = (List<Failure>) fields.get("fFailures", null);
                                                  ^
junit4-r4.13.2/src/main/java/junit/framework/TestResult.java:145: warning: [removal] ThreadDeath in java.lang has been deprecated and marked for removal
        } catch (ThreadDeath e) { // don't catch ThreadDeath by accident
                 ^
junit4-r4.13.2/src/main/java/org/junit/internal/runners/statements/FailOnTimeout.java:145: warning: [removal] isDaemon() in ThreadGroup has been deprecated and marked for removal
        if (!threadGroup.isDaemon()) {
                        ^
junit4-r4.13.2/src/main/java/org/junit/internal/runners/statements/FailOnTimeout.java:151: warning: [removal] setDaemon(boolean) in ThreadGroup has been deprecated and marked for removal
                threadGroup.setDaemon(true);
                           ^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
4 errors
7 warnings

@marcphilipp
Copy link
Member

Can you compile it with Java 8?

@vaukai
Copy link
Author

vaukai commented Nov 6, 2023

Can you compile it with Java 8?

Java 8, Java 11,Java 17, all are fine. Only Java 21 fails.

@marcphilipp
Copy link
Member

The ClassNotFoundException is declared as part of the constructor signature:

private SerializedForm(ObjectInputStream.GetField fields) throws IOException, ClassNotFoundException {
fCount = (AtomicInteger) fields.get("fCount", null);
fIgnoreCount = (AtomicInteger) fields.get("fIgnoreCount", null);
assumptionFailureCount = (AtomicInteger) fields.get("assumptionFailureCount", null);
fFailures = (List<Failure>) fields.get("fFailures", null);
fRunTime = fields.get("fRunTime", 0L);
fStartTime = fields.get("fStartTime", 0L);
}

@vaukai
Copy link
Author

vaukai commented Nov 10, 2023

Dupe of #1739. Sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants