Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Inter-type member in combination with a private interface - Possible bug

Hi Everybody,

I was moving my environment from AspectJ 1.0.6 to 1.1 when I got an error in a code that was OK before. Reading the programming guide I can say that my code complies with AspectJ 1.1.

I created a simpler example to make the explanation easier. Consider three classes X, Y and SubY. Note that class Y is an abstract class.

public class X {}

public abstract class Y {}

public class SubY extends Y {}

Now consider an aspect WhoAmI that defines an interface, Flag, with a method whoami. The aspect changes classes X and Y to implement the interface and add their implementation of the whoami method.

public aspect AspectWhoAmI {

    private interface Flag {
        public void whoami();
    }
	
    declare parents: X || Y implements Flag;

    public void X.whoami() {
        System.out.println("I am x");
    }
	
    public void Y.whoami() {
        System.out.println("I am Y");
    }
}

When compiling this example in eclipse 2.1.1 with AJDT 1.1.4 I got the following error in class SubY "Class must implement the inherited method WhoAmI.Flag.whoami()".

If I remove the abstract modifier from the class Y the code compiles without errors. It seams to be a bug, doesn't it? The code complies without erros if I remove the method signature from the Flag interface keeping the abstract modifier in class Y. However, if I do this the subtypes of Flag would not be forced to implement the whoami method at compile time.

Best Regards,
Sergio


--
Sérgio Soares
Centro de Informática - UFPE
scbs@xxxxxxxxxxx
http://www.cin.ufpe.br/~scbs

Software Productivity Group
http://www.cin.ufpe.br/spg



Back to the top