Thanks to visit codestin.com
Credit goes to github.com

Skip to content

no error reporting for missing OverrideAspectMethod annotation #60

@dvojtise

Description

@dvojtise

In case of 2 base classes that inherit from each other, it is normal to have 2 aspects that inherit from each other that each point to its base class.

The annotation OverrideAspectMethod is used to both generate the super_ method method but also remind to the user that it overrides another method.

There is some code for checking that this annotation is correctly put, but it doesn't seem to work.

the following code does not report error (or at least a warning) about it

class Parent {
	public String name 
	new(String name){
		this.name = name
	}
} 
 
class ChildA   extends Parent{
	new(String name){
		super(name)
	}
}

@Aspect(className=typeof(Parent)) 
class ParentAspect {
	public def String myOperation() {
		"myOperation ParentAspect("+_self.name+")"
	} 
	public def String myOperation2() {
		"myOperation2 ParentAspect("+_self.name+")"
	}
} 
 
@Aspect(className=typeof(ChildA)) 
class ChildAAspect   extends ParentAspect{
	public def String myOperation() {        // An error should be reported here !!!
        // due to missing annotatio call to super is not possible
		"myOperation ChildAAspect("+_self.name+")"
	}
	@OverrideAspectMethod
	public def String myOperation2() {
		"myOperation2 ParentAspect("+_self.name+")[" + _self.super_myOperation2 +"]"
	}
}

Note: this must not be confused with the override modifier used when an aspect on a base class is refined by another aspect on the same base class as below:

@Aspect(className=typeof(ChildA)) 
class ChildAAspect2   extends ChildAAspect{
	override String myOperation() {
		"myOperation ChildAAspect("+_self.name+")"
	}	
	override String myOperation2() {
		"myOperation2 ParentAspect("+_self.name+")"
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions