Skip to content

Commit

Permalink
JavaCompiler: add output if no ToolsProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
hinerm committed Dec 2, 2015
1 parent f6f4e88 commit 2363a6d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/java/org/scijava/minimaven/JavaCompiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@

import javax.tools.ToolProvider;

import org.scijava.util.ClassUtils;
import org.scijava.util.FileUtils;
import org.scijava.util.ProcessUtils;

/**
* Encapsulates the Java compiler, falling back to command-line {@code javac}.
*
* @author Johannes Schindelin
* @author Mark Hiner
*/
public class JavaCompiler {
protected PrintStream err, out;
Expand All @@ -64,9 +66,15 @@ public void call(String[] arguments,
try {
javax.tools.JavaCompiler sysc = ToolProvider.getSystemJavaCompiler();
if (sysc != null) {
err.print("Found tools compiler: " + sysc.getClass());

This comment has been minimized.

Copy link
@ctrueden

ctrueden Dec 16, 2015

Member

Do we want to emit output on stderr when the tool provider is found? Won't that cause this message to appear in the common case then?

This comment has been minimized.

Copy link
@hinerm

hinerm Dec 16, 2015

Author Member

Yeah, we should probably guard all the err.println calls in verbose checks, at least.. any other thoughts on how to remove err.println in general?

This comment has been minimized.

Copy link
@ctrueden

ctrueden Dec 16, 2015

Member

Luckily, the BuildEnvironment already has verbose and debug flags. So let's pass them from there to the JavaCompiler and then use them here.

err.print(ClassUtils.getLocation(sysc.getClass()));
sysc.run(null, out, err, arguments);
return;
}
else {
err.println("No java.tools.JavaCompiler available. Checking for explicit javac.");

This comment has been minimized.

Copy link
@ctrueden

ctrueden Dec 16, 2015

Member

This should be javax.tools not java.tools.

}

if (javac == null) {
JarClassLoader loader = discoverJavac();
Class<?> main = loader == null ?
Expand Down

0 comments on commit 2363a6d

Please sign in to comment.