mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
can be final: should not trigger static fields with initializer in a constructor (IDEA-69011)
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
<problem>
|
||||
<file>Foo.java</file>
|
||||
<line>2</line>
|
||||
<description>final</description>
|
||||
</problem>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
public final class Foo {
|
||||
private static Object f1 = new Object(); // Can be final but unused
|
||||
private static Object object; // can't be final
|
||||
|
||||
Foo() {
|
||||
object = new Object();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(Foo.f1);
|
||||
System.out.println(Foo.object);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user