checker-framework icon indicating copy to clipboard operation
checker-framework copied to clipboard

Confusing wildcard-related error with Resource Leak Checker

Open msridhar opened this issue 2 years ago • 2 comments

          So most of the problems went away. However, now I can see a weird one:
    [javac] Compiling 1 source file to /home/jlewandowski/dev/cassandra/c18239-static-analysis/build/checkerframework-output
    [javac] /home/jlewandowski/dev/cassandra/c18239-static-analysis/src/java/org/apache/cassandra/utils/IntervalTree.java
    [javac] /home/jlewandowski/dev/cassandra/c18239-static-analysis/src/java/org/apache/cassandra/utils/IntervalTree.java:345: error: [mustcall:bound] incompatible bounds in wildcard
    [javac]                     C min = pointSerializer.deserialize(in);
    [javac]                       ^
    [javac]   type: ?[ extends @MustCall Object super C[ extends @MustCallUnknown Comparable<?> super @MustCallUnknown Void]]
    [javac]   upper bound: @MustCall Object
    [javac]   lower bound: C[ extends @MustCallUnknown Comparable<?[ extends @MustCall Object super C]> super @MustCallUnknown Void]
    [javac] /home/jlewandowski/dev/cassandra/c18239-static-analysis/src/java/org/apache/cassandra/utils/IntervalTree.java:346: error: [mustcall:bound] incompatible bounds in wildcard
    [javac]                     C max = pointSerializer.deserialize(in);
    [javac]                       ^
    [javac]   type: ?[ extends @MustCall Object super C[ extends @MustCallUnknown Comparable<?> super @MustCallUnknown Void]]
    [javac]   upper bound: @MustCall Object
    [javac]   lower bound: C[ extends @MustCallUnknown Comparable<?[ extends @MustCall Object super C]> super @MustCallUnknown Void]
    [javac] 2 errors

That can be reproduced with the following command:

ant cf-only '-Dcf.check.only=**/IntervalTree.java'

on this branch: https://github.com/jacek-lewandowski/cassandra/tree/checker-framework-testing

Originally posted by @jacek-lewandowski in https://github.com/typetools/checker-framework/issues/6077#issuecomment-1640221392

msridhar avatar Jul 18 '23 16:07 msridhar

@smillst does this look like #979 to you?

msridhar avatar Jul 18 '23 16:07 msridhar

@smillst does this look like #979 to you?

No, there's no type argument inference on these lines.

smillst avatar Jul 18 '23 16:07 smillst