This is the mail archive of the mauve-patches@sourceware.org mailing list for the Mauve project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RunnerProcess ignore abstract classes


This is a fix written by Raif (sorry for the delay Raif, I thought you
had committed this) that marks abstract classes as
NOT_A_TEST_DESCRIPTION instead of trying to instantiate them and
reporting a failure.  Note, these files SHOULD be marked "not-a-test"
but this little patch is a nice way of dealing with them regardless of
whether or not they are properly tagged.

2006-06-29  Anthony Balkissoon  <abalkiss@redhat.com>

	* RunnerProcess.java:
	(runtest): Check if the class is abstract (and therefore not a test) 
	and mark it as NOT_A_TEST_DESCRIPTION if so.

--Tony
Index: RunnerProcess.java
===================================================================
RCS file: /cvs/mauve/mauve/RunnerProcess.java,v
retrieving revision 1.10
diff -u -r1.10 RunnerProcess.java
--- RunnerProcess.java	27 Jun 2006 20:53:35 -0000	1.10
+++ RunnerProcess.java	29 Jun 2006 17:13:27 -0000
@@ -41,6 +41,7 @@
 import java.io.InputStreamReader;
 import java.io.Reader;
 import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.util.Vector;
@@ -254,6 +255,13 @@
     try
       {
         Class k = Class.forName(name);
+        int mods = k.getModifiers();
+        if (Modifier.isAbstract(mods))
+          {
+            description = NOT_A_TEST_DESCRIPTION;
+            return;
+          }
+        
         Object o = k.newInstance();
         if (! (o instanceof Testlet))
           {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]