question about https://bugs.openjdk.java.net/browse/JDK-8042785

Vicente-Arturo Romero-Zaldivar vicente.romero at oracle.com
Fri May 16 21:09:41 UTC 2014


Hi Alex,

Thanks for your replay. I already have a fix for this bug that is 
copying flags like final and strictfp from the original method to the 
bridge method, and no one else. But I preferred to double check with you 
before going on with the fix.

Thanks,
Vicente

On 16/05/14 20:46, David M. Lloyd wrote:
> On 05/16/2014 02:38 PM, Alex Buckley wrote:
>> Hi Vicente,
>>
>> 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.
>
> Not to mention any program which is relying on finality as a security 
> mechanism...
>



More information about the compiler-dev mailing list