From 91ed7bfd2b89235e0f78b893498711a8b1e02b9f Mon Sep 17 00:00:00 2001 From: Lijun Chen Date: Fri, 28 Aug 2026 19:30:38 +0200 Subject: [PATCH 1/5] S2479 Reduce noise by ignoring strings that are most likely generated --- java-checks-test-sources/default/pom.xml | 6 ++ .../ControlCharacterInLiteralCheck.java | Bin 3213 -> 3319 bytes ...eneratedStringLiteralRecognizerSample.java | 51 +++++++++ .../ControlCharacterInLiteralCheck.java | 7 +- .../GeneratedStringLiteralRecognizer.java | 102 ++++++++++++++++++ .../GeneratedStringLiteralRecognizerTest.java | 72 +++++++++++++ 6 files changed, 235 insertions(+), 3 deletions(-) create mode 100644 java-checks-test-sources/default/src/main/java/checks/helpers/GeneratedStringLiteralRecognizerSample.java create mode 100644 java-checks/src/main/java/org/sonar/java/checks/helpers/GeneratedStringLiteralRecognizer.java create mode 100644 java-checks/src/test/java/org/sonar/java/checks/helpers/GeneratedStringLiteralRecognizerTest.java diff --git a/java-checks-test-sources/default/pom.xml b/java-checks-test-sources/default/pom.xml index fc00b39f4a7..d9024753560 100644 --- a/java-checks-test-sources/default/pom.xml +++ b/java-checks-test-sources/default/pom.xml @@ -43,6 +43,12 @@ 3) Several plugins are disabled bellow to not generate jars --> + + org.jetbrains.kotlin + kotlin-stdlib + 1.8.0 + provided + org.jspecify diff --git a/java-checks-test-sources/default/src/main/java/checks/ControlCharacterInLiteralCheck.java b/java-checks-test-sources/default/src/main/java/checks/ControlCharacterInLiteralCheck.java index 43cf5f1e0e6c85dff42ce1ec1d5abfd49bdf9b79..0cbf28d2fc0d870a08597388bd8b8302398dfe7e 100644 GIT binary patch delta 136 zcmeB`{4QBvkeHmEn4YSToRONGU2M(8m6= nodesToVisit() { public void visitNode(Tree tree) { LiteralTree literal = (LiteralTree) tree; String literalValue = LiteralUtils.getAsStringValue(literal); - Matcher matcher = null; + Matcher matcher; if (allowTabsInTextBlocks && tree.is(Tree.Kind.TEXT_BLOCK)) { matcher = CONTROL_CHARACTERS_WITHOUT_TABS_PATTERN.matcher(literalValue); } else { matcher = CONTROL_CHARACTERS_PATTERN.matcher(literalValue); } - if (matcher.find()) { - reportIssue(literal, String.format(MESSAGE_FORMAT, literalValue.codePointAt(matcher.start()))); + if (matcher.find() && !GeneratedStringLiteralRecognizer.isGenerated(literal)) { + reportIssue(literal, String.format(MESSAGE_FORMAT, literalValue.codePointAt(matcher.start()))); } } diff --git a/java-checks/src/main/java/org/sonar/java/checks/helpers/GeneratedStringLiteralRecognizer.java b/java-checks/src/main/java/org/sonar/java/checks/helpers/GeneratedStringLiteralRecognizer.java new file mode 100644 index 00000000000..f6c9580bbf9 --- /dev/null +++ b/java-checks/src/main/java/org/sonar/java/checks/helpers/GeneratedStringLiteralRecognizer.java @@ -0,0 +1,102 @@ +/* + * SonarQube Java + * Copyright (C) SonarSource Sàrl + * mailto:info AT sonarsource DOT com + * + * You can redistribute and/or modify this program under the terms of + * the Sonar Source-Available License Version 1, as published by SonarSource Sàrl. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the Sonar Source-Available License for more details. + * + * You should have received a copy of the Sonar Source-Available License + * along with this program; if not, see https://sonarsource.com/license/ssal/ + */ +package org.sonar.java.checks.helpers; + +import org.sonar.java.model.ExpressionUtils; +import org.sonar.plugins.java.api.semantic.Type; +import org.sonar.plugins.java.api.tree.AnnotationTree; +import org.sonar.plugins.java.api.tree.CompilationUnitTree; +import org.sonar.plugins.java.api.tree.ExpressionTree; +import org.sonar.plugins.java.api.tree.ImportTree; +import org.sonar.plugins.java.api.tree.LiteralTree; +import org.sonar.plugins.java.api.tree.Tree; +import org.sonar.plugins.java.api.tree.TypeTree; + +/** + * Recognizes strings that are most likely not hand-written and maintained by developers. + * + * Currently we ignore: + * + *
    + *
  • {@code d1} strings in {@code kotlin.Metadata} annotations: + * example
  • + *
  • All strings in {@code kotlin.jvm.internal.SourceDebugExtension} annotations: + * example
  • + *
  • All strings in {@code kotlin.coroutines.jvm.internal.DebugMetadata} annotations: + * example
  • + *
+ */ +public final class GeneratedStringLiteralRecognizer { + + private static final String KOTLIN_METADATA = "kotlin.Metadata"; + private static final String KOTLIN_SOURCE_DEBUG_EXTENSION = "kotlin.jvm.internal.SourceDebugExtension"; + private static final String KOTLIN_DEBUG_METADATA = "kotlin.coroutines.jvm.internal.DebugMetadata"; + + private GeneratedStringLiteralRecognizer() { + } + + public static boolean isGenerated(LiteralTree literal) { + if (!literal.is(Tree.Kind.STRING_LITERAL, Tree.Kind.TEXT_BLOCK)) { + return false; + } + + Tree annotationArgument = literal; + while (annotationArgument.parent() != null && !annotationArgument.parent().is(Tree.Kind.ARGUMENTS)) { + annotationArgument = annotationArgument.parent(); + } + + Tree arguments = annotationArgument.parent(); + if (arguments == null || !(arguments.parent() instanceof AnnotationTree annotation)) { + return false; + } + + return isAnnotationType(annotation, KOTLIN_SOURCE_DEBUG_EXTENSION) + || isAnnotationType(annotation, KOTLIN_DEBUG_METADATA) + || (annotationArgument instanceof ExpressionTree argument + && "d1".equals(ExpressionUtils.annotationAttributeName(argument)) + && isAnnotationType(annotation, KOTLIN_METADATA)); + } + + private static boolean isAnnotationType(AnnotationTree annotation, String fullyQualifiedName) { + TypeTree annotationTypeTree = annotation.annotationType(); + Type annotationType = annotationTypeTree.symbolType(); + if (!annotationType.isUnknown()) { + return annotationType.is(fullyQualifiedName); + } + + String annotationName = ExpressionsHelper.concatenate((ExpressionTree) annotationTypeTree); + if (fullyQualifiedName.equals(annotationName)) { + return true; + } + + String unqualifiedName = fullyQualifiedName.substring(fullyQualifiedName.lastIndexOf('.') + 1); + return annotationName.equals(unqualifiedName) + && hasExplicitImport(annotation, fullyQualifiedName); + } + + private static boolean hasExplicitImport(Tree tree, String fullyQualifiedName) { + CompilationUnitTree compilationUnit = (CompilationUnitTree) ExpressionUtils.getParentOfType(tree, Tree.Kind.COMPILATION_UNIT); + return compilationUnit.imports().stream() + .filter(ImportTree.class::isInstance) + .map(ImportTree.class::cast) + .filter(importTree -> !importTree.isStatic()) + .map(ImportTree::qualifiedIdentifier) + .anyMatch(imported -> imported instanceof ExpressionTree expression + && fullyQualifiedName.equals(ExpressionsHelper.concatenate(expression))); + } + +} diff --git a/java-checks/src/test/java/org/sonar/java/checks/helpers/GeneratedStringLiteralRecognizerTest.java b/java-checks/src/test/java/org/sonar/java/checks/helpers/GeneratedStringLiteralRecognizerTest.java new file mode 100644 index 00000000000..ae3677fc418 --- /dev/null +++ b/java-checks/src/test/java/org/sonar/java/checks/helpers/GeneratedStringLiteralRecognizerTest.java @@ -0,0 +1,72 @@ +/* + * SonarQube Java + * Copyright (C) SonarSource Sàrl + * mailto:info AT sonarsource DOT com + * + * You can redistribute and/or modify this program under the terms of + * the Sonar Source-Available License Version 1, as published by SonarSource Sàrl. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the Sonar Source-Available License for more details. + * + * You should have received a copy of the Sonar Source-Available License + * along with this program; if not, see https://sonarsource.com/license/ssal/ + */ +package org.sonar.java.checks.helpers; + +import java.util.List; +import org.junit.jupiter.api.Test; +import org.sonar.java.checks.verifier.CheckVerifier; +import org.sonar.plugins.java.api.IssuableSubscriptionVisitor; +import org.sonar.plugins.java.api.tree.LiteralTree; +import org.sonar.plugins.java.api.tree.Tree; + +import static org.sonar.java.checks.verifier.TestUtils.mainCodeSourcesPath; + +class GeneratedStringLiteralRecognizerTest { + + private static final String TEST_FILE = "checks/helpers/GeneratedStringLiteralRecognizerSample.java"; + + @Test + void test() { + CheckVerifier.newVerifier() + .onFile(mainCodeSourcesPath(TEST_FILE)) + .withCheck(new TestCheck()) + .verifyIssues(); + } + + @Test + void test_without_dependencies() { + CheckVerifier.newVerifier() + .onFile(mainCodeSourcesPath(TEST_FILE)) + .withCheck(new TestCheck()) + .withClassPath(List.of()) + .verifyIssues(); + } + + @Test + void test_without_semantic() { + CheckVerifier.newVerifier() + .onFile(mainCodeSourcesPath(TEST_FILE)) + .withCheck(new TestCheck()) + .withoutSemantic() + .verifyIssues(); + } + + private static class TestCheck extends IssuableSubscriptionVisitor { + + @Override + public List nodesToVisit() { + return List.of(Tree.Kind.STRING_LITERAL, Tree.Kind.CHAR_LITERAL, Tree.Kind.TEXT_BLOCK); + } + + @Override + public void visitNode(Tree tree) { + if (GeneratedStringLiteralRecognizer.isGenerated((LiteralTree) tree)) { + reportIssue(tree, "Recognized as generated."); + } + } + } +} From 9dcc751e36d8d77d341cb14dff611c3eaea854d9 Mon Sep 17 00:00:00 2001 From: Lijun Chen Date: Mon, 31 Aug 2026 19:10:20 +0200 Subject: [PATCH 2/5] Address review comment: use JParserTestUtils for helper tests --- ...eneratedStringLiteralRecognizerSample.java | 51 ------- .../GeneratedStringLiteralRecognizerTest.java | 133 +++++++++++++----- 2 files changed, 101 insertions(+), 83 deletions(-) delete mode 100644 java-checks-test-sources/default/src/main/java/checks/helpers/GeneratedStringLiteralRecognizerSample.java diff --git a/java-checks-test-sources/default/src/main/java/checks/helpers/GeneratedStringLiteralRecognizerSample.java b/java-checks-test-sources/default/src/main/java/checks/helpers/GeneratedStringLiteralRecognizerSample.java deleted file mode 100644 index 1ea0f814d99..00000000000 --- a/java-checks-test-sources/default/src/main/java/checks/helpers/GeneratedStringLiteralRecognizerSample.java +++ /dev/null @@ -1,51 +0,0 @@ -package checks.helpers; - -import kotlin.Metadata; -import kotlin.coroutines.jvm.internal.DebugMetadata; - -@Metadata( - d1 = {"U+200B zero-width space: '​'"}, // Noncompliant {{Recognized as generated.}} - d2 = {"U+200B zero-width space: '​'"}) // Compliant -public class GeneratedStringLiteralRecognizerSample { - - String value = "U+200B zero-width space: '​'"; // Compliant - char character = 'a'; // Compliant - -} - -@kotlin.jvm.internal.SourceDebugExtension({ - "U+200B zero-width space: '​'", // Noncompliant - // Noncompliant@+1 - """ - U+200B zero-width space: '​' - """}) -class SourceDebugExtensionSample { -} - -@DebugMetadata( - c = "U+200B zero-width space: '​'", // Noncompliant - f = "U+200B zero-width space: '​'", // Noncompliant - m = "U+200B zero-width space: '​'", // Noncompliant - n = {"U+200B zero-width space: '​'"}) // Noncompliant -class DebugMetadataSample { -} - -@NotKotlinMetadata(d1 = {"U+200B zero-width space: '​'"}) // Compliant -class MetadataLookalikeSample { -} - -class ShadowedMetadataSample { - - @interface Metadata { - String[] d1(); - } - - // This is not kotlin.Metadata, so its d1 value is not considered generated - @Metadata(d1 = {"U+200B zero-width space: '​'"}) // Compliant - class Annotated { - } -} - -@interface NotKotlinMetadata { - String[] d1(); -} diff --git a/java-checks/src/test/java/org/sonar/java/checks/helpers/GeneratedStringLiteralRecognizerTest.java b/java-checks/src/test/java/org/sonar/java/checks/helpers/GeneratedStringLiteralRecognizerTest.java index ae3677fc418..60978d1f556 100644 --- a/java-checks/src/test/java/org/sonar/java/checks/helpers/GeneratedStringLiteralRecognizerTest.java +++ b/java-checks/src/test/java/org/sonar/java/checks/helpers/GeneratedStringLiteralRecognizerTest.java @@ -16,57 +16,126 @@ */ package org.sonar.java.checks.helpers; +import java.util.ArrayList; import java.util.List; import org.junit.jupiter.api.Test; -import org.sonar.java.checks.verifier.CheckVerifier; -import org.sonar.plugins.java.api.IssuableSubscriptionVisitor; +import org.sonar.plugins.java.api.tree.BaseTreeVisitor; import org.sonar.plugins.java.api.tree.LiteralTree; -import org.sonar.plugins.java.api.tree.Tree; -import static org.sonar.java.checks.verifier.TestUtils.mainCodeSourcesPath; +import static org.assertj.core.api.Assertions.assertThat; class GeneratedStringLiteralRecognizerTest { - private static final String TEST_FILE = "checks/helpers/GeneratedStringLiteralRecognizerSample.java"; + @Test + void recognizes_generated_literals() { + assertGenerated(""" + package kotlin; + @interface Metadata { + String[] d1(); + } + @Metadata(d1 = {"generated"}) + class A {} + """); + + assertGenerated(""" + package kotlin.jvm.internal; + @interface SourceDebugExtension { + String[] value(); + } + @SourceDebugExtension({ + "generated", + \""" + generated text block + \"""}) + class A {} + """); + + assertGenerated(""" + package kotlin.coroutines.jvm.internal; + @interface DebugMetadata { + String c(); + String f(); + String m(); + String[] n(); + } + @DebugMetadata(c = "c", f = "f", m = "m", n = {"n"}) + class A {} + """); + } @Test - void test() { - CheckVerifier.newVerifier() - .onFile(mainCodeSourcesPath(TEST_FILE)) - .withCheck(new TestCheck()) - .verifyIssues(); + void recognizes_generated_literals_without_dependencies() { + assertGenerated(""" + import kotlin.Metadata; + @Metadata(d1 = {"generated"}) + class A {} + """); + + assertGenerated(""" + @kotlin.jvm.internal.SourceDebugExtension({"generated"}) + class A {} + """); } @Test - void test_without_dependencies() { - CheckVerifier.newVerifier() - .onFile(mainCodeSourcesPath(TEST_FILE)) - .withCheck(new TestCheck()) - .withClassPath(List.of()) - .verifyIssues(); + void does_not_recognize_other_literals() { + assertNotGenerated(""" + package kotlin; + @interface Metadata { + String[] d2(); + } + @Metadata(d2 = {"not generated"}) + class A {} + """); + + assertNotGenerated(""" + @interface NotKotlinMetadata { + String[] d1(); + } + @NotKotlinMetadata(d1 = {"not generated"}) + class A { + String value = "not generated"; + char character = 'a'; + } + """); + + assertNotGenerated(""" + @Metadata(d1 = {"not generated"}) + class A {} + """); } @Test - void test_without_semantic() { - CheckVerifier.newVerifier() - .onFile(mainCodeSourcesPath(TEST_FILE)) - .withCheck(new TestCheck()) - .withoutSemantic() - .verifyIssues(); + void does_not_recognize_shadowed_kotlin_metadata() { + assertNotGenerated(""" + import kotlin.Metadata; + class A { + @interface Metadata { + String[] d1(); + } + @Metadata(d1 = {"not generated"}) + class B {} + } + """); } - private static class TestCheck extends IssuableSubscriptionVisitor { + private static void assertGenerated(String source) { + assertThat(literals(source)).allMatch(GeneratedStringLiteralRecognizer::isGenerated); + } - @Override - public List nodesToVisit() { - return List.of(Tree.Kind.STRING_LITERAL, Tree.Kind.CHAR_LITERAL, Tree.Kind.TEXT_BLOCK); - } + private static void assertNotGenerated(String source) { + assertThat(literals(source)).noneMatch(GeneratedStringLiteralRecognizer::isGenerated); + } - @Override - public void visitNode(Tree tree) { - if (GeneratedStringLiteralRecognizer.isGenerated((LiteralTree) tree)) { - reportIssue(tree, "Recognized as generated."); + private static List literals(String source) { + List literals = new ArrayList<>(); + JParserTestUtils.parse(source).accept(new BaseTreeVisitor() { + @Override + public void visitLiteral(LiteralTree tree) { + literals.add(tree); } - } + }); + assertThat(literals).isNotEmpty(); + return literals; } } From 684f8ddf2686c889bab775b83b5de52f81e2c680 Mon Sep 17 00:00:00 2001 From: Lijun Chen Date: Mon, 31 Aug 2026 19:10:52 +0200 Subject: [PATCH 3/5] Address review comment: remove external links --- .../checks/helpers/GeneratedStringLiteralRecognizer.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/java-checks/src/main/java/org/sonar/java/checks/helpers/GeneratedStringLiteralRecognizer.java b/java-checks/src/main/java/org/sonar/java/checks/helpers/GeneratedStringLiteralRecognizer.java index f6c9580bbf9..85fe43d552b 100644 --- a/java-checks/src/main/java/org/sonar/java/checks/helpers/GeneratedStringLiteralRecognizer.java +++ b/java-checks/src/main/java/org/sonar/java/checks/helpers/GeneratedStringLiteralRecognizer.java @@ -32,12 +32,9 @@ * Currently we ignore: * *
    - *
  • {@code d1} strings in {@code kotlin.Metadata} annotations: - * example
  • - *
  • All strings in {@code kotlin.jvm.internal.SourceDebugExtension} annotations: - * example
  • - *
  • All strings in {@code kotlin.coroutines.jvm.internal.DebugMetadata} annotations: - * example
  • + *
  • {@code d1} strings in {@code kotlin.Metadata} annotations
  • + *
  • All strings in {@code kotlin.jvm.internal.SourceDebugExtension} annotations
  • + *
  • All strings in {@code kotlin.coroutines.jvm.internal.DebugMetadata} annotations
  • *
*/ public final class GeneratedStringLiteralRecognizer { From aa0e9c35593bd59ef5f772a77f849ca6bae8b0a6 Mon Sep 17 00:00:00 2001 From: Lijun Chen Date: Mon, 31 Aug 2026 19:13:22 +0200 Subject: [PATCH 4/5] Address review comment: add javadoc --- .../checks/helpers/GeneratedStringLiteralRecognizer.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/java-checks/src/main/java/org/sonar/java/checks/helpers/GeneratedStringLiteralRecognizer.java b/java-checks/src/main/java/org/sonar/java/checks/helpers/GeneratedStringLiteralRecognizer.java index 85fe43d552b..c5b0e6551ad 100644 --- a/java-checks/src/main/java/org/sonar/java/checks/helpers/GeneratedStringLiteralRecognizer.java +++ b/java-checks/src/main/java/org/sonar/java/checks/helpers/GeneratedStringLiteralRecognizer.java @@ -46,6 +46,13 @@ public final class GeneratedStringLiteralRecognizer { private GeneratedStringLiteralRecognizer() { } + /** + * Checks whether a string or text block literal is (most likely) generated by a known tool. + * and not hand-written by developers. Useful for rule suppression for rules that raise on such literals. + * + * @param literal the literal to check + * @return {@code true} when the literal is recognized as generated + */ public static boolean isGenerated(LiteralTree literal) { if (!literal.is(Tree.Kind.STRING_LITERAL, Tree.Kind.TEXT_BLOCK)) { return false; From b70e237daa2f5b5acf02ab86a41899ee0100100c Mon Sep 17 00:00:00 2001 From: Lijun Chen Date: Mon, 31 Aug 2026 19:20:50 +0200 Subject: [PATCH 5/5] Address review comment: simplify recognition logic --- .../GeneratedStringLiteralRecognizer.java | 30 ++----------------- .../GeneratedStringLiteralRecognizerTest.java | 6 ---- 2 files changed, 3 insertions(+), 33 deletions(-) diff --git a/java-checks/src/main/java/org/sonar/java/checks/helpers/GeneratedStringLiteralRecognizer.java b/java-checks/src/main/java/org/sonar/java/checks/helpers/GeneratedStringLiteralRecognizer.java index c5b0e6551ad..877d2688852 100644 --- a/java-checks/src/main/java/org/sonar/java/checks/helpers/GeneratedStringLiteralRecognizer.java +++ b/java-checks/src/main/java/org/sonar/java/checks/helpers/GeneratedStringLiteralRecognizer.java @@ -19,12 +19,9 @@ import org.sonar.java.model.ExpressionUtils; import org.sonar.plugins.java.api.semantic.Type; import org.sonar.plugins.java.api.tree.AnnotationTree; -import org.sonar.plugins.java.api.tree.CompilationUnitTree; import org.sonar.plugins.java.api.tree.ExpressionTree; -import org.sonar.plugins.java.api.tree.ImportTree; import org.sonar.plugins.java.api.tree.LiteralTree; import org.sonar.plugins.java.api.tree.Tree; -import org.sonar.plugins.java.api.tree.TypeTree; /** * Recognizes strings that are most likely not hand-written and maintained by developers. @@ -76,31 +73,10 @@ public static boolean isGenerated(LiteralTree literal) { } private static boolean isAnnotationType(AnnotationTree annotation, String fullyQualifiedName) { - TypeTree annotationTypeTree = annotation.annotationType(); - Type annotationType = annotationTypeTree.symbolType(); - if (!annotationType.isUnknown()) { - return annotationType.is(fullyQualifiedName); - } - - String annotationName = ExpressionsHelper.concatenate((ExpressionTree) annotationTypeTree); - if (fullyQualifiedName.equals(annotationName)) { - return true; - } - + Type annotationType = annotation.symbolType(); String unqualifiedName = fullyQualifiedName.substring(fullyQualifiedName.lastIndexOf('.') + 1); - return annotationName.equals(unqualifiedName) - && hasExplicitImport(annotation, fullyQualifiedName); - } - - private static boolean hasExplicitImport(Tree tree, String fullyQualifiedName) { - CompilationUnitTree compilationUnit = (CompilationUnitTree) ExpressionUtils.getParentOfType(tree, Tree.Kind.COMPILATION_UNIT); - return compilationUnit.imports().stream() - .filter(ImportTree.class::isInstance) - .map(ImportTree.class::cast) - .filter(importTree -> !importTree.isStatic()) - .map(ImportTree::qualifiedIdentifier) - .anyMatch(imported -> imported instanceof ExpressionTree expression - && fullyQualifiedName.equals(ExpressionsHelper.concatenate(expression))); + return annotationType.is(fullyQualifiedName) + || (annotationType.isUnknown() && annotationType.name().equals(unqualifiedName)); } } diff --git a/java-checks/src/test/java/org/sonar/java/checks/helpers/GeneratedStringLiteralRecognizerTest.java b/java-checks/src/test/java/org/sonar/java/checks/helpers/GeneratedStringLiteralRecognizerTest.java index 60978d1f556..6a5cc4e18af 100644 --- a/java-checks/src/test/java/org/sonar/java/checks/helpers/GeneratedStringLiteralRecognizerTest.java +++ b/java-checks/src/test/java/org/sonar/java/checks/helpers/GeneratedStringLiteralRecognizerTest.java @@ -66,7 +66,6 @@ class A {} @Test void recognizes_generated_literals_without_dependencies() { assertGenerated(""" - import kotlin.Metadata; @Metadata(d1 = {"generated"}) class A {} """); @@ -98,11 +97,6 @@ class A { char character = 'a'; } """); - - assertNotGenerated(""" - @Metadata(d1 = {"not generated"}) - class A {} - """); } @Test