Community

AnnotatedElementMetaDataLoader and bridge methods

reply from Kabir Khan in JBoss Microcontainer Development - View the full discussion

I've made AnnotatedElementMetaDataLoader attempt to find a matching method. If it cannot be found, a null element loader is returned (or maybe I should throw an exception instead?)

 

Just so I remember in case I need to come back to it, this simple test

 

public class BridgeMethodTest
{
   static class BaseGenerics<T>
   {
      T getThing(T t)
      {
         return t;
      }
   }

   static class ChildGenerics extends BaseGenerics<String>
   {
      String getThing(String s)
      {
         return s;
      }
   }

   public static void main(String[] args)
   {
      for (Method m : ChildGenerics.class.getDeclaredMethods())
         System.out.println(m + " - " + m.isBridge());
   }
}


 

gives

 

java.lang.String org.jboss.test.benchmark.BridgeMethodTest$ChildGenerics.getThing(java.lang.String) - false
java.lang.Object org.jboss.test.benchmark.BridgeMethodTest$ChildGenerics.getThing(java.lang.Object) - true

Reply to this message by going to Community

Start a new discussion in JBoss Microcontainer Development at Community