Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Obtaining method bindings for types not explicitly declaring them
Obtaining method bindings for types not explicitly declaring them [message #1724726] Thu, 25 February 2016 15:37 Go to next message
Codetrails Team is currently offline Codetrails TeamFriend
Messages: 5
Registered: July 2014
Junior Member
My scenario is this:

class GrandParent<T> {
   public T m(T t) { return null; }
}

class Parent extends GrandParent<String> {
}

class Example extends Parent {
   public String m(String t) { return ""; }
}


In this AST I can easily obtain an IMethodBinding for both declarations of m(): GrandParent.m(T) and Example.m(String).

However, i would like to obtain the binding for Parent.m(String).

Is this possible? Can there even be such a binding?

If such a binding doesn't exist, can i artificially create it, i.e. by manually creating a key and parsing it with some existing utility method?
Re: Obtaining method bindings for types not explicitly declaring them [message #1724731 is a reply to message #1724726] Thu, 25 February 2016 15:52 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
When you obtain the ITypeBinding for Parent, what do you see in parentType.getDeclaredMethods()?
Re: Obtaining method bindings for types not explicitly declaring them [message #1724732 is a reply to message #1724731] Thu, 25 February 2016 15:53 Go to previous message
Codetrails Team is currently offline Codetrails TeamFriend
Messages: 5
Registered: July 2014
Junior Member
parentType.getDeclaredMethods() returns an empty array
Previous Topic:Correct call for ASTParser.setEnvironment(...)
Next Topic:Dynamic Compilation and Class Loader (file deletion during runtime without delay...)
Goto Forum:
  


Current Time: Fri Apr 26 03:01:33 GMT 2024

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

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

Back to the top