[jboss-cvs] JBossAS SVN: r104641 - in projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src: main/java/org/jboss/metadata/spi/scope and 5 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon May 10 18:51:57 EDT 2010


Author: dstephan
Date: 2010-05-10 18:51:56 -0400 (Mon, 10 May 2010)
New Revision: 104641

Added:
   projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/main/java/org/jboss/metadata/spi/retrieval/RetrievalUtils.java
   projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/main/java/org/jboss/metadata/spi/scope/UnmodifiableScopeKey.java
   projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/
   projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/
   projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/ClassNoMethodAnnotation1.java
   projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/ClassNoMethodAnnotation2.java
   projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/ClassNoMethodAnnotation3.java
   projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/ClassNoMethodAnnotation4.java
   projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/ClassNoMethodAnnotation5.java
   projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/NullAnnotatedElementMetaDataLoader.java
   projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/OriginalAnnotatedElementMetaDataLoader.java
   projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/SecurityActions.java
   projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/SingletonAnnotatedElementMetaDataLoader.java
   projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/test/
   projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/test/CreateScopeKeyBenchmark.java
   projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/test/CreateUnmodifiableScopeKeyBenchmark.java
   projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/test/NoComponentMetaDataCachingMetaDataContextBenchmark.java
   projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/loader/reflection/support/BridgeInterface.java
   projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/loader/reflection/support/BridgeMethodBean.java
Log:
JBPAPP-4220 - Updates required to backport JBMDR-69 to EAP 5.0.1. 

Added: projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/main/java/org/jboss/metadata/spi/retrieval/RetrievalUtils.java
===================================================================
--- projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/main/java/org/jboss/metadata/spi/retrieval/RetrievalUtils.java	                        (rev 0)
+++ projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/main/java/org/jboss/metadata/spi/retrieval/RetrievalUtils.java	2010-05-10 22:51:56 UTC (rev 104641)
@@ -0,0 +1,84 @@
+/*
+* 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.metadata.spi.retrieval;
+
+import org.jboss.logging.Logger;
+import org.jboss.metadata.plugins.context.CachingMetaDataContext;
+import org.jboss.metadata.spi.MetaData;
+import org.jboss.metadata.spi.context.MetaDataContext;
+
+/**
+ * Utilities for MDR metadata
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class RetrievalUtils
+{
+   private final static Logger log = Logger.getLogger(RetrievalUtils.class);
+   
+   /**
+    * Takes a MetaData and reworks the internal MetaDataContext to be caching.
+    * If the metadata structure cannot be determined, a warning is logged, but no error is thrown.
+    * 
+    * @param metaData The meta data we want to cache
+    * @return a cached meta data, or the original parameter if adding caching was not possible
+    * @throws IllegalArgumentException if the metaData parameter is null
+    */
+   public static MetaData createCachedMetaData(MetaData metaData)
+   {
+      if (metaData == null)
+         throw new IllegalArgumentException("Null meta data");
+      
+      if (metaData.getClass() != MetaDataRetrievalToMetaDataBridge.class)
+      {
+         log.warn("MetaDataUtils.createCachedMetaData(): meta data is not a MetaDataRetrievalToMetaDataBridge, not adding caching");
+         return metaData;
+      }
+       
+      if (((MetaDataRetrievalToMetaDataBridge)metaData).getMetaDataRetrieval() instanceof MetaDataContext == false)
+      {
+         log.warn("MetaDataUtils.createCachedMetaData(): Could not determine structure of meta data, not adding caching");
+         return metaData;
+      }
+      
+      MetaDataContext ctx = (MetaDataContext)((MetaDataRetrievalToMetaDataBridge)metaData).getMetaDataRetrieval();
+      return new MetaDataRetrievalToMetaDataBridge(createCachedMetaDataContext(ctx));
+   }
+
+   /**
+    * Creates a cached meta data context for the passed in context. All the parent contexts
+    * will also be cached
+    * 
+    * @param ctx the meta data context we want to cache
+    * @param the cached meta data context
+    */
+   private static MetaDataContext createCachedMetaDataContext(MetaDataContext ctx)
+   {
+      MetaDataContext parent = ctx.getParent();
+      if (parent != null)
+      {
+         parent = createCachedMetaDataContext(parent);
+      }
+      return new CachingMetaDataContext(parent, ctx.getLocalRetrievals());
+   }
+}

Added: projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/main/java/org/jboss/metadata/spi/scope/UnmodifiableScopeKey.java
===================================================================
--- projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/main/java/org/jboss/metadata/spi/scope/UnmodifiableScopeKey.java	                        (rev 0)
+++ projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/main/java/org/jboss/metadata/spi/scope/UnmodifiableScopeKey.java	2010-05-10 22:51:56 UTC (rev 104641)
@@ -0,0 +1,370 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, 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.metadata.spi.scope;
+
+import java.io.Serializable;
+import java.util.*;
+
+/**
+ * The UnmodifiableScopeKey represents a path which is made up of the path entries.
+ *
+ * The UnmodifiableScopeKey (Server=Bob,Deployment=Foo.war,Class=Bar)
+ * is the child of (Server=Bob,Deployment=Foo.war),
+ * which is the child of (Server=Bob).  Think about this statement in terms of
+ * a path relationship.  The server (Bob) contains a deployment (Foo.war) and
+ * the deployment contains a class (Bar).
+ *
+ * See historical design notes
+ * http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3972233#3972233
+ * http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4013747#4013747
+ *
+ * Thread Safety:  This class is immutable and therefore thread safe.
+ *
+ * Note: this class requires that class Scope implement Comparable, so that it
+ * can correctly sort the array of Scopes.  Note that is not needed for 
+ * UnmodifiableScopeKey(ScopeKey), which is already sorted.
+ *
+ * Warning:  This class (delicately) extends ScopeKey and overides all ScopeKey methods.
+ * Since there is no common interface class between the two classes, there are risks to be
+ * aware of.  If a new method is added to ScopeKey and not to UnmodifiableScopeKey, undesireable
+ * behavior will occur when that new method is invoked (ScopeKey's member variables will be null). 
+ *
+ * @author <a href="smarlow at redhat.com">Scott Marlow</a>
+ * @version $Revision: 75678 $
+ */
+
+public final class UnmodifiableScopeKey extends ScopeKey implements Serializable, Cloneable
+{
+   /** The serialVersionUID */
+   private static final long serialVersionUID = -442157853443439820L;
+
+   // the entries in this array are always sorted by (int) Scope.level.level
+   // Therefore, the maxScopeLevel is always found at the last element.
+   private final Scope theScopes[];
+
+   // Scopes in collection form
+   private final Collection<Scope> theScopesCollection;
+
+   // The cached hashCode that is calculated only once by the constructor
+   private final int hashcode;
+
+   public UnmodifiableScopeKey( ScopeKey key)
+   {
+      theScopes = new Scope[key.getScopes().size()];
+      key.getScopes().toArray(theScopes);
+      // sort(theScopes);  // already sorted
+      hashcode = ScopeKey.computeHashCode(theScopes);
+      theScopesCollection = Collections.unmodifiableCollection(Arrays.asList(theScopes));
+   }
+
+   /**
+    * Create a new ScopeKey.
+    *
+    * @param level the scope level
+    * @param qualifier the scope qualifier
+    */
+   public UnmodifiableScopeKey(ScopeLevel level, Object qualifier)
+   {
+      this(new Scope(level, qualifier));
+   }
+
+   /**
+    * Create a new ScopeKey.
+    *
+    * @param scopes is a collection of Scope instances that make up the represented path
+    * @throws IllegalArgumentException if parameter scopes is null
+    */
+   public UnmodifiableScopeKey(Collection<Scope> scopes)
+   {
+      if (scopes == null)
+         throw new IllegalArgumentException("Null scopes");
+      theScopes = new Scope[scopes.size()];
+      scopes.toArray(theScopes);
+      sort(theScopes);
+      hashcode = ScopeKey.computeHashCode(theScopes);
+      theScopesCollection = Collections.unmodifiableCollection(Arrays.asList(theScopes));
+   }
+
+   /**
+    * Create a new ScopeKey.
+    *
+    * @param scopes is zero or more Scope instances that make up the represented path
+    * @throws IllegalArgumentException if parameter scopes is null
+    */
+   public UnmodifiableScopeKey(Scope... scopes)
+   {
+      if (scopes == null)
+         throw new IllegalArgumentException("Null scopes");
+      theScopes = setup(scopes.length, scopes);
+      hashcode = ScopeKey.computeHashCode(theScopes);
+      theScopesCollection = Collections.unmodifiableCollection(Arrays.asList(theScopes));
+   }
+
+   /**
+    * Create a new ScopeKey.
+    *
+    * @param max number of passed Scope instances to use
+    * @param scopes is zero or more Scope instances that make up the represented path
+    * @throws IllegalArgumentException if parameter scopes is null
+    */
+   public UnmodifiableScopeKey(int max, Scope... scopes)
+   {
+      if (scopes == null)
+         throw new IllegalArgumentException("Null scopes");
+      theScopes = setup(max, scopes);
+      hashcode = ScopeKey.computeHashCode(theScopes);
+      theScopesCollection = Collections.unmodifiableCollection(Arrays.asList(theScopes));
+   }
+
+   public ScopeKey getOptimizedKey()
+   {
+      return this;
+   }
+
+   /**
+    * Get the scopes
+    *
+    * @return the unmodifiable collection of the scopes in expected path order
+    */
+   public Collection<Scope> getScopes()
+   {
+      return theScopesCollection;
+   }
+
+   /**
+    * Get a scope
+    *
+    * @param level the scope level
+    * @return the scope
+    * @throws IllegalArgumentException if level is null.
+    */
+   public Scope getScope(ScopeLevel level)
+   {
+      if (level == null)
+         throw new IllegalArgumentException("Null level");
+      // Note that the following search succeeds because we know that the qualifier (empty string)
+      // is ignored during the search.
+      int idx = Arrays.binarySearch(theScopes, new Scope(level,""));
+      if(idx >= 0)
+         return theScopes[idx];
+      return null;   // not found
+   }
+
+   /**
+    * Get the maximum scope level
+    *
+    * @return the largest scope level
+    */
+   public ScopeLevel getMaxScopeLevel()
+   {
+      // the maximum scope level is always the last entry (since we are sorted by scopelevel)
+      if (theScopes.length > 0)
+         return theScopes[theScopes.length - 1].getScopeLevel();
+      else
+         return null;
+   }
+
+   /**
+    * Get the parent scope key
+    *
+    * @return the parent or null if there is no parent (meaning that we
+    * are at the top most element in the path)
+    */
+   public ScopeKey getParent()
+   {
+    if (theScopes.length < 2)
+         return null;
+    ScopeKey result = new UnmodifiableScopeKey(theScopes.length - 1, theScopes);
+    return result;
+   }
+
+   /**
+    * Is this parent of key parameter.
+    *
+    * @param key the key parameter
+    * @return true if this is direct parent of key param
+    * @throws IllegalArgumentException if parameter key is null
+    */
+   public boolean isParent(ScopeKey key)
+   {
+      if (key == null)
+         throw new IllegalArgumentException("Null key");
+
+      Scope[] keyArray = key.getArray();
+
+      // The passed key doesn't have a parent
+      if (keyArray.length < 2)
+         return false;
+
+      // If it is a child, it will have one more scope
+      if (theScopes.length != keyArray.length - 1)
+         return false;
+
+      for (int looper = 0; looper < keyArray.length - 1; looper ++)
+      {
+         if(keyArray[looper].equals(theScopes[looper]) == false)
+            return false;
+      }
+      return true;
+   }
+
+   /**
+    * Get scope for the specified scopeLevel
+    *
+    * @param scopeLevel the scope level
+    * @return the scope or null if there is no such level
+    * @throws IllegalArgumentException if parameter scopeLevel is null
+    */
+   public Scope getScopeLevel(ScopeLevel scopeLevel)
+   {
+      if (scopeLevel == null)
+         throw new IllegalArgumentException("Null scope level");
+      return getScope(scopeLevel);
+   }
+
+   public String toString()
+   {
+      return getScopes().toString();
+   }
+
+   public boolean equals(Object object)
+   {
+      if (object == this)
+         return true;
+      if (object == null || object instanceof ScopeKey == false)
+         return false;
+      ScopeKey other = (ScopeKey) object;
+      Scope[] otherArray = other.getArray();
+      return Arrays.equals(theScopes, otherArray);
+   }
+
+   public int hashCode()
+   {
+      return hashcode;
+   }
+
+   /**
+    * Get the frozen.
+    *
+    * @return true as UnmodifiableScopeKey is always frozen
+    */
+   public boolean isFrozen()
+   {
+      return true;
+   }
+
+   /**
+    * This method is ignored as UnmodifiableScopeKey is always frozen
+    */
+   public void freeze()
+   {
+   }   
+
+   /**
+    * Scope cannot be added to an UnmodifiableScopeKey (instead construct a new UnmodifiableScopeKey).  
+    * Calling addScope will always fail.
+    * 
+    * @param scope the scope
+    * @throws IllegalArgumentException if scope is null.
+    * @throws IllegalStateException because UnmodifiableScopeKey is always frozen
+    */
+   public Scope addScope(Scope scope)
+   {
+      if (scope == null)
+         throw new IllegalArgumentException("Null scope");
+      throw new IllegalStateException("The scope key is frozen");
+   }
+
+    /**
+    * Scope cannot be added to an UnmodifiableScopeKey (instead construct a new UnmodifiableScopeKey).  
+    * Calling addScope will always fail.
+    *
+    * @param level the scope level
+    * @param qualifier the scope qualifier
+    * @throws IllegalStateException because UnmodifiableScopeKey is always frozen
+    */
+   public Scope addScope(ScopeLevel level, Object qualifier)
+   {
+      throw new IllegalStateException("The scope key is frozen"); 
+   }
+
+   /**
+    * Scope cannot be removed from an UnmodifiableScopeKey (instead construct a new UnmodifiableScopeKey).  
+    * Calling removeScope will always fail.
+    *
+    * @param scope the scope
+    * @throws IllegalStateException because UnmodifiableScopeKey is always frozen
+    */
+   public Scope removeScope(Scope scope)
+   {
+      throw new IllegalStateException("The scope key is frozen");
+   }
+
+   /**
+    * ScopeLevel cannot be removed from an UnmodifiableScopeKey (instead construct a new UnmodifiableScopeKey).  
+    * Calling removeScope will always fail.
+    *
+    * @param scopeLevel the scopeLevel
+    * @throws IllegalStateException because UnmodifiableScopeKey is always frozen
+    */
+   public Scope removeScopeLevel(ScopeLevel scopeLevel)
+   {
+      throw new IllegalStateException("The scope key is frozen");
+   }
+
+   /**
+    * clone will always return a frozen copy of the UnmodifiableScopeKey.  
+    * This is different then ScopeKey.clone(), which returns an unfrozen ScopeKey.
+    */
+   public ScopeKey clone()
+   {
+      ScopeKey result = super.clone();
+      return result;
+   }
+
+   private static Scope[] setup(int max, Scope... scopes)
+   {
+      if (max > scopes.length)
+         max = scopes.length;
+      Scope createdScopes[] = new Scope[max];
+      for (int looper = 0; looper < max; looper++)
+         createdScopes[looper] = scopes[looper];
+      if (max > 1)
+         sort(createdScopes);
+      return createdScopes;
+   }
+
+   private static void sort(Scope scopes[])
+   {
+      Arrays.sort(scopes);
+   }
+
+   protected Scope[] getArray()
+   {
+      return theScopes;
+   }
+
+   protected Collection<Scope> getScopesCollection()
+   {
+      return theScopesCollection;
+   }
+}

Added: projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/ClassNoMethodAnnotation1.java
===================================================================
--- projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/ClassNoMethodAnnotation1.java	                        (rev 0)
+++ projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/ClassNoMethodAnnotation1.java	2010-05-10 22:51:56 UTC (rev 104641)
@@ -0,0 +1,40 @@
+/*
+* 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.metadata.benchmark.support;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClassNoMethodAnnotation1
+{
+   public void method1(){}
+   public void method2(){}
+   public void method3(){}
+   public void method4(){}
+   public void method5(){}
+   public void method6(){}
+   public void method7(){}
+   public void method8(){}
+   public void method9(){}
+}
\ No newline at end of file

Added: projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/ClassNoMethodAnnotation2.java
===================================================================
--- projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/ClassNoMethodAnnotation2.java	                        (rev 0)
+++ projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/ClassNoMethodAnnotation2.java	2010-05-10 22:51:56 UTC (rev 104641)
@@ -0,0 +1,40 @@
+/*
+* 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.metadata.benchmark.support;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClassNoMethodAnnotation2
+{
+   public void method1(){}
+   public void method2(){}
+   public void method3(){}
+   public void method4(){}
+   public void method5(){}
+   public void method6(){}
+   public void method7(){}
+   public void method8(){}
+   public void method9(){}
+}
\ No newline at end of file

Added: projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/ClassNoMethodAnnotation3.java
===================================================================
--- projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/ClassNoMethodAnnotation3.java	                        (rev 0)
+++ projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/ClassNoMethodAnnotation3.java	2010-05-10 22:51:56 UTC (rev 104641)
@@ -0,0 +1,40 @@
+/*
+* 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.metadata.benchmark.support;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClassNoMethodAnnotation3
+{
+   public void method1(){}
+   public void method2(){}
+   public void method3(){}
+   public void method4(){}
+   public void method5(){}
+   public void method6(){}
+   public void method7(){}
+   public void method8(){}
+   public void method9(){}
+}

Added: projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/ClassNoMethodAnnotation4.java
===================================================================
--- projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/ClassNoMethodAnnotation4.java	                        (rev 0)
+++ projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/ClassNoMethodAnnotation4.java	2010-05-10 22:51:56 UTC (rev 104641)
@@ -0,0 +1,40 @@
+/*
+* 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.metadata.benchmark.support;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClassNoMethodAnnotation4
+{
+   public void method1(){}
+   public void method2(){}
+   public void method3(){}
+   public void method4(){}
+   public void method5(){}
+   public void method6(){}
+   public void method7(){}
+   public void method8(){}
+   public void method9(){}
+}

Added: projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/ClassNoMethodAnnotation5.java
===================================================================
--- projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/ClassNoMethodAnnotation5.java	                        (rev 0)
+++ projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/ClassNoMethodAnnotation5.java	2010-05-10 22:51:56 UTC (rev 104641)
@@ -0,0 +1,40 @@
+/*
+* 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.metadata.benchmark.support;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClassNoMethodAnnotation5
+{
+   public void method1(){}
+   public void method2(){}
+   public void method3(){}
+   public void method4(){}
+   public void method5(){}
+   public void method6(){}
+   public void method7(){}
+   public void method8(){}
+   public void method9(){}
+}

Added: projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/NullAnnotatedElementMetaDataLoader.java
===================================================================
--- projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/NullAnnotatedElementMetaDataLoader.java	                        (rev 0)
+++ projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/NullAnnotatedElementMetaDataLoader.java	2010-05-10 22:51:56 UTC (rev 104641)
@@ -0,0 +1,388 @@
+/*
+* 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.metadata.benchmark.support;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+
+import org.jboss.logging.Logger;
+import org.jboss.metadata.plugins.loader.BasicMetaDataLoader;
+import org.jboss.metadata.plugins.loader.SimpleMetaDataLoader;
+import org.jboss.metadata.spi.retrieval.AnnotationItem;
+import org.jboss.metadata.spi.retrieval.AnnotationsItem;
+import org.jboss.metadata.spi.retrieval.MetaDataItem;
+import org.jboss.metadata.spi.retrieval.MetaDataRetrieval;
+import org.jboss.metadata.spi.retrieval.MetaDatasItem;
+import org.jboss.metadata.spi.retrieval.ValidTime;
+import org.jboss.metadata.spi.retrieval.basic.BasicAnnotationsItem;
+import org.jboss.metadata.spi.retrieval.basic.BasicMetaDatasItem;
+import org.jboss.metadata.spi.retrieval.simple.SimpleAnnotationItem;
+import org.jboss.metadata.spi.retrieval.simple.SimpleAnnotationsItem;
+import org.jboss.metadata.spi.scope.CommonLevels;
+import org.jboss.metadata.spi.scope.Scope;
+import org.jboss.metadata.spi.scope.ScopeKey;
+import org.jboss.metadata.spi.scope.ScopeLevel;
+import org.jboss.metadata.spi.scope.UnmodifiableScopeKey;
+import org.jboss.metadata.spi.signature.ConstructorParametersSignature;
+import org.jboss.metadata.spi.signature.ConstructorSignature;
+import org.jboss.metadata.spi.signature.DeclaredMethodSignature;
+import org.jboss.metadata.spi.signature.FieldSignature;
+import org.jboss.metadata.spi.signature.MethodParametersSignature;
+import org.jboss.metadata.spi.signature.MethodSignature;
+import org.jboss.metadata.spi.signature.Signature;
+import org.jboss.util.JBossStringBuilder;
+import org.jboss.util.Strings;
+
+/**
+ * AnnotatedElementMetaDataLoader.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 101076 $
+ */
+public class NullAnnotatedElementMetaDataLoader extends BasicMetaDataLoader 
+{
+   /** The log */
+   private static final Logger log = Logger.getLogger(NullAnnotatedElementMetaDataLoader.class);
+   
+   /** The annotated element */
+   private AnnotatedElement annotated;
+   
+   private static final ScopeKey getScopeKey(AnnotatedElement annotated)
+   {
+      Scope scope;
+      if (annotated instanceof Class)
+      {
+         Class<?> clazz = Class.class.cast(annotated);
+         scope = new Scope(CommonLevels.CLASS, clazz);
+      }
+      else if (annotated instanceof Member)
+      {
+         Member member = (Member) annotated;
+         scope = new Scope(CommonLevels.JOINPOINT, member);
+      }
+      else
+      {
+         return ScopeKey.DEFAULT_SCOPE;
+      }
+      return new UnmodifiableScopeKey(scope);
+   }
+   
+   /**
+    * Create a new AnnotatedElementMetaDataContext.
+    * 
+    * @param annotated the annotated element
+    */
+   public NullAnnotatedElementMetaDataLoader(AnnotatedElement annotated)
+   {
+      super(getScopeKey(annotated));
+      if (annotated == null)
+         throw new IllegalArgumentException("Null annotated element");
+      this.annotated = annotated;
+   }
+
+   @SuppressWarnings("unchecked")
+   public AnnotationsItem retrieveAnnotations()
+   {
+      Annotation[] annotations = annotated.getAnnotations();
+      if (annotations.length == 0)
+         return SimpleAnnotationsItem.NO_ANNOTATIONS;
+      
+      AnnotationItem[] items = new AnnotationItem[annotations.length];
+      for (int i = 0; i < items.length; ++i)
+         items[i] = new SimpleAnnotationItem(annotations[i]);
+      return new SimpleAnnotationsItem(items);
+   }
+   
+   public <T extends Annotation> AnnotationItem<T> retrieveAnnotation(Class<T> annotationType)
+   {
+      T annotation = annotated.getAnnotation(annotationType);
+      if (annotation == null)
+         return null;
+      return new SimpleAnnotationItem<T>(annotation);
+   }
+
+   public MetaDataRetrieval getComponentMetaDataRetrieval(Signature signature)
+   {
+      if (signature == null)
+         return null;
+
+      if (annotated instanceof Class)
+      {
+         Class<?> clazz = Class.class.cast(annotated);
+         if (signature instanceof ConstructorSignature)
+         {
+            ConstructorSignature constructorSignature = (ConstructorSignature) signature;
+            Constructor<?> constructor = constructorSignature.getConstructor();
+            if (constructor == null)
+               constructor = SecurityActions.findConstructor(clazz, signature.getParametersTypes(clazz));
+            if (constructor == null)
+            {
+               if (log.isTraceEnabled())
+                  log.trace("Constructor with signature " + signature + " does not exist on class " + clazz.getName());
+               return null;
+            }
+            if (constructor.getAnnotations().length == 0)
+               return null;
+            return new NullAnnotatedElementMetaDataLoader(constructor);
+         }
+         else if (signature instanceof MethodSignature)
+         {
+            MethodSignature methodSignature = (MethodSignature) signature;
+            Method method = methodSignature.getMethod();
+            if (method == null)
+               method = SecurityActions.findMethod(clazz, signature.getName(), signature.getParametersTypes(clazz));
+            if (method == null)
+            {
+               if (log.isTraceEnabled())
+                  log.trace("Method with signature " + signature + " does not exist on class " + clazz.getName());
+               return null;
+            }
+            if (method.getAnnotations().length == 0)
+               return null;
+            return new NullAnnotatedElementMetaDataLoader(method);
+         }
+         else if (signature instanceof DeclaredMethodSignature)
+         {
+            DeclaredMethodSignature methodSignature = (DeclaredMethodSignature) signature;
+            Method method = methodSignature.getMethod();
+            if (method == null)
+            {
+               clazz = getDeclaringClass(clazz, methodSignature.getDeclaringClass());
+               if (clazz == null)
+                  return null;
+               try
+               {
+                  method = SecurityActions.findDeclaredMethod(clazz, signature.getName(), signature.getParametersTypes(clazz));
+               }
+               catch (NoSuchMethodException nsme)
+               {
+                  if (log.isTraceEnabled())
+                     log.trace("Method with signature " + signature + " does not exist on class " + clazz.getName());
+                  return null;     
+               }
+            }
+            if (method.getAnnotations().length == 0)
+               return null;
+            return new NullAnnotatedElementMetaDataLoader(method);
+         }
+         else if (signature instanceof MethodParametersSignature)
+         {
+            MethodParametersSignature methodParametersSignature = (MethodParametersSignature) signature;
+            Method method = methodParametersSignature.getMethod();
+            if (method == null)
+               method = SecurityActions.findMethod(clazz, signature.getName(), signature.getParametersTypes(clazz));
+            if (method == null)
+            {
+               if (log.isTraceEnabled())
+                  log.trace("Method with signature " + signature + " does not exist on class " + clazz.getName());
+               return null;
+            }
+            Annotation[][] paramAnnotations = method.getParameterAnnotations();
+            if (paramAnnotations[methodParametersSignature.getParam()].length == 0)
+               return null;
+            return new SimpleMetaDataLoader(paramAnnotations[methodParametersSignature.getParam()]);
+         }
+         else if (signature instanceof ConstructorParametersSignature)
+         {
+            ConstructorParametersSignature constructorParametersSignature = (ConstructorParametersSignature) signature;
+            Constructor<?> constructor = constructorParametersSignature.getConstructor();
+            if (constructor == null)
+               constructor = SecurityActions.findConstructor(clazz, signature.getParametersTypes(clazz));
+            if (constructor == null)
+            {
+               if (log.isTraceEnabled())
+                  log.trace("Constructor with signature " + signature + " does not exist on class " + clazz.getName());
+               return null;
+            }
+            Annotation[][] paramAnnotations = constructor.getParameterAnnotations();
+            if (paramAnnotations[constructorParametersSignature.getParam()].length == 0)
+               return null;
+            return new SimpleMetaDataLoader(paramAnnotations[constructorParametersSignature.getParam()]);
+         }
+         else if (signature instanceof FieldSignature)
+         {
+            FieldSignature fieldSignature = (FieldSignature) signature;
+            Field field = fieldSignature.getField();
+            if (field == null)
+               field = SecurityActions.findField(clazz, signature.getName());
+            if (field == null)
+            {
+               if (log.isTraceEnabled())
+                  log.trace("Field " + signature.getName() + " does not exist on class " + clazz.getName());
+               return null;
+            }
+            if (field.getAnnotations().length == 0)
+               return null;
+            return new NullAnnotatedElementMetaDataLoader(field);
+         }
+      }
+
+      if (annotated instanceof Method)
+      {
+         if (signature instanceof MethodParametersSignature)
+         {
+            Method method = (Method)annotated;
+            Annotation[][] paramAnnotations = method.getParameterAnnotations();
+            MethodParametersSignature sig = (MethodParametersSignature) signature;
+            if (paramAnnotations[sig.getParam()].length == 0)
+               return null;
+            return new SimpleMetaDataLoader(paramAnnotations[sig.getParam()]);
+         }
+      }
+
+      if (annotated instanceof Constructor)
+      {
+         if (signature instanceof ConstructorParametersSignature)
+         {
+            Constructor<?> constructor = Constructor.class.cast(annotated);
+            Annotation[][] paramAnnotations = constructor.getParameterAnnotations();
+            ConstructorParametersSignature sig = (ConstructorParametersSignature) signature;
+            if (paramAnnotations[sig.getParam()].length == 0)
+               return null;
+            return new SimpleMetaDataLoader(paramAnnotations[sig.getParam()]);
+         }
+      }
+
+      return null;
+   }
+
+   public boolean isEmpty()
+   {
+      Annotation[] annotations = annotated.getAnnotations();
+      return annotations == null || annotations.length == 0;
+   }
+
+   public String toString()
+   {
+      JBossStringBuilder buffer = new JBossStringBuilder();
+      Strings.defaultToString(buffer, this);
+      buffer.append("[");
+      buffer.append(annotated);
+      buffer.append("]");
+      return buffer.toString();
+   }
+
+   /**
+    * Get the declaring class from the reference class
+    * 
+    * @param reference the reference class
+    * @param declaringClass the declaring class
+    * @return the class or null if the declaring class is not a super class of the reference
+    */
+   private static Class<?> getDeclaringClass(Class<?> reference, String declaringClass)
+   {
+      while (reference != null)
+      {
+         if (declaringClass.equals(reference.getName()))
+            return reference;
+         
+         reference = reference.getSuperclass();
+      }
+      return null;
+   }
+   
+   /**
+    * http://community.jboss.org/thread/148203
+    * Singleton be returned by AnnotatedElementMetaDataLoader.getComponentMetaDataRetrieval() when there are no annotations for the member. This is to avoid
+    * the overhead of creating a new AnnotatedElementMetaDataLoader even in those cases, something which shows up to be a big bottleneck in AS startup time,
+    * mainly due to the creation of AnnotatedElementMetaDataLoader's ScopeKey.    
+    */
+   private static class NullAnnotatedElementComponentMetaDataLoader implements MetaDataRetrieval
+   {
+      final static NullAnnotatedElementComponentMetaDataLoader INSTANCE = new NullAnnotatedElementComponentMetaDataLoader();
+      final static ScopeKey nullScopeKey = new ScopeKey(new Scope(CommonLevels.JOINPOINT, INSTANCE));
+      
+      final BasicAnnotationsItem noANnnotationsItem = new BasicAnnotationsItem(null, new AnnotationItem[0]);
+      final BasicMetaDatasItem noMetaDatasItem = new BasicMetaDatasItem(null, new MetaDataItem[0]);
+      final ValidTime validTime = new ValidTime();
+      
+      public MetaDataRetrieval getComponentMetaDataRetrieval(Signature signature)
+      {
+         return INSTANCE;
+      }
+
+      public ScopeKey getScope()
+      {
+         return nullScopeKey;
+      }
+
+      public MetaDataRetrieval getScopedRetrieval(ScopeLevel level)
+      {
+         return INSTANCE;
+      }
+
+      public ValidTime getValidTime()
+      {
+         return validTime;
+      }
+
+      public boolean isEmpty()
+      {
+         return true;
+      }
+
+      public <T extends Annotation> AnnotationItem<T> retrieveAnnotation(Class<T> annotationType)
+      {
+         return null;
+      }
+
+      public AnnotationsItem retrieveAnnotations()
+      {
+         return noANnnotationsItem;
+      }
+
+      public AnnotationsItem retrieveAnnotationsAnnotatedWith(Class<? extends Annotation> meta)
+      {
+         return noANnnotationsItem;
+      }
+
+      public AnnotationsItem retrieveLocalAnnotations()
+      {
+         return noANnnotationsItem;
+      }
+
+      public MetaDatasItem retrieveLocalMetaData()
+      {
+         return noMetaDatasItem;
+      }
+
+      public MetaDatasItem retrieveMetaData()
+      {
+         return noMetaDatasItem;
+      }
+
+      public <T> MetaDataItem<T> retrieveMetaData(Class<T> type)
+      {
+         return null;
+      }
+
+      public MetaDataItem<?> retrieveMetaData(String name)
+      {
+         return null;
+      }
+      
+   }
+}

Added: projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/OriginalAnnotatedElementMetaDataLoader.java
===================================================================
--- projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/OriginalAnnotatedElementMetaDataLoader.java	                        (rev 0)
+++ projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/OriginalAnnotatedElementMetaDataLoader.java	2010-05-10 22:51:56 UTC (rev 104641)
@@ -0,0 +1,372 @@
+/*
+* 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.metadata.benchmark.support;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+
+import org.jboss.logging.Logger;
+import org.jboss.metadata.plugins.loader.BasicMetaDataLoader;
+import org.jboss.metadata.plugins.loader.SimpleMetaDataLoader;
+import org.jboss.metadata.spi.retrieval.AnnotationItem;
+import org.jboss.metadata.spi.retrieval.AnnotationsItem;
+import org.jboss.metadata.spi.retrieval.MetaDataItem;
+import org.jboss.metadata.spi.retrieval.MetaDataRetrieval;
+import org.jboss.metadata.spi.retrieval.MetaDatasItem;
+import org.jboss.metadata.spi.retrieval.ValidTime;
+import org.jboss.metadata.spi.retrieval.basic.BasicAnnotationsItem;
+import org.jboss.metadata.spi.retrieval.basic.BasicMetaDatasItem;
+import org.jboss.metadata.spi.retrieval.simple.SimpleAnnotationItem;
+import org.jboss.metadata.spi.retrieval.simple.SimpleAnnotationsItem;
+import org.jboss.metadata.spi.scope.CommonLevels;
+import org.jboss.metadata.spi.scope.Scope;
+import org.jboss.metadata.spi.scope.ScopeKey;
+import org.jboss.metadata.spi.scope.ScopeLevel;
+import org.jboss.metadata.spi.scope.UnmodifiableScopeKey;
+import org.jboss.metadata.spi.signature.ConstructorParametersSignature;
+import org.jboss.metadata.spi.signature.ConstructorSignature;
+import org.jboss.metadata.spi.signature.DeclaredMethodSignature;
+import org.jboss.metadata.spi.signature.FieldSignature;
+import org.jboss.metadata.spi.signature.MethodParametersSignature;
+import org.jboss.metadata.spi.signature.MethodSignature;
+import org.jboss.metadata.spi.signature.Signature;
+import org.jboss.util.JBossStringBuilder;
+import org.jboss.util.Strings;
+
+/**
+ * AnnotatedElementMetaDataLoader.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 101076 $
+ */
+public class OriginalAnnotatedElementMetaDataLoader extends BasicMetaDataLoader 
+{
+   /** The log */
+   private static final Logger log = Logger.getLogger(OriginalAnnotatedElementMetaDataLoader.class);
+   
+   /** The annotated element */
+   private AnnotatedElement annotated;
+   
+   private static final ScopeKey getScopeKey(AnnotatedElement annotated)
+   {
+      Scope scope;
+      if (annotated instanceof Class)
+      {
+         Class<?> clazz = Class.class.cast(annotated);
+         scope = new Scope(CommonLevels.CLASS, clazz);
+      }
+      else if (annotated instanceof Member)
+      {
+         Member member = (Member) annotated;
+         scope = new Scope(CommonLevels.JOINPOINT, member);
+      }
+      else
+      {
+         return ScopeKey.DEFAULT_SCOPE;
+      }
+      return new UnmodifiableScopeKey(scope);
+   }
+   
+   /**
+    * Create a new AnnotatedElementMetaDataContext.
+    * 
+    * @param annotated the annotated element
+    */
+   public OriginalAnnotatedElementMetaDataLoader(AnnotatedElement annotated)
+   {
+      super(getScopeKey(annotated));
+      if (annotated == null)
+         throw new IllegalArgumentException("Null annotated element");
+      this.annotated = annotated;
+   }
+
+   @SuppressWarnings("unchecked")
+   public AnnotationsItem retrieveAnnotations()
+   {
+      Annotation[] annotations = annotated.getAnnotations();
+      if (annotations.length == 0)
+         return SimpleAnnotationsItem.NO_ANNOTATIONS;
+      
+      AnnotationItem[] items = new AnnotationItem[annotations.length];
+      for (int i = 0; i < items.length; ++i)
+         items[i] = new SimpleAnnotationItem(annotations[i]);
+      return new SimpleAnnotationsItem(items);
+   }
+   
+   public <T extends Annotation> AnnotationItem<T> retrieveAnnotation(Class<T> annotationType)
+   {
+      T annotation = annotated.getAnnotation(annotationType);
+      if (annotation == null)
+         return null;
+      return new SimpleAnnotationItem<T>(annotation);
+   }
+
+   public MetaDataRetrieval getComponentMetaDataRetrieval(Signature signature)
+   {
+      if (signature == null)
+         return null;
+
+      if (annotated instanceof Class)
+      {
+         Class<?> clazz = Class.class.cast(annotated);
+         if (signature instanceof ConstructorSignature)
+         {
+            ConstructorSignature constructorSignature = (ConstructorSignature) signature;
+            Constructor<?> constructor = constructorSignature.getConstructor();
+            if (constructor == null)
+               constructor = SecurityActions.findConstructor(clazz, signature.getParametersTypes(clazz));
+            if (constructor == null)
+            {
+               if (log.isTraceEnabled())
+                  log.trace("Constructor with signature " + signature + " does not exist on class " + clazz.getName());
+               return null;
+            }
+            return new OriginalAnnotatedElementMetaDataLoader(constructor);
+         }
+         else if (signature instanceof MethodSignature)
+         {
+            MethodSignature methodSignature = (MethodSignature) signature;
+            Method method = methodSignature.getMethod();
+            if (method == null)
+               method = SecurityActions.findMethod(clazz, signature.getName(), signature.getParametersTypes(clazz));
+            if (method == null)
+            {
+               if (log.isTraceEnabled())
+                  log.trace("Method with signature " + signature + " does not exist on class " + clazz.getName());
+               return null;
+            }
+            return new OriginalAnnotatedElementMetaDataLoader(method);
+         }
+         else if (signature instanceof DeclaredMethodSignature)
+         {
+            DeclaredMethodSignature methodSignature = (DeclaredMethodSignature) signature;
+            Method method = methodSignature.getMethod();
+            if (method == null)
+            {
+               clazz = getDeclaringClass(clazz, methodSignature.getDeclaringClass());
+               if (clazz == null)
+                  return null;
+               try
+               {
+                  method = SecurityActions.findDeclaredMethod(clazz, signature.getName(), signature.getParametersTypes(clazz));
+               }
+               catch (NoSuchMethodException nsme)
+               {
+                  if (log.isTraceEnabled())
+                     log.trace("Method with signature " + signature + " does not exist on class " + clazz.getName());
+                  return null;     
+               }
+            }
+            return new OriginalAnnotatedElementMetaDataLoader(method);
+         }
+         else if (signature instanceof MethodParametersSignature)
+         {
+            MethodParametersSignature methodParametersSignature = (MethodParametersSignature) signature;
+            Method method = methodParametersSignature.getMethod();
+            if (method == null)
+               method = SecurityActions.findMethod(clazz, signature.getName(), signature.getParametersTypes(clazz));
+            if (method == null)
+            {
+               if (log.isTraceEnabled())
+                  log.trace("Method with signature " + signature + " does not exist on class " + clazz.getName());
+               return null;
+            }
+            Annotation[][] paramAnnotations = method.getParameterAnnotations();
+            return new SimpleMetaDataLoader(paramAnnotations[methodParametersSignature.getParam()]);
+         }
+         else if (signature instanceof ConstructorParametersSignature)
+         {
+            ConstructorParametersSignature constructorParametersSignature = (ConstructorParametersSignature) signature;
+            Constructor<?> constructor = constructorParametersSignature.getConstructor();
+            if (constructor == null)
+               constructor = SecurityActions.findConstructor(clazz, signature.getParametersTypes(clazz));
+            if (constructor == null)
+            {
+               if (log.isTraceEnabled())
+                  log.trace("Constructor with signature " + signature + " does not exist on class " + clazz.getName());
+               return null;
+            }
+            Annotation[][] paramAnnotations = constructor.getParameterAnnotations();
+            return new SimpleMetaDataLoader(paramAnnotations[constructorParametersSignature.getParam()]);
+         }
+         else if (signature instanceof FieldSignature)
+         {
+            FieldSignature fieldSignature = (FieldSignature) signature;
+            Field field = fieldSignature.getField();
+            if (field == null)
+               field = SecurityActions.findField(clazz, signature.getName());
+            if (field == null)
+            {
+               if (log.isTraceEnabled())
+                  log.trace("Field " + signature.getName() + " does not exist on class " + clazz.getName());
+               return null;
+            }
+            return new OriginalAnnotatedElementMetaDataLoader(field);
+         }
+      }
+
+      if (annotated instanceof Method)
+      {
+         if (signature instanceof MethodParametersSignature)
+         {
+            Method method = (Method)annotated;
+            Annotation[][] paramAnnotations = method.getParameterAnnotations();
+            MethodParametersSignature sig = (MethodParametersSignature) signature;
+            return new SimpleMetaDataLoader(paramAnnotations[sig.getParam()]);
+         }
+      }
+
+      if (annotated instanceof Constructor)
+      {
+         if (signature instanceof ConstructorParametersSignature)
+         {
+            Constructor<?> constructor = Constructor.class.cast(annotated);
+            Annotation[][] paramAnnotations = constructor.getParameterAnnotations();
+            ConstructorParametersSignature sig = (ConstructorParametersSignature) signature;
+            return new SimpleMetaDataLoader(paramAnnotations[sig.getParam()]);
+         }
+      }
+
+      return null;
+   }
+
+   public boolean isEmpty()
+   {
+      Annotation[] annotations = annotated.getAnnotations();
+      return annotations == null || annotations.length == 0;
+   }
+
+   public String toString()
+   {
+      JBossStringBuilder buffer = new JBossStringBuilder();
+      Strings.defaultToString(buffer, this);
+      buffer.append("[");
+      buffer.append(annotated);
+      buffer.append("]");
+      return buffer.toString();
+   }
+
+   /**
+    * Get the declaring class from the reference class
+    * 
+    * @param reference the reference class
+    * @param declaringClass the declaring class
+    * @return the class or null if the declaring class is not a super class of the reference
+    */
+   private static Class<?> getDeclaringClass(Class<?> reference, String declaringClass)
+   {
+      while (reference != null)
+      {
+         if (declaringClass.equals(reference.getName()))
+            return reference;
+         
+         reference = reference.getSuperclass();
+      }
+      return null;
+   }
+   
+   /**
+    * http://community.jboss.org/thread/148203
+    * Singleton be returned by AnnotatedElementMetaDataLoader.getComponentMetaDataRetrieval() when there are no annotations for the member. This is to avoid
+    * the overhead of creating a new AnnotatedElementMetaDataLoader even in those cases, something which shows up to be a big bottleneck in AS startup time,
+    * mainly due to the creation of AnnotatedElementMetaDataLoader's ScopeKey.    
+    */
+   private static class NullAnnotatedElementComponentMetaDataLoader implements MetaDataRetrieval
+   {
+      final static NullAnnotatedElementComponentMetaDataLoader INSTANCE = new NullAnnotatedElementComponentMetaDataLoader();
+      final static ScopeKey nullScopeKey = new ScopeKey(new Scope(CommonLevels.JOINPOINT, INSTANCE));
+      
+      final BasicAnnotationsItem noANnnotationsItem = new BasicAnnotationsItem(null, new AnnotationItem[0]);
+      final BasicMetaDatasItem noMetaDatasItem = new BasicMetaDatasItem(null, new MetaDataItem[0]);
+      final ValidTime validTime = new ValidTime();
+      
+      public MetaDataRetrieval getComponentMetaDataRetrieval(Signature signature)
+      {
+         return INSTANCE;
+      }
+
+      public ScopeKey getScope()
+      {
+         return nullScopeKey;
+      }
+
+      public MetaDataRetrieval getScopedRetrieval(ScopeLevel level)
+      {
+         return INSTANCE;
+      }
+
+      public ValidTime getValidTime()
+      {
+         return validTime;
+      }
+
+      public boolean isEmpty()
+      {
+         return true;
+      }
+
+      public <T extends Annotation> AnnotationItem<T> retrieveAnnotation(Class<T> annotationType)
+      {
+         return null;
+      }
+
+      public AnnotationsItem retrieveAnnotations()
+      {
+         return noANnnotationsItem;
+      }
+
+      public AnnotationsItem retrieveAnnotationsAnnotatedWith(Class<? extends Annotation> meta)
+      {
+         return noANnnotationsItem;
+      }
+
+      public AnnotationsItem retrieveLocalAnnotations()
+      {
+         return noANnnotationsItem;
+      }
+
+      public MetaDatasItem retrieveLocalMetaData()
+      {
+         return noMetaDatasItem;
+      }
+
+      public MetaDatasItem retrieveMetaData()
+      {
+         return noMetaDatasItem;
+      }
+
+      public <T> MetaDataItem<T> retrieveMetaData(Class<T> type)
+      {
+         return null;
+      }
+
+      public MetaDataItem<?> retrieveMetaData(String name)
+      {
+         return null;
+      }
+      
+   }
+}

Added: projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/SecurityActions.java
===================================================================
--- projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/SecurityActions.java	                        (rev 0)
+++ projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/SecurityActions.java	2010-05-10 22:51:56 UTC (rev 104641)
@@ -0,0 +1,141 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, 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.metadata.benchmark.support;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+import org.jboss.reflect.plugins.introspection.ReflectionUtils;
+
+/**
+ * SecurityActions.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+class SecurityActions
+{
+   /**
+    * Find the method by name and parameters.
+    *
+    * @param clazz the class to look for method
+    * @param name the name
+    * @param parameterTypes the types
+    * @return method or null if not found
+    */
+   static Method findMethod(final Class<?> clazz, final String name, final Class<?>... parameterTypes)
+   {
+      SecurityManager sm = System.getSecurityManager();
+      if (sm == null)
+         return ReflectionUtils.findMethod(clazz, name, parameterTypes);
+
+      return AccessController.doPrivileged(new PrivilegedAction<Method>()
+      {
+         public Method run()
+         {
+            return ReflectionUtils.findMethod(clazz, name, parameterTypes);
+         }
+      });
+   }
+
+   /**
+    * Find the field by name.
+    *
+    * @param clazz the class to look for field
+    * @param name the name
+    * @return field or null if not found
+    */
+   static Field findField(final Class<?> clazz, final String name)
+   {
+      SecurityManager sm = System.getSecurityManager();
+      if (sm == null)
+         return ReflectionUtils.findField(clazz, name);
+
+      return AccessController.doPrivileged(new PrivilegedAction<Field>()
+      {
+         public Field run()
+         {
+            return ReflectionUtils.findField(clazz, name);
+         }
+      });
+   }
+
+   /**
+    * Find the constructor by parameters.
+    *
+    * @param clazz the class to look for constructor
+    * @param parameterTypes the types
+    * @return constructor or null if not found
+    */
+   static Constructor<?> findConstructor(final Class<?> clazz, final Class<?>... parameterTypes)
+   {
+      SecurityManager sm = System.getSecurityManager();
+      if (sm == null)
+         return ReflectionUtils.findConstructor(clazz, parameterTypes);
+
+      return AccessController.doPrivileged(new PrivilegedAction<Constructor<?>>()
+      {
+         public Constructor<?> run()
+         {
+            return ReflectionUtils.findConstructor(clazz, parameterTypes);
+         }
+      });
+   }
+
+   /**
+    * Returns a method named <code>methodName</code> with params
+    * <code>parameterTypes</code> declared in the <code>declaringClass</code>.
+    * Methods with public, private, protected and package access are considered while 
+    * 
+    * @param declaringClass The Class declaring the method
+    * @param methodName The name of the method
+    * @param parameterTypes The parameters types accepted by the method
+    * @return found declared method
+    * @throws NoSuchMethodException If the method is not found in the <code>declaringClass</code>
+    */
+   static Method findDeclaredMethod(final Class<?> declaringClass, final String methodName, final Class<?>... parameterTypes) throws NoSuchMethodException
+   {
+      SecurityManager sm = System.getSecurityManager();
+      if (sm == null)
+         return declaringClass.getDeclaredMethod(methodName, parameterTypes);
+
+      try
+      {
+         return AccessController.doPrivileged(new PrivilegedExceptionAction<Method>()
+         {
+            public Method run() throws NoSuchMethodException
+            {
+               return declaringClass.getDeclaredMethod(methodName, parameterTypes);
+            }
+         });
+      }
+      catch (PrivilegedActionException pae)
+      {
+         throw (NoSuchMethodException) pae.getException();
+      }
+   }
+}

Added: projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/SingletonAnnotatedElementMetaDataLoader.java
===================================================================
--- projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/SingletonAnnotatedElementMetaDataLoader.java	                        (rev 0)
+++ projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/support/SingletonAnnotatedElementMetaDataLoader.java	2010-05-10 22:51:56 UTC (rev 104641)
@@ -0,0 +1,388 @@
+/*
+* 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.metadata.benchmark.support;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+
+import org.jboss.logging.Logger;
+import org.jboss.metadata.plugins.loader.BasicMetaDataLoader;
+import org.jboss.metadata.plugins.loader.SimpleMetaDataLoader;
+import org.jboss.metadata.spi.retrieval.AnnotationItem;
+import org.jboss.metadata.spi.retrieval.AnnotationsItem;
+import org.jboss.metadata.spi.retrieval.MetaDataItem;
+import org.jboss.metadata.spi.retrieval.MetaDataRetrieval;
+import org.jboss.metadata.spi.retrieval.MetaDatasItem;
+import org.jboss.metadata.spi.retrieval.ValidTime;
+import org.jboss.metadata.spi.retrieval.basic.BasicAnnotationsItem;
+import org.jboss.metadata.spi.retrieval.basic.BasicMetaDatasItem;
+import org.jboss.metadata.spi.retrieval.simple.SimpleAnnotationItem;
+import org.jboss.metadata.spi.retrieval.simple.SimpleAnnotationsItem;
+import org.jboss.metadata.spi.scope.CommonLevels;
+import org.jboss.metadata.spi.scope.Scope;
+import org.jboss.metadata.spi.scope.ScopeKey;
+import org.jboss.metadata.spi.scope.ScopeLevel;
+import org.jboss.metadata.spi.scope.UnmodifiableScopeKey;
+import org.jboss.metadata.spi.signature.ConstructorParametersSignature;
+import org.jboss.metadata.spi.signature.ConstructorSignature;
+import org.jboss.metadata.spi.signature.DeclaredMethodSignature;
+import org.jboss.metadata.spi.signature.FieldSignature;
+import org.jboss.metadata.spi.signature.MethodParametersSignature;
+import org.jboss.metadata.spi.signature.MethodSignature;
+import org.jboss.metadata.spi.signature.Signature;
+import org.jboss.util.JBossStringBuilder;
+import org.jboss.util.Strings;
+
+/**
+ * AnnotatedElementMetaDataLoader.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 101076 $
+ */
+public class SingletonAnnotatedElementMetaDataLoader extends BasicMetaDataLoader 
+{
+   /** The log */
+   private static final Logger log = Logger.getLogger(SingletonAnnotatedElementMetaDataLoader.class);
+   
+   /** The annotated element */
+   private AnnotatedElement annotated;
+   
+   private static final ScopeKey getScopeKey(AnnotatedElement annotated)
+   {
+      Scope scope;
+      if (annotated instanceof Class)
+      {
+         Class<?> clazz = Class.class.cast(annotated);
+         scope = new Scope(CommonLevels.CLASS, clazz);
+      }
+      else if (annotated instanceof Member)
+      {
+         Member member = (Member) annotated;
+         scope = new Scope(CommonLevels.JOINPOINT, member);
+      }
+      else
+      {
+         return ScopeKey.DEFAULT_SCOPE;
+      }
+      return new UnmodifiableScopeKey(scope);
+   }
+   
+   /**
+    * Create a new AnnotatedElementMetaDataContext.
+    * 
+    * @param annotated the annotated element
+    */
+   public SingletonAnnotatedElementMetaDataLoader(AnnotatedElement annotated)
+   {
+      super(getScopeKey(annotated));
+      if (annotated == null)
+         throw new IllegalArgumentException("Null annotated element");
+      this.annotated = annotated;
+   }
+
+   @SuppressWarnings("unchecked")
+   public AnnotationsItem retrieveAnnotations()
+   {
+      Annotation[] annotations = annotated.getAnnotations();
+      if (annotations.length == 0)
+         return SimpleAnnotationsItem.NO_ANNOTATIONS;
+      
+      AnnotationItem[] items = new AnnotationItem[annotations.length];
+      for (int i = 0; i < items.length; ++i)
+         items[i] = new SimpleAnnotationItem(annotations[i]);
+      return new SimpleAnnotationsItem(items);
+   }
+   
+   public <T extends Annotation> AnnotationItem<T> retrieveAnnotation(Class<T> annotationType)
+   {
+      T annotation = annotated.getAnnotation(annotationType);
+      if (annotation == null)
+         return null;
+      return new SimpleAnnotationItem<T>(annotation);
+   }
+
+   public MetaDataRetrieval getComponentMetaDataRetrieval(Signature signature)
+   {
+      if (signature == null)
+         return null;
+
+      if (annotated instanceof Class)
+      {
+         Class<?> clazz = Class.class.cast(annotated);
+         if (signature instanceof ConstructorSignature)
+         {
+            ConstructorSignature constructorSignature = (ConstructorSignature) signature;
+            Constructor<?> constructor = constructorSignature.getConstructor();
+            if (constructor == null)
+               constructor = SecurityActions.findConstructor(clazz, signature.getParametersTypes(clazz));
+            if (constructor == null)
+            {
+               if (log.isTraceEnabled())
+                  log.trace("Constructor with signature " + signature + " does not exist on class " + clazz.getName());
+               return null;
+            }
+            if (constructor.getAnnotations().length == 0)
+               return NullAnnotatedElementComponentMetaDataLoader.INSTANCE;
+            return new SingletonAnnotatedElementMetaDataLoader(constructor);
+         }
+         else if (signature instanceof MethodSignature)
+         {
+            MethodSignature methodSignature = (MethodSignature) signature;
+            Method method = methodSignature.getMethod();
+            if (method == null)
+               method = SecurityActions.findMethod(clazz, signature.getName(), signature.getParametersTypes(clazz));
+            if (method == null)
+            {
+               if (log.isTraceEnabled())
+                  log.trace("Method with signature " + signature + " does not exist on class " + clazz.getName());
+               return null;
+            }
+            if (method.getAnnotations().length == 0)
+               return NullAnnotatedElementComponentMetaDataLoader.INSTANCE;
+            return new SingletonAnnotatedElementMetaDataLoader(method);
+         }
+         else if (signature instanceof DeclaredMethodSignature)
+         {
+            DeclaredMethodSignature methodSignature = (DeclaredMethodSignature) signature;
+            Method method = methodSignature.getMethod();
+            if (method == null)
+            {
+               clazz = getDeclaringClass(clazz, methodSignature.getDeclaringClass());
+               if (clazz == null)
+                  return null;
+               try
+               {
+                  method = SecurityActions.findDeclaredMethod(clazz, signature.getName(), signature.getParametersTypes(clazz));
+               }
+               catch (NoSuchMethodException nsme)
+               {
+                  if (log.isTraceEnabled())
+                     log.trace("Method with signature " + signature + " does not exist on class " + clazz.getName());
+                  return null;     
+               }
+            }
+            if (method.getAnnotations().length == 0)
+               return NullAnnotatedElementComponentMetaDataLoader.INSTANCE;
+            return new SingletonAnnotatedElementMetaDataLoader(method);
+         }
+         else if (signature instanceof MethodParametersSignature)
+         {
+            MethodParametersSignature methodParametersSignature = (MethodParametersSignature) signature;
+            Method method = methodParametersSignature.getMethod();
+            if (method == null)
+               method = SecurityActions.findMethod(clazz, signature.getName(), signature.getParametersTypes(clazz));
+            if (method == null)
+            {
+               if (log.isTraceEnabled())
+                  log.trace("Method with signature " + signature + " does not exist on class " + clazz.getName());
+               return null;
+            }
+            Annotation[][] paramAnnotations = method.getParameterAnnotations();
+            if (paramAnnotations[methodParametersSignature.getParam()].length == 0)
+               return NullAnnotatedElementComponentMetaDataLoader.INSTANCE;
+            return new SimpleMetaDataLoader(paramAnnotations[methodParametersSignature.getParam()]);
+         }
+         else if (signature instanceof ConstructorParametersSignature)
+         {
+            ConstructorParametersSignature constructorParametersSignature = (ConstructorParametersSignature) signature;
+            Constructor<?> constructor = constructorParametersSignature.getConstructor();
+            if (constructor == null)
+               constructor = SecurityActions.findConstructor(clazz, signature.getParametersTypes(clazz));
+            if (constructor == null)
+            {
+               if (log.isTraceEnabled())
+                  log.trace("Constructor with signature " + signature + " does not exist on class " + clazz.getName());
+               return null;
+            }
+            Annotation[][] paramAnnotations = constructor.getParameterAnnotations();
+            if (paramAnnotations[constructorParametersSignature.getParam()].length == 0)
+               return NullAnnotatedElementComponentMetaDataLoader.INSTANCE;
+            return new SimpleMetaDataLoader(paramAnnotations[constructorParametersSignature.getParam()]);
+         }
+         else if (signature instanceof FieldSignature)
+         {
+            FieldSignature fieldSignature = (FieldSignature) signature;
+            Field field = fieldSignature.getField();
+            if (field == null)
+               field = SecurityActions.findField(clazz, signature.getName());
+            if (field == null)
+            {
+               if (log.isTraceEnabled())
+                  log.trace("Field " + signature.getName() + " does not exist on class " + clazz.getName());
+               return null;
+            }
+            if (field.getAnnotations().length == 0)
+               return NullAnnotatedElementComponentMetaDataLoader.INSTANCE;
+            return new SingletonAnnotatedElementMetaDataLoader(field);
+         }
+      }
+
+      if (annotated instanceof Method)
+      {
+         if (signature instanceof MethodParametersSignature)
+         {
+            Method method = (Method)annotated;
+            Annotation[][] paramAnnotations = method.getParameterAnnotations();
+            MethodParametersSignature sig = (MethodParametersSignature) signature;
+            if (paramAnnotations[sig.getParam()].length == 0)
+               return NullAnnotatedElementComponentMetaDataLoader.INSTANCE;
+            return new SimpleMetaDataLoader(paramAnnotations[sig.getParam()]);
+         }
+      }
+
+      if (annotated instanceof Constructor)
+      {
+         if (signature instanceof ConstructorParametersSignature)
+         {
+            Constructor<?> constructor = Constructor.class.cast(annotated);
+            Annotation[][] paramAnnotations = constructor.getParameterAnnotations();
+            ConstructorParametersSignature sig = (ConstructorParametersSignature) signature;
+            if (paramAnnotations[sig.getParam()].length == 0)
+               return NullAnnotatedElementComponentMetaDataLoader.INSTANCE;
+            return new SimpleMetaDataLoader(paramAnnotations[sig.getParam()]);
+         }
+      }
+
+      return null;
+   }
+
+   public boolean isEmpty()
+   {
+      Annotation[] annotations = annotated.getAnnotations();
+      return annotations == null || annotations.length == 0;
+   }
+
+   public String toString()
+   {
+      JBossStringBuilder buffer = new JBossStringBuilder();
+      Strings.defaultToString(buffer, this);
+      buffer.append("[");
+      buffer.append(annotated);
+      buffer.append("]");
+      return buffer.toString();
+   }
+
+   /**
+    * Get the declaring class from the reference class
+    * 
+    * @param reference the reference class
+    * @param declaringClass the declaring class
+    * @return the class or null if the declaring class is not a super class of the reference
+    */
+   private static Class<?> getDeclaringClass(Class<?> reference, String declaringClass)
+   {
+      while (reference != null)
+      {
+         if (declaringClass.equals(reference.getName()))
+            return reference;
+         
+         reference = reference.getSuperclass();
+      }
+      return null;
+   }
+   
+   /**
+    * http://community.jboss.org/thread/148203
+    * Singleton be returned by AnnotatedElementMetaDataLoader.getComponentMetaDataRetrieval() when there are no annotations for the member. This is to avoid
+    * the overhead of creating a new AnnotatedElementMetaDataLoader even in those cases, something which shows up to be a big bottleneck in AS startup time,
+    * mainly due to the creation of AnnotatedElementMetaDataLoader's ScopeKey.    
+    */
+   private static class NullAnnotatedElementComponentMetaDataLoader implements MetaDataRetrieval
+   {
+      final static NullAnnotatedElementComponentMetaDataLoader INSTANCE = new NullAnnotatedElementComponentMetaDataLoader();
+      final static ScopeKey nullScopeKey = new ScopeKey(new Scope(CommonLevels.JOINPOINT, INSTANCE));
+      
+      final BasicAnnotationsItem noANnnotationsItem = new BasicAnnotationsItem(null, new AnnotationItem[0]);
+      final BasicMetaDatasItem noMetaDatasItem = new BasicMetaDatasItem(null, new MetaDataItem[0]);
+      final ValidTime validTime = new ValidTime();
+      
+      public MetaDataRetrieval getComponentMetaDataRetrieval(Signature signature)
+      {
+         return INSTANCE;
+      }
+
+      public ScopeKey getScope()
+      {
+         return nullScopeKey;
+      }
+
+      public MetaDataRetrieval getScopedRetrieval(ScopeLevel level)
+      {
+         return INSTANCE;
+      }
+
+      public ValidTime getValidTime()
+      {
+         return validTime;
+      }
+
+      public boolean isEmpty()
+      {
+         return true;
+      }
+
+      public <T extends Annotation> AnnotationItem<T> retrieveAnnotation(Class<T> annotationType)
+      {
+         return null;
+      }
+
+      public AnnotationsItem retrieveAnnotations()
+      {
+         return noANnnotationsItem;
+      }
+
+      public AnnotationsItem retrieveAnnotationsAnnotatedWith(Class<? extends Annotation> meta)
+      {
+         return noANnnotationsItem;
+      }
+
+      public AnnotationsItem retrieveLocalAnnotations()
+      {
+         return noANnnotationsItem;
+      }
+
+      public MetaDatasItem retrieveLocalMetaData()
+      {
+         return noMetaDatasItem;
+      }
+
+      public MetaDatasItem retrieveMetaData()
+      {
+         return noMetaDatasItem;
+      }
+
+      public <T> MetaDataItem<T> retrieveMetaData(Class<T> type)
+      {
+         return null;
+      }
+
+      public MetaDataItem<?> retrieveMetaData(String name)
+      {
+         return null;
+      }
+      
+   }
+}

Added: projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/test/CreateScopeKeyBenchmark.java
===================================================================
--- projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/test/CreateScopeKeyBenchmark.java	                        (rev 0)
+++ projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/test/CreateScopeKeyBenchmark.java	2010-05-10 22:51:56 UTC (rev 104641)
@@ -0,0 +1,60 @@
+/*
+* 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.metadata.benchmark.test;
+
+import org.jboss.metadata.spi.scope.CommonLevels;
+import org.jboss.metadata.spi.scope.Scope;
+import org.jboss.metadata.spi.scope.ScopeKey;
+import org.jboss.metadata.spi.scope.UnmodifiableScopeKey;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class CreateScopeKeyBenchmark
+{
+   static int count = 100000;
+   public static void main(String[] args)
+   {
+      Scope[] scopes = new Scope[count];
+      for (int i = 0 ; i < count ; i++)
+      {
+         scopes[i] = new Scope(CommonLevels.JOINPOINT, i); 
+      }
+      
+      ScopeKey[] keys = new ScopeKey[count];
+      long start = System.currentTimeMillis();
+      for (int i = 0 ; i < count ; i++)
+      {
+         keys[i] = new ScopeKey(scopes[i]);
+      }
+      System.out.println("---> " + (System.currentTimeMillis() - start));
+      for (int i = 0 ; i < count ; i++)
+      {
+         if (keys[i] == null)
+            throw new IllegalStateException();
+         if (keys[i].getScopes().iterator().next().equals(scopes[i]) == false)
+            throw new IllegalStateException();
+      }
+   }
+}

Added: projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/test/CreateUnmodifiableScopeKeyBenchmark.java
===================================================================
--- projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/test/CreateUnmodifiableScopeKeyBenchmark.java	                        (rev 0)
+++ projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/test/CreateUnmodifiableScopeKeyBenchmark.java	2010-05-10 22:51:56 UTC (rev 104641)
@@ -0,0 +1,61 @@
+/*
+* 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.metadata.benchmark.test;
+
+import org.jboss.metadata.spi.scope.CommonLevels;
+import org.jboss.metadata.spi.scope.Scope;
+import org.jboss.metadata.spi.scope.ScopeKey;
+import org.jboss.metadata.spi.scope.UnmodifiableScopeKey;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class CreateUnmodifiableScopeKeyBenchmark
+{
+   static int count = 100000;
+   public static void main(String[] args)
+   {
+      Scope[] scopes = new Scope[count];
+      for (int i = 0 ; i < count ; i++)
+      {
+         scopes[i] = new Scope(CommonLevels.JOINPOINT, i); 
+      }
+      
+      ScopeKey[] keys = new ScopeKey[count];
+      long start = System.currentTimeMillis();
+      for (int i = 0 ; i < count ; i++)
+      {
+         keys[i] = new UnmodifiableScopeKey(scopes[i]);
+      }
+      System.out.println("---> " + (System.currentTimeMillis() - start));
+      for (int i = 0 ; i < count ; i++)
+      {
+         if (keys[i] == null)
+            throw new IllegalStateException();
+         if (keys[i].getScopes().iterator().next().equals(scopes[i]) == false)
+            throw new IllegalStateException();
+      }
+   }
+
+}

Added: projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/test/NoComponentMetaDataCachingMetaDataContextBenchmark.java
===================================================================
--- projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/test/NoComponentMetaDataCachingMetaDataContextBenchmark.java	                        (rev 0)
+++ projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/benchmark/test/NoComponentMetaDataCachingMetaDataContextBenchmark.java	2010-05-10 22:51:56 UTC (rev 104641)
@@ -0,0 +1,184 @@
+/*
+* 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.metadata.benchmark.test;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.jboss.metadata.plugins.context.AbstractMetaDataContext;
+import org.jboss.metadata.plugins.loader.memory.MemoryMetaDataLoader;
+import org.jboss.metadata.plugins.loader.reflection.AnnotatedElementMetaDataLoader;
+import org.jboss.metadata.plugins.repository.AbstractMetaDataRepository;
+import org.jboss.metadata.plugins.repository.basic.BasicMetaDataRepository;
+import org.jboss.metadata.spi.MetaData;
+import org.jboss.metadata.spi.retrieval.MetaDataRetrieval;
+import org.jboss.metadata.spi.retrieval.MetaDataRetrievalToMetaDataBridge;
+import org.jboss.metadata.spi.retrieval.RetrievalUtils;
+import org.jboss.metadata.spi.scope.CommonLevels;
+import org.jboss.metadata.spi.scope.Scope;
+import org.jboss.metadata.spi.scope.ScopeKey;
+import org.jboss.metadata.spi.signature.DeclaredMethodSignature;
+import org.jboss.test.metadata.benchmark.support.NullAnnotatedElementMetaDataLoader;
+import org.jboss.test.metadata.benchmark.support.OriginalAnnotatedElementMetaDataLoader;
+import org.jboss.test.metadata.benchmark.support.SingletonAnnotatedElementMetaDataLoader;
+import org.jboss.test.metadata.benchmark.support.ClassNoMethodAnnotation1;
+import org.jboss.test.metadata.benchmark.support.ClassNoMethodAnnotation2;
+import org.jboss.test.metadata.benchmark.support.ClassNoMethodAnnotation3;
+import org.jboss.test.metadata.benchmark.support.ClassNoMethodAnnotation4;
+import org.jboss.test.metadata.benchmark.support.ClassNoMethodAnnotation5;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class NoComponentMetaDataCachingMetaDataContextBenchmark extends TestCase
+{
+//   ClassRetrieval classRetrieval = ClassRetrieval.SINGLETON;
+//   ClassRetrieval classRetrieval = ClassRetrieval.ORIGINAL;
+//   ClassRetrieval classRetrieval = ClassRetrieval.NULL;
+   ClassRetrieval classRetrieval = ClassRetrieval.LATEST; 
+   
+   BasicMetaDataRepository repository = new BasicMetaDataRepository();
+   
+//   boolean caching = true;
+   boolean caching = false;
+   
+   int iterations = 1000;
+   int count = 1000;
+
+   private MetaDataRetrieval createClassRetrieval(Class<?> clazz)
+   {
+      if (classRetrieval == ClassRetrieval.NULL)
+         return new NullAnnotatedElementMetaDataLoader(clazz);
+      if (classRetrieval == ClassRetrieval.SINGLETON)
+         return new SingletonAnnotatedElementMetaDataLoader(clazz);
+      if (classRetrieval == ClassRetrieval.ORIGINAL)
+         return new OriginalAnnotatedElementMetaDataLoader(clazz);
+      if (classRetrieval == ClassRetrieval.LATEST)
+         return new AnnotatedElementMetaDataLoader(clazz);
+      
+      throw new RuntimeException();
+   }
+   
+
+   
+   public void testContexts()
+   {
+      List<MetaDataWrapper> data = createMetaDatas();
+      
+      assertEquals(count, data.size());
+      
+      long start = System.currentTimeMillis();
+      
+      for (int i = 0 ; i < iterations ; i++)
+      {
+         for (MetaDataWrapper wrapper : data)
+         {
+            for (Method m : wrapper.getClazz().getDeclaredMethods())
+            {
+               DeclaredMethodSignature sig = new DeclaredMethodSignature(m);
+               MetaData component = wrapper.getMetaData().getComponentMetaData(sig);
+               if (component != null && component.isEmpty() == false)
+                  throw new IllegalStateException("Expected null MD");
+            }
+         }
+      }
+      
+      System.out.println("------>" + (System.currentTimeMillis() - start));
+   }
+   
+   private List<MetaDataWrapper> createMetaDatas()
+   {
+      List<MetaDataWrapper> metaDatas = new ArrayList<MetaDataWrapper>();
+      
+      MemoryMetaDataLoader jvm = new MemoryMetaDataLoader(new ScopeKey(new Scope(CommonLevels.JVM, "THIS")));
+      for (int i = 0 ; i < count ; i++)
+      {
+         List<MetaDataRetrieval> retrievals = new ArrayList<MetaDataRetrieval>();
+         
+         retrievals.add(jvm);
+         retrievals.add(createClassRetrieval(getAnnotatedElementClass(i)));
+         retrievals.add(new MemoryMetaDataLoader(new ScopeKey(new Scope(CommonLevels.INSTANCE, "Bean" + i))));
+         
+         AbstractMetaDataContext context = new AbstractMetaDataContext(null, retrievals);
+         MetaData metaData = new MetaDataRetrievalToMetaDataBridge(context);
+         
+         if (caching)
+            metaData = RetrievalUtils.createCachedMetaData(metaData);
+         
+         MetaDataWrapper wrapped = new MetaDataWrapper(metaData, getAnnotatedElementClass(i));
+         metaDatas.add(wrapped);
+      }
+      
+      return metaDatas;
+   }
+   private Class<?> getAnnotatedElementClass(int i)
+   {
+      int mod = i % 5;
+      switch (mod)
+      {
+         case 0 :
+            return ClassNoMethodAnnotation1.class;
+         case 1 :
+            return ClassNoMethodAnnotation2.class;
+         case 2 :
+            return ClassNoMethodAnnotation3.class;
+         case 3 :
+            return ClassNoMethodAnnotation4.class;
+         case 4 :
+            return ClassNoMethodAnnotation5.class;
+         default:
+            throw new IllegalStateException();
+      }
+   }
+   
+   private static class MetaDataWrapper
+   {
+      MetaData metaData;
+      Class<?> clazz;
+      
+      public MetaDataWrapper(MetaData metaData, Class<?> clazz)
+      {
+         this.metaData = metaData;
+         this.clazz = clazz;
+      }
+
+      public MetaData getMetaData()
+      {
+         return metaData;
+      }
+      
+      public Class<?> getClazz()
+      {
+         return clazz;
+      }
+   }
+   
+   private enum ClassRetrieval
+   {
+      ORIGINAL, NULL, SINGLETON, LATEST
+   }
+}

Added: projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/loader/reflection/support/BridgeInterface.java
===================================================================
--- projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/loader/reflection/support/BridgeInterface.java	                        (rev 0)
+++ projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/loader/reflection/support/BridgeInterface.java	2010-05-10 22:51:56 UTC (rev 104641)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright (c) 2010, 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.metadata.loader.reflection.support;
+
+/**
+ * @author <a href="cdewolf at redhat.com">Carlo de Wolf</a>
+ */
+public interface BridgeInterface<T>
+{
+   T unambiguous(T t);
+   
+   T ambiguous(T t);
+}

Added: projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/loader/reflection/support/BridgeMethodBean.java
===================================================================
--- projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/loader/reflection/support/BridgeMethodBean.java	                        (rev 0)
+++ projects/jboss-mdr/branches/2.0.2.GA_JBPAPP-4220/src/test/java/org/jboss/test/metadata/loader/reflection/support/BridgeMethodBean.java	2010-05-10 22:51:56 UTC (rev 104641)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright (c) 2010, 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.metadata.loader.reflection.support;
+
+import org.jboss.test.metadata.shared.support.TestAnnotation;
+
+/**
+ * @author <a href="cdewolf at redhat.com">Carlo de Wolf</a>
+ */
+public class BridgeMethodBean implements BridgeInterface<String>
+{
+   @TestAnnotation
+   public String unambiguous(String t)
+   {
+      throw new RuntimeException("NYI: org.jboss.test.metadata.loader.reflection.support.BridgedMethodBean.unambiguous");
+   }
+   
+   @TestAnnotation
+   public String ambiguous(String t)
+   {
+      throw new RuntimeException("NYI: org.jboss.test.metadata.loader.reflection.support.BridgedMethodBean.ambiguous");
+   }
+   
+   @TestAnnotation
+   public Long ambiguous(Long t)
+   {
+      throw new RuntimeException("NYI: org.jboss.test.metadata.loader.reflection.support.BridgedMethodBean.ambiguous");
+   }
+}




More information about the jboss-cvs-commits mailing list