RFR: 8231622: SuppressWarning("serial") ignored on field serialVersionUID [v2]
Guoxiong Li
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.
#!/usr/bin/python
import os
def clean(output_file):
if os.path.exists(output_file):
os.remove(output_file)
def outputFileName(full_path, output_file):
output_file = open(output_file, 'a')
output_file.write(full_path)
output_file.write("\n")
output_file.close()
def findStrListInTestFile(full_path, find_str_list):
search_file = open(full_path, 'r')
content = search_file.read()
search_file.close()
for find_str in find_str_list:
is_found = content.find(find_str)
if is_found == -1:
return False
return True
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 is_found:
outputFileName(full_path, output_file)
if __name__ == "__main__":
findDir = "test"
findStrList = ["Copyright", "ref=", "-XDrawDiagnostics"]
outputFile = "result.txt"
clean(outputFile)
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.
[result.txt](https://github.com/openjdk/jdk/files/5656821/result.txt)
Anyway, I don't think we should continue to discuss the concrete content in this patch.
-------------
PR: https://git.openjdk.java.net/jdk/pull/1626
More information about the compiler-dev
mailing list