Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » How to get actual IMethodBinding for anonymous class constructor?
How to get actual IMethodBinding for anonymous class constructor? [message #1719971] Wed, 13 January 2016 14:04 Go to next message
Sergey Toshin is currently offline Sergey ToshinFriend
Messages: 56
Registered: May 2015
Member
Hello,
Let's assume that I have a code
class Base
{
	public Base()
	{
		System.out.println("Hello");
	}
}

new Base()
{
	public void test()
	{
		
	}
};

It means that when I call
new Base(){...} 

this constructor will be called
public Base()
{
	System.out.println("Hello");
}

but when I try to get key of IMethodBinding of this ClassInstanceCreation, I receive another key than actual constructor has. So my question is how to get this key? Thanks
Re: How to get actual IMethodBinding for anonymous class constructor? [message #1720339 is a reply to message #1719971] Sun, 17 January 2016 20:20 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
Strictly speaking, the anonymous instantiation will invoke the ctor of Base only indirectly via super().
That means that seeing different keys from the instance creation and the ctor declaration should be expected.
OTOH, I'm not 100% sure, what exactly you're trying to achieve.
Stephan
Re: How to get actual IMethodBinding for anonymous class constructor? [message #1720355 is a reply to message #1720339] Mon, 18 January 2016 07:42 Go to previous messageGo to next message
Sergey Toshin is currently offline Sergey ToshinFriend
Messages: 56
Registered: May 2015
Member
Sorry, but I want to get IMethodBinding in implicit ctor call. The given example demonstrates this. Here is no implitic call to super(...), but it's called. So my point is to get somehow IMethodBinding for super() which will be called
Re: How to get actual IMethodBinding for anonymous class constructor? [message #1720356 is a reply to message #1720339] Mon, 18 January 2016 07:42 Go to previous messageGo to next message
Sergey Toshin is currently offline Sergey ToshinFriend
Messages: 56
Registered: May 2015
Member
No Message Body
Re: How to get actual IMethodBinding for anonymous class constructor? [message #1721447 is a reply to message #1720356] Wed, 27 January 2016 14:40 Go to previous message
Sergey Toshin is currently offline Sergey ToshinFriend
Messages: 56
Registered: May 2015
Member
Any ideas?
Previous Topic:running Java program problem
Next Topic:Creating a new Eclipse project with a Git repository
Goto Forum:
  


Current Time: Fri Apr 26 21:08:10 GMT 2024

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

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

Back to the top