Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » From CompletionContext.getExpectedTypes* to type names (with type parameters expanded)
From CompletionContext.getExpectedTypes* to type names (with type parameters expanded) [message #1420879] Wed, 10 September 2014 16:08
Andreas Sewe is currently offline Andreas SeweFriend
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?
Previous Topic:specify "directory target" in jardesc
Next Topic:MQTT + Eclipse Paho + Java 8 + compiler with line command
Goto Forum:
  


Current Time: Mon Dec 02 09:03:21 GMT 2024

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

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

Back to the top