-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #12318 SecurityUtils should not elminate calls to existing methods #12319
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm OK with the approach of "just call the methods if they exist and let the JVM work it out".
A couple of niggles...
@@ -93,8 +83,7 @@ public static Object getSecurityManager() | |||
{ | |||
try | |||
{ | |||
if (!USE_SECURITY_MANAGER) | |||
return null; | |||
// TODO cache this method on class loading like the other two methods ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's do this
@@ -113,8 +102,7 @@ public static Object getSecurityManager() | |||
*/ | |||
public static void checkPermission(Permission permission) throws SecurityException | |||
{ | |||
if (!USE_SECURITY_MANAGER) | |||
return; | |||
// TODO cache this methodon class loading like the other two methods ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets do this
@@ -142,9 +130,11 @@ public static void checkPermission(Permission permission) throws SecurityExcepti | |||
*/ | |||
public static <T> T doPrivileged(PrivilegedAction<T> action) | |||
{ | |||
if (!USE_SECURITY_MANAGER || doPrivileged == null) | |||
// Keep this method short and inlineable. | |||
MethodHandle methodHandle = doPrivileged; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure why the local methodHandle
variable is needed? doPrivileged
is final.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure either, it's in 12.0 where I copied this from.
Perhaps its required for Java to automatically inline the function ? I don't know much about the automatic inlining behaviour.
I have removed it.
3b4e520
to
0a25638
Compare
Thank you for the review, I have tried to address your comments. Shouldn't we use CAPS for the methodHandle constants ? |
We have a bit of a mixed usage of CAPS for |
@olamy can you look at CI failure? Doesn't look like a flake, but then doesn't look related to this PR either. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, subject to CI clean build
@gregw build is fine @stoty please have a read here https://www.eclipse.org/legal/eca/ once you have signed let us know and we will revalidate the PR |
Thank you. |
@stoty perfect. PR validated Thanks! |
No description provided.