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

MethodHandles.lookup().findVirtual() on unexported package does not throw exception #1738

Closed
pdbain-ibm opened this issue Apr 23, 2018 · 4 comments

Comments

@pdbain-ibm
Copy link
Contributor

For testcase code, see https://github.com/pdbain-ibm/openj9/tree/modularity/test/functional/Java9andUp, org.openj9.test.modularity.tests.MethodVisibilityTests

Test in module org.openj9test.modularity.testerModule tries to perform MethodHandles.lookup().findVirtual() on a class in an unexported package in a read module.

The reference implementation throws java.lang.IllegalAccessException, OpenJ9 throws no error.

@pdbain-ibm
Copy link
Contributor Author

See #1709 about test development issues.

@pdbain-ibm
Copy link
Contributor Author

MethodHandles.lookup().findClass() should also throw IllegalAccessException.
MethodType.fromMethodDescriptorString() should throw no exception.

@pdbain-ibm
Copy link
Contributor Author

From the API spec:

public static MethodHandles.Lookup publicLookup​() Returns a lookup object which is trusted minimally. The lookup has the PUBLIC and UNCONDITIONAL modes. It can only be used to create method handles to public members of public classes in packages that are exported unconditionally. As a matter of pure convention, the lookup class of this lookup object will be Object.

@pdbain-ibm
Copy link
Contributor Author

Closed by #1801

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

No branches or pull requests

2 participants