mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
anonym -> lambda: reject refs to the next static from static field initializer
This commit is contained in:
+1
-1
@@ -508,7 +508,7 @@ public class AnonymousCanBeLambdaInspection extends BaseJavaBatchLocalInspection
|
||||
final PsiExpression initializer = ((PsiField)resolved).getInitializer();
|
||||
if (initializer == null ||
|
||||
resolved == member ||
|
||||
initializer.getTextOffset() > myAnonymClass.getTextOffset() && !((PsiField)resolved).hasModifierProperty(PsiModifier.STATIC)) {
|
||||
initializer.getTextOffset() > myAnonymClass.getTextOffset() && ((PsiField)resolved).hasModifierProperty(PsiModifier.STATIC) == member.hasModifierProperty(PsiModifier.STATIC)) {
|
||||
myBodyContainsForbiddenRefs = true;
|
||||
return;
|
||||
}
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Replace with lambda" "false"
|
||||
import java.util.function.Function;
|
||||
|
||||
class Test {
|
||||
private static final Function<String, String> FUN = new Fun<caret>ction<String, String>() {
|
||||
@Override
|
||||
public String apply(final String s) {
|
||||
return B_FUN.apply(s);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
private static final Function<String, String> B_FUN = null;
|
||||
}
|
||||
Reference in New Issue
Block a user