Skip to main content



      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 06:08 Go to next message
Eclipse UserFriend
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 09:57 Go to previous message
Eclipse UserFriend
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: Wed Jul 23 09:35:31 EDT 2025

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

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

Back to the top