Tue, 23 Jul 2013 18:28:58 +0200
8021129: Use public lookup again
Reviewed-by: lagergren, sundar
1.1 --- a/src/jdk/internal/dynalink/beans/AbstractJavaLinker.java Tue Jul 23 21:45:27 2013 +0530 1.2 +++ b/src/jdk/internal/dynalink/beans/AbstractJavaLinker.java Tue Jul 23 18:28:58 2013 +0200 1.3 @@ -292,6 +292,8 @@ 1.4 return new SimpleDynamicMethod(unreflectSafely(m), member.getDeclaringClass(), member.getName()); 1.5 } 1.6 1.7 + private static final Lookup publicLookup = new Lookup(MethodHandles.publicLookup()); 1.8 + 1.9 /** 1.10 * Unreflects a method handle from a Method or a Constructor using safe (zero-privilege) unreflection. Should be 1.11 * only used for methods and constructors that are not caller sensitive. If a caller sensitive method were 1.12 @@ -303,14 +305,13 @@ 1.13 private static MethodHandle unreflectSafely(AccessibleObject m) { 1.14 if(m instanceof Method) { 1.15 final Method reflMethod = (Method)m; 1.16 - final MethodHandle handle = SafeUnreflector.unreflect(reflMethod); 1.17 + final MethodHandle handle = publicLookup.unreflect(reflMethod); 1.18 if(Modifier.isStatic(reflMethod.getModifiers())) { 1.19 return StaticClassIntrospector.editStaticMethodHandle(handle); 1.20 } 1.21 return handle; 1.22 } 1.23 - return StaticClassIntrospector.editConstructorMethodHandle(SafeUnreflector.unreflectConstructor( 1.24 - (Constructor<?>)m)); 1.25 + return StaticClassIntrospector.editConstructorMethodHandle(publicLookup.unreflectConstructor((Constructor<?>)m)); 1.26 } 1.27 1.28 private static DynamicMethod mergeMethods(SingleDynamicMethod method, DynamicMethod existing, Class<?> clazz, String name) {
2.1 --- a/src/jdk/internal/dynalink/beans/FacetIntrospector.java Tue Jul 23 21:45:27 2013 +0530 2.2 +++ b/src/jdk/internal/dynalink/beans/FacetIntrospector.java Tue Jul 23 18:28:58 2013 +0200 2.3 @@ -84,6 +84,7 @@ 2.4 package jdk.internal.dynalink.beans; 2.5 2.6 import java.lang.invoke.MethodHandle; 2.7 +import java.lang.invoke.MethodHandles; 2.8 import java.lang.reflect.Field; 2.9 import java.lang.reflect.Member; 2.10 import java.lang.reflect.Method; 2.11 @@ -92,6 +93,7 @@ 2.12 import java.util.Collection; 2.13 import java.util.Collections; 2.14 import java.util.Map; 2.15 +import jdk.internal.dynalink.support.Lookup; 2.16 2.17 /** 2.18 * Base for classes that expose class field and method information to an {@link AbstractJavaLinker}. There are 2.19 @@ -99,6 +101,8 @@ 2.20 * @author Attila Szegedi 2.21 */ 2.22 abstract class FacetIntrospector { 2.23 + private static final Lookup publicLookup = new Lookup(MethodHandles.publicLookup()); 2.24 + 2.25 private final Class<?> clazz; 2.26 private final boolean instance; 2.27 private final boolean isRestricted; 2.28 @@ -160,11 +164,11 @@ 2.29 2.30 2.31 MethodHandle unreflectGetter(Field field) { 2.32 - return editMethodHandle(SafeUnreflector.unreflectGetter(field)); 2.33 + return editMethodHandle(publicLookup.unreflectGetter(field)); 2.34 } 2.35 2.36 MethodHandle unreflectSetter(Field field) { 2.37 - return editMethodHandle(SafeUnreflector.unreflectSetter(field)); 2.38 + return editMethodHandle(publicLookup.unreflectSetter(field)); 2.39 } 2.40 2.41 /**
3.1 --- a/src/jdk/internal/dynalink/beans/SafeUnreflector.java Tue Jul 23 21:45:27 2013 +0530 3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 3.3 @@ -1,156 +0,0 @@ 3.4 -/* 3.5 - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 3.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.7 - * 3.8 - * This code is free software; you can redistribute it and/or modify it 3.9 - * under the terms of the GNU General Public License version 2 only, as 3.10 - * published by the Free Software Foundation. Oracle designates this 3.11 - * particular file as subject to the "Classpath" exception as provided 3.12 - * by Oracle in the LICENSE file that accompanied this code. 3.13 - * 3.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 3.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 3.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 3.17 - * version 2 for more details (a copy is included in the LICENSE file that 3.18 - * accompanied this code). 3.19 - * 3.20 - * You should have received a copy of the GNU General Public License version 3.21 - * 2 along with this work; if not, write to the Free Software Foundation, 3.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 3.23 - * 3.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 3.25 - * or visit www.oracle.com if you need additional information or have any 3.26 - * questions. 3.27 - */ 3.28 - 3.29 -/* 3.30 - * This file is available under and governed by the GNU General Public 3.31 - * License version 2 only, as published by the Free Software Foundation. 3.32 - * However, the following notice accompanied the original version of this 3.33 - * file, and Oracle licenses the original version of this file under the BSD 3.34 - * license: 3.35 - */ 3.36 -/* 3.37 - Copyright 2009-2013 Attila Szegedi 3.38 - 3.39 - Licensed under both the Apache License, Version 2.0 (the "Apache License") 3.40 - and the BSD License (the "BSD License"), with licensee being free to 3.41 - choose either of the two at their discretion. 3.42 - 3.43 - You may not use this file except in compliance with either the Apache 3.44 - License or the BSD License. 3.45 - 3.46 - If you choose to use this file in compliance with the Apache License, the 3.47 - following notice applies to you: 3.48 - 3.49 - You may obtain a copy of the Apache License at 3.50 - 3.51 - http://www.apache.org/licenses/LICENSE-2.0 3.52 - 3.53 - Unless required by applicable law or agreed to in writing, software 3.54 - distributed under the License is distributed on an "AS IS" BASIS, 3.55 - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 3.56 - implied. See the License for the specific language governing 3.57 - permissions and limitations under the License. 3.58 - 3.59 - If you choose to use this file in compliance with the BSD License, the 3.60 - following notice applies to you: 3.61 - 3.62 - Redistribution and use in source and binary forms, with or without 3.63 - modification, are permitted provided that the following conditions are 3.64 - met: 3.65 - * Redistributions of source code must retain the above copyright 3.66 - notice, this list of conditions and the following disclaimer. 3.67 - * Redistributions in binary form must reproduce the above copyright 3.68 - notice, this list of conditions and the following disclaimer in the 3.69 - documentation and/or other materials provided with the distribution. 3.70 - * Neither the name of the copyright holder nor the names of 3.71 - contributors may be used to endorse or promote products derived from 3.72 - this software without specific prior written permission. 3.73 - 3.74 - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 3.75 - IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 3.76 - TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 3.77 - PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER 3.78 - BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 3.79 - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 3.80 - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 3.81 - BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 3.82 - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 3.83 - OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 3.84 - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3.85 -*/ 3.86 - 3.87 -package jdk.internal.dynalink.beans; 3.88 - 3.89 -import java.lang.invoke.MethodHandle; 3.90 -import java.lang.reflect.Constructor; 3.91 -import java.lang.reflect.Field; 3.92 -import java.lang.reflect.Method; 3.93 -import java.security.AccessController; 3.94 -import java.security.PrivilegedAction; 3.95 -import jdk.internal.dynalink.beans.sandbox.Unreflector; 3.96 - 3.97 -/** 3.98 - * Provides lookup of unreflected method handles through delegation to an instance of {@link SafeUnreflectorImpl}. If 3.99 - * Dynalink is run as trusted code, the delegate class is loaded into an isolated zero-permissions protection domain, 3.100 - * serving as a firebreak against an accidental privilege escalation downstream. 3.101 - */ 3.102 -final class SafeUnreflector { 3.103 - private static final String UNREFLECTOR_IMPL_CLASS_NAME = "jdk.internal.dynalink.beans.SafeUnreflectorImpl"; 3.104 - private static final Unreflector impl = createImpl(); 3.105 - 3.106 - private SafeUnreflector() { 3.107 - } 3.108 - 3.109 - /** 3.110 - * Performs a {@link java.lang.invoke.MethodHandles.Lookup#unreflect(Method)}, converting any encountered 3.111 - * {@link IllegalAccessException} into an {@link IllegalAccessError}. 3.112 - * 3.113 - * @param m the method to unreflect 3.114 - * @return the unreflected method handle. 3.115 - */ 3.116 - static MethodHandle unreflect(Method m) { 3.117 - return impl.unreflect(m); 3.118 - } 3.119 - 3.120 - /** 3.121 - * Performs a {@link java.lang.invoke.MethodHandles.Lookup#unreflectGetter(Field)}, converting any encountered 3.122 - * {@link IllegalAccessException} into an {@link IllegalAccessError}. 3.123 - * 3.124 - * @param f the field for which a getter is unreflected 3.125 - * @return the unreflected field getter handle. 3.126 - */ 3.127 - static MethodHandle unreflectGetter(Field f) { 3.128 - return impl.unreflectGetter(f); 3.129 - } 3.130 - 3.131 - /** 3.132 - * Performs a {@link java.lang.invoke.MethodHandles.Lookup#unreflectSetter(Field)}, converting any encountered 3.133 - * {@link IllegalAccessException} into an {@link IllegalAccessError}. 3.134 - * 3.135 - * @param f the field for which a setter is unreflected 3.136 - * @return the unreflected field setter handle. 3.137 - */ 3.138 - static MethodHandle unreflectSetter(Field f) { 3.139 - return impl.unreflectSetter(f); 3.140 - } 3.141 - 3.142 - static MethodHandle unreflectConstructor(Constructor<?> c) { 3.143 - return impl.unreflectConstructor(c); 3.144 - } 3.145 - 3.146 - private static Unreflector createImpl() { 3.147 - final Class<?> unreflectorImplClass = AccessController.doPrivileged(new PrivilegedAction<Class<?>>() { 3.148 - @Override 3.149 - public Class<?> run() { 3.150 - return SandboxClassLoader.loadClass(UNREFLECTOR_IMPL_CLASS_NAME); 3.151 - } 3.152 - }); 3.153 - try { 3.154 - return (Unreflector)unreflectorImplClass.newInstance(); 3.155 - } catch(InstantiationException | IllegalAccessException e) { 3.156 - throw new RuntimeException(e.getMessage(), e); 3.157 - } 3.158 - } 3.159 -}
4.1 --- a/src/jdk/internal/dynalink/beans/SafeUnreflectorImpl.java Tue Jul 23 21:45:27 2013 +0530 4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 4.3 @@ -1,146 +0,0 @@ 4.4 -/* 4.5 - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 4.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4.7 - * 4.8 - * This code is free software; you can redistribute it and/or modify it 4.9 - * under the terms of the GNU General Public License version 2 only, as 4.10 - * published by the Free Software Foundation. Oracle designates this 4.11 - * particular file as subject to the "Classpath" exception as provided 4.12 - * by Oracle in the LICENSE file that accompanied this code. 4.13 - * 4.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 4.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 4.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 4.17 - * version 2 for more details (a copy is included in the LICENSE file that 4.18 - * accompanied this code). 4.19 - * 4.20 - * You should have received a copy of the GNU General Public License version 4.21 - * 2 along with this work; if not, write to the Free Software Foundation, 4.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 4.23 - * 4.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 4.25 - * or visit www.oracle.com if you need additional information or have any 4.26 - * questions. 4.27 - */ 4.28 - 4.29 -/* 4.30 - * This file is available under and governed by the GNU General Public 4.31 - * License version 2 only, as published by the Free Software Foundation. 4.32 - * However, the following notice accompanied the original version of this 4.33 - * file, and Oracle licenses the original version of this file under the BSD 4.34 - * license: 4.35 - */ 4.36 -/* 4.37 - Copyright 2009-2013 Attila Szegedi 4.38 - 4.39 - Licensed under both the Apache License, Version 2.0 (the "Apache License") 4.40 - and the BSD License (the "BSD License"), with licensee being free to 4.41 - choose either of the two at their discretion. 4.42 - 4.43 - You may not use this file except in compliance with either the Apache 4.44 - License or the BSD License. 4.45 - 4.46 - If you choose to use this file in compliance with the Apache License, the 4.47 - following notice applies to you: 4.48 - 4.49 - You may obtain a copy of the Apache License at 4.50 - 4.51 - http://www.apache.org/licenses/LICENSE-2.0 4.52 - 4.53 - Unless required by applicable law or agreed to in writing, software 4.54 - distributed under the License is distributed on an "AS IS" BASIS, 4.55 - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 4.56 - implied. See the License for the specific language governing 4.57 - permissions and limitations under the License. 4.58 - 4.59 - If you choose to use this file in compliance with the BSD License, the 4.60 - following notice applies to you: 4.61 - 4.62 - Redistribution and use in source and binary forms, with or without 4.63 - modification, are permitted provided that the following conditions are 4.64 - met: 4.65 - * Redistributions of source code must retain the above copyright 4.66 - notice, this list of conditions and the following disclaimer. 4.67 - * Redistributions in binary form must reproduce the above copyright 4.68 - notice, this list of conditions and the following disclaimer in the 4.69 - documentation and/or other materials provided with the distribution. 4.70 - * Neither the name of the copyright holder nor the names of 4.71 - contributors may be used to endorse or promote products derived from 4.72 - this software without specific prior written permission. 4.73 - 4.74 - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 4.75 - IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 4.76 - TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 4.77 - PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER 4.78 - BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 4.79 - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 4.80 - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 4.81 - BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 4.82 - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 4.83 - OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 4.84 - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 4.85 -*/ 4.86 - 4.87 -package jdk.internal.dynalink.beans; 4.88 - 4.89 -import java.lang.invoke.MethodHandle; 4.90 -import java.lang.invoke.MethodHandles; 4.91 -import java.lang.reflect.Constructor; 4.92 -import java.lang.reflect.Field; 4.93 -import java.lang.reflect.Method; 4.94 -import jdk.internal.dynalink.beans.sandbox.Unreflector; 4.95 - 4.96 -/** 4.97 - * Performs lookup of unreflected method handles by delegating to {@link MethodHandles#lookup()} using itself as the 4.98 - * lookup class. When Dynalink runs as trusted code, this class is loaded into an isolated zero-permissions protection 4.99 - * domain to stop any accidental privilege escalation. 4.100 - */ 4.101 -final class SafeUnreflectorImpl implements Unreflector { 4.102 - 4.103 - SafeUnreflectorImpl() { 4.104 - } 4.105 - 4.106 - @Override 4.107 - public MethodHandle unreflect(Method m) { 4.108 - try { 4.109 - return MethodHandles.lookup().unreflect(m); 4.110 - } catch(IllegalAccessException e) { 4.111 - final IllegalAccessError ee = new IllegalAccessError("Failed to unreflect method " + m); 4.112 - ee.initCause(e); 4.113 - throw ee; 4.114 - } 4.115 - } 4.116 - 4.117 - @Override 4.118 - public MethodHandle unreflectGetter(Field f) { 4.119 - try { 4.120 - return MethodHandles.lookup().unreflectGetter(f); 4.121 - } catch(IllegalAccessException e) { 4.122 - final IllegalAccessError ee = new IllegalAccessError("Failed to unreflect getter for field " + f); 4.123 - ee.initCause(e); 4.124 - throw ee; 4.125 - } 4.126 - } 4.127 - 4.128 - @Override 4.129 - public MethodHandle unreflectSetter(Field f) { 4.130 - try { 4.131 - return MethodHandles.lookup().unreflectSetter(f); 4.132 - } catch(IllegalAccessException e) { 4.133 - final IllegalAccessError ee = new IllegalAccessError("Failed to unreflect setter for field " + f); 4.134 - ee.initCause(e); 4.135 - throw ee; 4.136 - } 4.137 - } 4.138 - 4.139 - @Override 4.140 - public MethodHandle unreflectConstructor(Constructor<?> c) { 4.141 - try { 4.142 - return MethodHandles.lookup().unreflectConstructor(c); 4.143 - } catch(IllegalAccessException e) { 4.144 - final IllegalAccessError ee = new IllegalAccessError("Failed to unreflect constructor " + c); 4.145 - ee.initCause(e); 4.146 - throw ee; 4.147 - } 4.148 - } 4.149 -}
5.1 --- a/src/jdk/internal/dynalink/beans/SandboxClassLoader.java Tue Jul 23 21:45:27 2013 +0530 5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 5.3 @@ -1,228 +0,0 @@ 5.4 -/* 5.5 - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 5.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5.7 - * 5.8 - * This code is free software; you can redistribute it and/or modify it 5.9 - * under the terms of the GNU General Public License version 2 only, as 5.10 - * published by the Free Software Foundation. Oracle designates this 5.11 - * particular file as subject to the "Classpath" exception as provided 5.12 - * by Oracle in the LICENSE file that accompanied this code. 5.13 - * 5.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 5.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 5.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 5.17 - * version 2 for more details (a copy is included in the LICENSE file that 5.18 - * accompanied this code). 5.19 - * 5.20 - * You should have received a copy of the GNU General Public License version 5.21 - * 2 along with this work; if not, write to the Free Software Foundation, 5.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 5.23 - * 5.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 5.25 - * or visit www.oracle.com if you need additional information or have any 5.26 - * questions. 5.27 - */ 5.28 - 5.29 -/* 5.30 - * This file is available under and governed by the GNU General Public 5.31 - * License version 2 only, as published by the Free Software Foundation. 5.32 - * However, the following notice accompanied the original version of this 5.33 - * file, and Oracle licenses the original version of this file under the BSD 5.34 - * license: 5.35 - */ 5.36 -/* 5.37 - Copyright 2009-2013 Attila Szegedi 5.38 - 5.39 - Licensed under both the Apache License, Version 2.0 (the "Apache License") 5.40 - and the BSD License (the "BSD License"), with licensee being free to 5.41 - choose either of the two at their discretion. 5.42 - 5.43 - You may not use this file except in compliance with either the Apache 5.44 - License or the BSD License. 5.45 - 5.46 - If you choose to use this file in compliance with the Apache License, the 5.47 - following notice applies to you: 5.48 - 5.49 - You may obtain a copy of the Apache License at 5.50 - 5.51 - http://www.apache.org/licenses/LICENSE-2.0 5.52 - 5.53 - Unless required by applicable law or agreed to in writing, software 5.54 - distributed under the License is distributed on an "AS IS" BASIS, 5.55 - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 5.56 - implied. See the License for the specific language governing 5.57 - permissions and limitations under the License. 5.58 - 5.59 - If you choose to use this file in compliance with the BSD License, the 5.60 - following notice applies to you: 5.61 - 5.62 - Redistribution and use in source and binary forms, with or without 5.63 - modification, are permitted provided that the following conditions are 5.64 - met: 5.65 - * Redistributions of source code must retain the above copyright 5.66 - notice, this list of conditions and the following disclaimer. 5.67 - * Redistributions in binary form must reproduce the above copyright 5.68 - notice, this list of conditions and the following disclaimer in the 5.69 - documentation and/or other materials provided with the distribution. 5.70 - * Neither the name of the copyright holder nor the names of 5.71 - contributors may be used to endorse or promote products derived from 5.72 - this software without specific prior written permission. 5.73 - 5.74 - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 5.75 - IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 5.76 - TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 5.77 - PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER 5.78 - BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 5.79 - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 5.80 - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 5.81 - BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 5.82 - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 5.83 - OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 5.84 - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 5.85 -*/ 5.86 - 5.87 -package jdk.internal.dynalink.beans; 5.88 - 5.89 -import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC; 5.90 -import static jdk.internal.org.objectweb.asm.Opcodes.ASM4; 5.91 - 5.92 -import java.io.IOException; 5.93 -import java.io.InputStream; 5.94 -import java.security.Permissions; 5.95 -import java.security.ProtectionDomain; 5.96 -import java.security.SecureClassLoader; 5.97 -import java.security.SecureRandom; 5.98 -import jdk.internal.org.objectweb.asm.ClassReader; 5.99 -import jdk.internal.org.objectweb.asm.ClassVisitor; 5.100 -import jdk.internal.org.objectweb.asm.ClassWriter; 5.101 -import jdk.internal.org.objectweb.asm.MethodVisitor; 5.102 - 5.103 -/** 5.104 - * A utility class that can load a class with specified name into an isolated zero-permissions protection domain. It can 5.105 - * be used to load classes that perform security-sensitive operations with no privileges at all, therefore ensuring such 5.106 - * operations will only succeed if they would require no permissions, as well as to make sure that if these operations 5.107 - * bind some part of the security execution context to their results, the bound security context is completely 5.108 - * unprivileged. Such measures serve as firebreaks against accidental privilege escalation. 5.109 - */ 5.110 -final class SandboxClassLoader { 5.111 - private final String className; 5.112 - private final String randomizedClassName; 5.113 - 5.114 - private SandboxClassLoader(String className) { 5.115 - this.className = className; 5.116 - final String simpleClassName = className.substring(className.lastIndexOf('.') + 1); 5.117 - this.randomizedClassName = "randomPackage" + Long.toHexString(new SecureRandom().nextLong()) + "." + simpleClassName; 5.118 - } 5.119 - 5.120 - /** 5.121 - * Load the named class into a zero-permissions protection domain. Even if the class is already loaded into the 5.122 - * Dynalink's class loader, an independent class is created from the same bytecode, thus the returned class will 5.123 - * never be identical with the one that might already be loaded. The class to be loaded is supposed to be package 5.124 - * private and have no public constructors. This is not a functional requirement, but it is enforced to ensure that 5.125 - * the original class was made adequately inaccessible. The returned class will be public and its constructors will 5.126 - * be changed to public. The only permission given to the returned class will be 5.127 - * {@code accessClassInPackage.jdk.internal.dynalink.beans.sandbox}. That package should be used solely to define 5.128 - * SPI interfaces implemented by the loaded class. 5.129 - * @param className the fully qualified name of the class to load 5.130 - * @return the loaded class, renamed to a random package, made public, its constructors made public, and lacking any 5.131 - * permissions except access to the sandbox package. 5.132 - * @throws SecurityException if the calling code lacks the {@code createClassLoader} runtime permission. This 5.133 - * normally means that Dynalink itself is running as untrusted code, and whatever functionality was meant to be 5.134 - * isolated into an unprivileged class is likely okay to be used directly too. 5.135 - */ 5.136 - static Class<?> loadClass(String className) throws SecurityException { 5.137 - return new SandboxClassLoader(className).loadClass(); 5.138 - } 5.139 - 5.140 - private Class<?> loadClass() throws SecurityException { 5.141 - final ClassLoader loader = createClassLoader(); 5.142 - try { 5.143 - final Class<?> clazz = Class.forName(randomizedClassName, true, loader); 5.144 - // Sanity check to ensure we didn't accidentally pick up the class from elsewhere 5.145 - if(clazz.getClassLoader() != loader) { 5.146 - throw new AssertionError(randomizedClassName + " was loaded from a different class loader"); 5.147 - } 5.148 - return clazz; 5.149 - } catch(ClassNotFoundException e) { 5.150 - throw new AssertionError(e); 5.151 - } 5.152 - } 5.153 - 5.154 - private ClassLoader createClassLoader() throws SecurityException { 5.155 - final String lclassName = this.randomizedClassName; 5.156 - // We deliberately override loadClass instead of findClass so that we don't give a chance to finding this 5.157 - // class already loaded anywhere else. We use this class' loader as the parent class loader as the loaded class 5.158 - // needs to be able to access implemented interfaces from the sandbox package. 5.159 - return new SecureClassLoader(getClass().getClassLoader()) { 5.160 - @Override 5.161 - protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { 5.162 - if(name.equals(lclassName)) { 5.163 - final byte[] bytes = getClassBytes(); 5.164 - // Define the class with a protection domain that grants (almost) no permissions. 5.165 - Class<?> clazz = defineClass(name, bytes, 0, bytes.length, createMinimalPermissionsDomain()); 5.166 - if(resolve) { 5.167 - resolveClass(clazz); 5.168 - } 5.169 - return clazz; 5.170 - } 5.171 - 5.172 - final int i = name.lastIndexOf('.'); 5.173 - if (i != -1) { 5.174 - final SecurityManager sm = System.getSecurityManager(); 5.175 - if (sm != null) { 5.176 - sm.checkPackageAccess(name.substring(0, i)); 5.177 - } 5.178 - } 5.179 - return super.loadClass(name, resolve); 5.180 - } 5.181 - }; 5.182 - } 5.183 - 5.184 - /** 5.185 - * Create a no-permissions protection domain. Except, it's not really a no-permissions protection domain, since we 5.186 - * need to give the protection domain the permission to access the sandbox package where the interop interfaces are 5.187 - * defined. 5.188 - * @return a new (almost) no-permission protection domain. 5.189 - */ 5.190 - private static ProtectionDomain createMinimalPermissionsDomain() { 5.191 - final Permissions p = new Permissions(); 5.192 - p.add(new RuntimePermission("accessClassInPackage.jdk.internal.dynalink.beans.sandbox")); 5.193 - return new ProtectionDomain(null, p); 5.194 - } 5.195 - 5.196 - private byte[] getClassBytes() { 5.197 - try(final InputStream in = getClass().getResourceAsStream("/" + className.replace('.', '/') + ".class")) { 5.198 - final ClassReader cr = new ClassReader(in); 5.199 - final ClassWriter cw = new ClassWriter(cr, 0); 5.200 - cr.accept(new ClassVisitor(ASM4, cw) { 5.201 - @Override 5.202 - public void visit(int version, int access, String name, String signature, String superName, 5.203 - String[] interfaces) { 5.204 - // Rename the class to its random name, and make it public (otherwise we won't be able to 5.205 - // instantiate it). The privileged template class is package-private. 5.206 - if((access & ACC_PUBLIC) != 0) { 5.207 - throw new IllegalArgumentException("Class " + className + " must be package-private"); 5.208 - } 5.209 - super.visit(version, access | ACC_PUBLIC, randomizedClassName.replace('.', '/'), 5.210 - signature, superName, interfaces); 5.211 - } 5.212 - 5.213 - @Override 5.214 - public MethodVisitor visitMethod(int access, String name, String desc, String signature, 5.215 - String[] exceptions) { 5.216 - // Make the constructor(s) public (otherwise we won't be able to instantiate the class). The 5.217 - // privileged template's constructor(s) should not be public. 5.218 - final boolean isCtor = "<init>".equals(name); 5.219 - if(isCtor && ((access & ACC_PUBLIC) != 0)) { 5.220 - throw new IllegalArgumentException("Class " + className + " must have no public constructors"); 5.221 - } 5.222 - return super.visitMethod(isCtor ? (access | ACC_PUBLIC) : access, name, desc, signature, 5.223 - exceptions); 5.224 - } 5.225 - }, 0); 5.226 - return cw.toByteArray(); 5.227 - } catch(IOException e) { 5.228 - throw new RuntimeException(e); 5.229 - } 5.230 - } 5.231 -}
6.1 --- a/src/jdk/internal/dynalink/beans/sandbox/Unreflector.java Tue Jul 23 21:45:27 2013 +0530 6.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 6.3 @@ -1,132 +0,0 @@ 6.4 -/* 6.5 - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 6.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6.7 - * 6.8 - * This code is free software; you can redistribute it and/or modify it 6.9 - * under the terms of the GNU General Public License version 2 only, as 6.10 - * published by the Free Software Foundation. Oracle designates this 6.11 - * particular file as subject to the "Classpath" exception as provided 6.12 - * by Oracle in the LICENSE file that accompanied this code. 6.13 - * 6.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 6.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 6.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 6.17 - * version 2 for more details (a copy is included in the LICENSE file that 6.18 - * accompanied this code). 6.19 - * 6.20 - * You should have received a copy of the GNU General Public License version 6.21 - * 2 along with this work; if not, write to the Free Software Foundation, 6.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 6.23 - * 6.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 6.25 - * or visit www.oracle.com if you need additional information or have any 6.26 - * questions. 6.27 - */ 6.28 - 6.29 -/* 6.30 - * This file is available under and governed by the GNU General Public 6.31 - * License version 2 only, as published by the Free Software Foundation. 6.32 - * However, the following notice accompanied the original version of this 6.33 - * file, and Oracle licenses the original version of this file under the BSD 6.34 - * license: 6.35 - */ 6.36 -/* 6.37 - Copyright 2009-2013 Attila Szegedi 6.38 - 6.39 - Licensed under both the Apache License, Version 2.0 (the "Apache License") 6.40 - and the BSD License (the "BSD License"), with licensee being free to 6.41 - choose either of the two at their discretion. 6.42 - 6.43 - You may not use this file except in compliance with either the Apache 6.44 - License or the BSD License. 6.45 - 6.46 - If you choose to use this file in compliance with the Apache License, the 6.47 - following notice applies to you: 6.48 - 6.49 - You may obtain a copy of the Apache License at 6.50 - 6.51 - http://www.apache.org/licenses/LICENSE-2.0 6.52 - 6.53 - Unless required by applicable law or agreed to in writing, software 6.54 - distributed under the License is distributed on an "AS IS" BASIS, 6.55 - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 6.56 - implied. See the License for the specific language governing 6.57 - permissions and limitations under the License. 6.58 - 6.59 - If you choose to use this file in compliance with the BSD License, the 6.60 - following notice applies to you: 6.61 - 6.62 - Redistribution and use in source and binary forms, with or without 6.63 - modification, are permitted provided that the following conditions are 6.64 - met: 6.65 - * Redistributions of source code must retain the above copyright 6.66 - notice, this list of conditions and the following disclaimer. 6.67 - * Redistributions in binary form must reproduce the above copyright 6.68 - notice, this list of conditions and the following disclaimer in the 6.69 - documentation and/or other materials provided with the distribution. 6.70 - * Neither the name of the copyright holder nor the names of 6.71 - contributors may be used to endorse or promote products derived from 6.72 - this software without specific prior written permission. 6.73 - 6.74 - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 6.75 - IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 6.76 - TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 6.77 - PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER 6.78 - BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 6.79 - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 6.80 - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 6.81 - BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 6.82 - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 6.83 - OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 6.84 - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 6.85 -*/ 6.86 - 6.87 -package jdk.internal.dynalink.beans.sandbox; 6.88 - 6.89 -import java.lang.invoke.MethodHandle; 6.90 -import java.lang.reflect.Constructor; 6.91 -import java.lang.reflect.Field; 6.92 -import java.lang.reflect.Method; 6.93 - 6.94 -/** 6.95 - * Interface for creating unreflected method handles. This class is public for implementation purposes and is not part 6.96 - * of any supported API. 6.97 - */ 6.98 -public interface Unreflector { 6.99 - /** 6.100 - * Performs similarly to {@link java.lang.invoke.MethodHandles.Lookup#unreflect(Method)} for some lookup object, 6.101 - * also converting any encountered {@link IllegalAccessException} into an {@link IllegalAccessError}. 6.102 - * 6.103 - * @param m the method to unreflect 6.104 - * @return the unreflected method handle. 6.105 - */ 6.106 - public MethodHandle unreflect(Method m); 6.107 - 6.108 - /** 6.109 - * Performs similarly to {@link java.lang.invoke.MethodHandles.Lookup#unreflectGetter(Field)} for some lookup 6.110 - * object, also converting any encountered {@link IllegalAccessException} into an {@link IllegalAccessError}. 6.111 - * 6.112 - * @param f the field for which a getter is unreflected 6.113 - * @return the unreflected field getter handle. 6.114 - */ 6.115 - public MethodHandle unreflectGetter(Field f); 6.116 - 6.117 - /** 6.118 - * Performs similarly to {@link java.lang.invoke.MethodHandles.Lookup#unreflectSetter(Field)} for some lookup 6.119 - * object, also converting any encountered {@link IllegalAccessException} into an {@link IllegalAccessError}. 6.120 - * 6.121 - * @param f the field for which a setter is unreflected 6.122 - * @return the unreflected field setter handle. 6.123 - */ 6.124 - public MethodHandle unreflectSetter(Field f); 6.125 - 6.126 - /** 6.127 - * Performs similarly to {@link java.lang.invoke.MethodHandles.Lookup#unreflectConstructor(Constructor)} for some 6.128 - * lookup object, also converting any encountered {@link IllegalAccessException} into an {@link IllegalAccessError}. 6.129 - * 6.130 - * @param c the constructor to unreflect 6.131 - * @return the unreflected constructor handle. 6.132 - */ 6.133 - public MethodHandle unreflectConstructor(Constructor<?> c); 6.134 - 6.135 -}
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/test/script/trusted/JDK-8021129.js Tue Jul 23 18:28:58 2013 +0200 7.3 @@ -0,0 +1,43 @@ 7.4 +/* 7.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 7.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7.7 + * 7.8 + * This code is free software; you can redistribute it and/or modify it 7.9 + * under the terms of the GNU General Public License version 2 only, as 7.10 + * published by the Free Software Foundation. 7.11 + * 7.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 7.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 7.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 7.15 + * version 2 for more details (a copy is included in the LICENSE file that 7.16 + * accompanied this code). 7.17 + * 7.18 + * You should have received a copy of the GNU General Public License version 7.19 + * 2 along with this work; if not, write to the Free Software Foundation, 7.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 7.21 + * 7.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 7.23 + * or visit www.oracle.com if you need additional information or have any 7.24 + * questions. 7.25 + */ 7.26 + 7.27 +/** 7.28 + * JDK-8021129: Test prevention of access to members of restricted classes. 7.29 + * Note that even though the script runs as trusted, we still don't allow 7.30 + * access to non-public portions of restricted classes. 7.31 + * 7.32 + * @test 7.33 + * @run 7.34 + */ 7.35 +var r1 = new (Java.type("jdk.nashorn.internal.test.models.InternalRunnable")) 7.36 +r1.run() // Can execute method from an implemented non-restricted interface 7.37 +print(r1.toString()) // Can execute public method from a superclass 7.38 + 7.39 +print(r1.restrictedRun === undefined) // Can't see method from a restricted interface 7.40 +print(r1.canNotInvokeThis === undefined) // Can't see any other public methods 7.41 +print(r1.invisibleProperty === undefined) // Can't see any other properties 7.42 +print(r1.canSeeThisField === undefined) // Can't see fields from superclasses 7.43 +print(r1.canNotSeeThisField === undefined) // Can't see its own fields 7.44 + 7.45 +var r2 = new (Java.type("jdk.nashorn.test.models.InternalRunnableSuperclass")) 7.46 +print(r2.canSeeThisField) // Superclass field works fine on its own 7.47 \ No newline at end of file
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 8.2 +++ b/test/script/trusted/JDK-8021129.js.EXPECTED Tue Jul 23 18:28:58 2013 +0200 8.3 @@ -0,0 +1,9 @@ 8.4 +InternalRunnable.run() executed! 8.5 +InternalRunnable.toString() executed! 8.6 + 8.7 +true 8.8 +true 8.9 +true 8.10 +true 8.11 +true 8.12 +19
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 9.2 +++ b/test/src/jdk/nashorn/internal/test/models/InternalRunnable.java Tue Jul 23 18:28:58 2013 +0200 9.3 @@ -0,0 +1,71 @@ 9.4 +/* 9.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 9.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 9.7 + * 9.8 + * This code is free software; you can redistribute it and/or modify it 9.9 + * under the terms of the GNU General Public License version 2 only, as 9.10 + * published by the Free Software Foundation. Oracle designates this 9.11 + * particular file as subject to the "Classpath" exception as provided 9.12 + * by Oracle in the LICENSE file that accompanied this code. 9.13 + * 9.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 9.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 9.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 9.17 + * version 2 for more details (a copy is included in the LICENSE file that 9.18 + * accompanied this code). 9.19 + * 9.20 + * You should have received a copy of the GNU General Public License version 9.21 + * 2 along with this work; if not, write to the Free Software Foundation, 9.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 9.23 + * 9.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 9.25 + * or visit www.oracle.com if you need additional information or have any 9.26 + * questions. 9.27 + */ 9.28 + 9.29 +package jdk.nashorn.internal.test.models; 9.30 + 9.31 +import java.io.PrintWriter; 9.32 +import java.io.StringWriter; 9.33 + 9.34 +public class InternalRunnable implements Runnable, RestrictedRunnable { 9.35 + 9.36 + // This is a public field in a restricted class; scripts should not see it. 9.37 + public final int canNotSeeThisField = 42; 9.38 + 9.39 + private boolean runExecuted = false; 9.40 + 9.41 + @Override 9.42 + public void run() { 9.43 + runExecuted = true; 9.44 + } 9.45 + 9.46 + @Override 9.47 + public void restrictedRun() { 9.48 + // This is a public method on a restricted interface; scripts should not see it. 9.49 + throw new AssertionError(); 9.50 + } 9.51 + 9.52 + @Override 9.53 + public String toString() { 9.54 + final StringWriter sw = new StringWriter(); 9.55 + final PrintWriter pw = new PrintWriter(sw); 9.56 + if(runExecuted) { 9.57 + pw.println("InternalRunnable.run() executed!"); 9.58 + } 9.59 + pw.println("InternalRunnable.toString() executed!"); 9.60 + pw.flush(); 9.61 + return sw.toString(); 9.62 + } 9.63 + 9.64 + public void canNotInvokeThis() { 9.65 + // This is a public method in a restricted class; scripts should not see it. 9.66 + throw new AssertionError(); 9.67 + } 9.68 + 9.69 + public void getInvisibleProperty() { 9.70 + // This is a public method in a restricted class; scripts should not see it. 9.71 + throw new AssertionError(); 9.72 + } 9.73 +} 9.74 +
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 10.2 +++ b/test/src/jdk/nashorn/internal/test/models/RestrictedRunnable.java Tue Jul 23 18:28:58 2013 +0200 10.3 @@ -0,0 +1,34 @@ 10.4 +/* 10.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 10.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.7 + * 10.8 + * This code is free software; you can redistribute it and/or modify it 10.9 + * under the terms of the GNU General Public License version 2 only, as 10.10 + * published by the Free Software Foundation. Oracle designates this 10.11 + * particular file as subject to the "Classpath" exception as provided 10.12 + * by Oracle in the LICENSE file that accompanied this code. 10.13 + * 10.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 10.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.17 + * version 2 for more details (a copy is included in the LICENSE file that 10.18 + * accompanied this code). 10.19 + * 10.20 + * You should have received a copy of the GNU General Public License version 10.21 + * 2 along with this work; if not, write to the Free Software Foundation, 10.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.23 + * 10.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 10.25 + * or visit www.oracle.com if you need additional information or have any 10.26 + * questions. 10.27 + */ 10.28 + 10.29 +package jdk.nashorn.internal.test.models; 10.30 + 10.31 +/** 10.32 + * Acts as a restricted interface implemented by a restricted class. 10.33 + * 10.34 + */ 10.35 +public interface RestrictedRunnable { 10.36 + public void restrictedRun(); 10.37 +}
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 11.2 +++ b/test/src/jdk/nashorn/test/models/InternalRunnableSuperclass.java Tue Jul 23 18:28:58 2013 +0200 11.3 @@ -0,0 +1,35 @@ 11.4 +/* 11.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 11.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 11.7 + * 11.8 + * This code is free software; you can redistribute it and/or modify it 11.9 + * under the terms of the GNU General Public License version 2 only, as 11.10 + * published by the Free Software Foundation. Oracle designates this 11.11 + * particular file as subject to the "Classpath" exception as provided 11.12 + * by Oracle in the LICENSE file that accompanied this code. 11.13 + * 11.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 11.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 11.17 + * version 2 for more details (a copy is included in the LICENSE file that 11.18 + * accompanied this code). 11.19 + * 11.20 + * You should have received a copy of the GNU General Public License version 11.21 + * 2 along with this work; if not, write to the Free Software Foundation, 11.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 11.23 + * 11.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 11.25 + * or visit www.oracle.com if you need additional information or have any 11.26 + * questions. 11.27 + */ 11.28 + 11.29 +package jdk.nashorn.test.models; 11.30 + 11.31 +/** 11.32 + * Acts as a non-restricted superclass for a restricted class. 11.33 + * 11.34 + */ 11.35 +public class InternalRunnableSuperclass { 11.36 + public final int canSeeThisField = 19; 11.37 + 11.38 +}