src/share/vm/prims/unsafe.cpp
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File
*** old/src/share/vm/prims/unsafe.cpp Wed Aug 3 07:55:16 2016
--- new/src/share/vm/prims/unsafe.cpp Wed Aug 3 07:55:15 2016
*** 785,796 ****
--- 785,800 ----
// When you load an anonymous class U, it works as if you changed its name just before loading,
// to a name that you will never use again. Since the name is lost, no other class can directly
// link to any member of U. Just after U is loaded, the only way to use it is reflectively,
// through java.lang.Class methods like Class.newInstance.
+ // The package of an anonymous class must either match its host's class's package or be in the
+ // unnamed package. If it is in the unnamed package then it will be put in its host class's
+ // package.
+ //
+
// Access checks for linkage sites within U continue to follow the same rules as for named classes.
// The package of an anonymous class is given by the package qualifier on the name under which it was loaded.
// An anonymous class also has special privileges to access any member of its host class.
// This is the main reason why this loading operation is unsafe. The purpose of this is to
// allow language implementations to simulate "open classes"; a host class in effect gets
// new code when an anonymous class is loaded alongside it. A less convenient but more
// standard way to do this is with reflection, which can also be set to ignore access
src/share/vm/prims/unsafe.cpp
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File