Re: [abc-users] Compilation error with intertypes when using the abc weaver

From: Henrique Rebêlo <hemr_at_cin.ufpe.br>
Date: Tue, 19 May 2009 12:52:02 -0300

Hi Pavel and Eric,

  Thanks to you guys to taking the time to look into this issue.

  "The Java letters include uppercase and lowercase ASCII Latin letters A-Z
> (\u0041-\u005a), and a-z (\u0061-\u007a), and, for historical reasons, the
> ASCII underscore (_, or \u005f) and dollar sign ($, or \u0024). The $
> character should be used only in mechanically generated source code or,
> rarely, to access preexisting names on legacy systems."
>
>
    Yes, the dollar sign ($) is perfect legal in Java as well as AspectJ.

The $ character is perfectly legal in Java identifiers (in fact you can have
> a
> variable called "$"), but is usually omitted from introductory texts
> because
> it is used for compiler-generated names (cf. this$0, names for nested
> classes,
> accessor methods and advice names) and if human programmers avoid it, the
> probability of accidental name clashes is reduced.

    Yes, as I said, the first time I saw this things was in the JML
generated instrumented source code. In fact, this code is a intermediary
.java source file to be compiled. In such a file, we can see several
syntetic fields and methods using $. These members are not allowed to be
used direct by users... So, as you mentioned above, it's a compiler-pattern
for generated names.

Henrique

On Tue, May 19, 2009 at 8:45 AM, Pavel Avgustinov <pavel_at_comlab.ox.ac.uk>wrote:

> Hi Eric,
>
> Thanks for taking the time to look into this.
>
> I was intrigued by your diagnosis, so I consulted the Java Language
> Specification. The relevant section is:
>
> http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.8
>
> This states, among other interesting and useful things,
>
> "The Java letters include uppercase and lowercase ASCII Latin letters A-Z
> (\u0041-\u005a), and a-z (\u0061-\u007a), and, for historical reasons, the
> ASCII underscore (_, or \u005f) and dollar sign ($, or \u0024). The $
> character should be used only in mechanically generated source code or,
> rarely, to access preexisting names on legacy systems."
>
> The $ character is perfectly legal in Java identifiers (in fact you can
> have a
> variable called "$"), but is usually omitted from introductory texts
> because
> it is used for compiler-generated names (cf. this$0, names for nested
> classes,
> accessor methods and advice names) and if human programmers avoid it, the
> probability of accidental name clashes is reduced.
>
> - P
>
> On Tuesday 19 May 2009 12:28:34 Eric Bodden wrote:
> > > Yes, surprisingly both alow that. In relation to Java, I first saw
> > > such a situation in the instrumented source code
> > > generated by JML. In addition, since a valid AspectJ program is
> also
> > > a valid Java program, we can use "$" in AspectJ
> > > programs as well, for instance, in intertype declarations (as in
> > > previous email).
> >
> > Yes, there's two different things: identifiers in Java source code and
> > identifiers in the bytecode. $ is allowed in bytecode but not usually
> > on the source level. The AspectJ language definition states that
> > AspectJ identifiers are just Java identifiers. Therefore AspectJ
> > compilers should not actually parse your example program. I have
> > raised a bug against ajc to clarify that...
> > https://bugs.eclipse.org/bugs/show_bug.cgi?id=276794
> >
> > Anyway, I have not yet had the time to look into this but I suspect
> > that abc may get confused by those names. I will see if I can find
> > some time to dig a bit deeper into the problem today.
> >
> > Eric
>
>
>
>

-- 
Henrique Rebêlo, Centro de Informática, UFPE
http://www.cin.ufpe.br/~hemr
Received on Tue May 19 2009 - 16:52:12 BST

This archive was generated by hypermail 2.2.0 : Tue May 19 2009 - 17:30:13 BST