JDK-8169887 : javax/swing/JEditorPane/8080972/TestJEditor.java, javax/swing/text/View/8080972/TestObjectView.java are failing
Type:Bug
Component:client-libs
Affected Version:9
Priority:P3
Status:Resolved
Resolution:Fixed
Submitted:2016-11-17
Updated:2016-12-01
Resolved:2016-11-22
The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
Ubuntu 16.04 Linux, client nightly b145
java.lang.RuntimeException: Editor kit is not UserEditorKit!
java.lang.RuntimeException: Component is not UserJComponent!
both pass for the previous PIT.
Comments
After more digging it apparently the case that there was always a check there which compared class loaders.
This is quite different than Class.newInstance() which first determined if you could access public members
and if you could .. would also find private ones (!). It also had no thisLoader == thatLoader check.
There seem to be 3 options here
1) revert to the deprecated Class.newInstance()
2) See if Class.getConstructor() will suffice for this case
3) Use doPrivileged to be able to access a private default constructor.
18-11-2016
java.lang.Class.getDeclaredConstructor() is @CallerSensitive.
But checkMemberAccess() will in some cases additionally verify if the classloader for java.lang.Class is
the same as that of the caller. In previous releases this would be the case for any code in the core platform.
Now that no longer holds for at least java.desktop. I am not sure if it holds only for java.base .. it might
be true for some other modules too needed to bootstrap the VM.
So there is an apparent behavioural change here that needs examining.
17-11-2016
Caused by this :-
http://cr.openjdk.java.net/~prr/8155874/src/java.desktop/share/classes/javax/swing/JEditorPane.java.sdiff.html
The exception is :-
java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessDeclaredMembers")
at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:471)
at java.base/java.security.AccessController.checkPermission(AccessController.java:894)
at java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:548)
at java.base/java.lang.Class.checkMemberAccess(Class.java:2595)
at java.base/java.lang.Class.getDeclaredConstructor(Class.java:2365)
at java.desktop/javax.swing.JEditorPane.createEditorKitForContentType(JEditorPane.java:1201)
at TestJEditor.testJEditorPane(TestJEditor.java:58)