Name: tb29552 Date: 08/12/97
In the following code, the qualified name C.y is illegal,
because C names a type, and y names a non-static member of
that type. Javac accepts this code inside an instance
method of C, which implies it is using the presence of
"this" as a reason for allowing the access.
class C {
int y = 5;
void f () {
System.out.println(C.y); // looks like javac is treating as "this.y"
}
}
======================================================================
- duplicates
-
JDK-4045101 javac allows illegal qualified name class_name.instance_field
-
- Closed
-
-
JDK-4087127 Instance access through types not allowed
-
- Closed
-