--- old/test/tools/javac/sym/ElementStructureTest.java 2015-06-01 08:14:37.239910808 -0700 +++ new/test/tools/javac/sym/ElementStructureTest.java 2015-06-01 08:14:37.100909892 -0700 @@ -93,6 +93,12 @@ public class ElementStructureTest { + static final byte[] hash6 = new byte[] { + (byte) 0x99, (byte) 0x34, (byte) 0x82, (byte) 0xCF, + (byte) 0xE0, (byte) 0x53, (byte) 0xF3, (byte) 0x13, + (byte) 0x4E, (byte) 0xCF, (byte) 0x49, (byte) 0x32, + (byte) 0xB7, (byte) 0x52, (byte) 0x0F, (byte) 0x68 + }; static final byte[] hash7 = new byte[] { (byte) 0x6B, (byte) 0xA2, (byte) 0xE9, (byte) 0x8E, (byte) 0xE1, (byte) 0x8E, (byte) 0x60, (byte) 0xBE, @@ -109,37 +115,11 @@ final static Map version2Hash = new HashMap<>(); static { + version2Hash.put("6", hash6); version2Hash.put("7", hash7); version2Hash.put("8", hash8); } - static final byte[] alternativeHash6 = new byte[] { - (byte) 0x99, (byte) 0x34, (byte) 0x82, (byte) 0xCF, - (byte) 0xE0, (byte) 0x53, (byte) 0xF3, (byte) 0x13, - (byte) 0x4E, (byte) 0xCF, (byte) 0x49, (byte) 0x32, - (byte) 0xB7, (byte) 0x52, (byte) 0x0F, (byte) 0x68 - }; - static final byte[] alternativeHash7 = new byte[] { - (byte) 0x6B, (byte) 0xA2, (byte) 0xE9, (byte) 0x8E, - (byte) 0xE1, (byte) 0x8E, (byte) 0x60, (byte) 0xBE, - (byte) 0x54, (byte) 0xC4, (byte) 0x33, (byte) 0x3E, - (byte) 0x0C, (byte) 0x2D, (byte) 0x3A, (byte) 0x7C - }; - static final byte[] alternativeHash8 = new byte[] { - (byte) 0xC1, (byte) 0x14, (byte) 0xE4, (byte) 0xC7, - (byte) 0x66, (byte) 0x21, (byte) 0x72, (byte) 0x77, - (byte) 0x70, (byte) 0x73, (byte) 0x84, (byte) 0x8B, - (byte) 0xFA, (byte) 0xF0, (byte) 0x1F, (byte) 0x9C - }; - - final static Map version2AlternativeHash = new HashMap<>(); - - static { - version2AlternativeHash.put("6", alternativeHash6); - version2AlternativeHash.put("7", alternativeHash7); - version2AlternativeHash.put("8", alternativeHash8); - } - public static void main(String... args) throws Exception { if (args.length == 0) { new ElementStructureTest().doTest(); @@ -161,14 +141,13 @@ for (PlatformProviderFactory fac : ServiceLoader.load(PlatformProviderFactory.class)) { for (PlatformProvider provider : fac.createPlatformProviders()) { String ver = provider.getName(); - if (!version2AlternativeHash.containsKey(ver)) + if (!version2Hash.containsKey(ver)) continue; try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); Writer output = new OutputStreamWriter(baos, "UTF-8")) { run(output, ver); output.close(); byte[] actual = MessageDigest.getInstance("MD5").digest(baos.toByteArray()); - if (!Arrays.equals(version2Hash.get(ver), actual) && - !Arrays.equals(version2AlternativeHash.get(ver), actual)) + if (!Arrays.equals(version2Hash.get(ver), actual)) throw new AssertionError("Wrong hash: " + toHex(actual) + " for version: " + ver); } } @@ -249,7 +228,7 @@ } void run(Writer output, String version) throws Exception { - JavacTaskImpl task = (JavacTaskImpl) ToolProvider.getSystemJavaCompiler().getTask(null, null, null, Arrays.asList("-platform", version), null, Arrays.asList(new ToolBox.JavaSource("Test", ""))); + JavacTaskImpl task = (JavacTaskImpl) ToolProvider.getSystemJavaCompiler().getTask(null, null, null, Arrays.asList("-release", version), null, Arrays.asList(new ToolBox.JavaSource("Test", ""))); task.parse(); JavaFileManager fm = task.getContext().get(JavaFileManager.class);