Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Resolving generics TT in method signature(<T:Ljava.lang.Object;>([TT;)[TT; )
Resolving generics TT in method signature [message #874727] Mon, 21 May 2012 12:49 Go to next message
Marcel Bruch is currently offline Marcel BruchFriend
Messages: 230
Registered: July 2009
Senior Member
Hi,

is there a simple means to resolve TT to java.lang.Object as given in the Signature <T:Ljava.lang.Object;>([TT;)[TT; using JDT utility methods?

org.eclipse.jdt.core.Signature offers a wealth of methods that remove any kind of generics - but I couldn't find anything that would help me to resolve TT.

Thanks,
Marcel


tw: @MarcelBruch
tw: @Recommenders

[Updated on: Mon, 21 May 2012 12:50]

Report message to a moderator

Re: Resolving generics TT in method signature [message #874983 is a reply to message #874727] Mon, 21 May 2012 22:33 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1048
Registered: July 2009
Senior Member
Hi Marcel,

AFAICS the Signature class only performs strictly syntactic translations, whereas resolving is a semantic operation.

Considering the next logical step, what would you expect from
<T::I1;:I2;> m(TT;)V
(where T is a type variable with two bounds)? If you'd want the actual erasure you'd need to find the least upper bound, which however is implemented only for bindings (and can only be).

You probably don't want to go through any resolved bindings, right?

If you just need the special case for unbounded type variables, I'm afraid you may have to code this yourself.

best,
Stephan
Re: Resolving generics TT in method signature [message #875061 is a reply to message #874983] Tue, 22 May 2012 04:23 Go to previous messageGo to next message
Marcel Bruch is currently offline Marcel BruchFriend
Messages: 230
Registered: July 2009
Senior Member
Hi Stephan,

thanks for your answer. So, I've to create that mapping by myself. I've to dig a little deeper into the signatures then and figure out how these strings are composed.

>You probably don't want to go through any resolved bindings, right?

I don't have them at this point. I only have signatures stored in the CompletionProposals. I just have to be sure that I can map any JDT signature to their bytecode counterpart. Otherwise I may fail to find the right proposals. http://goo.gl/aadho http://goo.gl/9YtZL

Thanks.
Marcel


tw: @MarcelBruch
tw: @Recommenders
Re: Resolving generics TT in method signature [message #875448 is a reply to message #875061] Tue, 22 May 2012 19:18 Go to previous message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1048
Registered: July 2009
Senior Member
Marcel Bruch wrote on Tue, 22 May 2012 06:23
I just have to be sure that I can map any JDT signature to their bytecode counterpart. Otherwise I may fail to find the right proposals.


So, Engine.getSignature() prefers generic signatures over raw ones. Out of curiosity: why do you need to compare against raw signatures? Where do you get those from?

best,
Stephan

Previous Topic:Why does cancel button exist?
Next Topic:Eclipe always opening same files
Goto Forum:
  


Current Time: Sat Dec 20 01:02:14 GMT 2014

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

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