RFR [9] 8145589: Test6277246.java fails to compile after JDK-8144479
Chris Hegarty
chris.hegarty at oracle.com
Thu Dec 17 15:15:25 UTC 2015
For ease of review, I moved the complete changes into a webrev.
http://cr.openjdk.java.net/~chegar/8145589/webrev/
-Chris.
On 17 Dec 2015, at 15:08, Chris Hegarty <chris.hegarty at oracle.com> wrote:
> On 17 Dec 2015, at 14:54, Roger Riggs <Roger.Riggs at oracle.com> wrote:
>
>> Hi Chris,
>>
>> Looks fine.
>
> Thanks Roger. Just a little addition to this review.
>
> While not strictly necessary, I’d like to clean up another, string,
> reference use in a reflective call. ( It is not causing a failure as
> the security manager will restrict access to sun.*, but it may
> avoid confusion in the future.
>
> diff --git a/test/java/beans/EventHandler/Test6277246.java b/test/java/beans/EventHandler/Test6277246.java
> --- a/test/java/beans/EventHandler/Test6277246.java
> +++ b/test/java/beans/EventHandler/Test6277246.java
> @@ -39,7 +39,7 @@
> Class container = Class.forName("java.lang.Class");
> Class parameter = Class.forName("java.lang.String");
> Method method = container.getMethod("forName", parameter);
> - Object[] arglist = new Object[] {"sun.misc.BASE64Encoder"};
> + Object[] arglist = new Object[] {"sun.security.x509.X509CertInfo"};
> EventHandler eh = new EventHandler(Test6277246.class, "forName", "", "forName");
> Object object = eh.invoke(null, method, arglist);
> throw new Error((object != null) ? "test failure" : "test error”);
>
> -Chris.
>
>> Roger
>>
>>
>> On 12/17/2015 9:46 AM, Chris Hegarty wrote:
>>> The removal of BASE64Encoder, and a related types, in 8144479 [1]
>>> has triggered the failure of java/beans/Introspector/Test6277246.java.
>>> Another internal type should be used instead of sun.misc.BASE64Encoder.
>>> The sun.security.x509 package seems stable, and is being used in other
>>> areas, like langtools and jigsaw/jake to test accessibility.
>>>
>>>
>>> diff --git a/test/java/beans/Introspector/Test6277246.java b/test/java/beans/Introspector/Test6277246.java
>>> --- a/test/java/beans/Introspector/Test6277246.java
>>> +++ b/test/java/beans/Introspector/Test6277246.java
>>> @@ -25,7 +25,7 @@
>>> * @test
>>> * @bug 6277246
>>> * @summary Tests problem with java.beans use of reflection
>>> - * @modules java.base/sun.misc
>>> + * @modules java.base/sun.security.x509
>>> * java.desktop
>>> * @run main/othervm Test6277246
>>> * @author Jeff Nisewanger
>>> @@ -36,11 +36,10 @@
>>> import java.beans.Introspector;
>>> import java.beans.MethodDescriptor;
>>> import java.lang.reflect.Method;
>>> -import sun.misc.BASE64Encoder;
>>> public class Test6277246 {
>>> public static void main(String[] args) throws IntrospectionException {
>>> - Class type = BASE64Encoder.class;
>>> + Class type = sun.security.x509.X509CertInfo.class;
>>> System.setSecurityManager(new SecurityManager());
>>> BeanInfo info = Introspector.getBeanInfo(type);
>>> for (MethodDescriptor md : info.getMethodDescriptors()) {
>>> @@ -48,7 +47,7 @@
>>> System.out.println(method);
>>> String name = method.getDeclaringClass().getName();
>>> - if (name.startsWith("sun.misc.")) {
>>> + if (name.startsWith("sun.")) {
>>> throw new Error("found inaccessible method");
>>> }
>>> }
>>>
>>> diff --git a/test/ProblemList.txt b/test/ProblemList.txt
>>> --- a/test/ProblemList.txt
>>> +++ b/test/ProblemList.txt
>>> @@ -126,9 +126,6 @@
>>> java/beans/Introspector/8132566/OverridePropertyInfoTest.java generic-all
>>> java/beans/Introspector/8132566/OverrideUserDefPropertyInfoTest.java generic-all
>>> -# 8145589
>>> -java/beans/Introspector/Test6277246.java generic-all
>>> -
>>> ############################################################################
>>> # jdk_lang
>>>
>>>
>>> -Chris.
>>>
>>> [1] https://bugs.openjdk.java.net/browse/JDK-8144479
>>
>
More information about the core-libs-dev
mailing list