Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Why doesn't a local variable's IBinding have a declaring class, when in a class initializer?
Why doesn't a local variable's IBinding have a declaring class, when in a class initializer? [message #648125] Tue, 11 January 2011 11:08 Go to next message
Arlindo is currently offline ArlindoFriend
Messages: 33
Registered: August 2009
Member
I've noticed, local variables declared in an instance initializer have no "declaring class" (IVariableBinding.getDeclaringClass() returns null).

However, classes declared inside an instance initializer return the enclosing class as the declaring class.

Should this inconsistency be considered a bug?

public class Initializer {
    {
        int i = 2;       // has no declaring class
        class Inside { } // has declaring class
    }
}
Re: Why doesn't a local variable's IBinding have a declaring class, when in a class initializer? [message #648167 is a reply to message #648125] Tue, 11 January 2011 14:57 Go to previous message
Olivier Thomann is currently offline Olivier ThomannFriend
Messages: 518
Registered: July 2009
Senior Member
This is what the javadoc of the getDeclaringClass() method defines. So changing it would be a breaking API change.

This can only be done by defining a new API.

Olivier
Previous Topic:Creating a Java search scope without creating a project?
Next Topic:Java Perspective sees a project; Java Browsing Perspective doesn't
Goto Forum:
  


Current Time: Thu Apr 25 08:14:25 GMT 2024

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

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

Back to the top