[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] Re: declare parents and inheritance
|
Hi Andy!
I am on 3.1, and as I pointed in a previous mail I was seeing the
gutter annotations, but nothing happened at runtime. However, I think
it was a problem with duplicate classes on the classpath, because right
now, before cleaning the classpath it's working as expected.
Thanks everybody for your help, and sorry for the noise for nothing.
./alex
--
.w( the_mindstorm )p.
On 3/16/06, Andy Clement <andrew.clement@xxxxxxxxx> wrote:
Are you on Eclipse 3.1 or 3.2?
I
just tried in 3.1 and it worked fine for me (I put all your types into
one file so had to remove 'public' from all but the testcase
declaration). Do you see any gutter annotations? You should
see 3 arrows - two leaving the declare parents statements and one
pointing to the Parent class.
Andy.
On 15/03/06,
Alexandru Popescu <the.mindstorm.mailinglist@xxxxxxxxx> wrote:
This is getting weirder and weirder. Run from the console it works. So
it seems, something wrong with the IDE. But I really don't have the
slightest idea what may be wrong. Any ideas?
./alex
--
.w( the_mindstorm )p.
On 3/15/06, Alexandru Popescu <
the.mindstorm.mailinglist@xxxxxxxxx> wrote:
The following tests are failing with the last AJDT build:
public class DeclareParentsTestCase extends TestCase {
protected Parent m_parent;
protected ChildA m_childA;
protected ChildB m_childB;
protected void setUp() throws Exception {
super.setUp();
m_parent= new Parent();
m_childA= new ChildA();
m_childB= new ChildB();
}
public void testParent() {
assertTrue("expected inheritance", (m_parent instanceof IInterfaceA));
assertTrue("expected inheritance", (m_parent instanceof IInterfaceB));
}
public void testChildA() {
assertTrue("expected inheritance", (m_childA instanceof IInterfaceA));
assertTrue("expected inheritance", (m_childA instanceof IInterfaceB));
}
public void testChildB() {
assertTrue("expected inheritance", (m_childB instanceof IInterfaceA));
assertTrue("expected inheritance", (m_childB instanceof IInterfaceB));
}
}
public class Parent {}
public class ChildA extends Parent {}
public class ChildB extends Parent {}
public interface IInterfaceA {}
public interface IInterfaceB {}
public aspect DeclareParents {
declare parents: Parent implements IInterfaceA;
declare parents: Parent+ implements IInterfaceB;
}
This is very very weird. The gutter shows that Parent class implements both IInterfaceA, IInterfaceB. What is going on? :-S.
./alex
--
.w( the_mindstorm )p.
It works for me. Maybe you aren't
weaving into Parents and/or Child?
public aspect DeclareParents {
declare parents: Parent implements
IInterface;
private boolean
IInterface.isInterface() {
return true;
}
public static void main(String args[])
{
System.out.println(new
Child().isInterface());
}
}
interface IInterface {}
class Parent {}
class Child extends Parent {}
C:\devel\scratch>ajc DeclareParents.aj
C:\devel\scratch>java DeclareParents
true
I have tried also with
declare parents Parent+ implements IInterface, but no good result. I am
definitely doing something wrong.
./alex
--
.w( the_mindstorm )p.
On 3/15/06, Alexandru
Popescu <the.mindstorm.mailinglist@xxxxxxxxx>
wrote:
Hi!
Maybe this is a stupid question, but at this moment I don't have a good answer
for it (sorry 3am):
if Child extends Parent and declare parents Parent implements IInterface, isn't
supposed to have the condition (Child instanceof IInterface) true? Or should I
declare parents with:
declare parents Parent+ implements IInterface?
thanks and sorry for the "stupid" question,
./alex
--
.w( the_mindstorm )p.
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users