mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix message for final locals used inside local/anonym classes in java 8 (IDEA-131949)
This commit is contained in:
+3
-2
@@ -651,10 +651,11 @@ public class HighlightControlFlowUtil {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if (languageLevel.isAtLeast(LanguageLevel.JDK_1_8) && isEffectivelyFinal(variable, innerClass, context)) {
|
||||
final boolean isToBeEffectivelyFinal = languageLevel.isAtLeast(LanguageLevel.JDK_1_8);
|
||||
if (isToBeEffectivelyFinal && isEffectivelyFinal(variable, innerClass, context)) {
|
||||
return null;
|
||||
}
|
||||
final String description = JavaErrorMessages.message("variable.must.be.final", context.getText());
|
||||
final String description = JavaErrorMessages.message(isToBeEffectivelyFinal ? "variable.must.be.final.or.effectively.final" : "variable.must.be.final", context.getText());
|
||||
|
||||
final HighlightInfo highlightInfo =
|
||||
HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(context).descriptionAndTooltip(description).create();
|
||||
|
||||
@@ -134,6 +134,7 @@ variable.already.assigned=Variable ''{0}'' might already have been assigned to
|
||||
variable.assigned.in.loop=Variable ''{0}'' might be assigned in loop
|
||||
assignment.to.final.variable=Cannot assign a value to final variable ''{0}''
|
||||
variable.must.be.final=Variable ''{0}'' is accessed from within inner class, needs to be declared final
|
||||
variable.must.be.final.or.effectively.final=Variable ''{0}'' is accessed from within inner class, needs to be final or effectively final
|
||||
initializer.must.be.able.to.complete.normally=Initializer must be able to complete normally
|
||||
weaker.privileges={0}; attempting to assign weaker access privileges (''{1}''); was ''{2}''
|
||||
incompatible.return.type=attempting to use incompatible return type
|
||||
|
||||
+1
-1
@@ -108,7 +108,7 @@ class ParameterIsEffectivelyFinal {
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
System.out.println(<error descr="Variable 'o' is accessed from within inner class, needs to be declared final">o</error>);
|
||||
System.out.println(<error descr="Variable 'o' is accessed from within inner class, needs to be final or effectively final">o</error>);
|
||||
}
|
||||
}.run();
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user