IDEA-243546 Allow local interfaces and enums on language level 15-preview (part of JEP 384)

Also: fix non-static access checks for local interfaces/enums/records (JEP 384)
Also: i18n of error messages

GitOrigin-RevId: 40448f089229d77e32eb200b4011e1aea09391b0
This commit is contained in:
Tagir Valeev
2020-06-16 09:43:13 +03:00
committed by intellij-monorepo-bot
parent 1a1a2b05a6
commit 2072855222
16 changed files with 257 additions and 58 deletions
@@ -2,7 +2,7 @@ class Foo {
void test() {
record NoComponent() {}
static record DeclaredStatic() {}
<error descr="Modifier 'static' not allowed here">static</error> record DeclaredStatic() {}
<error descr="Modifier 'private' not allowed here">private</error> record Private() {}
}
@@ -22,8 +22,19 @@ class Foo {
System.out.println(<error descr="Non-static field 'instanceVar' cannot be referenced from a static context">instanceVar</error>);
System.out.println(<error descr="Non-static variable 'outerLocal' cannot be referenced from a static context">outerLocal</error>);
System.out.println(X);
System.out.println(compileTimeConstant);
System.out.println(<error descr="Non-static variable 'compileTimeConstant' cannot be referenced from a static context">compileTimeConstant</error>);
}
}
}
<T> void typeParameter() {
record R(<error descr="'T' cannot be referenced from a static context">T</error> t) {}
}
static class Box<T> {
void test() {
T t;
record R(<error descr="'Foo.Box.this' cannot be referenced from a static context">T</error> t) {}
}
}
}