From 36a6d4925717cd3bbcb919b6dadd29fbc6b21d58 Mon Sep 17 00:00:00 2001 From: Chaoren Lin Date: Tue, 26 Jul 2022 07:55:19 -0700 Subject: [PATCH] Port CheckReturnValue from Error Prone to Android Lint. PiperOrigin-RevId: 463335590 --- .../bugpatterns/CheckReturnValueTest.java | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/CheckReturnValueTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/CheckReturnValueTest.java index 145553d0dfb..3b3daf7e76a 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/CheckReturnValueTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/CheckReturnValueTest.java @@ -110,7 +110,7 @@ public void testNegativeCase() { public void testPackageAnnotation() { compilationHelper .addSourceLines( - "package-info.java", // + "lib/package-info.java", // "@com.google.errorprone.annotations.CheckReturnValue", "package lib;") .addSourceLines( @@ -156,7 +156,7 @@ public void testClassAnnotation() { public void testVoidReturningMethodInAnnotatedPackage() { compilationHelper .addSourceLines( - "package-info.java", // + "lib/package-info.java", // "@com.google.errorprone.annotations.CheckReturnValue", "package lib;") .addSourceLines( @@ -179,7 +179,7 @@ public void testVoidReturningMethodInAnnotatedPackage() { public void badCRVOnProcedure() { compilationHelper .addSourceLines( - "Test.java", + "lib/Test.java", "package lib;", "@com.google.errorprone.annotations.CheckReturnValue", "public class Test {", @@ -194,7 +194,7 @@ public void badCRVOnProcedure() { public void badCRVOnPseudoProcedure() { compilationHelper .addSourceLines( - "Test.java", + "lib/Test.java", "package lib;", "@com.google.errorprone.annotations.CheckReturnValue", "public class Test {", @@ -212,7 +212,7 @@ public void badCRVOnPseudoProcedure() { public void testIgnoreCRVOnMockito() { compilationHelper .addSourceLines( - "Test.java", + "lib/Test.java", "package lib;", "public class Test {", " @com.google.errorprone.annotations.CheckReturnValue", @@ -241,7 +241,7 @@ public void testIgnoreCRVOnMockito() { public void testPackageAnnotationButCanIgnoreReturnValue() { compilationHelper .addSourceLines( - "package-info.java", + "lib/package-info.java", "@com.google.errorprone.annotations.CheckReturnValue", "package lib;") .addSourceLines( @@ -286,7 +286,7 @@ public void testClassAnnotationButCanIgnoreReturnValue() { public void badCanIgnoreReturnValueOnProcedure() { compilationHelper .addSourceLines( - "Test.java", + "lib/Test.java", "package lib;", "@com.google.errorprone.annotations.CheckReturnValue", "public class Test {", @@ -351,7 +351,7 @@ public void testNestedClassWithCanIgnoreAnnotation() { public void testPackageWithCanIgnoreAnnotation() { compilationHelper .addSourceLines( - "package-info.java", + "lib/package-info.java", "@com.google.errorprone.annotations.CheckReturnValue", "package lib;") .addSourceLines( @@ -404,7 +404,7 @@ public void errorBothMethod() { public void testJavaLangVoidReturningMethodInAnnotatedPackage() { compilationHelper .addSourceLines( - "package-info.java", + "lib/package-info.java", "@com.google.errorprone.annotations.CheckReturnValue", "package lib;") .addSourceLines( @@ -924,7 +924,7 @@ public void usingElementInTestExpected() { public void testAutoValueBuilderSetterMethods() { compilationHelper .addSourceLines( - "Animal.java", + "com/google/frobber/Animal.java", "package com.google.frobber;", "import com.google.auto.value.AutoValue;", "import com.google.errorprone.annotations.CheckReturnValue;", @@ -944,7 +944,7 @@ public void testAutoValueBuilderSetterMethods() { " }", "}") .addSourceLines( - "AnimalCaller.java", + "com/google/frobber/AnimalCaller.java", "package com.google.frobber;", "public final class AnimalCaller {", " static void testAnimal() {", @@ -962,7 +962,7 @@ public void testAutoValueBuilderSetterMethods() { public void testAutoValueBuilderSetterMethodsOnInterface() { compilationHelper .addSourceLines( - "Animal.java", + "com/google/frobber/Animal.java", "package com.google.frobber;", "import com.google.auto.value.AutoValue;", "import com.google.errorprone.annotations.CheckReturnValue;", @@ -985,7 +985,7 @@ public void testAutoValueBuilderSetterMethodsOnInterface() { " }", "}") .addSourceLines( - "AnimalCaller.java", + "com/google/frobber/AnimalCaller.java", "package com.google.frobber;", "public final class AnimalCaller {", " static void testAnimal() {", @@ -1005,7 +1005,7 @@ public void testAutoValueBuilderSetterMethodsOnInterface() { public void testAutoValueGetterMethods() { compilationHelper .addSourceLines( - "Animal.java", + "com/google/frobber/Animal.java", "package com.google.frobber;", "import com.google.auto.value.AutoValue;", "@AutoValue", @@ -1014,7 +1014,7 @@ public void testAutoValueGetterMethods() { " abstract int numberOfLegs();", "}") .addSourceLines( - "AnimalCaller.java", + "com/google/frobber/AnimalCaller.java", "package com.google.frobber;", "public final class AnimalCaller {", " static void testAnimal() {", @@ -1035,13 +1035,13 @@ public void testAutoValueGetterMethods() { public void testAutoBuilderSetterMethods() { compilationHelper .addSourceLines( - "Person.java", + "com/google/frobber/Person.java", "package com.google.frobber;", "public final class Person {", " public Person(String name, int id) {}", "}") .addSourceLines( - "PersonBuilder.java", + "com/google/frobber/PersonBuilder.java", "package com.google.frobber;", "import com.google.auto.value.AutoBuilder;", "import com.google.errorprone.annotations.CheckReturnValue;", @@ -1056,7 +1056,7 @@ public void testAutoBuilderSetterMethods() { " Person build();", "}") .addSourceLines( - "PersonCaller.java", + "com/google/frobber/PersonCaller.java", "package com.google.frobber;", "public final class PersonCaller {", " static void testPersonBuilder() {", @@ -1080,14 +1080,14 @@ public void testAutoBuilderSetterMethods() { public void testAutoBuilderSetterMethods_withInterface() { compilationHelper .addSourceLines( - "LogUtil.java", + "com/google/frobber/LogUtil.java", "package com.google.frobber;", "import java.util.logging.Level;", "public class LogUtil {", " public static void log(Level severity, String message) {}", "}") .addSourceLines( - "Caller.java", + "com/google/frobber/Caller.java", "package com.google.frobber;", "import com.google.auto.value.AutoBuilder;", "import java.util.logging.Level;", @@ -1103,7 +1103,7 @@ public void testAutoBuilderSetterMethods_withInterface() { " void call(); // calls: LogUtil.log(severity, message)", "}") .addSourceLines( - "LogCaller.java", + "com/google/frobber/LogCaller.java", "package com.google.frobber;", "import java.util.logging.Level;", "public final class LogCaller {",