Skip to content

Commit

Permalink
Fix weird issue with annotation in test compilation
Browse files Browse the repository at this point in the history
Without this change `./gradlew :executor:compileTestJava` fails with:

```
> Task :executor:compileTestJava
/home/runner/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/33.2.1-jre/818e780da2c66c63bbb6480fef1f3855eeafa3e4/guava-33.2.1-jre.jar(/com/google/common/collect/Streams.class): warning: Cannot find annotation method 'replacement()' in type 'InlineMe': class file for com.google.errorprone.annotations.InlineMe not found
/home/runner/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/33.2.1-jre/818e780da2c66c63bbb6480fef1f3855eeafa3e4/guava-33.2.1-jre.jar(/com/google/common/collect/Streams.class): warning: Cannot find annotation method 'replacement()' in type 'InlineMe'
/home/runner/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/33.2.1-jre/818e780da2c66c63bbb6480fef1f3855eeafa3e4/guava-33.2.1-jre.jar(/com/google/common/collect/Streams.class): warning: Cannot find annotation method 'value()' in type 'InlineMeValidationDisabled': class file for com.google.errorprone.annotations.InlineMeValidationDisabled not found
/home/runner/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/33.2.1-jre/818e780da2c66c63bbb6480fef1f3855eeafa3e4/guava-33.2.1-jre.jar(/com/google/common/collect/Streams.class): warning: Cannot find annotation method 'replacement()' in type 'InlineMe'
/home/runner/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/33.2.1-jre/818e780da2c66c63bbb6480fef1f3855eeafa3e4/guava-33.2.1-jre.jar(/com/google/common/collect/Streams.class): warning: Cannot find annotation method 'value()' in type 'InlineMeValidationDisabled'
/home/runner/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/33.2.1-jre/818e780da2c66c63bbb6480fef1f3855eeafa3e4/guava-33.2.1-jre.jar(/com/google/common/collect/Streams.class): warning: Cannot find annotation method 'replacement()' in type 'InlineMe'
/home/runner/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/33.2.1-jre/818e780da2c66c63bbb6480fef1f3855eeafa3e4/guava-33.2.1-jre.jar(/com/google/common/collect/Streams.class): warning: Cannot find annotation method 'value()' in type 'InlineMeValidationDisabled'
/home/runner/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/33.2.1-jre/818e780da2c66c63bbb6480fef1f3855eeafa3e4/guava-33.2.1-jre.jar(/com/google/common/collect/Streams.class): warning: Cannot find annotation method 'replacement()' in type 'InlineMe'
/home/runner/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/33.2.1-jre/818e780da2c66c63bbb6480fef1f3855eeafa3e4/guava-33.2.1-jre.jar(/com/google/common/collect/Streams.class): warning: Cannot find annotation method 'value()' in type 'InlineMeValidationDisabled'
error: warnings found and -Werror specified
```

`./gradlew allDeps` should the correct annotations dependency being part of the test compilation classpath.

Go figure.
  • Loading branch information
big-andy-coates committed Jun 23, 2024
1 parent bb55441 commit 1bbea00
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions executor/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,10 @@ tasks.test {
dependsOn(":test-service-extension-metadata:jar")
dependsOn(":test-services:jar")
dependsOn(":test-service:buildAppImage")
}

tasks.compileTestJava {
// For some reason, since upgrading guava-testlib from 33.0.0-jre to 33.1.0-jre, without this, task fails with:
// ../com.google.guava/guava/33.2.1-jre/818e780da2c66c63bbb6480fef1f3855eeafa3e4/guava-33.2.1-jre.jar(/com/google/common/collect/Streams.class): warning: Cannot find annotation method 'replacement()' in type 'InlineMe': class file for com.google.errorprone.annotations.InlineMe not found
options.compilerArgs.add("-Xlint:-classfile")
}

0 comments on commit 1bbea00

Please sign in to comment.