# HG changeset patch # User emc # Date 1415313597 18000 # Node ID 78713cf9fa0bdd2fe6330e93cb2d8736e130f767 # Parent 4e7c4d692e934cb9023af8201e7c2b510e9c4ee1 8062245: Test executes incorrect class Summary: Fix issue with test executing incorrect class, and trivial test failure linked to different subclasses of CharSequance. Reviewed-by: jjg diff -r 4e7c4d692e93 -r 78713cf9fa0b langtools/test/tools/javac/processing/model/type/BoundsTest.java --- a/langtools/test/tools/javac/processing/model/type/BoundsTest.java Wed Jul 05 20:06:58 2017 +0200 +++ b/langtools/test/tools/javac/processing/model/type/BoundsTest.java Thu Nov 06 17:39:57 2014 -0500 @@ -25,7 +25,6 @@ * @test * @bug 6499673 * @library /tools/javac/lib - * @ignore 8062245 Test executes incorrect class * @build JavacTestingAbstractProcessor BoundsTest * @run main BoundsTest * @summary Assertion check for TypeVariable.getUpperBound() fails @@ -86,8 +85,8 @@ }; private static final String[] NoBounds_supers = {}; - private HashSet expected_bounds; - private HashSet expected_supers; + private HashSet expected_bounds; + private HashSet expected_supers; private static final File classesdir = new File("intersectionproperties"); private static final JavaCompiler comp = @@ -99,8 +98,8 @@ final String[] Test_bounds, final String[] Test_supers) throws IOException { System.err.println("Testing " + Test_name); - expected_bounds = new HashSet(Arrays.asList(Test_bounds)); - expected_supers = new HashSet(Arrays.asList(Test_supers)); + expected_bounds = new HashSet<>(Arrays.asList(Test_bounds)); + expected_supers = new HashSet<>(Arrays.asList(Test_supers)); final Iterable files = fm.getJavaFileObjectsFromFiles(Collections.singleton(writeFile(classesdir, Test_name, Test_contents))); final JavacTask ct = @@ -130,7 +129,7 @@ } public static void main(String... args) throws IOException { - new IntersectionPropertiesTest().run(); + new BoundsTest().run(); } private static File writeFile(File dir, String path, String body) @@ -166,18 +165,17 @@ final List bounds = typeParameterElement.getBounds(); final List supers = processingEnv.getTypeUtils().directSupertypes(upperBound); - final HashSet actual_bounds = new HashSet(); - final HashSet actual_supers = new HashSet(); + final HashSet actual_bounds = new HashSet<>(); + final HashSet actual_supers = new HashSet<>(); for(TypeMirror ty : bounds) { - actual_bounds.add(((TypeElement)((DeclaredType)ty).asElement()).getQualifiedName()); + actual_bounds.add(((TypeElement)((DeclaredType)ty).asElement()).getQualifiedName().toString()); } for(TypeMirror ty : supers) { - actual_supers.add(((TypeElement)((DeclaredType)ty).asElement()).getQualifiedName()); + actual_supers.add(((TypeElement)((DeclaredType)ty).asElement()).getQualifiedName().toString()); } - if (!expected_bounds.equals(actual_bounds)) { System.err.println("Mismatched expected and actual bounds."); System.err.println("Expected:"); @@ -190,7 +188,7 @@ } if (!expected_supers.equals(actual_supers)) { - System.err.println("Mismatched expected and actual bounds."); + System.err.println("Mismatched expected and actual supers."); System.err.println("Expected:"); for(CharSequence tm : expected_supers) System.err.println(" " + tm);