From 317c1d188434a576543c33404cc1bd43f3b2b895 Mon Sep 17 00:00:00 2001
From: Stephan Schroevers <stephan.schroevers@teampicnic.com>
Date: Sat, 28 Apr 2018 19:30:36 +0200
Subject: [PATCH] WIP.

This is a mess. Half of these changes aren't necessary.  And this breaks due to
a JDK 9 internal API change. See also
https://github.com/typetools/checker-framework/issues/1224
---
 error-prone-contrib/pom.xml | 25 ++++++++++++++
 pom.xml                     | 65 ++++++++++++++++++++++++++++++++++++-
 2 files changed, 89 insertions(+), 1 deletion(-)

diff --git a/error-prone-contrib/pom.xml b/error-prone-contrib/pom.xml
index 8555f740cca..43c7a603fc9 100644
--- a/error-prone-contrib/pom.xml
+++ b/error-prone-contrib/pom.xml
@@ -74,5 +74,30 @@
             <artifactId>spring-web</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.checkerframework</groupId>
+            <artifactId>checker-compat-qual</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.checkerframework</groupId>
+            <artifactId>checker-qual</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.checkerframework</groupId>
+            <artifactId>checker</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <!--<dependency>
+                <groupId>org.checkerframework</groupId>
+                <artifactId>compiler</artifactId>
+                <scope>provided</scope>
+            </dependency>-->
+        <dependency>
+            <groupId>org.checkerframework</groupId>
+            <artifactId>jdk8</artifactId>
+            <scope>provided</scope>
+        </dependency>
     </dependencies>
 </project>
diff --git a/pom.xml b/pom.xml
index f5f7cf911c0..b5ccd201227 100644
--- a/pom.xml
+++ b/pom.xml
@@ -63,6 +63,7 @@
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <version.auto-service>1.0-rc4</version.auto-service>
+        <version.checker-framework>2.5.5</version.checker-framework>
         <version.error-prone>2.3.2</version.error-prone>
         <version.error-prone-javac>9+181-r4173-1</version.error-prone-javac>
         <version.guava-beta-checker>1.0</version.guava-beta-checker>
@@ -189,10 +190,30 @@
                 <artifactId>junit</artifactId>
                 <version>4.13-beta-2</version>
             </dependency>
+            <dependency>
+                <groupId>org.checkerframework</groupId>
+                <artifactId>checker-compat-qual</artifactId>
+                <version>${version.checker-framework}</version>
+            </dependency>
             <dependency>
                 <groupId>org.checkerframework</groupId>
                 <artifactId>checker-qual</artifactId>
-                <version>2.6.0</version>
+                <version>${version.checker-framework}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.checkerframework</groupId>
+                <artifactId>checker</artifactId>
+                <version>${version.checker-framework}</version>
+            </dependency>
+            <!--<dependency>
+                <groupId>org.checkerframework</groupId>
+                <artifactId>compiler</artifactId>
+                <version>${version.checker-framework}</version>
+            </dependency>-->
+            <dependency>
+                <groupId>org.checkerframework</groupId>
+                <artifactId>jdk8</artifactId>
+                <version>${version.checker-framework}</version>
             </dependency>
             <dependency>
                 <groupId>org.slf4j</groupId>
@@ -867,7 +888,41 @@
                                     <artifactId>nullaway</artifactId>
                                     <version>${version.nullaway}</version>
                                 </path>
+                                <path>
+                                    <groupId>org.checkerframework</groupId>
+                                    <artifactId>checker-qual</artifactId>
+                                    <version>${version.checker-framework}</version>
+                                </path>
+                                <!--<path>
+                                    <groupId>org.checkerframework</groupId>
+                                    <artifactId>checker-compat-qual</artifactId>
+                                    <version>${version.checker-framework}</version>
+                                </path>-->
+                                <path>
+                                    <groupId>org.checkerframework</groupId>
+                                    <artifactId>checker</artifactId>
+                                    <version>${version.checker-framework}</version>
+                                </path>
+                                <!--<path>
+                                    <groupId>org.checkerframework</groupId>
+                                    <artifactId>compiler</artifactId>
+                                    <version>${version.checker-framework}</version>
+                                </path>-->
+                                <!-- EP depends on incompatible version 2.1.14. -->
+                                <!--<path>
+                                    <groupId>org.checkerframework</groupId>
+                                    <artifactId>javacutil</artifactId>
+                                    <version>${version.checker-framework}</version>
+                                </path>-->
+                                <path>
+                                    <groupId>org.checkerframework</groupId>
+                                    <artifactId>jdk8</artifactId>
+                                    <version>${version.checker-framework}</version>
+                                </path>
                             </annotationProcessorPaths>
+                            <annotationProcessors>
+                                <annotationProcessor>org.checkerframework.checker.nullness.NullnessChecker</annotationProcessor>
+                            </annotationProcessors>
                             <compilerArgs combine.children="append">
                                 <!-- We enable nearly all doclint checks,
                                 except that we don't care about missing Javadoc
@@ -912,6 +967,14 @@
                             </compilerArgs>
                             <showWarnings>true</showWarnings>
                         </configuration>
+                        <dependencies>
+                            <!-- Fix in EP -->
+                            <dependency>
+                                <groupId>org.checkerframework</groupId>
+                                <artifactId>checker-qual</artifactId>
+                                <version>${version.checker-framework}</version>
+                            </dependency>
+                        </dependencies>
                     </plugin>
                     <plugin>
                         <groupId>org.apache.maven.plugins</groupId>