Running javac with symlinks

Bruno Alexandre Rosa bruno.rosa at eldorado.org.br
Mon Nov 28 13:57:50 UTC 2016


Thanks a lot, Jonathan!

That said, I'll update the scripts I'm using.
Just a quick note: this microbenchmark suite is actually more of a collection of HelloWorld-like programs :)

Regards,
Bruno Rosa

From: compiler-dev [mailto:compiler-dev-bounces at openjdk.java.net] On Behalf Of Jonathan Gibbons
Sent: sábado, 26 de novembro de 2016 01:37
To: compiler-dev at openjdk.java.net
Subject: Re: Running javac with symlinks


Bruno,

Since it is not really specified how javac operates in the context of symlinks, I think you can say that the new behavior is neither a feature nor a bug, but maybe just a side-effect of the internal change from using java.io.File to java.nio.file.Path.

That being said, the behavior was inconsistent for following symlinks as needed for directories, but not for the final file itself. And as you noted when you forwarded the question to jdk9-dev, the man page does specify "the same directory as the source file".

Also, both man pages from openjdk8 and an early access Java SE9 [2] have the same text regarding the default behavior:



"If the -d option is not specified, then javac puts each class file in the same directory as the source file from which it was generated."
So, I think that makes the change come down on the side of a feature, and not a bug.

In general, I would recommend specifying an output directory for compiled class files with -d, and not rely on behavior of putting the class file in the same directory as the source, which IMO is more suitable for simple HelloWorld-type programs.

-- Jon

On 11/25/16 10:47 AM, Bruno Alexandre Rosa wrote:
Hi, everyone,

I came across a minor unusual situation trying to compile and run the java version of a benchmark suite [1]: in jdk9, when the source files are actually symlinks, the bytecode files are generated in the same directories as the *targets* of the links as opposed to the behavior in jdk8, whereas in the bytecode files are generated in the same path as the link themselves.

So, my question is: is this new behavior a feature or a bug?

Regards,
Bruno Rosa

[1] - https://benchmarksgame.alioth.debian.org/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20161128/64ed965a/attachment-0001.html>


More information about the compiler-dev mailing list