question about https://bugs.openjdk.java.net/browse/JDK-8042785
alex.buckley at oracle.com
Fri May 16 19:38:15 UTC 2014
On 5/16/2014 10:11 AM, Vicente-Arturo Romero-Zaldivar wrote:
> Regarding the bug report in the subject. I initially considered it a bug
> but now I'm wondering about the meaning of a final flag in a bridge
> method. Also I didn't find in the spec a reference saying what flags can
> be applied to bridge methods. For example can a bridge method be
> strictfp too?
As David indicated, there is no "problem" with a bridge method being
marked final (or strictfp) in the class file. It's syntactically legal
(access_flags allows it) and semantically level (you can meaningfully
have a bridge method that is not overrideable).
My concern is with unforeseen consequences at the language level. Today
it is possible to override a bridge method - yes, it's almost certainly
accidental, but if we start making some bridge methods final then some
programs are going to break. But, the number of such programs will be
low, and arguably they never deserved to compile. So, I would go ahead
with the bug fix.
More information about the compiler-dev