Goktug Gokdogan has uploaded a new change for review.

  https://gwt-review.googlesource.com/2371


Change subject: Removes obsolute way of identifying test classes in module.
......................................................................

Removes obsolute way of identifying test classes in module.

Actually, I hope this is obsolute because I couldn't find any use cases.

Change-Id: I765ac2274336e78707c1975b1eb6fab6ac27d30b
---
M user/src/com/google/gwt/junit/rebind/GWTRunnerProxyGenerator.java
1 file changed, 5 insertions(+), 36 deletions(-)



diff --git a/user/src/com/google/gwt/junit/rebind/GWTRunnerProxyGenerator.java b/user/src/com/google/gwt/junit/rebind/GWTRunnerProxyGenerator.java
index 574ae25..adc139f 100644
--- a/user/src/com/google/gwt/junit/rebind/GWTRunnerProxyGenerator.java
+++ b/user/src/com/google/gwt/junit/rebind/GWTRunnerProxyGenerator.java
@@ -28,6 +28,7 @@
 import com.google.gwt.core.ext.typeinfo.JType;
 import com.google.gwt.core.ext.typeinfo.NotFoundException;
 import com.google.gwt.core.ext.typeinfo.TypeOracle;
+import com.google.gwt.junit.JUnitFatalLaunchException;
 import com.google.gwt.junit.client.GWTTestCase;
 import com.google.gwt.junit.client.GWTTestCase.TestModuleInfo;
 import com.google.gwt.junit.client.impl.GWTRunnerProxy;
@@ -41,7 +42,6 @@
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;
-import java.util.TreeSet;

 /**
  * This class generates a JSNI based {@link GWTRunnerProxy} implementation.
@@ -114,7 +114,7 @@
     SourceWriter sourceWriter =
getSourceWriter(logger, context, packageName, generatedBaseClass, null, null);
     if (sourceWriter != null) {
- writeMethodCreateTestAccessor(logger, context, moduleName, sourceWriter); + writeMethodCreateTestAccessor(sourceWriter, getTestClasses(logger, context, moduleName));
       sourceWriter.commit(logger);
     }

@@ -156,9 +156,7 @@
    * }-{@literal*}/;
    * </pre>
    */
-  private void writeMethodCreateTestAccessor(
- TreeLogger logger, GeneratorContext context, String moduleName, SourceWriter sw) { - Set<JClassType> testClasses = getTestClasses(logger, context, moduleName); + private void writeMethodCreateTestAccessor(SourceWriter sw, Set<JClassType> testClasses) { sw.println("public native final %s createTestAccessor() /*-{", JSNI_TEST_ACCESSOR);
     sw.indent();
     sw.println("return {");
@@ -199,9 +197,8 @@
     TestModuleInfo moduleInfo = GWTTestCase.getTestsForModule(moduleName);
Set<TestInfo> moduleTests = (moduleInfo == null) ? null : moduleInfo.getTests();
     if (moduleTests == null || moduleTests.isEmpty()) {
-      // Fall back to pulling in all types in the module.
- JClassType[] allTestTypes = getAllPossibleTestTypes(context.getTypeOracle());
-      return getTestTypesForModule(logger, moduleName, allTestTypes);
+      logger.log(TreeLogger.ERROR, "No tests found in module");
+      throw new JUnitFatalLaunchException();
     } else {
       Set<JClassType> testClasses = new LinkedHashSet<JClassType>();
       for (TestInfo testInfo : moduleTests) {
@@ -240,34 +237,6 @@
       composerFactory.addImplementedInterface(interfaceName);
     }
     return composerFactory.createSourceWriter(ctx, printWriter);
-  }
-
-  private Set<JClassType> getTestTypesForModule(
-      TreeLogger logger, String moduleName, JClassType[] allTestTypes) {
-    // Must use sorted set to prevent nondeterminism.
-    Set<JClassType> testClasses = new TreeSet<JClassType>();
-    for (JClassType classType : allTestTypes) {
- if (!classType.isPublic() || classType.isAbstract() | | !classType.isDefaultInstantiable()) {
-        continue;
-      }
-
- String className = getPackagePrefix(classType) + classType.getName().replace('.', '$');
-
-      try {
-        Class<?> testClass = Class.forName(className);
-        GWTTestCase instantiated = (GWTTestCase) testClass.newInstance();
-        if (!moduleName.equals(instantiated.getModuleName())) {
-          continue;
-        }
-      } catch (Throwable e) {
- logger.log(TreeLogger.INFO, "Error determining if test class '" + className - + "' is a part of the current module; skipping; expect subsequent errors "
-            + "if this test class is run", e);
-        continue;
-      }
-      testClasses.add(classType);
-    }
-    return testClasses;
   }

   private static List<JMethod> getTestMethods(JClassType requestedClass) {

--
To view, visit https://gwt-review.googlesource.com/2371
To unsubscribe, visit https://gwt-review.googlesource.com/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I765ac2274336e78707c1975b1eb6fab6ac27d30b
Gerrit-PatchSet: 1
Gerrit-Project: gwt
Gerrit-Branch: master
Gerrit-Owner: Goktug Gokdogan <gok...@google.com>

--
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
--- You received this message because you are subscribed to the Google Groups "Google Web Toolkit Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to