Skip to content

Commit

Permalink
Check initializer != null in reassignment.
Browse files Browse the repository at this point in the history
Fix a `NullPointerException` and false positives in ordinary methods.
  • Loading branch information
nnym committed Nov 1, 2022
1 parent ce7aad4 commit de8a4f1
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public class HighlightFilter implements HighlightInfoFilter {
var declaration = parent.getParent() instanceof PsiReference reference ? reference.resolve() : ((PsiReference) parent).resolve();

return !(declaration instanceof PsiField field
&& initializer != null
&& initializer.hasModifier(JvmModifier.STATIC) == field.hasModifier(JvmModifier.STATIC)
&& !PsiUtil.isConstantExpression(field.getInitializer())
&& PsiUtil.findEnclosingConstructorOrInitializer(LambdaUtil.getContainingClassOrLambda(element)) != initializer
Expand Down

0 comments on commit de8a4f1

Please sign in to comment.