-
Notifications
You must be signed in to change notification settings - Fork 300
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
Android : Build did not fail due to Null Derefence. #891
Comments
Thanks for the report. I think the issue is that the Gradle Errorprone Plugin no longer supports Android: tbroyer/gradle-errorprone-plugin#91 I wonder if things would work with a 2.x version of the Gradle Errorprone Plugin, which also might require using an older version of the Android Gradle Plugin. @AbhishekIIScPhD any chance you could test out older versions to see what happens? Alternately we could just try to figure out how to do everything manually with putting Error Prone and NullAway on the processor path and then passing the right compiler arguments to get things to run. |
@msridhar, you are right. The older version of the plugin, For example 2.0.1 worked on my sample application by breaking the build due to possible null dereferences. Thank you for you time. |
Thanks for confirming. We need to update our instructions for Android. |
Fixes #891. It's hard to add a regression test for this, but I manually tested that with the new configuration, NullAway errors are detected in the sample app. After this lands, I'd like to update the readme further to refer to this particular commit, so users can see the changes we needed to make.
I am working with android application sample-app in the master branch of the repository.
Issue :
Build does not fail due to possible Null Dereference in the application
Android :
I un-commented the code in MainActivity.java under sample-app.
I execute > ./gradlew :sample-app:build but, does not throw any error with the following code fragment.
Code Fragment:
`
Object x = null;
}
static int checkModel(@nonnull String s) {`
Furthermore, I also built the Java application in the repository.
Java :
I made changes to the code in MyClass.java under sample.
When I execute > ./gradlew :sample:build and throws a build error for the following code fragment.
Code Fragment:
`static void log(@nullable Object x) {
if (x == null) {
System.out.println(x.toString());
checkMoodel(null);
}
static int checkModel(@nonnull String s)`
Output :
Please address the build script changes, if any for the Android application.
The text was updated successfully, but these errors were encountered: