[java-inspections] Add quotes to annotations in inspection messages

GitOrigin-RevId: a2d102bb75c6f0f213cfe79928909f8501be6ca7
This commit is contained in:
Bart van Helvert
2022-08-01 15:53:33 +02:00
committed by intellij-monorepo-bot
parent 9ee8313ff0
commit 2a86552363
52 changed files with 55 additions and 55 deletions

View File

@@ -147,9 +147,9 @@ message.class.inaccessible.from.module=Class ''{0}'' is not accessible from modu
message.class.inaccessible=Class ''{0}'' is not accessible here
inspection.i18n.quickfix.annotate=Annotate...
inspection.i18n.quickfix.annotate.as=Annotate as @{0}
inspection.i18n.quickfix.annotate.as=Annotate as ''@{0}''
inspection.i18n.quickfix.annotate.element=Annotate {0} ''{1}''...
inspection.i18n.quickfix.annotate.element.as=Annotate {0} ''{1}'' as @{2}
inspection.i18n.quickfix.annotate.element.as=Annotate {0} ''{1}'' as ''@{2}''
inspection.reference.default.package=<default>
error.message.invalid.java.type=Invalid Java type
move.0.to.the.beginning=Move ''{0}'' to the beginning

View File

@@ -1,4 +1,4 @@
// "Annotate method 'dontAnnotateBase' as @NotNull" "true-preview"
// "Annotate method 'dontAnnotateBase' as '@NotNull'" "true-preview"
import org.jetbrains.annotations.NotNull;
class X {

View File

@@ -1,4 +1,4 @@
// "Annotate method 'dontAnnotateBase' as @NotNull" "true-preview"
// "Annotate method 'dontAnnotateBase' as '@NotNull'" "true-preview"
import org.jetbrains.annotations.NotNull;
class X {

View File

@@ -1,6 +1,6 @@
import org.jetbrains.annotations.NonNls;
// "Annotate variable 'a' as @NonNls" "true-preview"
// "Annotate variable 'a' as '@NonNls'" "true-preview"
class Foo {
public boolean doTest() {
@NonNls String a;

View File

@@ -1,6 +1,6 @@
import org.jetbrains.annotations.NonNls;
// "Annotate method 'test' as @NonNls" "true-preview"
// "Annotate method 'test' as '@NonNls'" "true-preview"
class Foo {
@NonNls
Foo test(String s) {

View File

@@ -1,6 +1,6 @@
import org.jetbrains.annotations.NonNls;
// "Annotate variable 'a' as @NonNls" "true-preview"
// "Annotate variable 'a' as '@NonNls'" "true-preview"
class Foo {
public void doTest() {
@NonNls String a = new String("test");

View File

@@ -1,6 +1,6 @@
import org.jetbrains.annotations.NonNls;
// "Annotate variable 'a' as @NonNls" "true-preview"
// "Annotate variable 'a' as '@NonNls'" "true-preview"
class Foo {
public void doTest() {
@NonNls String a;

View File

@@ -1,6 +1,6 @@
import org.jetbrains.annotations.NonNls;
// "Annotate variable 'a' as @NonNls" "true-preview"
// "Annotate variable 'a' as '@NonNls'" "true-preview"
class Foo {
public boolean doTest() {
@NonNls String a;

View File

@@ -1,6 +1,6 @@
import org.jetbrains.annotations.NonNls;
// "Annotate field 'field' as @NonNls" "true-preview"
// "Annotate field 'field' as '@NonNls'" "true-preview"
class Foo {
@NonNls
String field = "text";

View File

@@ -1,6 +1,6 @@
import org.jetbrains.annotations.NonNls;
// "Annotate parameter 'sb' as @NonNls" "true-preview"
// "Annotate parameter 'sb' as '@NonNls'" "true-preview"
class Foo {
java.util.function.Consumer<StringBuilder> consumerTest() {
return (@NonNls var sb) -> sb.append("foo");

View File

@@ -1,6 +1,6 @@
import org.jetbrains.annotations.NonNls;
// "Annotate parameter 'sb' as @NonNls" "true-preview"
// "Annotate parameter 'sb' as '@NonNls'" "true-preview"
class Foo {
java.util.function.Consumer<StringBuilder> consumerTest() {
return (@NonNls StringBuilder sb) -> sb.append("foo");

View File

@@ -1,6 +1,6 @@
import org.jetbrains.annotations.Nls;
// "Annotate parameter 's' as @Nls" "true-preview"
// "Annotate parameter 's' as '@Nls'" "true-preview"
class Foo {
String foo(@org.jetbrains.annotations.Nls String s) { return s;}
{

View File

@@ -1,4 +1,4 @@
// "Annotate parameter 'obj' as @NonNls" "true-preview"
// "Annotate parameter 'obj' as '@NonNls'" "true-preview"
import org.jetbrains.annotations.NonNls;
import java.util.Optional;

View File

@@ -1,6 +1,6 @@
import org.jetbrains.annotations.NonNls;
// "Annotate parameter 's' as @NonNls" "true-preview"
// "Annotate parameter 's' as '@NonNls'" "true-preview"
class Foo {
public void doTest() {
doStringTest("test");

View File

@@ -1,6 +1,6 @@
import org.jetbrains.annotations.NonNls;
// "Annotate method 'doTest' as @NonNls" "true-preview"
// "Annotate method 'doTest' as '@NonNls'" "true-preview"
class Foo {
@NonNls
public String doTest() {

View File

@@ -1,6 +1,6 @@
import org.jetbrains.annotations.NonNls;
// "Annotate variable 'a' as @NonNls" "true-preview"
// "Annotate variable 'a' as '@NonNls'" "true-preview"
class Foo {
public void doTest() {
@NonNls String a = "test";

View File

@@ -1,6 +1,6 @@
import org.jetbrains.annotations.NonNls;
// "Annotate variable 'a' as @NonNls" "true-preview"
// "Annotate variable 'a' as '@NonNls'" "true-preview"
class Foo {
public void doTest() {
@NonNls String a = (s("test"));

View File

@@ -1,6 +1,6 @@
import org.jetbrains.annotations.NonNls;
// "Annotate variable 'a' as @NonNls" "true-preview"
// "Annotate variable 'a' as '@NonNls'" "true-preview"
class Foo {
public void doTest() {
@NonNls String a = (this.s("test"));

View File

@@ -1,4 +1,4 @@
// "Annotate field 'out' as @NonNls" "true"
// "Annotate field 'out' as '@NonNls'" "true"
class Foo {
public void doTest() {
System.out.println("Test");

View File

@@ -1,4 +1,4 @@
// "Annotate variable 'a' as @NonNls" "true-preview"
// "Annotate variable 'a' as '@NonNls'" "true-preview"
class Foo {
public boolean doTest() {
String a;

View File

@@ -1,4 +1,4 @@
// "Annotate method 'test' as @NonNls" "true-preview"
// "Annotate method 'test' as '@NonNls'" "true-preview"
class Foo {
Foo test(String s) {
return this;

View File

@@ -1,4 +1,4 @@
// "Annotate variable 'a' as @NonNls" "true-preview"
// "Annotate variable 'a' as '@NonNls'" "true-preview"
class Foo {
public void doTest() {
String a = new String("te<caret>st");

View File

@@ -1,4 +1,4 @@
// "Annotate variable 'a' as @NonNls" "true-preview"
// "Annotate variable 'a' as '@NonNls'" "true-preview"
class Foo {
public void doTest() {
String a;

View File

@@ -1,4 +1,4 @@
// "Annotate variable 'a' as @NonNls" "true-preview"
// "Annotate variable 'a' as '@NonNls'" "true-preview"
class Foo {
public boolean doTest() {
String a;

View File

@@ -1,4 +1,4 @@
// "Annotate field 'field' as @NonNls" "true-preview"
// "Annotate field 'field' as '@NonNls'" "true-preview"
class Foo {
String field = "t<caret>ext";
}

View File

@@ -1,4 +1,4 @@
// "Annotate parameter 'sb' as @NonNls" "true-preview"
// "Annotate parameter 'sb' as '@NonNls'" "true-preview"
class Foo {
java.util.function.Consumer<StringBuilder> consumerTest() {
return sb -> sb.append("<caret>foo");

View File

@@ -1,4 +1,4 @@
// "Annotate parameter 'sb' as @NonNls" "true-preview"
// "Annotate parameter 'sb' as '@NonNls'" "true-preview"
class Foo {
java.util.function.Consumer<StringBuilder> consumerTest() {
return sb -> sb.append("<caret>foo");

View File

@@ -1,4 +1,4 @@
// "Annotate parameter 's' as @Nls" "true-preview"
// "Annotate parameter 's' as '@Nls'" "true-preview"
class Foo {
String foo(@org.jetbrains.annotations.Nls String s) { return s;}
{

View File

@@ -1,4 +1,4 @@
// "Annotate parameter 'obj' as @NonNls" "true-preview"
// "Annotate parameter 'obj' as '@NonNls'" "true-preview"
import java.util.Optional;
class Foo {

View File

@@ -1,4 +1,4 @@
// "Annotate parameter 'obj' as @NonNls" "false"
// "Annotate parameter 'obj' as '@NonNls'" "false"
import java.util.Optional;
class Foo {

View File

@@ -1,4 +1,4 @@
// "Annotate parameter 's' as @NonNls" "true-preview"
// "Annotate parameter 's' as '@NonNls'" "true-preview"
class Foo {
public void doTest() {
doStringTest("te<caret>st");

View File

@@ -1,4 +1,4 @@
// "Annotate method 'doTest' as @NonNls" "true-preview"
// "Annotate method 'doTest' as '@NonNls'" "true-preview"
class Foo {
public String doTest() {
return "t<caret>ext";

View File

@@ -1,4 +1,4 @@
// "Annotate variable 'a' as @NonNls" "true-preview"
// "Annotate variable 'a' as '@NonNls'" "true-preview"
class Foo {
public void doTest() {
String a = "t<caret>est";

View File

@@ -1,4 +1,4 @@
// "Annotate variable 'a' as @NonNls" "true-preview"
// "Annotate variable 'a' as '@NonNls'" "true-preview"
class Foo {
public void doTest() {
String a = (s("t<caret>est"));

View File

@@ -1,4 +1,4 @@
// "Annotate variable 'a' as @NonNls" "true-preview"
// "Annotate variable 'a' as '@NonNls'" "true-preview"
class Foo {
public void doTest() {
String a = (this.s("t<caret>est"));

View File

@@ -1,4 +1,4 @@
// "Annotate field 'out' as @NonNls" "true"
// "Annotate field 'out' as '@NonNls'" "true"
class Foo {
public void doTest() {
System.out.println("Te<caret>st");

View File

@@ -1,4 +1,4 @@
// "Annotate annotation 'Test' as @Retention(RetentionPolicy.RUNTIME)" "true-preview"
// "Annotate annotation 'Test' as '@Retention(RetentionPolicy.RUNTIME)'" "true-preview"
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

View File

@@ -1,4 +1,4 @@
// "Annotate annotation 'Test' as @Retention(RetentionPolicy.RUNTIME)" "true-preview"
// "Annotate annotation 'Test' as '@Retention(RetentionPolicy.RUNTIME)'" "true-preview"
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

View File

@@ -1,4 +1,4 @@
// "Annotate annotation 'Test' as @Retention(RetentionPolicy.RUNTIME)" "true-preview"
// "Annotate annotation 'Test' as '@Retention(RetentionPolicy.RUNTIME)'" "true-preview"
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

View File

@@ -1,4 +1,4 @@
// "Annotate annotation 'NotNull' as @Retention(RetentionPolicy.RUNTIME)" "false"
// "Annotate annotation 'NotNull' as '@Retention(RetentionPolicy.RUNTIME)'" "false"
import org.jetbrains.annotations.NotNull;
import java.lang.reflect.Method;

View File

@@ -1,4 +1,4 @@
// "Annotate annotation 'Test' as @Retention(RetentionPolicy.RUNTIME)" "true-preview"
// "Annotate annotation 'Test' as '@Retention(RetentionPolicy.RUNTIME)'" "true-preview"
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
import java.lang.reflect.Method;

View File

@@ -1,4 +1,4 @@
// "Annotate annotation 'Subst' as @Retention(RetentionPolicy.RUNTIME)" "false"
// "Annotate annotation 'Subst' as '@Retention(RetentionPolicy.RUNTIME)'" "false"
import org.intellij.lang.annotations.Subst;
import java.lang.reflect.Method;

View File

@@ -364,7 +364,7 @@ public class NullableStuffInspectionTest extends LightJavaCodeInsightFixtureTest
String oldDefault = manager.getDefaultNotNull();
try {
manager.setDefaultNotNull("typeUse.NotNull");
doTestWithFix("Annotate as @NotNull");
doTestWithFix("Annotate as '@NotNull'");
}
finally {
manager.setDefaultNotNull(oldDefault);
@@ -381,7 +381,7 @@ public class NullableStuffInspectionTest extends LightJavaCodeInsightFixtureTest
String oldDefault = manager.getDefaultNotNull();
try {
manager.setDefaultNotNull("typeUse.NotNull");
doTestWithFix("Annotate as @NotNull");
doTestWithFix("Annotate as '@NotNull'");
}
finally {
manager.setDefaultNotNull(oldDefault);

View File

@@ -388,7 +388,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
@ParameterizedTest
void foo(String param) { }
}
""".trimIndent(), "Annotate class 'Test' as @TestInstance")
""".trimIndent(), "Annotate class 'Test' as '@TestInstance'")
}
fun `test malformed parameterized introduce method source quickfix`() {
myFixture.testQuickFix(ULanguage.JAVA, """

View File

@@ -1,4 +1,4 @@
// "Annotate method 'test' as @Override" "true"
// "Annotate method 'test' as '@Override'" "true"
class Super {
void test() {}
}

View File

@@ -1,4 +1,4 @@
// "Annotate method 'test' as @Override" "true"
// "Annotate method 'test' as '@Override'" "true"
class Super {
void test() {}
}

View File

@@ -1,6 +1,6 @@
import org.jetbrains.annotations.NonNls;
// "Annotate parameter 'str' as @NonNls" "true"
// "Annotate parameter 'str' as '@NonNls'" "true"
class X {
void test(@NonNls String str) {
String result = "foo" + str;

View File

@@ -1,4 +1,4 @@
// "Annotate parameter 'str' as @NonNls" "true"
// "Annotate parameter 'str' as '@NonNls'" "true"
class X {
void test(String str) {
String result = "foo" +<caret> str;

View File

@@ -1,6 +1,6 @@
import org.jetbrains.annotations.NonNls;
// "Annotate variable 'foo' as @NonNls" "true"
// "Annotate variable 'foo' as '@NonNls'" "true"
class X {
void test() {
@NonNls String foo = "bar";

View File

@@ -1,4 +1,4 @@
// "Annotate variable 'foo' as @NonNls" "true"
// "Annotate variable 'foo' as '@NonNls'" "true"
class X {
void test() {
String foo = "bar";

View File

@@ -24,7 +24,7 @@ public class AddSerialAnnotationFixTest extends LightJavaInspectionTestCase {
"class Test implements Serializable {\n" +
" private static final long /*'serialVersionUID' can be annotated with '@Serial' annotation*//*_*/serialVersionUID/**/ = 7874493593505141603L;\n" +
"}");
checkQuickFix("Annotate field 'serialVersionUID' as @Serial", "import java.io.*;\n" +
checkQuickFix("Annotate field 'serialVersionUID' as '@Serial'", "import java.io.*;\n" +
"class Test implements Serializable {\n" +
" @Serial\n" +
" private static final long serialVersionUID = 7874493593505141603L;\n" +
@@ -38,7 +38,7 @@ public class AddSerialAnnotationFixTest extends LightJavaInspectionTestCase {
" return 1;\n" +
" }\n" +
"}");
checkQuickFix("Annotate method 'readResolve' as @Serial", "import java.io.*;\n" +
checkQuickFix("Annotate method 'readResolve' as '@Serial'", "import java.io.*;\n" +
"class Test implements Serializable {\n" +
" @Serial\n" +
" protected Object readResolve() throws ObjectStreamException {\n" +

View File

@@ -38,7 +38,7 @@ public class RedundantSlf4jDefinitionInspectionTest extends LombokInspectionTest
public void testRedundantSlf4jDefinition() {
doTest();
checkQuickFix("Annotate class 'RedundantSlf4jDefinition' as @Slf4j");
checkQuickFix("Annotate class 'RedundantSlf4jDefinition' as '@Slf4j'");
}
}