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

From: Eric Bodden <eric.bodden_at_mail.mcgill.ca>
Date: Tue, 19 May 2009 09:53:17 -0400

Hi all.

I looked into this a bit.

Indeed it's a bug in the polyglot frontend. It has nothing to do with
the "$" sign; the bug even occurs without it. Henrique, you should be
able to compile your code by adding "-ext abc.ja" to your command
line. This tells abc to use the newer JastAdd-based frontend instead.
At least your little example compiles fine with that frontend. I will
see if I can fix the bug in the polyglot-based frontend nevertheless.

Eric

2009/5/19 Eric Bodden <eric.bodden_at_mail.mcgill.ca>:
> Oh, I guess that explains that then. Thanks a lot for pointing this
> out Pavel. Guess we have been teaching something wrong then in our
> compiler class for ages :P
>
> Were you guys aware of this when you first implemented abc? I would be
> surprised if abc did not internally make some assumptions about
> certain $ signs being or not being part of certain identifiers.
>
> Eric
>
> 2009/5/19 Pavel Avgustinov <pavel_at_comlab.ox.ac.uk>:
>> 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
>>
>>
>>
>>
>
>
>
> --
> Eric Bodden
> Sable Research Group, McGill University
> Montréal, Québec, Canada
>

-- 
Eric Bodden
Sable Research Group, McGill University
Montréal, Québec, Canada
Received on Tue May 19 2009 - 14:53:31 BST

This archive was generated by hypermail 2.2.0 : Tue May 19 2009 - 15:10:13 BST