Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output directory is incorrect for non-Windows #322

Closed
lombokissues opened this issue Jul 14, 2015 · 3 comments
Closed

Output directory is incorrect for non-Windows #322

lombokissues opened this issue Jul 14, 2015 · 3 comments
Assignees
Milestone

Comments

@lombokissues
Copy link

Migrated from Google Code (issue 249)

@lombokissues
Copy link
Author

👤 anthony@whitford.com   🕗 Aug 08, 2011 at 04:25 UTC

From a non-Windows machine (Mac OS X or Linux Ubuntu, for example), run something like:

$ java -jar lombok.jar delombok /Users/anthony/Documents/lombok.maven/test-maven-lombok/src/main/lombok/ -d /Users/anthony/Documents/lombok.maven/test-maven-lombok/target/generated-sources/delombok

Then, list the file in the output directory:

$ ls -l /Users/anthony/Documents/lombok.maven/test-maven-lombok/target/generated-sources/delombok

In my example, I have a source code file: /Users/anthony/Documents/lombok.maven/test-maven-lombok/src/main/lombok/org/projectlombok/test/DataExample.java
Since I specified the source path to be /Users/anthony/Documents/lombok.maven/test-maven-lombok/src/main/lombok/, I am expecting the generated files to be:
/Users/anthony/Documents/lombok.maven/test-maven-lombok/target/generated-sources/delombok/org/projectlombok/test/DataExample.java
Alas, what I see instead is:
/Users/anthony/Documents/lombok.maven/test-maven-lombok/target/generated-sources/delombok/Users/anthony/Documents/lombok.maven/test-maven-lombok/src/main/lombok/org/projectlombok/test/DataExample.java

I have seen this problem with 0.10.RC1 through 0.10.RC3 -- but only on non-Windows (Mac and Ubuntu). Windows works as expected.

Consider the following debug from Delombok.createFileWriter:

inBase : /Users/anthony/Documents/lombok.maven/test-maven-lombok/src/main/lombok
inBase.toURI : file:/Users/anthony/Documents/lombok.maven/test-maven-lombok/src/main/lombok/
file : /Users/anthony/Documents/lombok.maven/test-maven-lombok/src/main/lombok/org/projectlombok/test/DataExample.java
relative : /Users/anthony/Documents/lombok.maven/test-maven-lombok/src/main/lombok/org/projectlombok/test/DataExample.java

You can see that "relative" is not properly being transformed to be "relative." I would expect it to become:
org/projectlombok/test/DataExample.java

It would seem that the URI being generated for the last argument from this line:
else rawWriter = createFileWriter(output, baseMap.get(unit), unit.sourcefile.toUri());
is lacking the "file:/" prefix, so the relativize is not working…

I can resolve this problem by changing this line:

URI relative = inBase.toURI().relativize(file);

to:

    URI base = inBase.toURI();
    URI relative = base.relativize(base.resolve(file));

Note that I'm running into this problem during testing of the new lombok-maven-plugin. I am using Java 6 update 26 on Mac OSX Lion. Thanks for your help.

@lombokissues
Copy link
Author

👤 r.spilker   🕗 Aug 08, 2011 at 20:04 UTC

Fixed in d00576e and will be in 0.10.0. Implemented just like you suggested and attributed to you in the commit.

@lombokissues
Copy link
Author

End of migration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants