[infer][eradicate] add support for butterknife @Bind annotation

Summary:
Add support for field initilized via the @Bind construct of Butterknife
master
jrm 9 years ago
parent c0446276a1
commit fcc0c72ecb

@ -0,0 +1,7 @@
prebuilt_jar(
name = 'butterknife',
binary_jar = 'butterknife-7.0.1.jar',
visibility = [
'PUBLIC',
],
)

@ -97,6 +97,8 @@ let ma_contains ma ann_names =
let initializer_ = "com.facebook.infer.annotation.Initializer" let initializer_ = "com.facebook.infer.annotation.Initializer"
let inject = "Inject" let inject = "Inject"
let inject_view = "InjectView"
let bind = "Bind"
let mutable_ = "Mutable" let mutable_ = "Mutable"
let nullable = "Nullable" let nullable = "Nullable"
let nonnull = "Nonnull" let nonnull = "Nonnull"
@ -113,15 +115,17 @@ let ia_is_present ia =
ia_ends_with ia present ia_ends_with ia present
let ia_is_nonnull ia = let ia_is_nonnull ia =
ia_ends_with ia nonnull list_exists
|| ia_ends_with ia notnull (ia_ends_with ia)
|| ia_ends_with ia camel_nonnull [nonnull; notnull; camel_nonnull]
let ia_is_initializer ia = let ia_is_initializer ia =
ia_contains ia initializer_ ia_contains ia initializer_
let ia_is_inject ia = let ia_is_inject ia =
ia_ends_with ia inject list_exists
(ia_ends_with ia)
[inject; inject_view; bind]
let ia_is_mutable ia = let ia_is_mutable ia =
ia_ends_with ia mutable_ ia_ends_with ia mutable_

@ -6,6 +6,7 @@ dependencies = [
'//dependencies/java/jsr-305:jsr-305', '//dependencies/java/jsr-305:jsr-305',
'//dependencies/java/jsr-330:jsr-330', '//dependencies/java/jsr-330:jsr-330',
'//dependencies/java/android/support/v4:android-support-v4', '//dependencies/java/android/support/v4:android-support-v4',
'//dependencies/java/butterknife:butterknife',
] ]
java_library( java_library(

@ -9,7 +9,11 @@
package codetoanalyze.java.eradicate; package codetoanalyze.java.eradicate;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.widget.EditText;
import butterknife.Bind;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -27,6 +31,8 @@ public class FieldNotInitialized {
@NonNull String e; @NonNull String e;
@Bind(42) EditText f;
// Eradicate should only report one initialization error // Eradicate should only report one initialization error
FieldNotInitialized() {} FieldNotInitialized() {}

Loading…
Cancel
Save