java: highlighting for statics in anonymous classes

This commit is contained in:
Roman Shevchenko
2013-09-16 13:01:31 +04:00
parent 2c8eb0da10
commit 20150830af
3 changed files with 23 additions and 7 deletions

View File

@@ -48,7 +48,7 @@ public class a {
<error descr="Inner classes cannot have static declarations">static</error>
final int f2 = x instanceof Integer ? 1 : 0;
<error descr="Modifier 'static' not allowed here">static</error>
<error descr="Inner classes cannot have static declarations"><error descr="Modifier 'static' not allowed here">static</error></error>
class a_ic_c2 {}
<error descr="Inner classes cannot have static declarations">static</error>
@@ -75,7 +75,7 @@ public class a {
<error descr="Inner classes cannot have static declarations">static</error>
final int f2 = x instanceof Integer ? 1 : 0;
<error descr="Modifier 'static' not allowed here">static</error>
<error descr="Inner classes cannot have static declarations"><error descr="Modifier 'static' not allowed here">static</error></error>
class a_ic_c2 {}
<error descr="Inner classes cannot have static declarations">static</error>

View File

@@ -91,7 +91,7 @@ enum OurEnum {
enum TestEnum
{
A(<error descr="Illegal forward reference">B</error>), B(A);
A(<error descr="Illegal forward reference">B</error>), B(A);
TestEnum(TestEnum other) {
<error descr="Call to super is not allowed in enum constructor">super(null, 0)</error>;
}
@@ -115,8 +115,7 @@ class X extends <error descr="Classes cannot directly extend 'java.lang.Enum'">E
enum StaticInEnumConstantInitializer {
AN {
<error descr="Modifier 'static' not allowed here">static</error> class s {
}
<error descr="Inner classes cannot have static declarations"><error descr="Modifier 'static' not allowed here">static</error></error> class s { }
private <error descr="Inner classes cannot have static declarations">static</error> final String t = String.valueOf(1);
};
}
@@ -176,7 +175,6 @@ enum MyEnum {
}
//end of IDEADEV-8192
class EnumBugIDEADEV15333 {
public enum Type { one, to }
Type type = Type.one;
@@ -187,3 +185,21 @@ class EnumBugIDEADEV15333 {
}
}
}
class NestedEnums {
enum E1 { }
class C2 {
<error descr="Inner classes cannot have static declarations">enum E2</error> { }
}
static class C3 {
enum E3 { }
}
{
new C3() {
<error descr="Inner classes cannot have static declarations">enum E2</error> { }
};
}
}