Skip to content

Commit

Permalink
Merge pull request #5129 from keithc-ca/access
Browse files Browse the repository at this point in the history
Fix handling of defining accessor and proxy classes in Java 12
  • Loading branch information
pshipton authored Mar 16, 2019
2 parents e93b8cd + 41007aa commit a3d5585
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 9 additions & 0 deletions runtime/jcl/common/clsldr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ Java_java_lang_ClassLoader_defineClassImpl(JNIEnv *env, jobject receiver, jstrin
}
#endif /* J9VM_OPT_DYNAMIC_LOAD_SUPPORT */

if (NULL == protectionDomain) {
/*
* Only trusted code has access to JavaLangAccess.defineClass();
* callers only provide a NULL protectionDomain when exemptions
* are required.
*/
options |= J9_FINDCLASS_FLAG_UNSAFE;
}

jclass result = defineClassCommon(env, receiver, className, classRep, offset, length, protectionDomain, options, NULL);

if (J9_ARE_ANY_BITS_SET(options, J9_FINDCLASS_FLAG_NAME_IS_INVALID) && (NULL == result) && (NULL == currentThread->currentException)) {
Expand Down
3 changes: 2 additions & 1 deletion test/functional/Java8andUp/playlist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,10 @@
</test>

<test>
<testCaseName>jsr335_interfacePrivateMethod_mode100</testCaseName>
<testCaseName>jsr335_interfacePrivateMethod</testCaseName>
<variations>
<variation>Mode100</variation>
<variation>NoOptions</variation>
</variations>
<command>$(JAVA_COMMAND) $(JVM_OPTIONS) \
-cp $(Q)$(RESOURCES_DIR)$(P)$(TESTNG)$(P)$(TEST_RESROOT)$(D)GeneralTest.jar$(P)$(LIB_DIR)$(D)asm-all.jar$(Q) \
Expand Down

0 comments on commit a3d5585

Please sign in to comment.