Hi Werner,
Here is the smallest representation that I can manage. As I am using gradle (3.1, same results under 2.4) and the issue is a build issue, the problem is presenting itself as necessarily a gradle problem.
To be clear, I do not suspect any conflict between CheckerFramework and montis static_code_analysis, so I have left the latter out of this example.
Listed towards the end of this message are a very simple Java file and a slightly less simple gradle.build file using lombok which demonstrates the problem. Lombok, through the medium of the @Data annotation, generates setters and getters for package-protected members 'foo' and 'bar'.
If this is built with the gradle.build file listed below (with the last 10 lines commented out, effectively disabling CheckerFramework as indicated here), it works fine.
$ ./gradlew build
:compileJava
:processResources UP-TO-DATE
:classes
:jar
:assemble
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test UP-TO-DATE
:check UP-TO-DATE
:build
BUILD SUCCESSFUL
Total time: 1.302 secs
$ java -cp build/libs/demo-conflict.jar org.test.Test
test has foo = 5, bar = BAR
If I enable CheckerFramework by removing the comments around that last block, the build looks like this:
$ ./gradlew build
:compileJavaC:\Users\mdykman\projects\mergespace\demo-conflict\src\main\java\org\test\Test.java:14: error: cannot find symbol
System.out.println(String.format("test has foo = %d, bar = %s",test.getFoo(),test.getBar()));
^
symbol: method getFoo()
location: variable test of type Test
C:\Users\mdykman\projects\mergespace\demo-conflict\src\main\java\org\test\Test.java:14: error: cannot find symbol
System.out.println(String.format("test has foo = %d, bar = %s",test.getFoo(),test.getBar()));
^
symbol: method getBar()
location: variable test of type Test
2 errors
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 1.749 secs
======== Test.java =======
package org.test;
import lombok.Data;
@Data
public class Test {
int foo = 5;
String bar="BAR";
public static void main(String[] args) {
Test test = new Test();
System.out.println(String.format("test has foo = %d, bar = %s",test.getFoo(),test.getBar()));
}
}
============= end of Test.java ==============
Here is my minimum gradle.build file. The interesting part is found in the last 10 lines.
========== build.gradle ============
apply plugin: 'java'
apply plugin: 'eclipse'
repositories {
jcenter()
}
ext.checkerFrameworkVersion = '2.1.4'
ext.jdkVersion = 'jdk8'
ext.targetJavaVersion = JavaVersion.VERSION_1_8
configurations {
checkerFrameworkJavac {
description = 'a customization of the OpenJDK javac compiler with additional support for type annotations'
}
checkerFrameworkAnnotatedJDK {
description = 'a copy of JDK classes with Checker Framework type qualifers inserted'
}
checkerFramework {
description = 'The Checker Framework: custom pluggable types for Java'
}
}
dependencies {
compile group: 'org.projectlombok', name: 'lombok', version: '1.16.8'
compile group: 'org.checkerframework', name: 'checker', version: checkerFrameworkVersion
checkerFrameworkAnnotatedJDK "org.checkerframework:${jdkVersion}:${checkerFrameworkVersion}"
checkerFramework "org.checkerframework:checker:${checkerFrameworkVersion}"
compile "org.checkerframework:checker-qual:${checkerFrameworkVersion}"
}
/*
tasks.withType(JavaCompile).all { JavaCompile compile ->
compile.options.compilerArgs = [
'-processor', 'org.checkerframework.checker.nullness.NullnessChecker',
'-processorpath', "${configurations.checkerFramework.asPath}",
// uncomment to turn Checker Framework errors into warnings
// '-Awarns',
"-Xbootclasspath/p:${configurations.checkerFrameworkAnnotatedJDK.asPath}"
]
}
*/