aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core
diff options
context:
space:
mode:
authorjhugunin <jhugunin>2003-05-27 17:35:13 +0000
committerjhugunin <jhugunin>2003-05-27 17:35:13 +0000
commitc509c6f751a553cc85d0210a408681f4f3ae05cb (patch)
treefa2cca61470367a01b1829c01964872faf91aa85 /org.aspectj.ajdt.core
parentd43889dac2de39e87071dc9ff32eaf630ca6b439 (diff)
downloadaspectj-c509c6f751a553cc85d0210a408681f4f3ae05cb.tar.gz
aspectj-c509c6f751a553cc85d0210a408681f4f3ae05cb.zip
fix and test for Bugzilla Bug 38131
ajc needs -d . option while correctly compiling classes from subpackage
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java7
-rw-r--r--org.aspectj.ajdt.core/testdata/src1/WrongPackage.java10
-rw-r--r--org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BasicCommandTestCase.java31
3 files changed, 46 insertions, 2 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
index 336f02da8..973be83e1 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
@@ -419,9 +419,12 @@ public class AjBuildManager {
File destinationPath = buildConfig.getOutputDir();
if (destinationPath == null) {
- destinationPath = new File(extractDestinationPathFromSourceFile(unitResult));
+ filename = new File(filename).getName();
+ filename = new File(extractDestinationPathFromSourceFile(unitResult), filename).getPath();
+ } else {
+ filename = new File(destinationPath, filename).getPath();
}
- filename = new File(destinationPath, filename).getPath();
+
//System.out.println("classfile: " + filename);
unwovenClassFiles.add(new UnwovenClassFile(filename, classFile.getBytes()));
}
diff --git a/org.aspectj.ajdt.core/testdata/src1/WrongPackage.java b/org.aspectj.ajdt.core/testdata/src1/WrongPackage.java
new file mode 100644
index 000000000..5237fca51
--- /dev/null
+++ b/org.aspectj.ajdt.core/testdata/src1/WrongPackage.java
@@ -0,0 +1,10 @@
+package a.b.c;
+
+public class WrongPackage {
+ public static void main(String[] args) {
+ Runnable r = new Runnable() {
+ public void run() {}
+ };
+ r.run();
+ }
+} \ No newline at end of file
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BasicCommandTestCase.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BasicCommandTestCase.java
index 464303753..dff6f8144 100644
--- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BasicCommandTestCase.java
+++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BasicCommandTestCase.java
@@ -12,6 +12,7 @@
package org.aspectj.ajdt.internal.compiler.batch;
+import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -139,4 +140,34 @@ public class BasicCommandTestCase extends CommandTestCase {
assertEquals("error for org.aspectj.lang.JoinPoint not found", 1, myHandler.getErrors().length);
}
+
+ public void testImplicitOutputDir() {
+ List args = new ArrayList();
+
+ args.add("-classpath");
+ args.add("../runtime/bin;../lib/junit/junit.jar;../testing-client/bin");
+
+ File f1 = new File("testdata/src1/p1/Foo.class");
+ File f2 = new File("testdata/src1/WrongPackage.class");
+ File f3 = new File("testdata/src1/WrongPackage$1.class");
+
+ if (f1.exists()) f1.delete();
+ if (f2.exists()) f2.delete();
+ if (f3.exists()) f3.delete();
+
+ args.add("testdata/src1/p1/Foo.java");
+ args.add("testdata/src1/WrongPackage.java");
+
+ runCompiler(args, NO_ERRORS);
+
+ assertTrue(f1.getPath(), f1.exists());
+ assertTrue(f2.getPath(), f2.exists());
+ assertTrue(f3.getPath(), f3.exists());
+
+ if (f1.exists()) f1.delete();
+ if (f2.exists()) f2.delete();
+ if (f3.exists()) f3.delete();
+
+
+ }
}