ppkarwasz commented on code in PR #3963:
URL: https://github.com/apache/solr/pull/3963#discussion_r2630130460


##########
gradle/validation/error-prone.gradle:
##########
@@ -61,6 +49,17 @@ allprojects { prj ->
       }
       dependencies {
         errorprone("com.google.errorprone:error_prone_core")
+
+        constraints {
+          rootConfiguration("com.google.errorprone:error_prone_annotations") {
+            version { strictly "2.31.0" }
+            because "Lock Error Prone dependencies to 2.31.0 to prevent 
accidental upgrades"
+          }
+          rootConfiguration("com.google.errorprone:error_prone_core") {
+            version { strictly "2.31.0" }
+            because "Lock Error Prone dependencies to 2.31.0 to prevent 
accidental upgrades"
+          }
+        }

Review Comment:
   There is a Java 11 build issue caused by a change in Log4j intended to 
silence a `-Werror -Xlint:all` warning (in retrospect, that fix introduced more 
follow-up issues than it solved 😢 ).
   
   Originally, users compiling with `-Werror -Xlint:all` hit:
   
   ```text
   warning: Cannot find annotation method 'replacement()' in type 'InlineMe': 
class file for com.google.errorprone.annotations.InlineMe not found
   ```
   
   To address this (see apache/logging-log4j2#3437), Log4j ended up adding 
several annotation artifacts to the **`compileOnlyApi`** configuration for all 
Log4j modules *in the Gradle Module Metadata* (`*.module`) file.
   
   That solves the warning for Gradle consumers (alternatively they could just 
use `-Xlint:-classfile` :wink:), but it also means the `*.module` now pins the 
*same annotation versions Log4j uses to compile itself*, and those versions are 
**Java 17 bytecode**:
   
   * `biz.aQute.bnd.annotation:7.1.0`
   * `com.google.errorprone:error_prone_annotations:2.38.0`
   
   Locally the snippet above works around it by forcing a downgrade, but that 
doesn’t work in the CI:
   
   <details>
     <summary>CI Error</summary>
   
   ```
    * What went wrong:
   Could not determine the dependencies of task ':solr:core:compileJava'.
   > Could not resolve all dependencies for configuration 
':solr:core:compileClasspath'.
      > Could not resolve com.google.errorprone:error_prone_annotations:2.31.0.
        Required by:
            project :solr:core > project :solr:api
            project :solr:core > project :solr:solrj
            project :solr:core > project :solr:solrj-zookeeper
            project :solr:core > project :solr:solrj-streaming
         > Cannot find a version of 
'com.google.errorprone:error_prone_annotations' that satisfies the version 
constraints:
              Dependency path 'org.apache.solr:core:9.11.0-SNAPSHOT' --> 
'org.apache.logging.log4j:log4j-api:2.25.3' (apiElements) --> 
'com.google.errorprone:error_prone_annotations:2.38.0'
              Constraint path 'org.apache.solr:core:9.11.0-SNAPSHOT' --> 
'org.apache.solr:solrj-streaming:9.11.0-SNAPSHOT' (apiElements) --> 
'com.google.errorprone:error_prone_annotations:2.31.0' because of the following 
reason: Computed from com.palantir.consistent-versions' versions.lock in 
solr-root
              Constraint path 'org.apache.solr:core:9.11.0-SNAPSHOT' --> 
'org.apache.solr:solrj-zookeeper:9.11.0-SNAPSHOT' (apiElements) --> 
'com.google.errorprone:error_prone_annotations:2.31.0' because of the following 
reason: Computed from com.palantir.consistent-versions' versions.lock in 
solr-root
              Constraint path 'org.apache.solr:core:9.11.0-SNAPSHOT' --> 
'org.apache.solr:solrj:9.11.0-SNAPSHOT' (apiElements) --> 
'com.google.errorprone:error_prone_annotations:2.31.0' because of the following 
reason: Computed from com.palantir.consistent-versions' versions.lock in 
solr-root
              Constraint path 'org.apache.solr:core:9.11.0-SNAPSHOT' --> 
'org.apache.solr:api:9.11.0-SNAPSHOT' (apiElements) --> 
'com.google.errorprone:error_prone_annotations:2.31.0' because of the following 
reason: Computed from com.palantir.consistent-versions' versions.lock in 
solr-root
              Dependency path 'org.apache.solr:core:9.11.0-SNAPSHOT' --> 
'org.apache.logging.log4j:log4j-core:2.25.3' (apiElements) --> 
'com.google.errorprone:error_prone_annotations:2.38.0'
              Constraint path 'org.apache.solr:core:9.11.0-SNAPSHOT' --> 
'org.apache:solr-root:9.11.0-SNAPSHOT' (gcvLocks) --> 
'com.google.errorprone:error_prone_annotations:{strictly 2.31.0}' because of 
the following reason: Locked by versions.lock
              Dependency path 'org.apache.solr:core:9.11.0-SNAPSHOT' --> 
'com.google.guava:guava:33.1.0-jre' (jreApiElements) --> 
'com.google.errorprone:error_prone_annotations:2.26.1'
              Constraint path 'org.apache.solr:core:9.11.0-SNAPSHOT' --> 
'org.apache.logging.log4j:log4j-api:2.25.3' (apiElements) --> 
'com.google.errorprone:error_prone_annotations:2.38.0' (compile) --> 
'com.google.errorprone:_:2.38.0' (default) --> 
'com.google.errorprone:error_prone_annotations:2.38.0' because of the following 
reason: belongs to platform com.google.errorprone:_:2.38.0
   ```
   
   </details>
   
   Any ideas why? How to downgrade those two dependencies, so that it works 
locally and in the CI?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to