geronimo-xbean-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1667275 - in /geronimo/xbean/trunk/xbean-finder/src: main/java/org/apache/xbean/finder/AnnotationFinder.java test/java/org/apache/xbean/finder/ClassFinderDepthTest.java
Date Tue, 17 Mar 2015 11:38:58 GMT
Author: rmannibucau
Date: Tue Mar 17 11:38:58 2015
New Revision: 1667275

URL: http://svn.apache.org/r1667275
Log:
test for parent scanning when Archive is module limited

Modified:
    geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/AnnotationFinder.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/AnnotationFinder.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/AnnotationFinder.java?rev=1667275&r1=1667274&r2=1667275&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 Mar 17 11:38:58 2015
@@ -248,17 +248,17 @@ public class AnnotationFinder implements
             linkInterfaces(classInfo);
 
         }
-
         return this;
     }
 
     public AnnotationFinder enableFindSubclasses() {
+        final boolean originalLinking = linking;
         linking = ALLOW_LAZY_LINKING;
         for (ClassInfo classInfo : classInfos.values().toArray(new ClassInfo[classInfos.size()]))
{
 
             linkParent(classInfo);
         }
-
+        linking = originalLinking;
         return this;
     }
 

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=1667275&r1=1667274&r2=1667275&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 Mar 17 11:38:58 2015
@@ -19,6 +19,8 @@ package org.apache.xbean.finder;
 import junit.framework.TestCase;
 import org.apache.xbean.finder.archive.ClassesArchive;
 
+import java.io.IOException;
+import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -44,6 +46,8 @@ public class ClassFinderDepthTest extend
     }
 
     public static class Color<T> implements HSB<T> {
+        @Deprecated
+        private String foo;
     }
 
     public static class Red extends Color {
@@ -60,6 +64,19 @@ public class ClassFinderDepthTest extend
     public static class Square extends Shape {
     }
 
+    public void testFindParentFieldOutsideArchive() {
+        final AnnotationFinder finder  = new AnnotationFinder(new ClassesArchive(Red.class)
{
+            @Override
+            public InputStream getBytecode(final String className) throws IOException, ClassNotFoundException
{
+                if (!className.contains("Red")) {
+                    throw new ClassNotFoundException();
+                }
+                return super.getBytecode(className);
+            }
+        }).link();
+        assertEquals(1, finder.findAnnotatedFields(Deprecated.class).size());
+    }
+
     public void testFindSubclassesIncomplete() throws Exception {
         for (int i = 0; i < 10; i++) {
             for (final AnnotationFinder finder : new AnnotationFinder[] {



Mime
View raw message