Bug in javac release flag?
Jonathan Gibbons
jonathan.gibbons at oracle.com
Mon Jan 22 15:34:54 UTC 2018
Forwarding to compiler-dev, which is a better place to discuss this issue.
-- Jon
On 1/22/18 7:11 AM, Stephen Colebourne wrote:
> I think I have a problem with the java release flag, reported by a user here:
> https://github.com/ThreeTen/threeten-extra/issues/91
>
> The particular case that is a problem are the new methods on java.lang.Math.
>
> Java 8 had these methods:
> floorDiv(long,long)
> floorDiv(int,int)
>
> Java 9 has these methods:
> floorDiv(long,long)
> floorDiv(int,int)
> floorDiv(long,int)
>
> (there are similar new overloads for other method names)
>
> Clearly, if you build on Java 9, code can link to the new(long,int)
> overload, but that code will get a NoSuchMethodError on Java 8.
>
> But, I am using Java 9 with the javac release flag set to be 8. If I
> understand the release flag correctly, the (long,int) overload should
> not be visible, and thus a different overload should be selected.
>
> So, is this a bug? Perhaps the tool that captures new method
> signatures doesn't handle overloads?
>
> (ThreeTen-Extra v1.3 was built using Maven on Java 9 using Maven's
> implementation of the release flag, so it could be Maven that is
> buggy, but I don't think so as it produces the correct classfile
> version number).
>
> thanks
> Stephen
More information about the core-libs-dev
mailing list