mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 05:10:22 +07:00
Java: Intention that wraps list/set/map with Collections.unmodifiable - don't suggest on the left-hand side of assignment (IDEA-208885)
This commit is contained in:
@@ -97,7 +97,7 @@ public class WrapWithUnmodifiableAction extends BaseIntentionAction {
|
||||
}
|
||||
PsiExpression expression = getParentExpression(editor, file);
|
||||
if (expression != null) {
|
||||
if (isUnmodifiable(expression)) {
|
||||
if (PsiUtil.isOnAssignmentLeftHand(expression) || isUnmodifiable(expression)) {
|
||||
return false;
|
||||
}
|
||||
PsiClass psiClass = PsiUtil.resolveClassInClassTypeOnly(expression.getType());
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Wrap with unmodifiable map" "false"
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
|
||||
class C {
|
||||
Map<String, String> map;
|
||||
{
|
||||
this.<caret>map = new HashMap<>();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user