ramanathan1504 commented on issue #4007:
URL: 
https://github.com/apache/logging-log4j2/issues/4007#issuecomment-5077313939

   @vy,  I completely overcomplicated things earlier by assuming parent POM 
overrides, and my Docker setup completely collapsed on me and messed up the 
results. 
   
   I started from my local installation, I installed Java 8 locally on my Mac 
and followed your exact steps manually. 
   
   this what i observed:
   
   **1. Created a reproduction project:** 
   I set up a minimal Gradle project using Java Toolchain 8, enabled 
`-Xlint:classfile` and `-Werror`, and added a class calling 
`PropertiesUtil.getProperties()` as Piotr suggested.
   
   **2. Verified against 2.26.0:**
   I pointed the project to `2.26.0`. The build failed with the "class file not 
found" warning:
   ```text
   > Task :compileJava FAILED
   
/Users/ramanathan/.m2/repository/org/apache/logging/log4j/log4j-api/2.26.0/log4j-api-2.26.0.jar(org/apache/logging/log4j/util/PropertiesUtil.class):
 warning: Cannot find annotation method 'value()' in type 
'aQute.bnd.annotation.spi.ServiceConsumer': class file for 
aQute.bnd.annotation.spi.ServiceConsumer not found
   error: warnings found and -Werror specified
   1 error
   3 warnings
   ```
   
   **3. Verified against unpatched 2.27.0-SNAPSHOT (which pulls 7.1.0):**
   I pointed the project to the current `2.x` branch. The build failed and 
reproduced the exact Java 17 bytecode error reported by users:
   ```text
   > Task :compileJava FAILED
   
/Users/ramanathan/.m2/repository/org/apache/logging/log4j/log4j-api/2.27.0-SNAPSHOT/log4j-api-2.27.0-SNAPSHOT.jar(org/apache/logging/log4j/util/PropertiesUtil.class):
 warning: Cannot find annotation method 'value()' in type 
'aQute.bnd.annotation.spi.ServiceConsumer': bad class file: 
/Users/ramanathan/.m2/repository/biz/aQute/bnd/biz.aQute.bnd.annotation/7.1.0/biz.aQute.bnd.annotation-7.1.0.jar(aQute/bnd/annotation/spi/ServiceConsumer.class)
       class file has wrong version 61.0, should be 52.0
       Please remove or make sure it appears in the correct subdirectory of the 
classpath.
   error: warnings found and -Werror specified
   1 error
   3 warnings
   ```
   
   **4. Verified the fix on patched 2.27.0-SNAPSHOT:**
   I bumped `<bnd.annotation.version>` to **`7.2.3`** in 
`log4j-parent/pom.xml`, ran `./mvnw clean install` to install it locally, and 
refreshed the Gradle cache. The build passed perfectly:
   ```text
   > Task :compileJava
   BUILD SUCCESSFUL in 2s
   2 actionable tasks: 2 executed
   ```
   


-- 
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]

Reply via email to