mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-125361 (False positive 'Field may be final')
This commit is contained in:
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -130,8 +130,8 @@ public final class DefiniteAssignmentUtil {
|
||||
}
|
||||
final boolean da = definiteAssignment.isDefinitelyAssigned();
|
||||
final boolean du = definiteAssignment.isDefinitelyUnassigned();
|
||||
definiteAssignment.set(true, false);
|
||||
for (PsiMethod method : anonymousClass.getMethods()) {
|
||||
definiteAssignment.set(true, false);
|
||||
checkCodeBlock(method.getBody(), definiteAssignment);
|
||||
}
|
||||
definiteAssignment.set(da, du);
|
||||
|
||||
+35
-1
@@ -885,4 +885,38 @@ class T58 {
|
||||
System.out.println("x = " + T58.x);
|
||||
x = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
class Foo {
|
||||
|
||||
public interface Accessor<T> {
|
||||
|
||||
T get();
|
||||
|
||||
void set(T value);
|
||||
|
||||
}
|
||||
|
||||
private double myValue; // no warning expected here
|
||||
|
||||
private final Accessor<Double> myValueAccessor;
|
||||
|
||||
public Foo() {
|
||||
myValue = 0;
|
||||
|
||||
myValueAccessor = new Accessor<Double>() {
|
||||
@Override
|
||||
public Double get() {
|
||||
return myValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(Double value) {
|
||||
myValue = value; // assignment
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public Accessor<Double> getValueAccessor() {
|
||||
return myValueAccessor;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user