From CompletionContext.getExpectedTypes* to type names (with type parameters expanded) [message #1420879] |
Wed, 10 September 2014 16:08 |
Andreas Sewe Messages: 111 Registered: June 2013 |
Senior Member |
|
|
Possibly reviving an old discussion Marcel and Stephan had 5 years ago:
Our situation (as manifested in Code Recommenders' Bug 443700) is that we somehow need to be able to tell, given an org.eclipse.jdt.core.CompletionContext, what types are expected.
Now, CompletionContext.getExpectedTypesSignatures() occasionally answers something less than helpful like "TT;", which makes it very hard to infer what type T would erase to (if there are bounds other than java.lang.Object present).
In contrast, CompletionContext.getExpectedTypesKeys() seems to contain a lot of information (like "Lorg/junit/Assert;.assertThat<T:Ljava/lang/Object;>(TT;Lorg/hamcrest/Matcher<-TT;>;)V:TT;" from the aforementioned bug report) about both T and its bounds (if any), but in a format that's not really meant for parsing and further consumption.
So, is there a way of mapping a type key to something more useful, e.g., a TypeBinding?
In a situation like
<N extends Number> void method(N n) { }
void caller() { method(<Ctrl+Space>); }
I'd really like to know that a java.lang.Number is expected, not just an "TN;".
Any advice?
|
|
|
Powered by
FUDForum. Page generated in 0.02331 seconds