Possible javac bug around final and covariant overrides
Vicente-Arturo Romero-Zaldivar
vicente.romero at oracle.com
Thu May 8 19:21:57 UTC 2014
Hi David,
IMO this is a bug. I have filed
https://bugs.openjdk.java.net/browse/JDK-8042785 to track it.
Thanks for your report,
Vicente
On 22/04/14 14:35, David M. Lloyd wrote:
> While exploring adding covariant overrides for Buffer classes, it was
> discovered that javac is not making synthetic methods for covariant
> overrides match the finality of the covariant method.
>
> Simple illustration:
>
> public class Test {
> public Object foo() { return null; }
> }
> public class TestSub extends Test {
> public final String foo() { return null; }
> }
>
> Yields (javap output):
>
> public class Test {
> public Test();
> public java.lang.Object foo();
> }
> public class TestSub extends Test {
> public TestSub();
> public final java.lang.String foo();
> public java.lang.Object foo(); // <- not final?!
> }
>
> Is there a good reason for this? Hypothetically it would seem that
> this might prevent HotSpot from modifying calls to the synthetic
> method to be monomorphic. Is this a legitimate concern?
>
More information about the compiler-dev
mailing list