Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

open-api: Fix compile warnings for testFixtures #11071

Merged
merged 1 commit into from
Sep 5, 2024

Conversation

ajantha-bhat
Copy link
Member

@ajantha-bhat ajantha-bhat commented Sep 3, 2024

./gradlew clean build -x test -x integrationTest --no-build-cache results in compile warnings for open-api module.

Screenshot 2024-09-02 at 7 49 23 PM

The reason is that new dependencies that are added in #10908 requires apigurdian during testFixtureCompilation.

+--- org.junit.jupiter:junit-jupiter:5.10.1 -> 5.10.3
|    +--- org.junit:junit-bom:5.10.3
|    |    +--- org.junit.jupiter:junit-jupiter:5.10.3 (c)
|    |    +--- org.junit.jupiter:junit-jupiter-engine:5.10.3 (c)
|    |    +--- org.junit.platform:junit-platform-commons:1.10.3 (c)
|    |    +--- org.junit.platform:junit-platform-engine:1.10.3 (c)
|    |    +--- org.junit.platform:junit-platform-suite-api:1.10.3 (c)
|    |    +--- org.junit.platform:junit-platform-suite-engine:1.10.3 (c)
|    |    +--- org.junit.jupiter:junit-jupiter-api:5.10.3 (c)
|    |    \--- org.junit.jupiter:junit-jupiter-params:5.10.3 (c)
|    +--- org.junit.jupiter:junit-jupiter-api:5.10.3
|    |    +--- org.junit:junit-bom:5.10.3 (*)
|    |    +--- org.opentest4j:opentest4j:1.3.0
|    |    +--- org.junit.platform:junit-platform-commons:1.10.3
|    |    |    +--- org.junit:junit-bom:5.10.3 (*)
|    |    |    \--- org.apiguardian:apiguardian-api:1.1.2
|    |    \--- org.apiguardian:apiguardian-api:1.1.2
|    \--- org.junit.jupiter:junit-jupiter-params:5.10.3
|         +--- org.junit:junit-bom:5.10.3 (*)
|         +--- org.junit.jupiter:junit-jupiter-api:5.10.3 (*)
|         \--- org.apiguardian:apiguardian-api:1.1.2
+--- org.junit.jupiter:junit-jupiter-engine:5.10.1 -> 5.10.3
|    +--- org.junit:junit-bom:5.10.3 (*)
|    +--- org.junit.platform:junit-platform-engine:1.10.3
|    |    +--- org.junit:junit-bom:5.10.3 (*)
|    |    +--- org.opentest4j:opentest4j:1.3.0
|    |    +--- org.junit.platform:junit-platform-commons:1.10.3 (*)
|    |    \--- org.apiguardian:apiguardian-api:1.1.2
|    +--- org.junit.jupiter:junit-jupiter-api:5.10.3 (*)
|    \--- org.apiguardian:apiguardian-api:1.1.2

@@ -177,6 +178,7 @@ slf4j-simple = { module = "org.slf4j:slf4j-simple", version.ref = "slf4j" }
snowflake-jdbc = { module = "net.snowflake:snowflake-jdbc", version.ref = "snowflake-jdbc" }

# test libraries
apiguardian = { module = "org.apiguardian:apiguardian-api", version.ref = "apiguardian" }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danielcweeks
Copy link
Contributor

@ajantha-bhat Strange as it may seem, we can use exclusions and not add a new library:

    testImplementation(libs.junit.suite.api) {
      exclude group: 'org.junit.jupiter'
    }
    testImplementation(libs.junit.suite.engine) {
      exclude group: 'org.junit.jupiter'
    }

I think I'd prefer this over adding new libraries

@ajantha-bhat
Copy link
Member Author

@danielcweeks: I tried excluding as you suggested and it didn't work. I also tried excluding just the exclude group: 'org.apiguardian', module: 'apiguardian-api' and it didn't work either.

The compile warnings is from Task :iceberg-open-api:compileTestFixturesJava. I checked the ./gradlew :iceberg-open-api:dependencies and couldn't find any dependencies that needs apiguardian for TestFixtures. So, I am assuming this dependency is needed by the plugin 'java-test-fixtures'?

I didn't find a way to fix these warnings without adding this compile time dependency. Feel free to try it out and let me know if there are other ways to handle this.

@danielcweeks
Copy link
Contributor

@ajantha-bhat Yeah, you're right. I must have been running with a cache and it was hiding the errors.

The dependency is pulled in via the RESTServerExtention.java in testFixtures via these interfaces:

import org.junit.jupiter.api.extension.AfterAllCallback;
import org.junit.jupiter.api.extension.BeforeAllCallback;
import org.junit.jupiter.api.extension.ExtensionContext;

which in turn have the annotations:

@API(
  status = Status.STABLE,
  since = "5.0"
)

I think they had previously fixed this issue in JUnit, but it looks like it has crept back into the latest releases.

@danielcweeks danielcweeks merged commit 2391bdd into apache:main Sep 5, 2024
47 checks passed
zachdisc pushed a commit to zachdisc/iceberg that referenced this pull request Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants