Skip to content

Include java_lang_Class_getClassFileVersion0 native for jdk20+ #22248

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

Merged
merged 1 commit into from
Jul 18, 2025

Conversation

pshipton
Copy link
Member

@pshipton pshipton commented Jul 17, 2025

Follow on to #21787

Fixes #21942

Failed tests are passing with this change.
https://openj9-jenkins.osuosl.org/view/Test/job/Grinder/4459

@pshipton
Copy link
Member Author

jenkins compile amac jdk25

@pshipton pshipton requested a review from keithc-ca July 17, 2025 20:52
@keithc-ca
Copy link
Contributor

getClassFileVersion0() is defined for Java 20+: the boundary for this change should be updated.

@pshipton
Copy link
Member Author

getClassFileVersion0() is defined for Java 20+: the boundary for this change should be updated.

I think that's only for Valhalla.

@keithc-ca
Copy link
Contributor

Class.java currently says:

/*[IF JAVA_SPEC_VERSION >= 20]*/
	/*[IF (JAVA_SPEC_VERSION < 25) & !INLINE-TYPES]*/
	private
	/*[ENDIF] (JAVA_SPEC_VERSION < 25) & !INLINE-TYPES */
	int getClassFileVersion() { ... }
	private native int getClassFileVersion0();
/*[ENDIF] JAVA_SPEC_VERSION >= 20 */

This and the native code should agree. If it's only truly needed for Java 25+, then the Java code should be:

/*[IF JAVA_SPEC_VERSION >= 25]*/
	int getClassFileVersion() { ... }
	private native int getClassFileVersion0();
/*[ENDIF] JAVA_SPEC_VERSION >= 25 */

@keithc-ca
Copy link
Contributor

@pshipton
Copy link
Member Author

Ya, I updated it. It didn't make sense to have a private method that nobody seems to call and wouldn't work anyway.

@keithc-ca
Copy link
Contributor

@pshipton
Copy link
Member Author

We don't run that test, so I guess we don't need it.

@pshipton
Copy link
Member Author

The only "hotspot" tests run on OpenJ9 are serviceability tests.

@pshipton
Copy link
Member Author

I suppose some app might be using reflection, so I'd better keep it.

@pshipton
Copy link
Member Author

I suppose some app might be using reflection, so I'd better keep it.

Hmm, although if this was true, somebody would have complained that it didn't work. I'll keep it as-is unless you think we need to support it in 21.

@keithc-ca
Copy link
Contributor

The only "hotspot" tests run on OpenJ9 are serviceability tests.

I think it's easy enough to keep it for Java 20+ that we should do that. We don't need to make trouble for the unknown reflective users and it might be helpful to enable more openjdk tests.

@pshipton
Copy link
Member Author

Ok, updated the natives to be included from 20.

@keithc-ca
Copy link
Contributor

Please update the commit message and the description here to reflect that this applies to jdk20+.

@pshipton pshipton changed the title Include java_lang_Class_getClassFileVersion0 native for jdk25+ Include java_lang_Class_getClassFileVersion0 native for jdk20+ Jul 17, 2025
@pshipton
Copy link
Member Author

Updated.

@keithc-ca
Copy link
Contributor

Jenkins compile zlinux jdk17,jdk21

@keithc-ca keithc-ca merged commit 4d70258 into eclipse-openj9:master Jul 18, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JDK25 UnsatisfiedLinkError: java/lang/Class.getClassFileVersion0()I
2 participants