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 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

Comment From: spring-projects-issues

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).

Comment From: spring-projects-issues

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