line numbers reported wrong


Subject: line numbers reported wrong
From: Karl Lieberherr (lieber@ccs.neu.edu)
Date: Tue Oct 08 2002 - 17:52:11 EDT


I would like to warn you that AspectJ has a tendency
to misreport line numbers.

For example, for the program below, the LoD checker reports:

Violation Found at A.java:16:4 jp call(void C.test())
Violation Found at A.java:22:4 jp call(D C.getD())
Violation Found at A.java:27:4 jp call(E D.getE())

while it should report:

Violation Found at A.java:18:4 jp call(void C.test())
Violation Found at A.java:26:4 jp call(D C.getD())
Violation Found at A.java:28:4 jp call(E D.getE())

Pengcheng Wu has reported this to the AspectJ team.

-- Karl

/**
 * @author wupc
 *
 * To change this generated comment edit the template variable "typecomment":
 * Window>Preferences>Java>Templates.
 * To enable and disable the creation of type comments go to
 * Window>Preferences>Java>Code Generation.
 */
import org.aspectj.lang.*;
import org.aspectj.lang.reflect.*;

class A {
B b;
public void t(B c) {
//public void t(C c) {
   ((C)b) // 16
   .
   test();
   b
   .
   test();
   b // 22
   .
   getC()
   .
   getD()
   . // 27
   getE();
}
}

class B {
C c;
C getC(){return new C();}
public void test() {
}
}

class C extends B {
D d;
D getD(){return new D();}
public void test() {}
}

class D {
E e;
E getE(){return new E();}
}

class E {}

class Main {
public static void main(String[] args) {
  A a = new A();
  a.b=new C();
  a.t(new C());
}
}



This archive was generated by hypermail 2b28 : Tue Oct 08 2002 - 17:53:26 EDT