On 10/02/2013 04:12 PM, Peter Levart wrote:
On 10/02/2013 12:19 PM, Remi Forax wrote:
final class ProxyClassesDumper {
...
private final Path dumpDir; // null if invalid
public static ProxyClassesDumper create(String dir) {
dir = dir.trim();
Path path = *Paths.get*(dir.isEmpty() ? "." : dir);
path = validateDumpDir(path)? path: null;
return new ProxyClassesDumper(path);
}
Hi Remi, Henry,
I think Henry is trying to re-validate the directory on each dump
attempt even if it was invalid on 1st dump attempt. Perhaps in order
to be able to start a VM with dump directory specified and only later
create or mount that directory.
Having a static field in the InnerClassLambdaMetafactory holding an
initialized ProxyClassesDumper is a good idea.
One thing to watch though is that Paths.get(String) can throw
InvalidPathException. This will render InnerClassLambdaMetafactory
non-functional since its static initialization will throw exception.
Each lambda capture will than throw Error. I think the exception
should be caught, logged and null returned from
ProxyClassesDumper.create() in that case...
yes, nice catch.
Regards, Peter
cheers,
Rémi