Abstract interface methods are added to implementing classes
Issue #282
resolved
JastAdd 2.2.2 weaves an abstract method declaration in an interface into all subtypes implementing the interface. This is demonstrated by the following JastAdd code:
Test.ast:
abstract Declarator;
FieldDecl : Declarator;
VarDecl : Declarator;
Test.jrag
aspect Test {
public interface Variable {
}
boolean Variable.needsQualifier();
Declarator implements Variable;
@Override public boolean FieldDecl.needsQualifier() {
return true;
}
@Override public boolean VarDecl.needsQualifier() {
return false;
}
}
This leads to a compile error because JastAdd adds the needsQualifier
declaration to Declarator
:
public abstract class Declarator extends ASTNode<ASTNode> implements Cloneable, Variable {
/**
* @aspect Test
* @declaredat tests/weaving/interface_decl_02p/Test.jrag:5
*/
boolean needsQualifier();
Compile error:
[junit] [FAIL] runTest[weaving/interface_decl_02p](tests.jastadd2.TestShouldPass)
[junit] Compilation failed when expected to pass:
[junit] tmp/weaving/interface_decl_02p/Declarator.java:14: error: needsQualifier() in Declarator cannot implement needsQualifier() in Variable
[junit] boolean needsQualifier();
[junit] ^
[junit] attempting to assign weaker access privileges; was public
Comments (2)
-
reporter -
reporter - changed status to resolved
Improve interface weaving: skip abstract methods
Abstract interface methods are no longer woven into implementing classes.
fixes
#282(bitbucket)→ <<cset 6f5d881160c4>>
- Log in to comment
Added test for this issue:
weaving/interface_decl_02p