[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [aspectj-users] AspectJ and @Override annotation
|
I think this is a straight java problem. @Override
indicates to the compiler that this method overrides a method in a super
class. This is different from implementing a method defined in an
interface.
These examples should work.
public interface MyString {
String toString();
}
public class MyClass1 implements MyString
{
// Implemented toString from MyString and also
overrides toString from Object
@Override
public String toString() { ... }
public void foo();
}
public interface HasFoo {
void foo();
}
public class MyClass2 extends MyClass1 implements HasFoo
{
// Implements foo from HasFoo but also overrides foo
from MyClass1
@Override
public void foo() { ... }
}
To do what you want,
you need to use a different annotation
(your.package.Implements?)
Troy
Sure, here's an example:
public interface NiceThing
{
void
doSomethingNice();
}
public class NiceImplementation implements
NiceThing {
@Override
public void
doSomethingNice()
{
System.getBios().fillWithZeroes();
System.err.println("Have a nice day
now!");
}
}
Running in
eclipse with Maven2's ApectJ plugin:
[ERROR] The method
doSomethingNice() of type NiceImplementation must override a superclass
method
Anyone ever had this problem? Google couldn't answer
me...
Thanks!
Rodrigo
On 8/18/07, Dean
Wampler <dean@xxxxxxxxxxxxxxxxxxxxx>
wrote:
There shouldn't be any conflicts. Can you post an example demonstrating
the problems you're having?
dean
On Aug 18, 2007, at 6:07 PM, Rodrigo Madera wrote:
Hello community,
I have
a project that has @Override annotations over methods that are being
implemented (as oposed to overriden) which is acceptable by Javac.
Is there any known incompatibility with AspectJ and @Override
annotations for implementing methods? I'm getting some errors on this on
my ported project.
Thanks for any
help,
Rodrigo
_______________________________________________
aspectj-users mailing list
Dean Wampler, Ph.D.
I want my tombstone to say:
Unknown Application Error in Dean Wampler.exe.
Application Terminated.
[Okay] [Cancel]
_______________________________________________
aspectj-users
mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users