Bug 38131 - ajc needs -d . option while correctly compiling classes from subpackage
Summary: ajc needs -d . option while correctly compiling classes from subpackage
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows NT
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: Jim Hugunin CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-05-27 01:46 EDT by Ramnivas Laddad CLA
Modified: 2003-05-27 13:41 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.