non-static fields should not be available in static context even if they are compile time constants (IDEA-150030)

This commit is contained in:
Anna Kozlova
2016-03-14 21:34:56 +01:00
parent ee9d80495a
commit 1aa1c9a921
2 changed files with 12 additions and 1 deletions
@@ -7,4 +7,15 @@ class Test {
<error descr="Inner classes cannot have static declarations">static</error> final Object j = <error descr="Non-static variable 'o' cannot be referenced from a static context">o</error>;
}
}
private final String a = "A";
static void foo() {
System.out.println(<error descr="Non-static field 'a' cannot be referenced from a static context">a</error>);
}
void f() {
class A4 {
static final String t = <error descr="Non-static field 'a' cannot be referenced from a static context">a</error>;
}
}
}