Generic type parser [message #207678] |
Thu, 23 June 2005 11:16 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
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 06:54 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
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.03262 seconds