--- old/test/jdk/java/lang/invoke/VarHandles/accessibility/TestFieldLookupAccessibility.java 2019-03-22 12:00:36.624320776 +0000 +++ new/test/jdk/java/lang/invoke/VarHandles/accessibility/TestFieldLookupAccessibility.java 2019-03-22 12:00:36.380316655 +0000 @@ -110,6 +110,10 @@ Object lookup(MethodHandles.Lookup l, Field f) throws Exception { return l.unreflectSetter(cloneAndSetAccessible(f)); } + + boolean isAccessible(Field f) { + return !(Modifier.isStatic(f.getModifiers()) && Modifier.isFinal(f.getModifiers())); + } }, VH() { Object lookup(MethodHandles.Lookup l, Field f) throws Exception { @@ -210,7 +214,9 @@ } } else { - Assert.assertEquals(actualFieldNames, expected, "Accessibility failures differ:"); + //If this is an MH_UNREFLECT_SETTER_ACCESSIBLE test, then we only expect the static final fields to cause exceptions. + if (fl != FieldLookup.MH_UNREFLECT_SETTER_ACCESSIBLE && actualFieldNames.stream().anyMatch(s->!(s.contains("static")&&(s.contains("final"))))) + Assert.assertEquals(actualFieldNames, expected, "Accessibility failures differ:"); } } else {