8139852: jjs interactive mode fails to work with security manager

Reviewed-by: attila, hannesw
This commit is contained in:
Athijegannathan Sundararajan 2015-10-19 15:49:21 +05:30
parent 3bbcdaa0b2
commit 6671d2c38d

View File

@ -51,7 +51,11 @@ import javax.tools.ToolProvider;
*/
final class PackagesHelper {
// JavaCompiler may be null on certain platforms (eg. JRE)
private static final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
private static final JavaCompiler compiler;
static {
// Use javac only if security manager is not around!
compiler = System.getSecurityManager() == null? ToolProvider.getSystemJavaCompiler() : null;
}
/**
* Is Java package properties helper available?