IJPF-CR-30511 [java-highlighting] IDEA-252433 Suggest the correct import when the wrong one was chosen from ambiguous

- change `to` with `with`

(cherry picked from commit c3e68d77a1b5ee1a5b252b19027cc061609ca9d6)

GitOrigin-RevId: 9ad86fb558f91e64e4a1068f5ea134424e3aff67
This commit is contained in:
Mikhail Pyltsin
2025-10-14 15:35:34 +02:00
committed by intellij-monorepo-bot
parent 0955865e8f
commit 8a4ce41c1c
2 changed files with 14 additions and 14 deletions

View File

@@ -147,8 +147,8 @@ enable.optimize.imports.on.the.fly=Enable 'Settings | Editor | General | Auto Im
implement.methods.fix=Implement methods
import.class.fix=Import class
replace.type.new.expression.family.name=Replace a constructor call type
replace.type.new.expression.name=Replace a constructor call type to ''{0}''
replace.type.variable.name=Replace a variable type to ''{0}''
replace.type.new.expression.name=Replace a constructor call type with ''{0}''
replace.type.variable.name=Replace a variable type with ''{0}''
insert.new.fix=Insert new
insert.super.constructor.call.family=Insert base class constructor call
make.class.an.interface.family=Make Class an Interface

View File

@@ -26,7 +26,7 @@ public class ReplaceTypeWithWrongImportFixTest extends LightJavaCodeInsightFixtu
void call(B<String> b){}
""");
IntentionAction intention = myFixture.findSingleIntention("Replace a constructor call type to 'bar.p2.A<String>'");
IntentionAction intention = myFixture.findSingleIntention("Replace a constructor call type with 'bar.p2.A<String>'");
assertEquals(myFixture.getIntentionPreviewText(intention),
"""
import bar.p1.A;
@@ -63,7 +63,7 @@ public class ReplaceTypeWithWrongImportFixTest extends LightJavaCodeInsightFixtu
B<? extends Object> b = new A<caret><String>("1");
}
""");
myFixture.launchAction(myFixture.findSingleIntention("Replace a variable type to 'bar.p1.B<? extends java.lang.Object>'"));
myFixture.launchAction(myFixture.findSingleIntention("Replace a variable type with 'bar.p1.B<? extends java.lang.Object>'"));
myFixture.checkResult("""
import bar.p1.A;
import bar.p1.B;
@@ -109,7 +109,7 @@ public class ReplaceTypeWithWrongImportFixTest extends LightJavaCodeInsightFixtu
B b = new A<caret><String>("1");
}
""");
myFixture.launchAction(myFixture.findSingleIntention("Replace a variable type to 'bar.p1.B<java.lang.String>'"));
myFixture.launchAction(myFixture.findSingleIntention("Replace a variable type with 'bar.p1.B<java.lang.String>'"));
myFixture.checkResult("""
import bar.p1.A;
import bar.p1.B;
@@ -135,7 +135,7 @@ public class ReplaceTypeWithWrongImportFixTest extends LightJavaCodeInsightFixtu
return new A<String>("1");
}
""");
myFixture.launchAction(myFixture.findSingleIntention("Replace a variable type to 'bar.p1.B<java.lang.String>'"));
myFixture.launchAction(myFixture.findSingleIntention("Replace a variable type with 'bar.p1.B<java.lang.String>'"));
myFixture.checkResult("""
import bar.p1.A;
import bar.p1.B;
@@ -161,7 +161,7 @@ public class ReplaceTypeWithWrongImportFixTest extends LightJavaCodeInsightFixtu
B<? extends Object> b = new A<caret><String>("1");
}
""");
myFixture.launchAction(myFixture.findSingleIntention("Replace a constructor call type to 'bar.p2.A<String>'"));
myFixture.launchAction(myFixture.findSingleIntention("Replace a constructor call type with 'bar.p2.A<String>'"));
myFixture.checkResult("""
import bar.p2.A;
import bar.p2.B;
@@ -194,7 +194,7 @@ public class ReplaceTypeWithWrongImportFixTest extends LightJavaCodeInsightFixtu
B<? extends Object> b = new A<caret><String>("1");
}
""");
assertEmpty(myFixture.filterAvailableIntentions("Replace a constructor call type to 'bar.p3.A<String>'"));
assertEmpty(myFixture.filterAvailableIntentions("Replace a constructor call type with 'bar.p3.A<String>'"));
}
public void testFixConstructorTypeClassNotAssignable() {
@@ -219,7 +219,7 @@ public class ReplaceTypeWithWrongImportFixTest extends LightJavaCodeInsightFixtu
B<? extends Object> b = new A<caret><String>("1");
}
""");
assertEmpty(myFixture.filterAvailableIntentions("Replace a constructor call type to 'bar.p3.A<String>'"));
assertEmpty(myFixture.filterAvailableIntentions("Replace a constructor call type with 'bar.p3.A<String>'"));
}
public void testFixConstructorTypeClassUnavailable() {
@@ -244,7 +244,7 @@ public class ReplaceTypeWithWrongImportFixTest extends LightJavaCodeInsightFixtu
B<? extends Object> b = new A<caret><String>("1");
}
""");
assertEmpty(myFixture.filterAvailableIntentions("Replace a constructor call type to 'bar.p3.A<String>'"));
assertEmpty(myFixture.filterAvailableIntentions("Replace a constructor call type with 'bar.p3.A<String>'"));
}
public void testFixConstructorTypeClassDefaultConstructor() {
@@ -276,7 +276,7 @@ public class ReplaceTypeWithWrongImportFixTest extends LightJavaCodeInsightFixtu
}
""");
myFixture.launchAction(myFixture.findSingleIntention("Replace a constructor call type to 'bar.p3.A<String>'"));
myFixture.launchAction(myFixture.findSingleIntention("Replace a constructor call type with 'bar.p3.A<String>'"));
myFixture.checkResult("""
import bar.p3.A;
import bar.p3.B;
@@ -298,7 +298,7 @@ public class ReplaceTypeWithWrongImportFixTest extends LightJavaCodeInsightFixtu
}
""");
myFixture.launchAction(myFixture.findSingleIntention("Replace a constructor call type to 'bar.p2.A<>'"));
myFixture.launchAction(myFixture.findSingleIntention("Replace a constructor call type with 'bar.p2.A<>'"));
myFixture.checkResult("""
import bar.p2.A;
import bar.p2.B;
@@ -330,7 +330,7 @@ public class ReplaceTypeWithWrongImportFixTest extends LightJavaCodeInsightFixtu
B<? extends Object> b = new A<caret><String>("1");
}
""");
assertEmpty(myFixture.filterAvailableIntentions("Replace a constructor call type to 'bar.p3.A<String>'"));
assertEmpty(myFixture.filterAvailableIntentions("Replace a constructor call type with 'bar.p3.A<String>'"));
}
public void testFixConstructorTypeNoAvailableClass() {
@@ -349,7 +349,7 @@ public class ReplaceTypeWithWrongImportFixTest extends LightJavaCodeInsightFixtu
B<? extends Object> b = new A<caret><String>("1");
}
""");
assertEmpty(myFixture.filterAvailableIntentions("Replace a constructor call type to 'bar.p3.A<String>'"));
assertEmpty(myFixture.filterAvailableIntentions("Replace a constructor call type with 'bar.p3.A<String>'"));
}
private void addClasses() {