ctolkmit / checker-framework

Automatically exported from code.google.com/p/checker-framework
0 stars 0 forks source link

Checkers Maven plugin does not handle annoated libraries #307

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Dependencies with annotated .class files are not getting handled by the maven 
plugin. I have tried this with 3rd party libraries such as Guava as well as 
custom libraries. The issue seems to be across the board regardless of which 
@Nullable annotation is being used (javax/checkers).

Attached is an example maven project that exhibits the behavior. The plugin 
errors saying both parameters should be @NonNull, even though the .class file 
has @Nullable annotations.

Is there is available fix for this? I tried using <procOnly>false</procOnly> 
but that does not do the trick either.

Adding stub files is my only way around this problem, but it is far from ideal 
since it does not scale and becomes quite tedious when it must be done for 
every project using the library.

public static void main(String[] args) {
  // Class Objects {
  //   <T> T firstNonNull(@Nullable String first, @Nullable String second)
  // }
  String str = Objects.firstNonNull(null, "nonnull");
  System.out.println(str);
}

------------------------------
Build output for "mvn clean checker:check"
------------------------------

[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder 
org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder
 with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building checkers-annoated-library-test develop-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ 
checkers-annoated-library-test ---
[INFO] Deleting C:\maven-checker-test\target
[INFO]
[INFO] --- checker-maven-plugin:1.7.2:check (default-cli) @ 
checkers-annoated-library-test ---
[INFO] Running Checker Framework version: 1.7.2
[INFO] Running processor(s): checkers.nullness.NullnessChecker
[INFO] -------------------------------------------------------------
[WARNING] CHECKER FRAMEWORK ERROR:
[INFO] -------------------------------------------------------------
[ERROR] C:\maven-checker-test\src\main\java\Main.java:[7,35] incompatible types 
in type argument.
  found   : @Initialized @Nullable String
  required: @Initialized @NonNull Object
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.486 s
[INFO] Finished at: 2014-03-24T15:07:34-08:00
[INFO] Final Memory: 7M/245M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal 
edu.washington.cs.types.checker:checker-maven-plugin:1.7.2:check (default-cli) 
on project checkers-annoated-library-test: Errors
found by the processor(s): Errors found by the processor(s):
[ERROR] C:\maven-checker-test\src\main\java\Main.java:[7,35] incompatible types 
in type argument.
[ERROR] found   : @Initialized @Nullable String
[ERROR] required: @Initialized @NonNull Object
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e 
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please 
read the following articles:
[ERROR] [Help 1] 
http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Original issue reported on code.google.com by cord.bar...@gmail.com on 24 Mar 2014 at 10:19

Attachments:

GoogleCodeExporter commented 9 years ago
I have reproduced this issue and I am looking into it.

Thank you for the report.

Original comment by Jonathan...@gmail.com on 25 Mar 2014 at 9:15

GoogleCodeExporter commented 9 years ago

Original comment by Jonathan...@gmail.com on 25 Mar 2014 at 9:24

GoogleCodeExporter commented 9 years ago

Original comment by michael.ernst@gmail.com on 15 Apr 2014 at 6:47

GoogleCodeExporter commented 9 years ago

Original comment by michael.ernst@gmail.com on 25 May 2014 at 4:59