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

org.apiguardian.api.API$Status not found after upgrading to 2021.0 and Spring Boot 2.6.1 #231

Closed
Zanndorin opened this issue Dec 3, 2021 · 6 comments

Comments

@Zanndorin
Copy link

Zanndorin commented Dec 3, 2021

Describe the bug
Getting a lot of

warning: unknown enum constant Status.STABLE
  reason: class file for org.apiguardian.api.API$Status not found 

(and a single)

warning: unknown enum constant Status.EXPERIMENTAL

warnings since upgrading to 2021.0 and Spring Boot 2.6.1, probably cause by SpringMockMVC calls in my junit5 test.
Running Java jdk-17+35 from Adoptium and gradle-7.3.1

Sample

@Test
    @DisplayName("Fetch request with empty body should return 400 response")
    public void fetchRestTest400() throws Exception {
        this.mockMvc.perform(post("/metadata")).andDo(print()).andExpect(status().is4xxClientError());
    }
@spencergibb
Copy link
Member

What is org.apiguardian.api.API$Status? It doesn't come from spring cloud

@Zanndorin
Copy link
Author

Zanndorin commented Dec 4, 2021

It was a "big" issue in 2017, I'm also confused why this should be caused by Spring Cloud but if we change it back to 2020.0.4 and earlier the warning disappears. I haven't really verified, but I assumed it is used via SpringMockMVC so my only guess is that some Spring dependency included in 2021.0.0 now overwrites something and causes this old bug to be back? Haven't found other people having this issue but we were quite early with the update...

(The issue could also be caused by Spring Boot 2.6.X of course or even a Gradle + Spring issue)

https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/test/web/servlet/MockMvc.html

junit-team/junit5#1105

@spencergibb
Copy link
Member

Did the change back to 2020.0.4 also include a boot change (since it's not compatible with boot 2.6)? I'm fairly confident that this isn't caused by spring cloud. Can you show your dependencies and the dependency tree from Gradle or maven?

@Zanndorin
Copy link
Author

Zanndorin commented Dec 4, 2021

Yes when changing back to Spring Cloud 2020.0.4 we also went to Boot 2.5.X, that was why I wrote 2.6.X and 2021.0.0 vs 2.5.X and 2020.0.4. Have not had time to verify the dependency tree / spend more time on the issue since it felt minor (only warnings and the tests still pass). Just wanted to document it somewhere because I found no one else having the issue and wasn't sure if we were just way to early. We upgraded to 2021.0.0 on Thursday as soon as it was available from Github. I know that they upgraded to JUnit 5.8.1 with Boot 2.6 so maybe I should try and post this to Spring Boot and JUnit too?

@spencergibb
Copy link
Member

Not without more information. We currently have no way to verify it reproduce the problem.

@Zanndorin
Copy link
Author

Yeah seems like Spring Boot starter Test 2.6.1 updated to Jupiter 5.8.1 which should contain the guardian but doesn't for us for some reason.

https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api/5.8.1

+--- org.springframework.boot:spring-boot-starter-test -> 2.5.4
|    +--- org.junit.jupiter:junit-jupiter:5.7.2
|    |    +--- org.junit:junit-bom:5.7.2
|    |    |    +--- org.junit.jupiter:junit-jupiter:5.7.2 (c)
|    |    |    +--- org.junit.jupiter:junit-jupiter-api:5.7.2 (c)
|    |    |    +--- org.junit.jupiter:junit-jupiter-engine:5.7.2 (c)
|    |    |    +--- org.junit.jupiter:junit-jupiter-params:5.7.2 (c)
|    |    |    +--- org.junit.platform:junit-platform-commons:1.7.2 (c)
|    |    |    \--- org.junit.platform:junit-platform-engine:1.7.2 (c)
|    |    +--- org.junit.jupiter:junit-jupiter-api:5.7.2
|    |    |    +--- org.junit:junit-bom:5.7.2 (*)
|    |    |    +--- org.apiguardian:apiguardian-api:1.1.0
|    |    |    +--- org.opentest4j:opentest4j:1.2.0
|    |    |    \--- org.junit.platform:junit-platform-commons:1.7.2
|    |    |         +--- org.junit:junit-bom:5.7.2 (*)
+--- org.springframework.boot:spring-boot-starter-test -> 2.6.1
|    +--- org.junit.jupiter:junit-jupiter:5.8.1
|    |    +--- org.junit:junit-bom:5.8.1
|    |    |    +--- org.junit.jupiter:junit-jupiter:5.8.1 (c)
|    |    |    +--- org.junit.jupiter:junit-jupiter-api:5.8.1 (c)
|    |    |    +--- org.junit.jupiter:junit-jupiter-engine:5.8.1 (c)
|    |    |    +--- org.junit.jupiter:junit-jupiter-params:5.8.1 (c)
|    |    |    +--- org.junit.platform:junit-platform-commons:1.8.1 (c)
|    |    |    \--- org.junit.platform:junit-platform-engine:1.8.1 (c)
|    |    +--- org.junit.jupiter:junit-jupiter-api:5.8.1
|    |    |    +--- org.junit:junit-bom:5.8.1 (*)
|    |    |    +--- org.opentest4j:opentest4j:1.2.0
|    |    |    \--- org.junit.platform:junit-platform-commons:1.8.1
|    |    |         \--- org.junit:junit-bom:5.8.1 (*)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants