Bug 38131

Summary: ajc needs -d . option while correctly compiling classes from subpackage
Product: [Tools] AspectJ Reporter: Ramnivas Laddad <ramnivas>
Component: CompilerAssignee: Jim Hugunin <jim-aj>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows NT   
Whiteboard:

Description Ramnivas Laddad CLA 2003-05-27 01:46:58 EDT
I am using 1.1rc1. This is a regression since rc1 and a deviation from javac.
I am guessing this may have to do something with change in the underlying
Eclipse compiler.

Create a class in a subpackage such as:
package subpackage;

public class Test {
    public static void main(String[] args) {
	System.out.println("Hello");
    }
}

Then compile using following command:
> ajc subpackage\Test.java

You will see a directory "subpackage" created under the existing "subpackage"
directory. The test.class is then put in subpackage\subpackage directory.
This means running java command results in 
Exception in thread "main" java.lang.NoClassDefFoundError: subpackage/Test

Running either of the following command fixes the problem:
> ajc -d . subpackage\Test.java

or 

> javac subpackage\Test.java

No big deal, really. But it will be nice to have same behavior as javac.
Comment 1 Jim Hugunin CLA 2003-05-27 13:41:35 EDT
This was a significant regression from 1.1rc1.  It is now fixed in the tree 
with a test in org.aspectj.ajdt.core/*/BasicCommandTestCase.  The behavior 
should exactly mimic that of javac (and the eclipse command-line compiler) 
when -d is not passed.

We had no test cases for this behavior because all of our testing 
infrastructure explicitly passes in an output directory to keep class files 
out of the source tree.