--- old/test/hotspot/jtreg/vmTestbase/nsk/stress/except/except004.java 2018-06-04 03:54:44.057482275 -0400 +++ new/test/hotspot/jtreg/vmTestbase/nsk/stress/except/except004.java 2018-06-04 03:54:42.513393035 -0400 @@ -211,15 +211,15 @@ Object integerValue = new Integer(0); Object doubleValue = new Double(0); Object trash = null; - Field abraPrivateField; Field abraIntegerField; Field abraBooleanField; + Field extPrivateField; try { - abraPrivateField = Abra.class.getDeclaredField("DONT_TOUCH_ME"); abraIntegerField = Abra.class.getDeclaredField("MAIN_CYR_NUMBER"); abraBooleanField = Abra.class.getDeclaredField("NOT_AN_INTEGER"); + extPrivateField = Ext.class.getDeclaredField("DONT_TOUCH_ME"); } catch (NoSuchFieldException nsfe) { - out.println("Test initialisation failed: field not found in class Abra"); + out.println("Test initialisation failed: field not found: " + nsfe.getMessage()); return 2; } @@ -369,7 +369,6 @@ // Check IllegalAccessException (positive): try { int junkIt = abraIntegerField.getInt(null); // legal - should pass -// int junkIt = abraPrivateField.getInt(null); // illegal - should fail if (TRACE_ON) log[messages++] = "Success: IllegalAccessException (positive)"; } catch (IllegalAccessException iae) { @@ -383,8 +382,7 @@ // Check IllegalAccessException (negative): try { -// int junkIt = abraIntegerField.getInt(null); // legal - should pass - int junkIt = abraPrivateField.getInt(null); // illegal - should fail + int junkIt = extPrivateField.getInt(null); // illegal - should fail log[messages++] = "Failure: IllegalAccessException (negative)"; exitCode = 2; // FAILED } catch (IllegalAccessException iae) { @@ -512,7 +510,7 @@ /** * This class should be used to check CloneNotSupportedException, - * IllegalAccessException, and IllegalArgumentException. + * and IllegalArgumentException. * The class extends except004 in order that its (protected) * method clone() be available from except004. */ @@ -527,10 +525,6 @@ /** * Will try to incorrectly access to this field from outside this class. */ - private static final int DONT_TOUCH_ME = 666; - /** - * Will try to incorrectly access to this field from outside this class. - */ public static final int MAIN_CYR_NUMBER = 47; /** * Will try to get this field like int zero. @@ -551,3 +545,11 @@ } } } + +/* Package accessible class that has non-accessible private member */ +class Ext { + /** + * Will try to incorrectly access to this field from outside this class. + */ + private static final int DONT_TOUCH_ME = 666; +}