javac allows instance access through types (like C++), but the JLS explicitly
disallows this. This is one of the many ways Java is better than C++ and it
will be great if javac can also be simplified likewise.
Example:
class C {
int x;
int y = C.x;
}
The reference to x as C.x is illegal, but javac allows it.
disallows this. This is one of the many ways Java is better than C++ and it
will be great if javac can also be simplified likewise.
Example:
class C {
int x;
int y = C.x;
}
The reference to x as C.x is illegal, but javac allows it.
- duplicates
-
JDK-4071330 treats qualified access like access via simple name
-
- Closed
-
-
JDK-4074927 Illegal code compiles
-
- Closed
-