geronimo-xbean-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r1133674 - in /geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder: AbstractFinder.java AnnotationFinder.java
Date Thu, 09 Jun 2011 06:16:55 GMT
Author: dblevins
Date: Thu Jun  9 06:16:54 2011
New Revision: 1133674

URL: http://svn.apache.org/viewvc?rev=1133674&view=rev
Log:
Keep track of the original classes passed to the annotation finder so that after linking when
the scope has increased to superclasses and interfaces that might be external to the application,
we can still get a list of only the original classes defined by the app.

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

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=1133674&r1=1133673&r2=1133674&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
Thu Jun  9 06:16:54 2011
@@ -50,6 +50,7 @@ import org.objectweb.asm.signature.Signa
 public abstract class AbstractFinder implements IAnnotationFinder {
     private final Map<String, List<Info>> annotated = new HashMap<String,
List<Info>>();
     protected final Map<String, ClassInfo> classInfos = new HashMap<String, ClassInfo>();
+    protected final Map<String, ClassInfo> originalInfos = new HashMap<String, ClassInfo>();
     private final List<String> classesNotLoaded = new ArrayList<String>();
     private final int ASM_FLAGS = ClassReader.SKIP_CODE + ClassReader.SKIP_DEBUG + ClassReader.SKIP_FRAMES;
 
@@ -58,7 +59,7 @@ public abstract class AbstractFinder imp
     protected abstract Class<?> loadClass(String fixedName) throws ClassNotFoundException;
 
     public List<String> getAnnotatedClassNames() {
-        return new ArrayList<String>(classInfos.keySet());
+        return new ArrayList<String>(originalInfos.keySet());
     }
 
     /**
@@ -67,6 +68,12 @@ public abstract class AbstractFinder imp
      * @throws IOException
      */
     public AbstractFinder link() throws IOException {
+        // already linked?
+        if (originalInfos.size() > 0) return this;
+
+        // keep track of what was originally from the archives
+        originalInfos.putAll(classInfos);
+
         for (ClassInfo classInfo : classInfos.values().toArray(new ClassInfo[classInfos.size()]))
{
 
             linkParent(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=1133674&r1=1133673&r2=1133674&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
Thu Jun  9 06:16:54 2011
@@ -66,6 +66,7 @@ public class AnnotationFinder implements
     private final Map<String, List<Info>> annotated = new HashMap<String,
List<Info>>();
 
     protected final Map<String, ClassInfo> classInfos = new HashMap<String, ClassInfo>();
+    protected final Map<String, ClassInfo> originalInfos = new HashMap<String, ClassInfo>();
     private final List<String> classesNotLoaded = new ArrayList<String>();
     private final int ASM_FLAGS = ClassReader.SKIP_CODE + ClassReader.SKIP_DEBUG + ClassReader.SKIP_FRAMES;
     private final Archive archive;
@@ -87,7 +88,7 @@ public class AnnotationFinder implements
     }
 
     public List<String> getAnnotatedClassNames() {
-        return new ArrayList<String>(classInfos.keySet());
+        return new ArrayList<String>(originalInfos.keySet());
     }
 
     /**
@@ -97,6 +98,12 @@ public class AnnotationFinder implements
      * @throws java.io.IOException
      */
     public AnnotationFinder link() {
+        // already linked?
+        if (originalInfos.size() > 0) return this;
+
+        // keep track of what was originally from the archives
+        originalInfos.putAll(classInfos);
+
         for (ClassInfo classInfo : classInfos.values().toArray(new ClassInfo[classInfos.size()]))
{
 
             linkParent(classInfo);



Mime
View raw message