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

beans.support type mismatch on PropertyComparator<T>() class [SPR-16920] #21459

Open
spring-projects-issues opened this issue Jun 8, 2018 · 2 comments
Labels
in: core status: waiting-for-triage

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Jun 8, 2018

Ron White opened SPR-16920 and commented

Hi!
Build/Compiling Spring Boot (2.0.2 Release) with Gradle 4.8, Goovy 2.4.12, Ant 1.9.11 on MacBookPro running JVM 1.8.0_25.  

Failed to compile on package org.springframework.beans.support
class PropertyComparator. It seems there is a type mismatch at/around line 135. 
Here is the error:

error: incompatible types:
PropertyComparator<CAP#1> cannot be converted to Comparator<? super CAP#1>                 source.sort(new PropertyComparator<>(sortDefinition));
where CAP#1 is a fresh type-variable:  CAP#1 extends Object from capture of ?

Was able to get the class to compile by removing the generic at line 136:

136        // source.sort(new PropertyComparator<>(sortDefinition));
137         source.sort(new PropertyComparator(sortDefinition));

If there is a better solution, please let me know.  

Thanks
rwhite35


Affects: 5.0.1

Reference URL: https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/beans/support/PropertyComparator.html

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jun 8, 2018

Juergen Hoeller commented

Could you try a newer JDK 8 release please? There have been a few bugs in javac's generics handling in recent years, and our code is generally known to compile fine with recent JDK 8 releases (in particular JDK 8 update 102 and later).

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jun 8, 2018

Ron White commented

Hi Juergen,

Yep, that seems to have corrected the issue.  Updated JDK from 1.8.0_25 to 1.8.0_171, changed the code back to the released version and re-ran the build.  Project built successfully without any errors.

Thank!
rwhite35

@spring-projects-issues spring-projects-issues added type: bug status: waiting-for-triage and removed type: bug labels Jan 11, 2019
@rstoyanchev rstoyanchev added the in: core label Nov 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core status: waiting-for-triage
Projects
None yet
Development

No branches or pull requests

2 participants