I have a Java 8 application with I want to bring to Java 11. The Gradle 5.0 build contains a dependency to JFreeChart 1.5.0 and JAVA_HOME is set to the installed jdk-11.0.1 from Oracle. When building a get the following output:
> Task :nemclient:compileJava
error: clone() in AbstractXYItemRenderer cannot implement clone() in PublicCloneable
attempting to assign weaker access privileges; was public
The class AbstractXYItemRenderer is provided by the JFreeChart library. There are two questions:
- Why does the build complain after all? Since I don't assume that Gradle tries to build the library (the library source is not provided here), what causes this error?
- An analysis of the library source shows, that the class
AbstractXYItemRenderer
doesn't implement thePublicClone
interface at all, neither directly nor indirectly.
The error disappears, when the modifier of the clone method is changed from protected to public. But I'd prefer to leave the code unchanged.
BTW: The same project in Eclipse (using Java 11 plugin and the mentioned jdk-11.0.1) has no compile issue.