Re: [abc-dev] Compilation order should matter?

From: Fernando Calheiros <xfernando@gmail.com>
Date: Wed Aug 02 2006 - 02:30:36 BST

Hmm, you're right, it should have been "-sourceroots .", but that
doesn't matter. The problem I mentioned doesn't have to do with the
AspectJ bug you mentioned, but that bug was the reason I decided to
try ABC.

A workaround for this bug which works on both compilers is creating an
interface with the constants and using "declare parents" instead of
trying to declare it with "public static final int Class.field = 1;".

The problem I described came up after I tried to build our system,
which was compiling with no problems on AspectJ, with ABC and got a
lot of "Case label must be an integral constant."

Then I wrote a simple test case (the one with the right order). The
test case worked fine, so it should also be working on my system, my
last desperate attempt was trying to see if the the lexicographical
order of the classes/aspects names affected the result, which indeed
was the problem.

Oege: this is not a showstopper, there are a few non-elegant ways of
going around this, such as putting all the aspects in a package that
starts with a letter that comes before than the first letter of the
remaining packages of the project, which would assure that the aspects
would be compiled first.

But it would be really nice if it worked either way. ;)

On 8/1/06, Eric Bodden <eric.bodden@mail.mcgill.ca> wrote:
> Hmmm, actually I am not so sure this is a bug. At least ajc should give
> you the same behavior up till now:
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=52105
>
> What *does* look wrong to me is "-sourceroots s40", because I believe
> that this should rather be pointing to the package *root*, i.e. the
> directory containing the "s40" folder. But this should not change
> anything, I guess.
>
> Eric
>
>
> > -----Original Message-----
> > From: Majordomo list server [mailto:majordomo@comlab.ox.ac.uk] On
> > Behalf Of Oege de Moor
> > Sent: Tuesday, August 01, 2006 4:54 PM
> > To: abc-dev@comlab.ox.ac.uk
> > Subject: RE: [abc-dev] Compilation order should matter?
> >
> > Many thanks for reporting this bug.
> >
> > It is, in fact, a bug in the Polyglot Java compiler framework.
> >
> > To verify that, leave out the aspect, put the interface in a separate
> > file and write "B implements IConstant" in the declaration of B. It
> > doesn't compile with the Polyglot compiler; I believe it might be a
> > problem with the implementation of barrier passes in Polyglot.
> >
> > We (the abc developers) are unlikely to fix this problem soon.
> > Is it a showstopper for you?
> >
> > -Oege
> >
> > > -----Original Message-----
> > > From: Majordomo list server [mailto:majordomo@comlab.ox.ac.uk] On
> > > Behalf Of Fernando Calheiros
> > > Sent: 01 August 2006 20:40
> > > To: abc-dev@comlab.ox.ac.uk
> > > Subject: [abc-dev] Compilation order should matter?
> > >
> > > Hi everyone, I'm using ABC in a research project and the following
> > > situation has come up... suppose that I have the following classes
> > and
> > > aspects (in their respective files).
> > >
> > > package s40;
> > >
> > > public class A {
> > > public static void main(String[] args) {
> > > switch(1) {
> > > case B.LITERAL:
> > > System.out.println("Works");
> > > }
> > > }
> > > }
> > >
> > > ---------------------------------------------------------
> > >
> > > package s40;
> > >
> > > public class B {
> > > }
> > >
> > > ---------------------------------------------------------
> > > package s40;
> > >
> > > public aspect C {
> > > declare parents : B implements IConstant;
> > >
> > > public interface IConstant {
> > > public static final int LITERAL = 1;
> > > }
> > > }
> > >
> > > This code should compile, but it doesn't (using "java abc.main.Main
> > > -sourceroots s40"), instead it gives me the following error message:
> > >
> > > A.java:6: Case label must be an integral constant.
> > >
> > > But if class A was named D (in D.java), this code compiles just
> fine.
> > >
> > > (It compiles with both ways in AspectJ)
> > >
> > > Is it a compiler bug?
> > >
> > > Thanks for your time,
> > > Fernando Calheiros
> >
> >
> >
>
>
>
Received on Wed Aug 02 02:30:52 2006

This archive was generated by hypermail 2.1.8 : Mon Aug 28 2006 - 10:20:08 BST