- 
        Couldn't load subscription status. 
- Fork 6.1k
8353642: Deprecate URL::getPermission method and networking permission classes for removal #24592
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
Conversation
| 👋 Welcome back dfuchs! A progress list of the required criteria for merging this PR into  | 
| @dfuch This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 53 new commits pushed to the  
 As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the  | 
| Webrevs
 | 
| The CSR is also ready to be reviewed at https://bugs.openjdk.org/browse/JDK-8354406 | 
| * {@link UnsupportedOperationException}, or return | ||
| * {@link java.security.AllPermission}. | ||
| */ | ||
| @Deprecated(since = "25") | 
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.
can this (and all other getPermission methods) be "forRemoval=true"?
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.
Possibly. @AlanBateman may have some thoughts on this.
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 think we should at least consider deprecating URLConnection.getPermission and HttpURLConnection.getPermission for removal, only because I don't immediately see the advantage of doing it in two steps for these two APIs.
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.
Thanks - I will do that then
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.
Done
| } | ||
| return this.sp.implies(that.sp); | ||
| @SuppressWarnings("removal") | ||
| var result = this.sp.implies(that.sp); | 
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.
Will we need to rewrite this code without SocketPermissions? Can we remove it, maybe? It is only used by CodeSource.implies, which is not used by the JDK (but may be used elsewhere).
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.
also the JavaDoc of the implies method references the SocketPermission. That will also need to be cleaned up at some point.
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.
That will be left over for someone in security-libs to cleanup this code at their convenience before we remove SocketException.
Hmmm... If the public API references SocketException we might have to deprecate in this PR too. Not sure what the implications are. Maybe @seanjmullan can advise.
| */ | ||
|  | ||
| @SuppressWarnings("removal") | ||
| @Deprecated(since = "25", forRemoval = true) | 
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 class is internal, no need to deprecate
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.
It helps getting warnings at the place where the class is used.
| The GHA failure (Windows) appears to be related. | 
| 
 Yes - I missed one windows specific file in my original patch. I have a test running in the CI and I am waiting for it to pass before updating the PR. | 
| if (this.sp == null) { | ||
| this.sp = new SocketPermission(thisHost, "resolve"); | ||
| @SuppressWarnings("removal") | ||
| var _ = this.sp = new SocketPermission(thisHost, "resolve"); | 
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.
What's the reason for the var _ = bit ?
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.
@SuppressWarnings can not be applied to a an expression - it needs a (variable/method/class) declaration
| 
 Should be fixed now | 
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.
Looks fine to me.
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.
LGTM.
| After discussion with @seanjmullan we decided to revert the changes to  | 
| * relevant | ||
| */ | ||
| @Override | ||
| @Deprecated(since = "25", forRemoval = true) | 
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.
Is this annotation required or more as a reminder that the superclass method is deprecated?
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 think it's needed because the superclass method is deprecated for removal. Will double check.
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.
Yes - it is needed. If you override a deprecated method you need to carry the deprecation annotation over. Here is what I got when I tried to remove the annotation on HttpURLConnection::getPermission() (the same error occurred on any subclass where I attempted to remove the annotation):
java/net/HttpURLConnection.java:615: warning: [dep-ann] deprecated item is not annotated with @Deprecated
    public Permission getPermission() throws IOException {
                      ^
error: warnings found and -Werror specified
| * as the Security Manager is no longer supported. | ||
| */ | ||
| @Deprecated(since = "25", forRemoval = true) | ||
| @SuppressWarnings("removal") | 
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.
Do you still need this annotation now that SocketPermission is not deprecated for removal?
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.
Ah - good point - I will double check.
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.
Yes - it is needed as well. Apparently if you override a deprecated method you need both @Deprecated and @SuppressWarning:
src/java.base/share/classes/java/net/HttpURLConnection.java:615: warning: [removal] getPermission() in URLConnection has been deprecated and marked for removal
    public Permission getPermission() throws IOException {
                      ^
error: warnings found and -Werror specified
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.
Ok, but seems redundant.
| /integrate | 
| Going to push as commit 45dfc2c. 
 Your commit was automatically rebased without conflicts. | 
Please find her a patch that deprecate networking permission classes for removal. The method
URL::getPermissionnow serves little purpose and is also deprecated. That method was overridden in subclasses and specified to return some of the deprecated permissions.Progress
Issues
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/24592/head:pull/24592$ git checkout pull/24592Update a local copy of the PR:
$ git checkout pull/24592$ git pull https://git.openjdk.org/jdk.git pull/24592/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 24592View PR using the GUI difftool:
$ git pr show -t 24592Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/24592.diff
Using Webrev
Link to Webrev Comment