diff -r 9b8c96f96a0f src/share/classes/com/sun/beans/finder/ConstructorFinder.java --- openjdk/jdk/src/share/classes/com/sun/beans/finder/ConstructorFinder.java Mon Jun 27 13:21:34 2011 -0700 +++ openjdk/jdk/src/share/classes/com/sun/beans/finder/ConstructorFinder.java Wed Aug 29 09:52:11 2012 +0200 @@ -29,6 +29,8 @@ import java.lang.reflect.Constructor; import java.lang.reflect.Modifier; +import sun.reflect.misc.ReflectUtil; + /** * This utility class provides {@code static} methods * to find a public constructor with specified parameter types @@ -61,7 +63,8 @@ if (Modifier.isAbstract(type.getModifiers())) { throw new NoSuchMethodException("Abstract class cannot be instantiated"); } - if (!Modifier.isPublic(type.getModifiers())) { + if (!ReflectUtil.isPackageAccessible(type) + || !Modifier.isPublic(type.getModifiers())) { throw new NoSuchMethodException("Class is not accessible"); } PrimitiveWrapperMap.replacePrimitivesWithWrappers(args); diff -r 9b8c96f96a0f src/share/classes/com/sun/beans/finder/FieldFinder.java --- openjdk/jdk/src/share/classes/com/sun/beans/finder/FieldFinder.java Mon Jun 27 13:21:34 2011 -0700 +++ openjdk/jdk/src/share/classes/com/sun/beans/finder/FieldFinder.java Wed Aug 29 09:52:11 2012 +0200 @@ -27,6 +27,8 @@ import java.lang.reflect.Field; import java.lang.reflect.Modifier; +import sun.reflect.misc.ReflectUtil; + /** * This utility class provides {@code static} methods * to find a public field with specified name @@ -56,7 +58,8 @@ if (!Modifier.isPublic(field.getModifiers())) { throw new NoSuchFieldException("Field '" + name + "' is not public"); } - if (!Modifier.isPublic(field.getDeclaringClass().getModifiers())) { + if (!ReflectUtil.isPackageAccessible(field.getDeclaringClass()) || + !Modifier.isPublic(field.getDeclaringClass().getModifiers())) { throw new NoSuchFieldException("Field '" + name + "' is not accessible"); } return field; diff -r 9b8c96f96a0f src/share/classes/com/sun/beans/finder/MethodFinder.java --- openjdk/jdk/src/share/classes/com/sun/beans/finder/MethodFinder.java Mon Jun 27 13:21:34 2011 -0700 +++ openjdk/jdk/src/share/classes/com/sun/beans/finder/MethodFinder.java Wed Aug 29 09:52:11 2012 +0200 @@ -33,6 +33,8 @@ import java.lang.reflect.Type; import java.util.Arrays; +import sun.reflect.misc.ReflectUtil; + /** * This utility class provides {@code static} methods * to find a public method with specified name and parameter types @@ -120,7 +122,8 @@ */ public static Method findAccessibleMethod(Method method) throws NoSuchMethodException { Class type = method.getDeclaringClass(); - if (Modifier.isPublic(type.getModifiers())) { + if (ReflectUtil.isPackageAccessible(type) + && Modifier.isPublic(type.getModifiers())) { return method; } if (Modifier.isStatic(method.getModifiers())) {