Miranda methods and Methods added by Code Generators

Neal Gafter neal at gafter.com
Mon Aug 9 07:26:04 PDT 2010


The SYNTHETIC attribute is currently defined to be for use on symbols that the compiler should ignore for purposes of semantic analysis.

-Neal

On Aug 9, 2010, at 6:11 AM, Maurizio Cimadamore <maurizio.cimadamore at oracle.com> wrote:

> 
>> Your description of the current situation is not quite accurate. When javac compiles the source of Child it is not at that time compiling the source of Parent. It only has the bytecode of Parent available (the generated SYNTHETIC method _only occurs_ in the bytecode). So, it is possible for javac to end up finding SYNTHETIC methods in its method tables which it has not itself introduced directly through analysis of source code.
> Are you suggesting that the check can erroneously fail in a scenario without AOP? If so, please post an example.
>> 
>> What I don't understand is why you have to rely on just the SYNTHETIC attribute to identify the cases which javac should discount. Looking at ClassWriter.java it appears that bridge methods are written to the classfile with the BRIDGE attribute. Similarly, Miranda methods are written with the SYNTHETIC and ABSTRACT attribute. So, why automatically discount SYNTHETIC methods? Could you not instead discount SYNTHETIC|BRIDGE or SYNTHETIC|ABSTRACT methods?
> That's what I had in mind when I said that the check could be perceived as too strict.
> 
> Maurizio



More information about the compiler-dev mailing list