Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Generic type parser
Generic type parser [message #207678] Thu, 23 June 2005 11:16 Go to next message
Eclipse UserFriend
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
Eclipse UserFriend
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.
Previous Topic:.class files hidden in Package Explorer view
Next Topic:How do I use the Eclipse compiler from within a standalone ANT?
Goto Forum:
  


Current Time: Sun Jun 30 13:51:14 GMT 2024

Powered by FUDForum. Page generated in 0.03299 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top