Generic type parser [message #207678] |
Thu, 23 June 2005 07:16  |
Eclipse User |
|
|
|
Originally posted by: julien.omondo.com
Hi,
I'm looking for a utility to convert the Java generic type declaration to
signature such as the method Signature.createTypeSignature(). But it doesn't
work for generic type. For example:
Signature.createTypeSignature("java.util.Collection<E>", true)
java.lang.IllegalArgumentException: java.util.Collection<E>
at
org.eclipse.jdt.core.Signature.createCharArrayTypeSignature( Signature.java:623)
at org.eclipse.jdt.core.Signature.createTypeSignature(Signature .java:595)
at org.eclipse.jdt.core.Signature.createTypeSignature(Signature .java:887)
thanks
julien
|
|
|
Re: Generic type parser [message #208074 is a reply to message #207678] |
Tue, 28 June 2005 02:54  |
Eclipse User |
|
|
|
Originally posted by: plankton.softwitch.net
julien wrote:
> Hi,
>
> I'm looking for a utility to convert the Java generic type declaration to
> signature such as the method Signature.createTypeSignature(). But it doesn't
> work for generic type. For example:
>
> Signature.createTypeSignature("java.util.Collection<E>", true)
> java.lang.IllegalArgumentException: java.util.Collection<E>
>
> at
> org.eclipse.jdt.core.Signature.createCharArrayTypeSignature( Signature.java:623)
>
> at org.eclipse.jdt.core.Signature.createTypeSignature(Signature .java:595)
>
> at org.eclipse.jdt.core.Signature.createTypeSignature(Signature .java:887)
>
>
> thanks
> julien
>
>
I think you know, Java's GenericType is much different from c/c++.
Vector<Object> and Vector<String> is perfectly same on runtime, and
there is a only single class. there is a no way to identificate them
while run-time. So, for any reason, we can't use genric-type on
run-time. generic datas are lost on compile time.
there are several reasosn why sun develpoed like this. anyway biggest
one is for type-safety. SUN wanted to know miss-casting during compile.
so JDK5.0 don't allow runtime-generic.
|
|
|
Powered by
FUDForum. Page generated in 0.05592 seconds