strictfp in annotations

Jonathan Gibbons jonathan.gibbons at oracle.com
Fri Nov 15 09:49:30 PST 2013


On 11/15/2013 05:09 AM, Joel Borggren-Franck wrote:
> Hi Alex,
>
> https://bugs.openjdk.java.net/browse/JDK-8028428
>
> tl;dr
>
> The following file does not compile in 7:
>
> import java.lang.annotation.*;
> @Retention(RetentionPolicy.RUNTIME)
> @interface T {
>      strictfp float ff() default -1.0f;
> }
>
>
> $ javac T.java
> T.java:4: error: modifier strictfp not allowed here
> strictfp float ff() default -1.0f;
>                 ^
> 1 error
>
> In 8 it compiles.
>
> JLS for 7 is actually slightly inconsistent here, the grammar in 9.6.1
> says AbstractMethodModifier but the grammar in chapter 18 says modifier.
>
> Question: is the grammar in 8 fixed? I assume AbstractMethodModifier is
> correct.
>
> cheers
> /Joel

Joel,

Note the the grammar is never a complete authority, but needs to be 
taken in conjunction with the surrounding text (assertions.)

-- Jon


More information about the compiler-dev mailing list