[testng] 259/355: Warnings.

Eugene Zhukov eugene-guest at moszumanska.debian.org
Tue Aug 18 10:20:13 UTC 2015


This is an automated email from the git hooks/post-receive script.

eugene-guest pushed a commit to annotated tag OpenBSD
in repository testng.

commit c4c903b5a66381c5b2d1212d9f980e7131426ae4
Author: Cedric Beust <cedric at beust.com>
Date:   Sun May 3 19:05:16 2015 -0700

    Warnings.
---
 src/main/java/org/testng/ITestMethodFinder.java    | 22 +++++++-------
 .../org/testng/internal/TestNGMethodFinder.java    | 13 ++++-----
 .../internal/annotations/AnnotationHelper.java     | 34 ++++++++++++----------
 3 files changed, 36 insertions(+), 33 deletions(-)

diff --git a/src/main/java/org/testng/ITestMethodFinder.java b/src/main/java/org/testng/ITestMethodFinder.java
index e175657..9cecd35 100755
--- a/src/main/java/org/testng/ITestMethodFinder.java
+++ b/src/main/java/org/testng/ITestMethodFinder.java
@@ -20,53 +20,53 @@ public interface ITestMethodFinder {
   /**
    * @return All the applicable test methods.
    */
-  ITestNGMethod[] getTestMethods(Class cls, XmlTest xmlTest);
+  ITestNGMethod[] getTestMethods(Class<?> cls, XmlTest xmlTest);
 
   /**
    * @return All the methods that should be invoked
    * before a test method is invoked.
    */
-  ITestNGMethod[] getBeforeTestMethods(Class cls);
+  ITestNGMethod[] getBeforeTestMethods(Class<?> cls);
 
   /**
    * @return All the methods that should be invoked
    * after a test method completes.
    */
-  ITestNGMethod[] getAfterTestMethods(Class cls);
+  ITestNGMethod[] getAfterTestMethods(Class<?> cls);
 
   /**
    * @return All the methods that should be invoked
    * after the test class has been created and before
    * any of its test methods is invoked.
    */
-  ITestNGMethod[] getBeforeClassMethods(Class cls);
+  ITestNGMethod[] getBeforeClassMethods(Class<?> cls);
 
   /**
    * @return All the methods that should be invoked
    * after the test class has been created and after
    * all its test methods have completed.
    */
-  ITestNGMethod[] getAfterClassMethods(Class cls);
+  ITestNGMethod[] getAfterClassMethods(Class<?> cls);
 
   /**
    * @return All the methods that should be invoked
    * before the suite starts running.
    */
-  ITestNGMethod[] getBeforeSuiteMethods(Class cls);
+  ITestNGMethod[] getBeforeSuiteMethods(Class<?> cls);
 
   /**
    * @return All the methods that should be invoked
    * after the suite has run all its tests.
    */
-  ITestNGMethod[] getAfterSuiteMethods(Class cls);
+  ITestNGMethod[] getAfterSuiteMethods(Class<?> cls);
 
-  ITestNGMethod[] getBeforeTestConfigurationMethods(Class testClass);
+  ITestNGMethod[] getBeforeTestConfigurationMethods(Class<?> testClass);
 
-  ITestNGMethod[] getAfterTestConfigurationMethods(Class testClass);
+  ITestNGMethod[] getAfterTestConfigurationMethods(Class<?> testClass);
 
-  ITestNGMethod[] getBeforeGroupsConfigurationMethods(Class testClass);
+  ITestNGMethod[] getBeforeGroupsConfigurationMethods(Class<?> testClass);
 
-  ITestNGMethod[] getAfterGroupsConfigurationMethods(Class testClass);
+  ITestNGMethod[] getAfterGroupsConfigurationMethods(Class<?> testClass);
 
 
 }
diff --git a/src/main/java/org/testng/internal/TestNGMethodFinder.java b/src/main/java/org/testng/internal/TestNGMethodFinder.java
index 86cf37e..50f3b16 100755
--- a/src/main/java/org/testng/internal/TestNGMethodFinder.java
+++ b/src/main/java/org/testng/internal/TestNGMethodFinder.java
@@ -1,6 +1,10 @@
 package org.testng.internal;
 
 
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Set;
+
 import org.testng.ITestMethodFinder;
 import org.testng.ITestNGMethod;
 import org.testng.annotations.IConfigurationAnnotation;
@@ -10,10 +14,6 @@ import org.testng.internal.annotations.AnnotationHelper;
 import org.testng.internal.annotations.IAnnotationFinder;
 import org.testng.xml.XmlTest;
 
-import java.lang.reflect.Method;
-import java.util.List;
-import java.util.Set;
-
 /**
  * The default strategy for finding test methods:  look up
  * annotations @Test in front of methods.
@@ -36,15 +36,14 @@ public class TestNGMethodFinder implements ITestMethodFinder {
   private RunInfo m_runInfo = null;
   private IAnnotationFinder m_annotationFinder = null;
 
-  public TestNGMethodFinder(RunInfo runInfo,
-                            IAnnotationFinder annotationFinder)
+  public TestNGMethodFinder(RunInfo runInfo, IAnnotationFinder annotationFinder)
   {
     m_runInfo = runInfo;
     m_annotationFinder = annotationFinder;
   }
 
   @Override
-  public ITestNGMethod[] getTestMethods(Class clazz, XmlTest xmlTest) {
+  public ITestNGMethod[] getTestMethods(Class<?> clazz, XmlTest xmlTest) {
     return AnnotationHelper.findMethodsWithAnnotation(
         clazz, ITestAnnotation.class, m_annotationFinder, xmlTest);
   }
diff --git a/src/main/java/org/testng/internal/annotations/AnnotationHelper.java b/src/main/java/org/testng/internal/annotations/AnnotationHelper.java
index 6375c58..182e528 100755
--- a/src/main/java/org/testng/internal/annotations/AnnotationHelper.java
+++ b/src/main/java/org/testng/internal/annotations/AnnotationHelper.java
@@ -1,6 +1,13 @@
 package org.testng.internal.annotations;
 
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.Map;
+
 import org.testng.ITestNGMethod;
+import org.testng.annotations.IAnnotation;
 import org.testng.annotations.IConfigurationAnnotation;
 import org.testng.annotations.IDataProviderAnnotation;
 import org.testng.annotations.IExpectedExceptionsAnnotation;
@@ -12,12 +19,6 @@ import org.testng.internal.TestNGMethod;
 import org.testng.internal.Utils;
 import org.testng.xml.XmlTest;
 
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.Map;
-
 /**
  * Helper methods to find @Test and @Configuration tags.  They minimize
  * the amount of casting we need to do.
@@ -27,7 +28,7 @@ import java.util.Map;
  */
 public class AnnotationHelper {
 
-  public static ITestAnnotation findTest(IAnnotationFinder finder, Class cls) {
+  public static ITestAnnotation findTest(IAnnotationFinder finder, Class<?> cls) {
     return finder.findAnnotation(cls, ITestAnnotation.class);
   }
 
@@ -76,7 +77,7 @@ public class AnnotationHelper {
   }
 
   public static IConfigurationAnnotation findConfiguration(IAnnotationFinder finder, Method m) {
-    IConfigurationAnnotation result = (IConfigurationAnnotation) finder.findAnnotation(m, IConfigurationAnnotation.class);
+    IConfigurationAnnotation result = finder.findAnnotation(m, IConfigurationAnnotation.class);
     if (result == null) {
       IConfigurationAnnotation bs = (IConfigurationAnnotation) finder.findAnnotation(m, IBeforeSuite.class);
       IConfigurationAnnotation as = (IConfigurationAnnotation) finder.findAnnotation(m, IAfterSuite.class);
@@ -191,8 +192,9 @@ public class AnnotationHelper {
    * Delegation method for creating the list of <CODE>ITestMethod</CODE>s to be
    * analysed.
    */
-  public static ITestNGMethod[] findMethodsWithAnnotation(Class rootClass, Class annotationClass,
-        IAnnotationFinder annotationFinder, XmlTest xmlTest)
+  public static ITestNGMethod[] findMethodsWithAnnotation(Class<?> rootClass,
+      Class<? extends IAnnotation> annotationClass, IAnnotationFinder annotationFinder,
+      XmlTest xmlTest)
   {
     // Keep a map of the methods we saw so that we ignore a method in a superclass if it's
     // already been seen in a child class
@@ -201,7 +203,7 @@ public class AnnotationHelper {
     try {
       vResult = Maps.newHashMap();
 //    Class[] classes = rootClass.getTestClasses();
-      Class cls = rootClass;
+      Class<?> cls = rootClass;
 
       //
       // If the annotation is on the class or superclass, it applies to all public methods
@@ -212,7 +214,7 @@ public class AnnotationHelper {
       // Otherwise walk through all the methods and keep those
       // that have the annotation
       //
-//    for (Class cls : classes) {
+//    for (Class<?> cls : classes) {
         while (null != cls) {
           boolean hasClassAnnotation = isAnnotationPresent(annotationFinder, cls, annotationClass);
           Method[] methods = cls.getDeclaredMethods();
@@ -272,7 +274,7 @@ public class AnnotationHelper {
       return result;
     }
 
-  public static Annotation findAnnotationSuperClasses(Class annotationClass, Class c) {
+  public static Annotation findAnnotationSuperClasses(Class<?> annotationClass, Class c) {
     while (c != null) {
       Annotation result = c.getAnnotation(annotationClass);
       if (result != null) return result;
@@ -293,11 +295,13 @@ public class AnnotationHelper {
     return false;
   }
 
-  private static boolean isAnnotationPresent(IAnnotationFinder annotationFinder, Method m, Class annotationClass) {
+  private static boolean isAnnotationPresent(IAnnotationFinder annotationFinder, Method m,
+      Class<? extends IAnnotation> annotationClass) {
     return annotationFinder.findAnnotation(m, annotationClass) != null;
   }
 
-  private static boolean isAnnotationPresent(IAnnotationFinder annotationFinder, Class cls, Class annotationClass) {
+  private static boolean isAnnotationPresent(IAnnotationFinder annotationFinder, Class<?> cls,
+      Class<? extends IAnnotation> annotationClass) {
     return annotationFinder.findAnnotation(cls, annotationClass) != null;
   }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/testng.git



More information about the pkg-java-commits mailing list