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

Improve failure analysis of NoSuchMethodErrors to show where superclasses were loaded from #21587

Closed
wilkinsona opened this issue May 27, 2020 · 0 comments
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@wilkinsona
Copy link
Member

When a subclass attempts to call a method on its superclass that is missing, the failure analysis isn't as helpful as it could be. It currently looks like this:

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    org.springframework.data.r2dbc.mapping.R2dbcMappingContext.<init>(R2dbcMappingContext.java:45)

The following method did not exist:

    org.springframework.data.r2dbc.mapping.R2dbcMappingContext.setForceQuote(Z)V

The method's class, org.springframework.data.r2dbc.mapping.R2dbcMappingContext, is available from the following locations:

    jar:file:/Users/awilkinson/.gradle/caches/modules-2/files-2.1/org.springframework.data/spring-data-r2dbc/1.1.0.RELEASE/646a7a0769b03db8ae46ec325b0df448854dd695/spring-data-r2dbc-1.1.0.RELEASE.jar!/org/springframework/data/r2dbc/mapping/R2dbcMappingContext.class

It was loaded from the following location:

    file:/Users/awilkinson/.gradle/caches/modules-2/files-2.1/org.springframework.data/spring-data-r2dbc/1.1.0.RELEASE/646a7a0769b03db8ae46ec325b0df448854dd695/spring-data-r2dbc-1.1.0.RELEASE.jar

In this case setForceQuote(boolean) should be inherited from org.springframework.data.relational.core.mapping.RelationalMappingContext but the version of RelationalMappingContext that's on the classpath is incompatible. We already include some information about where the class with the missing method was loaded from. When it's a method that should have been inherited, it would be useful to also include information about where its superclasses have been loaded from.

@wilkinsona wilkinsona added the type: enhancement A general enhancement label May 27, 2020
@wilkinsona wilkinsona added this to the 2.3.x milestone May 27, 2020
@wilkinsona wilkinsona self-assigned this May 27, 2020
@snicoll snicoll modified the milestones: 2.3.x, 2.3.1 May 27, 2020
snicoll added a commit that referenced this issue May 27, 2020
This commit polishes the assertions of the NoSuchMethodError failure
analyzer as the method format changes according to the JDK.

See gh-21587
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants