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
8231622: SuppressWarning("serial") ignored on field serialVersionUID #1626
Conversation
|
/label remove build |
@lgxbslgx |
Webrevs
|
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.
For tests that use /ref=file
-XDrawDiagnostics
the conventions are:
- Omit the complete legal header, including the copyright and license
- After
@test
add the text/nodynamiccopyright/
#1 protects the file against any future changes in the length of the legal header, that might affect line numbers, and #2 is for use by automated scripts that may check for the presence of the legal header.
Thank you for your comment. I revise my code according to your suggestion. And I found some previous tests use the wrong style which are like this patch. I want to modify them so that these tests won't mislead other developers, especially the new developers. Could I get your help to open a new issue about it in the bug tracker? Thanks a lot. |
Can you give me a list of tests that you think need to be addressed? |
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 approve these changes.
That being said, a more modern idiom for negative tests involving small source files and corresponding small golden files, is to write a single file that uses library code like toolbox.ToolBox
to write files on the fly, perhaps from content in a text block, and to compare the output against another text block. For slightly more advanced usage, you can compile strings directly using API like SimpleJavaFileObject
, and avoid the file system altogether.
@lgxbslgx This change now passes all automated pre-integration checks. 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 153 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. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@jonathan-gibbons) but any other Committer may sponsor as well.
|
I write a python script to help me to find the possible wrong style tests. The script finds string As you can see the entries in the annex The content of the python script is shown below. I don't attach it as an annex because GitHub doesn't support the python file type.
The steps to run the script are shown below.
The file Anyway, I don't think we should continue to discuss the concrete content in this patch. |
@jonathan-gibbons I revise the test code by using the library toolbox. Thank you for taking the time to review. |
/integrate |
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.
Nice improvement. You can make it even better in 3 places by using ToolBox.checkEquals
, which provides more detailed reporting in the case of a difference being found.
if (!Objects.equals(output, expected)) { | ||
throw new AssertionError("incorrect output\nactual=" + output + "\nexpected=" + expected); | ||
} |
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.
ToolBox provides checkEquals
which provides a more detailed error message in the case of a difference.
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.
Thank you for the suggestion. I fixed it.
@jonathan-gibbons I submit a patch[1] to solve the previous bad style tests. We can continue the discussion there. [1] #1732 |
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.
Latest change looks good
/integrate |
Could I ask your help to sponsor this patch? Thanks a lot. |
/sponsor |
@jonathan-gibbons @lgxbslgx Since your change was applied there have been 210 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 01d51a1. |
Hi all,
Currently, a warning is generated when compiling the following code by using the option
-Xlint
.The annotation
@SuppressWarnings("serial")
on field serialVersionUID is ignored by the compiler.This patch fixes it and adds some tests.
Thank you for taking the time to review.
Best Regards.
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/1626/head:pull/1626
$ git checkout pull/1626