[jboss-cvs] JBossAS SVN: r70906 - in projects/aop/trunk/aop/src: main/org/jboss/aop/annotation and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Mar 17 08:13:29 EDT 2008
Author: kabir.khan at jboss.com
Date: 2008-03-17 08:13:29 -0400 (Mon, 17 Mar 2008)
New Revision: 70906
Added:
projects/aop/trunk/aop/src/test/org/jboss/test/aop/ejb3dependencies/
projects/aop/trunk/aop/src/test/org/jboss/test/aop/ejb3dependencies/Advisor.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/ejb3dependencies/AnnotationRepository.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/ejb3dependencies/JoinPointInfo.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/ejb3dependencies/Readme.txt
Modified:
projects/aop/trunk/aop/src/main/org/jboss/aop/Advisor.java
projects/aop/trunk/aop/src/main/org/jboss/aop/annotation/AnnotationRepository.java
Log:
Make compatible with EJB3 and add some tests for compiling similar to ejb3
Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/Advisor.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/Advisor.java 2008-03-17 11:27:36 UTC (rev 70905)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/Advisor.java 2008-03-17 12:13:29 UTC (rev 70906)
@@ -359,7 +359,7 @@
if (annotations.isDisabled(annotation))
return null;
- T value = annotations.resolveClassAnnotation(annotation);
+ T value = annotations.resolveTypedClassAnnotation(annotation);
if (clazz == null) return null;
if (value == null && metadata == null)
{
@@ -447,7 +447,7 @@
if (annotations.isDisabled(m,annotation))
return null;
- T value = annotations.resolveAnnotation(m, annotation);
+ T value = annotations.resolveTypedAnnotation(m, annotation);
if (value == null && metadata == null)
{
value = AnnotationElement.getVisibleAnnotation(m, annotation);
@@ -495,7 +495,7 @@
}
}
- value = annotations.resolveAnnotation(f, annotation);
+ value = annotations.resolveTypedAnnotation(f, annotation);
if (value == null && metadata == null)
{
value = AnnotationElement.getVisibleAnnotation(f, annotation);
@@ -522,7 +522,7 @@
}
}
- value = annotations.resolveAnnotation(c, annotation);
+ value = annotations.resolveTypedAnnotation(c, annotation);
if (value == null && metadata == null)
{
value = AnnotationElement.getVisibleAnnotation(c, annotation);
@@ -1007,7 +1007,11 @@
throw new RuntimeException("dynamic field invocations not supported yet!");
}
- public Class<?> getClazz()
+ /**
+ * EJB3 counts on this being unchecked
+ */
+ @SuppressWarnings("unchecked")
+ public Class getClazz()
{
return clazz;
}
Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/annotation/AnnotationRepository.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/annotation/AnnotationRepository.java 2008-03-17 11:27:36 UTC (rev 70905)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/annotation/AnnotationRepository.java 2008-03-17 12:13:29 UTC (rev 70906)
@@ -80,8 +80,16 @@
classAnnotations.put(annotation.getName(), value);
}
- public <T extends Annotation> T resolveClassAnnotation(Class<T> annotation)
+ /**
+ * Overridden by EJB3
+ */
+ public Object resolveClassAnnotation(Class<? extends Annotation> annotation)
{
+ return resolveTypedClassAnnotation(annotation);
+ }
+
+ public <T extends Annotation> T resolveTypedClassAnnotation(Class<T> annotation)
+ {
Object value = classAnnotations.get(annotation.getName());
boolean reinsert = value instanceof String;
T ann = extractAnnotation(value, annotation);
@@ -92,8 +100,13 @@
return ann;
}
- public <T extends Annotation> T resolveAnnotation(Member m, Class<T> annotation)
+ public Object resolveAnnotation(Member m, Class<? extends Annotation> annotation)
{
+ return resolveTypedAnnotation(m, annotation);
+ }
+
+ public <T extends Annotation> T resolveTypedAnnotation(Member m, Class<T> annotation)
+ {
Object value = resolveAnnotation(m, annotation.getName());
boolean reinsert = value instanceof String;
T ann = extractAnnotation(value, annotation);
Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/ejb3dependencies/Advisor.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/ejb3dependencies/Advisor.java (rev 0)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/ejb3dependencies/Advisor.java 2008-03-17 12:13:29 UTC (rev 70906)
@@ -0,0 +1,67 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.aop.ejb3dependencies;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+/**
+ * This test is not currently meant to run. It is there to ensure that we don't break EJB3's dependencies
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class Advisor<T>
+{
+ org.jboss.aop.Advisor advisor = null;
+ Method m;
+ Constructor<?> c;
+ Field f;
+
+ @SuppressWarnings("unused")
+ public void test()
+ {
+ Class<?> clazz = advisor.getClazz();
+ }
+
+ public org.jboss.aop.Advisor getAdvisor()
+ {
+ return advisor;
+ }
+
+ @SuppressWarnings("unchecked")
+ protected Class<? extends T> getBeanClass()
+ {
+ return getAdvisor().getClazz();
+ }
+
+ @SuppressWarnings("unused")
+ public void testResolveAnnotation(Class<? extends Annotation> annotation)
+ {
+ Object o = advisor.resolveAnnotation(annotation);
+ o = advisor.resolveAnnotation(c, annotation);
+ o = advisor.resolveAnnotation(m, annotation);
+ advisor.resolveAnnotation(f, annotation);
+ }
+}
Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/ejb3dependencies/AnnotationRepository.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/ejb3dependencies/AnnotationRepository.java (rev 0)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/ejb3dependencies/AnnotationRepository.java 2008-03-17 12:13:29 UTC (rev 70906)
@@ -0,0 +1,46 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.aop.ejb3dependencies;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Member;
+
+/**
+ * This test is not currently meant to run. It is there to ensure that we don't break EJB3's dependencies
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class AnnotationRepository extends org.jboss.aop.annotation.AnnotationRepository
+{
+
+ public <A extends Annotation> A resolveAnnotation(Class<?> cls, Class<A> annotationType)
+ {
+ return null;
+ }
+
+ public <A extends Annotation> A resolveAnnotation(Class<?> cls, Member member, Class<A> annotationType)
+ {
+ return null;
+ }
+
+}
Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/ejb3dependencies/JoinPointInfo.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/ejb3dependencies/JoinPointInfo.java (rev 0)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/ejb3dependencies/JoinPointInfo.java 2008-03-17 12:13:29 UTC (rev 70906)
@@ -0,0 +1,45 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.aop.ejb3dependencies;
+
+import java.lang.reflect.Method;
+
+import org.jboss.aop.advice.Interceptor;
+
+/**
+ * This test is not currently meant to run. It is there to ensure that we don't break EJB3's dependencies
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class JoinPointInfo
+{
+ org.jboss.aop.MethodInfo info;
+ @SuppressWarnings("unused")
+ public void test()
+ {
+ Interceptor[] interceptor = info.interceptors;
+ Method method = info.unadvisedMethod;
+ }
+
+
+}
Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/ejb3dependencies/Readme.txt
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/ejb3dependencies/Readme.txt (rev 0)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/ejb3dependencies/Readme.txt 2008-03-17 12:13:29 UTC (rev 70906)
@@ -0,0 +1 @@
+This test is not currently meant to run. It is there to ensure that we don't break EJB3's dependencies
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list