-
Notifications
You must be signed in to change notification settings - Fork 746
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
178 changed files
with
631 additions
and
287 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,9 @@ | |
|
||
package com.google.errorprone.bugpatterns.android.testdata; | ||
|
||
/** @author [email protected] (Jason Long) */ | ||
/** | ||
* @author [email protected] (Jason Long) | ||
*/ | ||
public class CustomFragmentNotInstantiableNegativeCases { | ||
public static class NotAFragment1 { | ||
public NotAFragment1(int x) {} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,9 @@ | |
|
||
package com.google.errorprone.bugpatterns.android.testdata; | ||
|
||
/** @author [email protected] (Jason Long) */ | ||
/** | ||
* @author [email protected] (Jason Long) | ||
*/ | ||
public class CustomFragmentNotInstantiablePositiveCases { | ||
// BUG: Diagnostic contains: public | ||
static class PrivateFragment extends CustomFragment { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,9 @@ | |
|
||
import android.app.Fragment; | ||
|
||
/** @author [email protected] (Arnaud J. Venet) */ | ||
/** | ||
* @author [email protected] (Arnaud J. Venet) | ||
*/ | ||
public class FragmentNotInstantiableNegativeCases { | ||
public static class NotAFragment1 { | ||
public NotAFragment1(int x) {} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,9 @@ | |
|
||
import android.app.Fragment; | ||
|
||
/** @author [email protected] (Arnaud J. Venet) */ | ||
/** | ||
* @author [email protected] (Arnaud J. Venet) | ||
*/ | ||
public class FragmentNotInstantiablePositiveCases { | ||
// BUG: Diagnostic contains: public | ||
static class PrivateFragment extends Fragment { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,9 @@ | |
|
||
package com.google.errorprone.bugpatterns.android.testdata; | ||
|
||
/** @author [email protected] (Arnaud J. Venet) */ | ||
/** | ||
* @author [email protected] (Arnaud J. Venet) | ||
*/ | ||
public class HardCodedSdCardPathNegativeCases { | ||
static final String PATH1 = "/home/sdcard"; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,9 @@ | |
|
||
package com.google.errorprone.bugpatterns.android.testdata; | ||
|
||
/** @author [email protected] (Arnaud J. Venet) */ | ||
/** | ||
* @author [email protected] (Arnaud J. Venet) | ||
*/ | ||
public class HardCodedSdCardPathPositiveCases { | ||
// BUG: Diagnostic contains: Environment | ||
static final String PATH1 = "/sdcard"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,9 @@ | |
import android.os.Parcelable; | ||
import android.os.Parcelable.ClassLoaderCreator; | ||
|
||
/** @author [email protected] (Sumit Bhagwani) */ | ||
/** | ||
* @author [email protected] (Sumit Bhagwani) | ||
*/ | ||
public class ParcelableCreatorNegativeCases { | ||
|
||
public abstract static class PublicAbstractParcelableClass implements Parcelable { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,9 @@ | |
import android.os.Parcel; | ||
import android.os.Parcelable; | ||
|
||
/** @author [email protected] (Sumit Bhagwani) */ | ||
/** | ||
* @author [email protected] (Sumit Bhagwani) | ||
*/ | ||
public class ParcelableCreatorPositiveCases { | ||
|
||
// BUG: Diagnostic contains: ParcelableCreator | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,9 @@ | |
|
||
import android.graphics.Rect; | ||
|
||
/** @author [email protected] (Arnaud J. Venet) */ | ||
/** | ||
* @author [email protected] (Arnaud J. Venet) | ||
*/ | ||
public class RectIntersectReturnValueIgnoredNegativeCases { | ||
boolean checkSimpleCall(Rect rect, int aLeft, int aTop, int aRight, int aBottom) { | ||
return rect.intersect(aLeft, aTop, aRight, aBottom); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,9 @@ | |
|
||
import android.graphics.Rect; | ||
|
||
/** @author [email protected] (Arnaud J. Venet) */ | ||
/** | ||
* @author [email protected] (Arnaud J. Venet) | ||
*/ | ||
public class RectIntersectReturnValueIgnoredPositiveCases { | ||
void checkSimpleCall(Rect rect, int aLeft, int aTop, int aRight, int aBottom) { | ||
// BUG: Diagnostic contains: Return value of android.graphics.Rect.intersect() must be checked | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,9 @@ | |
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** @author [email protected] (Maria Sam) */ | ||
/** | ||
* @author [email protected] (Maria Sam) | ||
*/ | ||
public class FloggerRedundantIsEnabledNegativeCases { | ||
|
||
public void basicCase(FluentLogger logger) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,9 @@ | |
|
||
import com.google.common.flogger.FluentLogger; | ||
|
||
/** @author [email protected] (Maria Sam) */ | ||
/** | ||
* @author [email protected] (Maria Sam) | ||
*/ | ||
class FloggerRedundantIsEnabledPositiveCases { | ||
|
||
public void basicCase(FluentLogger logger) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,9 @@ | |
import com.google.inject.assistedinject.Assisted; | ||
import com.google.inject.assistedinject.AssistedInject; | ||
|
||
/** @author [email protected] (Eddie Aftandilian) */ | ||
/** | ||
* @author [email protected] (Eddie Aftandilian) | ||
*/ | ||
public class AssistedInjectScopingNegativeCases { | ||
|
||
/** Class is not assisted and has no scoping annotation. */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,9 @@ | |
import com.google.inject.assistedinject.AssistedInject; | ||
import com.google.inject.servlet.RequestScoped; | ||
|
||
/** @author [email protected] (Eddie Aftandilian) */ | ||
/** | ||
* @author [email protected] (Eddie Aftandilian) | ||
*/ | ||
public class AssistedInjectScopingPositiveCases { | ||
|
||
// BUG: Diagnostic contains: remove this line | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,9 @@ | |
|
||
import com.google.inject.Inject; | ||
|
||
/** @author [email protected] (Steven Goldfeder) */ | ||
/** | ||
* @author [email protected] (Steven Goldfeder) | ||
*/ | ||
public class InjectOnFinalFieldNegativeCases { | ||
|
||
/** Class has no final fields or @Inject annotations. */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,9 @@ | |
import com.google.inject.Inject; | ||
import javax.annotation.Nullable; | ||
|
||
/** @author [email protected] (Steven Goldfeder) */ | ||
/** | ||
* @author [email protected] (Steven Goldfeder) | ||
*/ | ||
public class InjectOnFinalFieldPositiveCases { | ||
/** Class has a final injectable(com.google.inject.Inject) field. */ | ||
public class TestClass1 { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,9 @@ | |
|
||
package com.google.errorprone.bugpatterns.inject.guice.testdata; | ||
|
||
/** @author [email protected] (Steven Goldfeder) */ | ||
/** | ||
* @author [email protected] (Steven Goldfeder) | ||
*/ | ||
public class OverridesGuiceInjectableMethodNegativeCases { | ||
|
||
/** Class with a method foo() annotated with @com.google.inject.Inject. */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,9 @@ | |
|
||
package com.google.errorprone.bugpatterns.inject.guice.testdata; | ||
|
||
/** @author [email protected] (Steven Goldfeder) */ | ||
/** | ||
* @author [email protected] (Steven Goldfeder) | ||
*/ | ||
public class OverridesJavaxInjectableMethodNegativeCases { | ||
/** Class with a method foo() with no annotations. */ | ||
public class TestClass1 { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,9 @@ | |
|
||
package com.google.errorprone.bugpatterns.inject.guice.testdata; | ||
|
||
/** @author [email protected] (Steven Goldfeder) */ | ||
/** | ||
* @author [email protected] (Steven Goldfeder) | ||
*/ | ||
public class OverridesJavaxInjectableMethodPositiveCases { | ||
|
||
/** Class with foo() */ | ||
|
@@ -41,7 +43,7 @@ public class TestClass2 extends TestClass1 { | |
// BUG: Diagnostic contains: @Inject | ||
public void foo() {} | ||
} | ||
|
||
/** | ||
* Class with a method foo() that is not annotated, but overrides a method that in turn overrides | ||
* a method that is annotated with @javax.inject.Inject. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,9 @@ | |
|
||
import com.google.inject.assistedinject.AssistedInject; | ||
|
||
/** @author [email protected] (Steven Goldfeder) */ | ||
/** | ||
* @author [email protected] (Steven Goldfeder) | ||
*/ | ||
public class AssistedInjectAndInjectOnConstructorsNegativeCases { | ||
/** Class has a single constructor with no annotation. */ | ||
public class TestClass1 { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,9 @@ | |
|
||
import com.google.inject.assistedinject.AssistedInject; | ||
|
||
/** @author [email protected] (Steven Goldfeder) */ | ||
/** | ||
* @author [email protected] (Steven Goldfeder) | ||
*/ | ||
public class AssistedInjectAndInjectOnConstructorsPositiveCases { | ||
/** | ||
* Class has a constructor annotated with @javax.inject.Inject and another constructor annotated | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,9 @@ | |
|
||
import com.google.inject.assistedinject.AssistedInject; | ||
|
||
/** @author [email protected] (Steven Goldfeder) */ | ||
/** | ||
* @author [email protected] (Steven Goldfeder) | ||
*/ | ||
public class AssistedInjectAndInjectOnSameConstructorNegativeCases { | ||
/** Class has a single constructor with no annotation. */ | ||
public class TestClass1 { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,9 @@ | |
|
||
import com.google.inject.assistedinject.AssistedInject; | ||
|
||
/** @author [email protected] (Steven Goldfeder) */ | ||
/** | ||
* @author [email protected] (Steven Goldfeder) | ||
*/ | ||
public class AssistedInjectAndInjectOnSameConstructorPositiveCases { | ||
/** Class has a constructor annotated with @javax.inject.Inject and @AssistedInject. */ | ||
public class TestClass1 { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,9 @@ | |
import com.google.inject.Provides; | ||
import javax.inject.Singleton; | ||
|
||
/** @author [email protected] (Sumit Bhagwani) */ | ||
/** | ||
* @author [email protected] (Sumit Bhagwani) | ||
*/ | ||
public class CloseableProvidesNegativeCases { | ||
|
||
static class DoesNotImplementsClosable { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,9 @@ | |
import java.nio.charset.StandardCharsets; | ||
import javax.inject.Singleton; | ||
|
||
/** @author [email protected] (Sumit Bhagwani) */ | ||
/** | ||
* @author [email protected] (Sumit Bhagwani) | ||
*/ | ||
public class CloseableProvidesPositiveCases { | ||
|
||
static class ImplementsClosable implements Closeable { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,9 @@ | |
import java.lang.annotation.Target; | ||
import javax.inject.Scope; | ||
|
||
/** @author [email protected](Steven Goldfeder) */ | ||
/** | ||
* @author [email protected](Steven Goldfeder) | ||
*/ | ||
public class InvalidTargetingOnScopingAnnotationNegativeCases { | ||
|
||
/** A scoping annotation with no specified target. */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,9 @@ | |
import java.lang.annotation.Target; | ||
import javax.inject.Scope; | ||
|
||
/** @author [email protected](Steven Goldfeder) */ | ||
/** | ||
* @author [email protected](Steven Goldfeder) | ||
*/ | ||
public class InvalidTargetingOnScopingAnnotationPositiveCases { | ||
|
||
/** Scoping excludes METHOD */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,9 @@ | |
|
||
import javax.inject.Inject; | ||
|
||
/** @author [email protected] (Steven Goldfeder) */ | ||
/** | ||
* @author [email protected] (Steven Goldfeder) | ||
*/ | ||
public class JavaxInjectOnAbstractMethodNegativeCases { | ||
|
||
/** Concrete class has no methods or annotations. */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,9 @@ | |
|
||
package com.google.errorprone.bugpatterns.inject.testdata; | ||
|
||
/** @author [email protected] (Steven Goldfeder) */ | ||
/** | ||
* @author [email protected] (Steven Goldfeder) | ||
*/ | ||
public class JavaxInjectOnAbstractMethodPositiveCases { | ||
|
||
/** Abstract class has an injectable(javax.inject.Inject) abstract method. */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,9 @@ | |
|
||
import javax.inject.Inject; | ||
|
||
/** @author [email protected] (Steven Goldfeder) */ | ||
/** | ||
* @author [email protected] (Steven Goldfeder) | ||
*/ | ||
public class JavaxInjectOnFinalFieldNegativeCases { | ||
|
||
/** Class has no final fields or @Inject annotations. */ | ||
|
Oops, something went wrong.