geronimo-xbean-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r1129943 - in /geronimo/xbean/trunk/xbean-finder/src: main/java/org/apache/xbean/finder/ test/java/org/apache/xbean/finder/
Date Tue, 31 May 2011 22:23:13 GMT
Author: dblevins
Date: Tue May 31 22:23:12 2011
New Revision: 1129943

URL: http://svn.apache.org/viewvc?rev=1129943&view=rev
Log:
Worked around issues with XBEAN-143 by temporarily disabling some of the code.
XBEAN-175: List annotated class names

Modified:
    geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/AbstractFinder.java
    geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/AnnotationFinder.java
    geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/IAnnotationFinder.java
    geronimo/xbean/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/ClassFinderDepthTest.java

Modified: geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/AbstractFinder.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/AbstractFinder.java?rev=1129943&r1=1129942&r2=1129943&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/AbstractFinder.java
(original)
+++ geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/AbstractFinder.java
Tue May 31 22:23:12 2011
@@ -57,6 +57,10 @@ public abstract class AbstractFinder imp
 
     protected abstract Class<?> loadClass(String fixedName) throws ClassNotFoundException;
 
+    public List<String> getAnnotatedClassNames() {
+        return new ArrayList<String>(classInfos.keySet());
+    }
+
     /**
      * The link() method must be called to successfully use the findSubclasses and findImplementations
methods
      * @return
@@ -908,14 +912,14 @@ public abstract class AbstractFinder imp
             } else {
                 ClassInfo classInfo = new ClassInfo(javaName(name), javaName(superName));
 
-                if (signature == null) {
+//                if (signature == null) {
                     for (String interfce : interfaces) {
                         classInfo.getInterfaces().add(javaName(interfce));
                     }
-                } else {
-                    // the class uses generics
-                    new SignatureReader(signature).accept(new GenericAwareInfoBuildingVisitor(GenericAwareInfoBuildingVisitor.TYPE.CLASS,
classInfo));
-                }
+//                } else {
+//                    // the class uses generics
+//                    new SignatureReader(signature).accept(new GenericAwareInfoBuildingVisitor(GenericAwareInfoBuildingVisitor.TYPE.CLASS,
classInfo));
+//                }
                 info = classInfo;
                 classInfos.put(classInfo.getName(), classInfo);
             }

Modified: geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/AnnotationFinder.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/AnnotationFinder.java?rev=1129943&r1=1129942&r2=1129943&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/AnnotationFinder.java
(original)
+++ geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/AnnotationFinder.java
Tue May 31 22:23:12 2011
@@ -86,6 +86,9 @@ public class AnnotationFinder implements
         }
     }
 
+    public List<String> getAnnotatedClassNames() {
+        return new ArrayList<String>(classInfos.keySet());
+    }
 
     /**
      * The link() method must be called to successfully use the findSubclasses and findImplementations
methods
@@ -1266,14 +1269,14 @@ public class AnnotationFinder implements
 
                 ClassInfo classInfo = new ClassInfo(javaName(name), javaName(superName));
 
-                if (signature == null) {
+//                if (signature == null) {
                     for (String interfce : interfaces) {
                         classInfo.getInterfaces().add(javaName(interfce));
                     }
-                } else {
-                    // the class uses generics
-                    new SignatureReader(signature).accept(new GenericAwareInfoBuildingVisitor(GenericAwareInfoBuildingVisitor.TYPE.CLASS,
classInfo));
-                }
+//                } else {
+//                    // the class uses generics
+//                    new SignatureReader(signature).accept(new GenericAwareInfoBuildingVisitor(GenericAwareInfoBuildingVisitor.TYPE.CLASS,
classInfo));
+//                }
                 info = classInfo;
 
                 classInfos.put(classInfo.getName(), classInfo);

Modified: geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/IAnnotationFinder.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/IAnnotationFinder.java?rev=1129943&r1=1129942&r2=1129943&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/IAnnotationFinder.java
(original)
+++ geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/IAnnotationFinder.java
Tue May 31 22:23:12 2011
@@ -54,4 +54,6 @@ public interface IAnnotationFinder {
     List<Annotated<Field>> findMetaAnnotatedFields(Class<? extends Annotation>
annotation);
 
     List<Annotated<Class<?>>> findMetaAnnotatedClasses(Class<? extends
Annotation> annotation);
+
+    List<String> getAnnotatedClassNames();
 }

Modified: geronimo/xbean/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/ClassFinderDepthTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/ClassFinderDepthTest.java?rev=1129943&r1=1129942&r2=1129943&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/ClassFinderDepthTest.java
(original)
+++ geronimo/xbean/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/ClassFinderDepthTest.java
Tue May 31 22:23:12 2011
@@ -23,6 +23,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import junit.framework.TestCase;
+import org.apache.xbean.finder.archive.ClassesArchive;
 
 /**
  * @version $Rev$ $Date$
@@ -30,7 +31,7 @@ import junit.framework.TestCase;
 public class ClassFinderDepthTest extends TestCase {
 
 
-    public static interface Hue {
+    public static interface Hue<T> {
     }
 
     public static interface Saturation {
@@ -39,10 +40,10 @@ public class ClassFinderDepthTest extend
     public static interface Brightness {
     }
 
-    public static interface HSB extends Hue, Saturation, Brightness {
+    public static interface HSB<T> extends Hue<T>, Saturation, Brightness {
     }
 
-    public static class Color implements HSB {
+    public static class Color<T> implements HSB<T> {
     }
 
     public static class Red extends Color {
@@ -60,7 +61,7 @@ public class ClassFinderDepthTest extend
     }
 
     public void testFindSubclassesIncomplete() throws Exception {
-        final AbstractFinder finder = new ClassFinder(Crimson.class, Square.class).link();
+        final AnnotationFinder finder = new AnnotationFinder(new ClassesArchive(Crimson.class,
Square.class)).link();
 
         assertSubclasses(finder, Color.class, Red.class, Crimson.class);
         assertSubclasses(finder, Red.class, Crimson.class);
@@ -71,13 +72,14 @@ public class ClassFinderDepthTest extend
     }
 
     public void testFindImplementations() throws Exception {
-        final AbstractFinder finder = new ClassFinder(Crimson.class, Square.class).link();
+        final AnnotationFinder finder = new AnnotationFinder(new ClassesArchive(Crimson.class,
Square.class)).link();
 
         assertImplementations(finder, HSB.class, Color.class, Red.class, Crimson.class);
         assertImplementations(finder, Hue.class, HSB.class, Color.class, Red.class, Crimson.class);
+        assertImplementations(finder, Saturation.class, HSB.class, Color.class, Red.class,
Crimson.class);
     }
     
-    private void assertSubclasses(AbstractFinder finder, Class<?> clazz, Class... subclasses)
{
+    private void assertSubclasses(AnnotationFinder finder, Class<?> clazz, Class...
subclasses) {
         final List<Class<?>> classes = new ArrayList(finder.findSubclasses(clazz));
 
         for (Class subclass : subclasses) {
@@ -86,7 +88,7 @@ public class ClassFinderDepthTest extend
         assertSize(classes, subclasses.length);
     }
 
-    private void assertImplementations(AbstractFinder finder, Class<?> clazz, Class...
implementations) {
+    private void assertImplementations(AnnotationFinder finder, Class<?> clazz, Class...
implementations) {
         final List<Class<?>> classes = new ArrayList(finder.findImplementations(clazz));
 
         for (Class subclass : implementations) {



Mime
View raw message