diff -r b35771556cd0 -r d003b3ef8b60 test/lib/jdk/test/lib/Utils.java --- a/test/lib/jdk/test/lib/Utils.java Mon Sep 16 09:21:42 2019 +0200 +++ b/test/lib/jdk/test/lib/Utils.java Mon Sep 16 09:28:54 2019 +0200 @@ -25,6 +25,7 @@ import java.io.File; import java.io.IOException; +import java.lang.annotation.Annotation; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.MalformedURLException; @@ -749,13 +750,14 @@ // until the method main() is found; the class containing that method is the // main test class and will be returned as the name of the test. // Special handling is used for testng tests. + @SuppressWarnings("unchecked") public static String getTestName() { String result = null; // If we are using testng, then we should be able to load the "Test" annotation. - Class testClassAnnotation; + Class testClassAnnotation; try { - testClassAnnotation = Class.forName("org.testng.annotations.Test"); + testClassAnnotation = (Class)Class.forName("org.testng.annotations.Test"); } catch (ClassNotFoundException e) { testClassAnnotation = null; } @@ -776,7 +778,7 @@ // annotation. If present, then use the name of this class. if (testClassAnnotation != null) { try { - Class c = Class.forName(className); + Class c = Class.forName(className); if (c.isAnnotationPresent(testClassAnnotation)) { result = className; break;