Security Manager API Removal#713
Conversation
|
Other GitHub Examples: full SecurityManager security = System.getSecurityManager();
if (security != null) {
try {
security.checkSystemClipboardAccess();
clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
} catch (SecurityException e) {
clipboard = new Clipboard("Application Clipboard");
}
}Should become clipboard = new Clipboard("Application Clipboard");or clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();and (original) SecurityManager sm = System.getSecurityManager();
if (sm != null) sm.checkPermission(new PropertyPermission("user.language", "write"));Should be removed completely. (bearbeitet) |
timtebeek
left a comment
There was a problem hiding this comment.
Let's address the comment I posted.
There was a problem hiding this comment.
Some suggestions could not be made:
- src/main/resources/META-INF/rewrite/examples.yml
- lines 20-19
- lines 59-69
- lines 105-106
- lines 216-215
- lines 239-240
- lines 490-499
- lines 538-537
- lines 559-575
- lines 997-1004
- lines 1033-1042
- lines 1092-1110
- lines 3147-3169
- lines 3198-3197
- lines 5616-5625
- lines 5643-5642
- lines 5796-5795
- lines 5831-5832
- lines 6581-6593
- lines 6606-6617
- lines 6631-6630
There was a problem hiding this comment.
Some suggestions could not be made:
- src/main/resources/META-INF/rewrite/examples.yml
- lines 20-19
- lines 59-69
- lines 105-106
- lines 216-215
- lines 239-240
- lines 490-499
- lines 538-537
- lines 559-575
- lines 997-1004
- lines 1033-1042
- lines 1092-1110
- lines 3147-3169
- lines 3198-3197
- lines 5616-5625
- lines 5643-5642
- lines 5796-5795
- lines 5831-5832
- lines 6581-6593
- lines 6606-6617
- lines 6631-6630
|
I'm seeing here
So then can we do the simplest thing here and make that explicit? So going from SecurityManager security = System.getSecurityManager();
if (security != null) { ... }To SecurityManager security = null;
if (security != null) { ... }That recipe should be very simple to write, and makes explicit what's now implicit. We do a very similar thing in rewrite-feature-flags where we replace the method invocation with a literal, and then call out to other visitors to clean up. Removing that conditional should then happen by default when the variable is always |
|
Yes, a decent option here. I will submit a second PR dealing with Securtity Manager. |
There was a problem hiding this comment.
Some suggestions could not be made:
- src/main/resources/META-INF/rewrite/examples.yml
- lines 20-19
- lines 59-69
- lines 105-106
- lines 216-215
- lines 239-240
- lines 490-499
- lines 538-537
- lines 559-575
- lines 997-1004
- lines 1033-1042
- lines 1092-1110
- lines 3147-3169
- lines 3198-3197
- lines 5616-5625
- lines 5643-5642
- lines 5796-5795
- lines 5831-5832
- lines 6581-6593
- lines 6606-6617
- lines 6631-6630
There was a problem hiding this comment.
Some suggestions could not be made:
- src/main/resources/META-INF/rewrite/examples.yml
- lines 20-19
- lines 59-69
- lines 105-106
- lines 216-215
- lines 239-240
- lines 490-499
- lines 538-537
- lines 559-575
- lines 997-1004
- lines 1033-1042
- lines 1092-1110
- lines 3147-3169
- lines 3198-3197
- lines 5616-5625
- lines 5643-5642
- lines 5796-5795
- lines 5831-5832
- lines 6581-6593
- lines 6606-6617
- lines 6631-6630
What's changed?
With Java 24 the Security Manager API pushes users from using itself. We can help by removing the methods.
What's your motivation?
Anything in particular you'd like reviewers to focus on?
Anyone you would like to review specifically?
Have you considered any alternatives or workarounds?
Any additional context
Checklist