diff --git a/dependencies/java/butterknife/BUCK b/dependencies/java/butterknife/BUCK new file mode 100644 index 000000000..af8411ff2 --- /dev/null +++ b/dependencies/java/butterknife/BUCK @@ -0,0 +1,7 @@ +prebuilt_jar( + name = 'butterknife', + binary_jar = 'butterknife-7.0.1.jar', + visibility = [ + 'PUBLIC', + ], +) diff --git a/dependencies/java/butterknife/butterknife-7.0.1.jar b/dependencies/java/butterknife/butterknife-7.0.1.jar new file mode 100644 index 000000000..7a03a8a2c Binary files /dev/null and b/dependencies/java/butterknife/butterknife-7.0.1.jar differ diff --git a/infer/src/checkers/annotations.ml b/infer/src/checkers/annotations.ml index eef5ddb0e..6286761c1 100644 --- a/infer/src/checkers/annotations.ml +++ b/infer/src/checkers/annotations.ml @@ -97,6 +97,8 @@ let ma_contains ma ann_names = let initializer_ = "com.facebook.infer.annotation.Initializer" let inject = "Inject" +let inject_view = "InjectView" +let bind = "Bind" let mutable_ = "Mutable" let nullable = "Nullable" let nonnull = "Nonnull" @@ -113,15 +115,17 @@ let ia_is_present ia = ia_ends_with ia present let ia_is_nonnull ia = - ia_ends_with ia nonnull - || ia_ends_with ia notnull - || ia_ends_with ia camel_nonnull + list_exists + (ia_ends_with ia) + [nonnull; notnull; camel_nonnull] let ia_is_initializer ia = ia_contains ia initializer_ 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 = ia_ends_with ia mutable_ diff --git a/infer/tests/codetoanalyze/java/eradicate/BUCK b/infer/tests/codetoanalyze/java/eradicate/BUCK index 966e21f98..21b1891f9 100644 --- a/infer/tests/codetoanalyze/java/eradicate/BUCK +++ b/infer/tests/codetoanalyze/java/eradicate/BUCK @@ -6,6 +6,7 @@ dependencies = [ '//dependencies/java/jsr-305:jsr-305', '//dependencies/java/jsr-330:jsr-330', '//dependencies/java/android/support/v4:android-support-v4', + '//dependencies/java/butterknife:butterknife', ] java_library( diff --git a/infer/tests/codetoanalyze/java/eradicate/FieldNotInitialized.java b/infer/tests/codetoanalyze/java/eradicate/FieldNotInitialized.java index d363fa04c..b9d4a01fa 100644 --- a/infer/tests/codetoanalyze/java/eradicate/FieldNotInitialized.java +++ b/infer/tests/codetoanalyze/java/eradicate/FieldNotInitialized.java @@ -9,7 +9,11 @@ package codetoanalyze.java.eradicate; + import android.support.annotation.NonNull; +import android.widget.EditText; + +import butterknife.Bind; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -27,6 +31,8 @@ public class FieldNotInitialized { @NonNull String e; + @Bind(42) EditText f; + // Eradicate should only report one initialization error FieldNotInitialized() {}