From: jhugunin Date: Tue, 27 May 2003 17:35:13 +0000 (+0000) Subject: fix and test for Bugzilla Bug 38131 X-Git-Tag: V1_1_0~43 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c509c6f751a553cc85d0210a408681f4f3ae05cb;p=aspectj.git fix and test for Bugzilla Bug 38131 ajc needs -d . option while correctly compiling classes from subpackage --- 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(); + + + } }