[JSR308] Re: Classfile representation of annotations

Michael Ernst mernst at csail.mit.edu
Mon Feb 5 11:16:27 EST 2007


> Both compile-time verification (of annotations) and annotations as part of
> the interface don't require annotations be preserved in the bytecode.  By
> bytecode here I don't mean class files, but the part of the class file
> representing the body of a method.  In other words, section 4 cites use
> cases that support changes to the class file format, but don't support
> anything in the class file format to represent anything in the interior of
> methods.

Annotations provide information about the code, but they don't change the
code.  That is, annotations exist outside the bytecode array and so do not
change it, but they can refer to the bytecode and represent properties of

It is desirable to represent local variable annotations, for example, but
that should be done via attributes (that will refer to specific offsets in
the bytecode) rather than by changing the bytecode itself.  I expect that
the bytecode array would be the same whether the annotations are present or


More information about the JSR308 mailing list