modifiers of default methods
Joe Darcy
joe.darcy at oracle.com
Fri Oct 5 10:54:43 PDT 2012
On 10/4/2012 5:10 PM, David Holmes wrote:
> On 4/10/2012 11:34 AM, Stephan Herrmann wrote:
>> Using jdk1.8.0-lambda-8-b56 I can compile the following
>>
>> public interface I {
>> strictfp synchronized void foo() default {}
>> }
> Interesting. I hadn't thought about this aspect of default methods. I
> can easily imagine people interpreting the above as meaning that the
> foo() method must always be synchronized and strictfp. And while
> synchronized is an implementation detail, strictfp could be seen as
> being part of the specification ...
The strictfp bit is an implementation detail, very similar to
synchronized. Just as the specification counterpart of "synchronized"
is something like "thread-safe" the specification counterpart of
"strictfp" would be "exactly specified numerical behavior."
-Joe
>
> David
> -----
>
>> public class C implements I {
>> public static void main (String[] args) {
>> System.out.println("Hi");
>> }
>> }
>>
>> but any attempt to run the resulting class files gives:
>>
>> Exception in thread "main" java.lang.ClassFormatError: Method foo in
>> class I has illegal modifiers: 0x821
>>
>> Does the VM require bit AccDefaultMethod to be set (I haven't yet
>> seen a specification of that flag), or is the VM simply not updated
>> to accept the newly legal combination of modifiers?
>>
>> best,
>> Stephan
>>
>>
More information about the lambda-dev
mailing list