Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port CheckReturnValue from Error Prone to Android Lint. #3448

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand All @@ -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 {",
Expand All @@ -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 {",
Expand All @@ -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",
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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 {",
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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;",
Expand All @@ -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() {",
Expand All @@ -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;",
Expand All @@ -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() {",
Expand All @@ -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",
Expand All @@ -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() {",
Expand All @@ -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;",
Expand All @@ -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() {",
Expand All @@ -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;",
Expand All @@ -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 {",
Expand Down