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

Add accessor methods for SharedSecrets#javaObjectInputFilterAccess #112

Merged
merged 1 commit into from
Jul 23, 2018

Conversation

gayanW
Copy link
Collaborator

@gayanW gayanW commented Jul 21, 2018

Adds SharedSecrets#getJavaObjectInputFilterAccess and SharedSecrets#setJavaObjectInputFilterAccess methods to jdk.internal.misc.SharedSecrets model class.

This fixes:

[junit] java.lang.NoSuchMethodException:
        jdk.internal.misc.SharedSecrets.setJavaObjectInputFilterAccess(Ljdk/internal/misc/JavaObjectInputFilterAccess;)V

Fixes: #111

Adds SharedSecrets#getJavaObjectInputFilterAccess and
SharedSecrets#setJavaObjectInputFilterAccess methods to
jdk.internal.misc.SharedSecrets model class.

This fixes:

[junit] java.lang.NoSuchMethodException:
        jdk.internal.misc.SharedSecrets.setJavaObjectInputFilterAccess(Ljdk/internal/misc/JavaObjectInputFilterAccess;)V
if (javaObjectInputFilterAccess == null) {
unsafe.ensureClassInitialized(ObjectInputFilter.Config.class);
}
return javaObjectInputFilterAccess;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as with the previous issue: should this code initialize a singleton, or possibly return null, if (javaObjectInputFilterAccess == null)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our ensureClassInitialized method seems to do nothing. So it will possibly return null.

public native void ensureClassInitialized(Class<?> cls);

@MJI
public void ensureClassInitialized__Ljava_lang_Class_2__V (MJIEnv env, int unsafeRef, int clsObjRef) {
// <2do> not sure if we have to do anyting here - if we have a class object, the class should already
// be initialized
}

JDK source for ensureClassInitialized:
https://github.com/unofficial-openjdk/openjdk/blob/6caf29475edb2d25cb9349f763451e20aa545c74/src/java.base/share/classes/jdk/internal/misc/Unsafe.java#L1032-L1043

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, this is indeed the same as in the JDK implementation. Merging this one.

@cyrille-artho cyrille-artho merged commit 08b895c into javapathfinder:java-10 Jul 23, 2018
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

Successfully merging this pull request may close these issues.

2 participants