From 8b1adb996db51cfc8ba2e73626319251177f4c1e Mon Sep 17 00:00:00 2001 From: Colin Alworth Date: Sat, 9 Nov 2024 14:01:46 -0600 Subject: [PATCH] Update testJavacWeirdness for additional weirdness --- .../javac/GeneratedClassnameFinderTest.java | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/dev/core/test/com/google/gwt/dev/javac/GeneratedClassnameFinderTest.java b/dev/core/test/com/google/gwt/dev/javac/GeneratedClassnameFinderTest.java index 65926826dc..8a5c6de23f 100644 --- a/dev/core/test/com/google/gwt/dev/javac/GeneratedClassnameFinderTest.java +++ b/dev/core/test/com/google/gwt/dev/javac/GeneratedClassnameFinderTest.java @@ -105,36 +105,39 @@ public void testEnum() { assertEquals(0, new EnumTester().getGeneratedClasses().size()); } + /** + * This test requires a lot of care and feeding to keep track of which version of Java the test + * classes were built with, and what the current release version is. + */ public void testJavacWeirdness() { List classNames = new JavacWeirdnessTester().getGeneratedClasses(); - if (classNames.size() == 4) { - // javac8: - // JavacWeirdnessTester$1 + if (classNames.size() == 3) { + // javac 11 with --release=11: + // javac 17 with --release=11: + // javac 21 with --release=11: // JavacWeirdnessTester$2 // JavacWeirdnessTester$2Foo // JavacWeirdnessTester$3Foo assertFalse(classNames.get(0) + " should not contain Foo", classNames.get(0).contains("Foo")); - assertFalse(classNames.get(1) + " should not contain Foo", - classNames.get(1).contains("Foo")); + assertTrue(classNames.get(1) + " should contain Foo", classNames.get(1).contains("Foo")); assertTrue(classNames.get(2) + " should contain Foo", classNames.get(2).contains("Foo")); - assertTrue(classNames.get(3) + " should contain Foo", classNames.get(3).contains("Foo")); } else if (classNames.size() == 5) { - // javac22: + // javac 22 with --release=11: // JavacWeirdnessTester$1 // JavacWeirdnessTester$2 // JavacWeirdnessTester$1Foo // JavacWeirdnessTester$2Foo // JavacWeirdnessTester$3Foo assertFalse(classNames.get(0) + " should not contain Foo", - classNames.get(0).contains("Foo")); + classNames.get(0).contains("Foo")); assertFalse(classNames.get(1) + " should not contain Foo", - classNames.get(1).contains("Foo")); + classNames.get(1).contains("Foo")); assertTrue(classNames.get(2) + " should contain Foo", classNames.get(2).contains("Foo")); assertTrue(classNames.get(3) + " should contain Foo", classNames.get(2).contains("Foo")); assertTrue(classNames.get(4) + " should contain Foo", classNames.get(3).contains("Foo")); } else { - fail("Expected 4 or 5 classes, found " + classNames); + fail("Expected 3 classes, found " + classNames); } }