Skip to content
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

Var false possitives detected when NPE (via nullaway) detected #4305

Open
xenoterracide opened this issue Feb 27, 2024 · 3 comments
Open

Var false possitives detected when NPE (via nullaway) detected #4305

xenoterracide opened this issue Feb 27, 2024 · 3 comments

Comments

@xenoterracide
Copy link

xenoterracide commented Feb 27, 2024

maybe this is an issue with nullaway, I'll cross report. None of these @Var's are not effectively final. this.git is variable though.

Full source here https://github.com/xenoterracide/gradle-semver/blob/external/bug/ep/buildSrc/src/main/kotlin/our.javacompile.gradle.kts

/home/runner/work/gradle-semver/gradle-semver/src/main/java/com/xenoterracide/gradle/semver/AbstractGitService.java:28: error: [NullAway] dereferenced expression this.git is @Nullable
    this.git.checkout();
            ^

> Task :compileJava
    (see http://t.uber.com/nullaway )
/home/runner/work/gradle-semver/gradle-semver/src/main/java/com/xenoterracide/gradle/semver/DelegatingSystemReader.java:15: error: [Var] Non-constant variable missing @Var annotation
  DelegatingSystemReader(SystemReader reader) {
                                      ^
    (see https://errorprone.info/bugpattern/Var)
  Did you mean 'DelegatingSystemReader(@Var SystemReader reader) {'?
/home/runner/work/gradle-semver/gradle-semver/src/main/java/com/xenoterracide/gradle/semver/DelegatingSystemReader.java:25: error: [Var] Non-constant variable missing @Var annotation
  public String getenv(String variable) {
                              ^
    (see https://errorprone.info/bugpattern/Var)
  Did you mean 'public String getenv(@Var String variable) {'?
/home/runner/work/gradle-semver/gradle-semver/src/main/java/com/xenoterracide/gradle/semver/DelegatingSystemReader.java:30: error: [Var] Non-constant variable missing @Var annotation
  public String getProperty(String key) {
                                   ^
    (see https://errorprone.info/bugpattern/Var)
  Did you mean 'public String getProperty(@Var String key) {'?
/home/runner/work/gradle-semver/gradle-semver/src/main/java/com/xenoterracide/gradle/semver/DelegatingSystemReader.java:35: error: [Var] Non-constant variable missing @Var annotation
  public FileBasedConfig openUserConfig(Config parent, FS fs) {
                                               ^
    (see https://errorprone.info/bugpattern/Var)
  Did you mean 'public FileBasedConfig openUserConfig(@Var Config parent, FS fs) {'?
/home/runner/work/gradle-semver/gradle-semver/src/main/java/com/xenoterracide/gradle/semver/DelegatingSystemReader.java:35: error: [Var] Non-constant variable missing @Var annotation
  public FileBasedConfig openUserConfig(Config parent, FS fs) {
                                                          ^
    (see https://errorprone.info/bugpattern/Var)
  Did you mean 'public FileBasedConfig openUserConfig(Config parent, @Var FS fs) {'?
/home/runner/work/gradle-semver/gradle-semver/src/main/java/com/xenoterracide/gradle/semver/DelegatingSystemReader.java:[40](https://github.com/xenoterracide/gradle-semver/actions/runs/8065969734/job/22032976374#step:4:41): error: [Var] Non-constant variable missing @Var annotation
  public FileBasedConfig openSystemConfig(Config parent, FS fs) {
                                                 ^
    (see https://errorprone.info/bugpattern/Var)
  Did you mean 'public FileBasedConfig openSystemConfig(@Var Config parent, FS fs) {'?
/home/runner/work/gradle-semver/gradle-semver/src/main/java/com/xenoterracide/gradle/semver/DelegatingSystemReader.java:40: error: [Var] Non-constant variable missing @Var annotation
  public FileBasedConfig openSystemConfig(Config parent, FS fs) {
                                                            ^
    (see https://errorprone.info/bugpattern/Var)
  Did you mean 'public FileBasedConfig openSystemConfig(Config parent, @Var FS fs) {'?
/home/runner/work/gradle-semver/gradle-semver/src/main/java/com/xenoterracide/gradle/semver/DelegatingSystemReader.java:[45](https://github.com/xenoterracide/gradle-semver/actions/runs/8065969734/job/22032976374#step:4:46): error: [Var] Non-constant variable missing @Var annotation
  public FileBasedConfig openJGitConfig(Config parent, FS fs) {
                                               ^
    (see https://errorprone.info/bugpattern/Var)
  Did you mean 'public FileBasedConfig openJGitConfig(@Var Config parent, FS fs) {'?
/home/runner/work/gradle-semver/gradle-semver/src/main/java/com/xenoterracide/gradle/semver/DelegatingSystemReader.java:45: error: [Var] Non-constant variable missing @Var annotation
  public FileBasedConfig openJGitConfig(Config parent, FS fs) {
                                                          ^
    (see https://errorprone.info/bugpattern/Var)
  Did you mean 'public FileBasedConfig openJGitConfig(Config parent, @Var FS fs) {'?
/home/runner/work/gradle-semver/gradle-semver/src/main/java/com/xenoterracide/gradle/semver/DelegatingSystemReader.java:[55](https://github.com/xenoterracide/gradle-semver/actions/runs/8065969734/job/22032976374#step:4:56): error: [Var] Non-constant variable missing @Var annotation
  public int getTimezone(long when) {
                              ^
    (see https://errorprone.info/bugpattern/Var)
  Did you mean 'public int getTimezone(@Var long when) {'?
/home/runner/work/gradle-semver/gradle-semver/src/main/java/com/xenoterracide/gradle/semver/ExceptionTools.java:10: error: [Var] Non-constant variable missing @Var annotation
  static RuntimeException rethrow(Throwable e) {
                                            ^
    (see https://errorprone.info/bugpattern/Var)
  Did you mean 'static RuntimeException rethrow(@Var Throwable e) {'?
aopalliance:aopalliance:1.0=annotationProcessor,errorprone,testAnnotationProcessor
com.github.ben-manes.caffeine:caffeine:3.0.5=annotationProcessor,errorprone,testAnnotationProcessor
com.github.kevinstern:software-and-algorithms:1.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.auto.service:auto-service-annotations:1.0.1=annotationProcessor,errorprone,testAnnotationProcessor
com.google.auto.value:auto-value-annotations:1.9=annotationProcessor,errorprone,testAnnotationProcessor
com.google.auto:auto-common:1.2.2=annotationProcessor,errorprone,testAnnotationProcessor
com.google.code.findbugs:jsr305:3.0.2=annotationProcessor,checkstyle,compileClasspath,errorprone,spotbugs,spotless1659553931,testAnnotationProcessor,testCompileClasspath
com.google.errorprone:error_prone_annotation:2.25.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.errorprone:error_prone_annotations:2.25.0=annotationProcessor,compileClasspath,errorprone,testAnnotationProcessor
com.google.errorprone:error_prone_check_api:2.25.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.errorprone:error_prone_core:2.25.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.errorprone:error_prone_type_annotations:2.25.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.guava:failureaccess:1.0.1=annotationProcessor,checkstyle,errorprone,spotless1659553931,testAnnotationProcessor
com.google.guava:guava-parent:32.1.1-jre=annotationProcessor,errorprone,testAnnotationProcessor
com.google.guava:guava:32.1.1-jre=annotationProcessor,errorprone,testAnnotationProcessor
com.google.inject:guice:5.1.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.protobuf:protobuf-java:3.19.6=annotationProcessor,errorprone,testAnnotationProcessor
com.uber.nullaway:nullaway:0.10.23=annotationProcessor,errorprone,testAnnotationProcessor
io.github.eisop:dataflow-errorprone:3.41.0-eisop1=annotationProcessor,errorprone,testAnnotationProcessor
io.github.java-diff-utils:java-diff-utils:4.12=annotationProcessor,errorprone,spotless1659553931,testAnnotationProcessor
javax.inject:javax.inject:1=annotationProcessor,errorprone,testAnnotationProcessor
org.checkerframework:checker-qual:3.33.0=annotationProcessor,errorprone,testAnnotationProcessor
org.checkerframework:dataflow-nullaway:3.40.0=annotationProcessor,errorprone,testAnnotationProcessor
org.pcollections:pcollections:4.0.1=annotationProcessor,errorprone,testAnnotationProcessor
@XN137
Copy link

XN137 commented Oct 8, 2024

this might be the same problem as described in #4595 wdyt ?

@xenoterracide
Copy link
Author

xenoterracide commented Oct 8, 2024

@XN137 possible, symptoms sound the same. I suppose you could write some tests that add nullaway and see if you get the same result.

@cushon
Copy link
Collaborator

cushon commented Oct 15, 2024

I think I understand what's happening in #4595, @xenoterracide if you get a chance could you try adding -XDshould-stop.ifError=FLOW to this build and see if the false positives go away?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants