[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [ajdt-dev] Signature-matching bug in inter-method declarations?
|
On a quick look, I think I understand why this program might be breaking.
It's a bug though - you should either get an error message at compilation
time or a program that runs, but not a program that fails at runtime. In
this case the program should run. Please submit a bug report against
AspectJ and the compiler component. Thanks.
(FWIW, some implementation detail: when a non-public ITD is made on a
target type, the method name in the target type is 'obfuscated' so that
only the designated set of callers can effectively call it (this is also
backed up with type checking). For a public ITD this is not necessary. I
suspect the bug is to do with having one 'obfuscated' name and one plain
name, *both* introduced by ITDs, and not realising before it is too late
that a virtual dispatch to one should call the other - ie. that they have
the same signature).
-- Adrian
Adrian_Colyer@xxxxxxxxxx
Philip Quitslund <philipq@xxxxxxxxxxx>
Sent by: ajdt-dev-admin@xxxxxxxxxxx
27/08/2004 18:50
Please respond to
ajdt-dev@xxxxxxxxxxx
To
ajdt-dev@xxxxxxxxxxx
cc
Subject
[ajdt-dev] Signature-matching bug in inter-method declarations?
Hey All!
Running the test program below, I get the following error:
java.lang.AbstractMethodError:
trouble.Trouble$A.ajc$interMethodDispatch2$trouble$getName()Ljava/lang/String;
at
trouble.Trouble$Bang.ajc$interMethodDispatch1$trouble_Trouble$Bang$trouble_Trouble$A$getName(Trouble.java)
at
trouble.Trouble$Bang.ajc$interMethod$trouble_Trouble$Bang$trouble_Trouble$A$toString(Trouble.java:40)
at trouble.Trouble$A.toString(Trouble.java)
at java.lang.String.valueOf(String.java:2131)
at java.io.PrintStream.print(PrintStream.java:462)
at java.io.PrintStream.println(PrintStream.java:599)
at trouble.Trouble.main(Trouble.java:34)
Exception in thread "main"
public class Trouble {
static abstract class A {}
static class B extends A {}
public static void main(String[] args) {
System.out.println(new B());
}
static aspect Bang {
abstract String A.getName();
public String B.getName() { return "B"; }
public String A.toString() { return getName(); }
}
}
The crux is in my declaration of A.getName() as package access and
B.getName() as public. If they both have identical access modifiers the
program runs fine...
Version Info:
Version: 1.1.12
Build id: 20040813151120
AspectJ version: 1.2.0
and:
j2sdk1.4.2_02
Am I missing something obvious or should I submit it to bugzilla?
Thanks,
-phil
_______________________________________________
ajdt-dev mailing list
ajdt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/ajdt-dev