Warning in getConstructor() in Java 6

I'm having compilation wornings after I switched to Java 6 in the following code:

Class cls = ...

Constructor constr = cls.getConstructor(Long.class, Date.class);

warning: [unchecked] unchecked call to getConstructor(java.lang.Class<?>...) as a member of the raw type java.lang.Class

Whatever I tried, I cannot get rid of this warning. Anybody can help?

Thanks,

Pavel

[417 byte] By [Pavel200a] at [2007-11-27 7:52:29]
# 1

Since 1.5, Class and Constructor are generic classes, so you can do such things as

Constructor<MyClass> clazz = MyClass.getDeclaredConstructor(null);

// notice how newInstance returns MyClass, no need to cast

MyClass myClass = clazz.newInstance();

To avoid the warning, you can simply declare constr as a Constructor<?>

georgemca at 2007-7-12 19:33:42 > top of Java-index,Core,Core APIs...
# 2
But I cannot use explicit reference to MyClass since I don't have one. Instead I have several classes which extend abstract MyClass.
pavel200a at 2007-7-12 19:33:42 > top of Java-index,Core,Core APIs...
# 3
> But I cannot use explicit reference to MyClass since> I don't have one. Instead I have several classes> which extend abstract MyClass.Constructor<? extends MyClass> con1;Constructor<?> con2;
georgemca at 2007-7-12 19:33:42 > top of Java-index,Core,Core APIs...
# 4
Thanks, that was helpful.
pavel200a at 2007-7-12 19:33:43 > top of Java-index,Core,Core APIs...