Skip to content

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

@wilkinsona

Description

@wilkinsona

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions