1 2 Previous Next 16 Replies Latest reply on Mar 6, 2008 4:03 PM by starksm64 Go to original post
      • 15. Re: Using a CompositeMetaType for a Map with String keys?

         

        "scott.stark@jboss.org" wrote:
        I don't understand why you don't value.getClass() is not the same ParameterizedType that you get from the field/method getGenericType()/getGenericReturnType().


        The generic types only survive on the compile time view,
        e.g. constructors, methods, fields, etc.
        they aren't used anywhere else.

        e.g. what should this do? Should it change the value from getClass() as you cast? :-)

        public void doSomething(HashMap<String, String> map)
        {
         HashMap erased = (HashMap) map; // erased.getClass() == plain class
         HashMap<String, String> unerased = erased; // unerased.getClass() == parameterized type
        }
        


        It would also break backwards compatibility if this wasn't true
        assert unerased.getClass() == erased.getClass();
        


        • 16. Re: Using a CompositeMetaType for a Map with String keys?
          starksm64

          Ok, I see.

          1 2 Previous Next