-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
8336843: Deprecate java.util.zip.ZipError for removal #20642
Conversation
/csr |
👋 Welcome back eirbjo! A progress list of the required criteria for merging this PR into |
@eirbjo 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 518 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
|
On a corpus search, found sbt/internal/inc/zip/ZipCentralDir.java referenced ZipError(was based off an old copy of ZipFS I believe), the file does not seem to be part of the GitHub repository and there are 5 usages com/aoapps/lang/Throwables.class and com/aoindustries/lang/Throwables.class (clone of each other I believe) com/android/tools/apk/analyzer/internal/ArchiveManagerImpl. ( 1 usage) So would be good to also alert those projects if possible |
There’s also HMCL’s |
Yes that is true. The difference there is that is due to the demo version of Zip FS and as of JDK 9, when Zip FS was supported, it did not throw ZipError |
A search on GitHub shows multiple Minecraft-related Java projects catch (but not create) ZipError for Java 8 backward compatibility. Maybe the actual deprecation can take steps; first with a functional removal to make ZipError constructors and methods throw errors, before finally removing it many releases later. |
I guess the deprecation warning itself is the "official" channel for communicating this type of information. But I agree it doesn't hurt to alert at least some of the larger projects, on a best-effort bases. So I have reached out to the following projects by reporting issues:
|
@@ -27,10 +27,11 @@ | |||
|
|||
/** | |||
* Signals that an unrecoverable error has occurred. | |||
* | |||
* @deprecated Use {@link ZipException} instead. |
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.
We should probably talk about how this is no longer created by the reference implementation since JDK 9 (and JDK 8's zipfs is really a demo). Should we note that we might functionally disable the constructor first?
@eirbjo I have updated the CSR to describe the solutions from both our and user sides. I think you can update the class Javadoc to something like: /**
* A legacy error for invalid ZIP format from argument incorrectly regarded as an internal error.
* This extends {@code InternalError} to maintain compatibility with preexisting client code catching
* {@code InternalError}.
*
* @deprecated
* This error is not suitable to indicate an exception for a general ZIP file; use {@link
* ZipException} instead.
* <p>
* {@code ZipError} fell out of use in the reference implementation in release 9 when the native ZIP
* API was brought over to Java. Its last uses was in ZipFile and the demo zipfs in release 8.
* <p>
* Code bases supporting release 8 should update to catch InternalError instead. Old binaries can
* use bytecode patching to upgrade CONSTANT_Class references to {@code java/util/zip/ZipError} in
* exception handler ranges to {@code java/lang/InternalError}.
*/ I don't know if we should include such an excerpt: /**
* <p>
* In a future release, implementation of {@code ZipError} will be removed before this class itself
* is removed; at that point, {@code ZipError} can no longer be constructed or used, but can still
* be compiled against as an aid in migration.
*/ I left the questions in CSR comment section; hope Joe Darcy can give us some advice here. |
While I agree an I also do not see a need to anything WRT the constructors as that is overkill IMHO. A release note will also go with this change which can suggest that code that also must support JDK 8 leverage InternalError |
I think linking to the CSR would be fine, but there is no prerequisite for API specs to link to CSRs. Need @jddarcy to double check here. I was emulating
|
I am not suggesting link to the CSR, what I was indicating the CSR provides more details because of the proposed removal. Comparing to The overall usage of ZipError is extremely minimal in the wild at best, from what I can tell was in a catch statement and was not documented to be thrown by any public API, though was thrown by ZipFile's internal ZipEntryIterator::next If this was a more heavily used Exception, it would probably warrant further consideration for additional documentation, I am not convinced it is needed here |
How about this: /**
* A legacy error for invalid input ZIP format.
*
* @deprecated
* Use {@link ZipException} instead. Code catching this error from the JDK 8 and earlier should update
* to catch {@code InternalError} instead.
*/ |
… in JDK 9 and to mention that code may be updated to catch the super class InternalError
JEP-277, "Enhanced Deprecation" includes the following recommendations: It is strongly recommended that the reasons for deprecating an API be described in that API's documentation comments. In addition, it is also recommended that potential replacement APIs be discussed and linked from the documentation. The reason we are deprecating this class is mainly that it became obsolete in JDK 9. I think we should say just that, and not elaborate with more details of the history of the class. The recommended API replacement depends a bit on whether the code catches or throws I think I would prefer to not update the class comment of this obsolete class. Based on the above, the PR now suggests the following documentation comment:
|
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.
/reviewers 2 reviewer
The updated deprecation specification looks good to me. I will review the CSR when you update it. Needs Lance or another engineer in the area to confirm too.
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 the revised proposal looks good and once you update the CSR, let me know and I will review it.
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 good.
Thanks @LanceAndersen and @liach for your patient reviews. I have updated the Specification section of the CSR and moved it to the Proposed state for an initial round of reviews: |
@eirbjo This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
@eirbjo Can you answer CSR review question about whether to just deprecate the constructor of |
Thanks for prodding! I have provided an answer to this question in the CSR: https://bugs.openjdk.org/browse/JDK-8338663#comment-14709333 |
The issue with removing This is different from referencing removed classes in method or field descriptors, those get treated as if they had the following declaration for the purposes of verification when determining whether public abstract final class <name> extends Object {
} |
@ExE-Boss Indeed, the removal is intended to be binary incompatible. Just like the example in [the fucntional removal of SecurityManager(https://openjdk.org/jeps/486), users can instrument or statically preprocess their |
The CSR has been approved to mark I plan to integrate this early next week. Just in case there are still any lingering concerns. Thanks for all the patient reviews and comments, here and in the CSR! |
As promised in the CSR, this change will be accompanied by a release note. A release note was drafted a while back, but I don't think anyone provided feedback. Before integrating this change, I would love if someone could take a look at the release note and provide feedback. This way all aspects of this task can be completed: |
/integrate |
Going to push as commit 7a1e832.
Your commit was automatically rebased without conflicts. |
Please review this PR which suggests to deprecate the unused class
java.util.zip.ZipError
for removal.The class has been unsed by OpenJDK since the ZIP API was rewritten from native to Java in JDK 9.
I opted to not explain the reason for the deprecation in detail, but instead simply point to
ZipException
as an alternative. Should more explanation be desired, I could prepend that with a note saying that the class is unused since JDK 9.A CSR for this API update has been drafted, I'll update the Specification section there once we reach a concensus on the deprecation note in this PR.
This deprecation was initially suggested here: https://mail.openjdk.org/pipermail/core-libs-dev/2024-June/125720.html
Progress
Issues
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/20642/head:pull/20642
$ git checkout pull/20642
Update a local copy of the PR:
$ git checkout pull/20642
$ git pull https://git.openjdk.org/jdk.git pull/20642/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 20642
View PR using the GUI difftool:
$ git pr show -t 20642
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/20642.diff
Webrev
Link to Webrev Comment