Backport of the "missing clinit attribute" javac error to 1.7?

Dawid Weiss dawid.weiss at
Fri Oct 24 09:00:48 UTC 2014

Hi Joel!

Sure, here it is:

It's really simple -- the annotation has a field that requires a
static initializer (imports omitted for brevity):

public @interface Ann {
  public static String FOO = new String("Foo");

and the class that's using it is simply annotated:

public class Main {

When you try to compile it (javac 1.7.0_40), the output is:

C:\carrot2\gh.dweiss\ann-clinit>javac *.java error: annotation Ann is missing value for the attribute <clinit>
1 error


On Fri, Oct 24, 2014 at 10:41 AM, Joel Borggren-Franck
<joel.franck at> wrote:
> Hi Dawid,
> Sorry for the delay, can you post a reproducer? It would be interesting
> to see the declaration of Foo and MyAnnotation.
> cheers
> /Joel
> On 2014-10-07, Dawid Weiss wrote:
>> Hello compiler folks!
>> I've encountered the (known and resolved in 1.8) problem with javac
>> failing on annotations with static final fields requiring complex
>> initialization. The failure manifests itself on the latest 1.7 with
>> (edited):
>> [ERROR] /.../[186,17] annotation foo.MyAnnotation is
>> missing value for the attribute <clinit>
>> This seems to be:
>> Are there any chances of backporting this patch to 1.7? ECJ compiles
>> such code without a glitch and so does 1.8 javac, of course.
>> Dawid

More information about the compiler-dev mailing list