RFR: 8231622: SuppressWarning("serial") ignored on field serialVersionUID [v2]
github.com+13688759+lgxbslgx at openjdk.java.net
Tue Dec 8 04:51:13 UTC 2020
On Mon, 7 Dec 2020 19:21:00 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:
>> Guoxiong Li has updated the pull request incrementally with one additional commit since the last revision:
>> Revise test cases. Remove legal header and add /nodynamiccopyright/
> 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.
> Can you give me a list of tests that you think need to be addressed?
I write a python script to help me to find the possible wrong style tests. The script finds string `Copyright`, `ref=` and `-XDrawDiagnostics` in the files of directory `test`. If a file contains these three strings, it will print the full path name of the file to `result.txt`.
As you can see the entries in the annex `result.txt`, for example, the `test/langtools/tools/doclint/multipackage/MultiPackage.java` is not a wrong style test and `test/langtools/tools/javac/AnonStaticMember_1.java` is a wrong style test.
Later, I will check all the entries manually and revise the wrong style tests because I can't find a better way to do that.
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.
def outputFileName(full_path, output_file):
output_file = open(output_file, 'a')
def findStrListInTestFile(full_path, find_str_list):
search_file = open(full_path, 'r')
content = search_file.read()
for find_str in find_str_list:
is_found = content.find(find_str)
if is_found == -1:
def findWrongStyleTests(find_dir, find_str_list, output_file):
for dir_path, dir_names, file_names in os.walk(find_dir):
for file_name in file_names:
full_path = os.path.join(dir_path, file_name)
is_found = findStrListInTestFile(full_path, find_str_list)
if __name__ == "__main__":
findDir = "test"
findStrList = ["Copyright", "ref=", "-XDrawDiagnostics"]
outputFile = "result.txt"
findWrongStyleTests(findDir, findStrList, outputFile)
The steps to run the script are shown below.
- Enter the jdk main directory: `cd path/to/jdk`
- Create a new python script: `vim test.py`
- Copy the code above to the file `test.py`
- Use python command to run the script: `python test.py`
The file `result.txt` is shown below.
Anyway, I don't think we should continue to discuss the concrete content in this patch.
More information about the compiler-dev