summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoraclement <aclement>2005-01-19 09:36:46 +0000
committeraclement <aclement>2005-01-19 09:36:46 +0000
commit71966e3348a05cb99b88885b8e6b751cc61a638e (patch)
treec55bfb4bd3c329fbd466f4d5232131a4b0cf1871 /tests
parent0c8315087053985cae6defeaa2e3f9377968de88 (diff)
downloadaspectj-71966e3348a05cb99b88885b8e6b751cc61a638e.tar.gz
aspectj-71966e3348a05cb99b88885b8e6b751cc61a638e.zip
Fix for Bug 82570: Weaved code does not include debug lines
Diffstat (limited to 'tests')
-rw-r--r--tests/.classpath1
-rw-r--r--tests/bugs150/PR82570_1.java32
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/Ajc150TestsNoHarness.java54
3 files changed, 87 insertions, 0 deletions
diff --git a/tests/.classpath b/tests/.classpath
index c312f108f..148ca2229 100644
--- a/tests/.classpath
+++ b/tests/.classpath
@@ -10,5 +10,6 @@
<classpathentry kind="src" path="/bridge"/>
<classpathentry kind="src" path="/ajde"/>
<classpathentry kind="src" path="/asm"/>
+ <classpathentry sourcepath="/lib/bcel/bcel-src.zip" kind="lib" path="/lib/bcel/bcel.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/tests/bugs150/PR82570_1.java b/tests/bugs150/PR82570_1.java
new file mode 100644
index 000000000..074ad22d1
--- /dev/null
+++ b/tests/bugs150/PR82570_1.java
@@ -0,0 +1,32 @@
+
+public class PR82570_1 {
+ public static void main(String[] args) {
+ new PR82570_1().m();
+ }
+
+ public void m() {
+
+ }
+}
+
+aspect X {
+
+
+ public PR82570_1.new(String p) {}
+
+ public int PR82570_1.itdField;
+
+ public void PR82570_1.itdMethod(String s) {
+
+ }
+
+ before(): call(* m(..)) {
+ System.err.println("m");
+ }
+
+ void around(): call(* m(..)) {
+
+ }
+
+}
+
diff --git a/tests/src/org/aspectj/systemtest/ajc150/Ajc150TestsNoHarness.java b/tests/src/org/aspectj/systemtest/ajc150/Ajc150TestsNoHarness.java
index e0b22155a..44c65430a 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/Ajc150TestsNoHarness.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/Ajc150TestsNoHarness.java
@@ -12,6 +12,10 @@ package org.aspectj.systemtest.ajc150;
import java.io.File;
+import org.aspectj.apache.bcel.classfile.JavaClass;
+import org.aspectj.apache.bcel.classfile.Method;
+import org.aspectj.apache.bcel.util.ClassPath;
+import org.aspectj.apache.bcel.util.SyntheticRepository;
import org.aspectj.tools.ajc.CompilationResult;
@@ -31,10 +35,60 @@ public class Ajc150TestsNoHarness extends TestUtils {
if (verbose) {System.err.println(rR.getStdErr());}
}
+
public void testIncorrectExceptionTableWhenReturnInMethod_pr79554() {
CompilationResult cR=ajc(baseDir,new String[]{"PR79554.java"});
if (verbose) { System.err.println(cR); System.err.println(cR.getStandardError());}
RunResult rR = run("PR79554");
if (verbose) {System.err.println(rR.getStdErr());}
}
+
+
+ public void testMissingDebugInfoForGeneratedMethods_pr82570() throws ClassNotFoundException {
+ boolean f = false;
+ CompilationResult cR = ajc(baseDir,new String[]{"PR82570_1.java"});
+ System.err.println(cR.getStandardError());
+ assertTrue("Expected no compile problem:"+cR,!cR.hasErrorMessages());
+ JavaClass jc = getClassFrom(ajc.getSandboxDirectory(),"PR82570_1");
+ Method[] meths = jc.getMethods();
+ for (int i = 0; i < meths.length; i++) {
+ Method method = meths[i];
+ if (f) System.err.println("Line number table for "+method.getName()+method.getSignature()+" = "+method.getLineNumberTable());
+ assertTrue("Didn't find a line number table for method "+method.getName()+method.getSignature(),
+ method.getLineNumberTable()!=null);
+ }
+
+ // This test would determine the info isn't there if you pass -g:none ...
+// cR = ajc(baseDir,new String[]{"PR82570_1.java","-g:none"});
+// assertTrue("Expected no compile problem:"+cR,!cR.hasErrorMessages());
+// System.err.println(cR.getStandardError());
+// jc = getClassFrom(ajc.getSandboxDirectory(),"PR82570_1");
+// meths = jc.getMethods();
+// for (int i = 0; i < meths.length; i++) {
+// Method method = meths[i];
+// assertTrue("Found a line number table for method "+method.getName(),
+// method.getLineNumberTable()==null);
+// }
+ }
+
+
+
+
+
+
+
+
+ ///////////////////////////////////////// TESTCASE HELPER METHODS BELOW HERE //////////////////////////
+
+ // Some util methods for accessing .class contents as BCEL objects
+
+ public SyntheticRepository createRepos(File cpentry) {
+ ClassPath cp = new ClassPath(cpentry+File.pathSeparator+System.getProperty("java.class.path"));
+ return SyntheticRepository.getInstance(cp);
+ }
+
+ private JavaClass getClassFrom(File where,String clazzname) throws ClassNotFoundException {
+ SyntheticRepository repos = createRepos(where);
+ return repos.loadClass(clazzname);
+ }
} \ No newline at end of file