[jboss-cvs] JBossAS SVN: r81094 - in projects/jboss-deployers/trunk: deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/support/jar/impl and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sat Nov 15 15:37:52 EST 2008
Author: alesj
Date: 2008-11-15 15:37:52 -0500 (Sat, 15 Nov 2008)
New Revision: 81094
Added:
projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/support/jar/impl/JarMarkOnClassExt.java
projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/support/war/impl/WebMarkOnClassExt.java
Modified:
projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/annotations/DefaultAnnotationEnvironment.java
projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/annotations/GenericAnnotationResourceVisitor.java
projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/test/AnnotationsScanningUnitTestCase.java
projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/test/AnnotationsScanningWithMetaDataUnitTestCase.java
Log:
[JBDEPLOY-131]; disable super scan; going past filter.
Modified: projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/annotations/DefaultAnnotationEnvironment.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/annotations/DefaultAnnotationEnvironment.java 2008-11-15 16:11:27 UTC (rev 81093)
+++ projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/annotations/DefaultAnnotationEnvironment.java 2008-11-15 20:37:52 UTC (rev 81094)
@@ -53,6 +53,8 @@
private static final Logger log = Logger.getLogger(DefaultAnnotationEnvironment.class);
/** The info map */
private transient Map<Class<? extends Annotation>, Map<ElementType, Set<ClassSignaturePair>>> env;
+ /** The checked class names */
+ private transient Set<String> checkedClassNames;
/** Should we keep the annotation */
private boolean keepAnnotations;
@@ -60,6 +62,7 @@
{
super(classLoader);
env = new HashMap<Class<? extends Annotation>, Map<ElementType, Set<ClassSignaturePair>>>();
+ checkedClassNames = new HashSet<String>();
}
/**
@@ -86,6 +89,17 @@
}
/**
+ * Was class name already checked.
+ *
+ * @param className the class name
+ * @return true if already checked, false otherwise
+ */
+ boolean isAlreadyChecked(String className)
+ {
+ return checkedClassNames.contains(className);
+ }
+
+ /**
* Put the annotation info.
*
* @param annotation the annotation
@@ -100,6 +114,9 @@
if (log.isTraceEnabled())
log.trace("Adding annotation @" + annClass.getSimpleName() + " for " + className + " at type " + type + ", signature: " + signature);
+ // add to checked
+ checkedClassNames.add(className);
+
Map<Class<? extends Annotation>, Map<ElementType, Set<ClassSignaturePair>>> env = getEnv();
Map<ElementType, Set<ClassSignaturePair>> elements = env.get(annClass);
Modified: projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/annotations/GenericAnnotationResourceVisitor.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/annotations/GenericAnnotationResourceVisitor.java 2008-11-15 16:11:27 UTC (rev 81093)
+++ projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/annotations/GenericAnnotationResourceVisitor.java 2008-11-15 20:37:52 UTC (rev 81094)
@@ -58,7 +58,8 @@
private ResourceFilter resourceFilter = ClassFilter.INSTANCE;
private ClassPool pool;
private boolean forceAnnotations;
- private boolean checkInterfaces;
+ private boolean checkSuper;
+ private boolean checkInterfaces = true;
private DefaultAnnotationEnvironment env;
private CtClass objectCtClass;
@@ -77,7 +78,6 @@
this.pool = pool;
this.env = new DefaultAnnotationEnvironment(classLoader);
this.objectCtClass = pool.makeClass(Object.class.getName());
- this.checkInterfaces = true;
}
public ResourceFilter getFilter()
@@ -159,14 +159,21 @@
if (ctClass == null || objectCtClass.equals(ctClass))
return;
+ String className = ctClass.getName();
+ if (env.isAlreadyChecked(className))
+ {
+ if (log.isTraceEnabled())
+ log.trace("Skipping already checked class name: " + className);
+ return;
+ }
+
if (checkInterfaces == false && ctClass.isInterface())
{
if (log.isTraceEnabled())
- log.trace("Skipping interface: " + ctClass.getName());
+ log.trace("Skipping interface: " + className);
return;
}
- String className = ctClass.getName();
if (log.isTraceEnabled())
log.trace("Scanning class " + className + " for annotations");
@@ -177,19 +184,21 @@
handleCtMembers(ElementType.METHOD, ctClass.getDeclaredMethods(), className, commit);
handleCtMembers(ElementType.FIELD, ctClass.getDeclaredFields(), className, commit);
- if (checkInterfaces)
+ if (checkSuper)
{
- // interfaces
- CtClass[] interfaces = ctClass.getInterfaces();
- if (interfaces != null && interfaces.length > 0)
+ if (checkInterfaces)
{
- for (CtClass intf : interfaces)
- handleCtClass(intf, commit);
+ // interfaces
+ CtClass[] interfaces = ctClass.getInterfaces();
+ if (interfaces != null && interfaces.length > 0)
+ {
+ for (CtClass intf : interfaces)
+ handleCtClass(intf, commit);
+ }
}
+ // super class
+ handleCtClass(ctClass.getSuperclass(), commit);
}
-
- // super class
- handleCtClass(ctClass.getSuperclass(), commit);
}
/**
@@ -316,6 +325,16 @@
}
/**
+ * Should we check super class for annotations as well.
+ *
+ * @param checkSuper the check super flag
+ */
+ public void setCheckSuper(boolean checkSuper)
+ {
+ this.checkSuper = checkSuper;
+ }
+
+ /**
* Should we check interfaces for annotations as well.
*
* @param checkInterfaces the check interfaces flag
Copied: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/support/jar/impl/JarMarkOnClassExt.java (from rev 81004, projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/support/jar/impl/JarMarkOnClassImpl.java)
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/support/jar/impl/JarMarkOnClassExt.java (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/support/jar/impl/JarMarkOnClassExt.java 2008-11-15 20:37:52 UTC (rev 81094)
@@ -0,0 +1,33 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.deployers.vfs.annotations.support.jar.impl;
+
+import org.jboss.test.deployers.vfs.annotations.support.Marked;
+import org.jboss.test.deployers.vfs.annotations.support.jar.JarMarkOnClassSuper;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+ at Marked
+public class JarMarkOnClassExt extends JarMarkOnClassSuper
+{
+}
\ No newline at end of file
Copied: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/support/war/impl/WebMarkOnClassExt.java (from rev 81004, projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/support/war/impl/WebMarkOnClassImpl.java)
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/support/war/impl/WebMarkOnClassExt.java (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/support/war/impl/WebMarkOnClassExt.java 2008-11-15 20:37:52 UTC (rev 81094)
@@ -0,0 +1,33 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.deployers.vfs.annotations.support.war.impl;
+
+import org.jboss.test.deployers.vfs.annotations.support.Marked;
+import org.jboss.test.deployers.vfs.annotations.support.war.WebMarkOnClassSuper;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+ at Marked
+public class WebMarkOnClassExt extends WebMarkOnClassSuper
+{
+}
\ No newline at end of file
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/test/AnnotationsScanningUnitTestCase.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/test/AnnotationsScanningUnitTestCase.java 2008-11-15 16:11:27 UTC (rev 81093)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/test/AnnotationsScanningUnitTestCase.java 2008-11-15 20:37:52 UTC (rev 81094)
@@ -46,11 +46,11 @@
protected void assertJar(DeploymentUnit jar)
{
- assertAnnotations(jar, 3, 1, 1);
+ assertAnnotations(jar, 4, 1, 1);
}
protected void assertWar(DeploymentUnit war)
{
- assertAnnotations(war, 4, 1, 1);
+ assertAnnotations(war, 5, 1, 1);
}
}
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/test/AnnotationsScanningWithMetaDataUnitTestCase.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/test/AnnotationsScanningWithMetaDataUnitTestCase.java 2008-11-15 16:11:27 UTC (rev 81093)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/test/AnnotationsScanningWithMetaDataUnitTestCase.java 2008-11-15 20:37:52 UTC (rev 81094)
@@ -46,11 +46,11 @@
protected void assertJar(DeploymentUnit jar)
{
- assertAnnotations(jar, 1, 0, 0);
+ assertAnnotations(jar, 2, 0, 0);
}
protected void assertWar(DeploymentUnit war)
{
- assertAnnotations(war, 1, 0, 0);
+ assertAnnotations(war, 2, 0, 0);
}
}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list