Questions tagged [nullaway]

5 questions
2
votes
1 answer

Kotlin's smart cast fails simple non-nullability deduction

Trying to understand why Kotlin's smart cast doesn't trigger for a fairly simple use case: val x: Int? = 1 val notNull: Boolean = x != null if (notNull) { val y: Int = x // fails to smart cast } However it works if we remove the intermediate…
Grozz
  • 8,317
  • 4
  • 38
  • 53
1
vote
0 answers

Error Prone and NullAway Illegal Access Exception

I am incorporating null away and error prone into my app and have added the following to my top-level build.gradle buildscript { repositories { google() maven { url 'https://plugins.gradle.org/m2/' } ... } …
Zachary Sweigart
  • 1,051
  • 9
  • 23
1
vote
0 answers

Non annotated methos as nullable by default

Is it possible to configure the IntelliJ or maybe the NullAway to consider non annotated method as Nullable by default? e.g. The following method: context.getResources().getString(R.string.app_name); The getResources is not annotated as nullable or…
ademar111190
  • 14,215
  • 14
  • 85
  • 114
0
votes
1 answer

How to use Lombok's RequiredArgsConstructor with Nullaway?

We're trying to add "Nullaway" (https://github.com/uber/NullAway) to our repo. This is a tool that assumes everything not annotated with @Nullable can't be null and enforces it in compile time. We also use Lombok, with focus on @Data. Lombok decides…
0
votes
2 answers

In a Maven build how do I configure Nullaway to exclude test classes?

In a Maven build how do I configure Nullaway to exclude test classes? Right now it's firing on code that specifically checks that NullPointerExceptions are thrown in the right places. The code to be excluded lives in the customary src/test/java…