On 03/02/22 7:07 pm, Alan Bateman wrote:
I think it would be useful to hear from Jon Gibbons or someone else
working on javac first. It would be a bit unusual to run the compiler
with a security manager and I thought it was deliberate to not grant
permissions to jdk.compiler in the default policy. Also the source
code launcher is aimed at the early stages of learning Java where
there shouldn't be advanced options or exotic execution modes.
To add some context on where I ran into this - I was experimenting with
security manager itself to see how the SocketChannel.bind() API behaves
when security manager was enabled. Something like this trivial code:
import java.nio.channels.*;
import java.net.*;
public class SecManager {
public static void main(final String[] args) throws Exception {
SocketChannel sc = SocketChannel.open();
System.out.println("Opened socket channel " + sc);
sc.bind(new InetSocketAddress("127.0.0.1", 23452));
System.out.println("Bound socket channel " + sc);
sc.close();
System.out.println("Closed socket channel " + sc);
}
}
I decided to use source launcher mode here and since I was experimenting
with security manager itself, I had to enable security manager.
I had a look at the JEP-330 https://openjdk.java.net/jeps/330 where this
feature was introduced but couldn't see a mention of whether
using/enabling security manager with this feature was allowed/supported.
-Jaikiran