3 Replies Latest reply on Jan 31, 2007 12:35 PM by Adrian Brock

    Bug in Sun compiler?

    Adrian Brock Master

      I found this while looking at a microcontainer test.

      It fails in both JDK5 and JDK6, but works with eclipse.

      Looks like a bug to me? Anybody confirm?

      package test;
      import java.lang.reflect.Constructor;
      import java.lang.reflect.Type;
      import java.util.Arrays;
      public class Main
       public static void main(String[] args) throws Exception
       Class<MyEnum> clazz = MyEnum.class;
       Constructor<MyEnum> constructor = clazz.getDeclaredConstructor(new Class[] { String.class, Integer.TYPE });
       Type[] types = constructor.getParameterTypes();
       Type[] generic = constructor.getGenericParameterTypes();
       System.out.println("types = " + Arrays.asList(types));
       System.out.println("generic = " + Arrays.asList(generic));
       if (Arrays.equals(types, generic) == false)
       throw new RuntimeException("They should be the same?");
       public enum MyEnum { ONE, TWO, THREE };