-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Java: Fixed
record
false positives (#3348)
- Loading branch information
1 parent
499b1fa
commit 3bd8fdb
Showing
3 changed files
with
89 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
public class Main { | ||
// "record" is used as variable name, but Prism marked it keyword | ||
public static void main(String[] record) { | ||
System.out.println(record); | ||
} | ||
// "record" is used as method name, but Prism marked it keyword | ||
public void record(String aaa){ | ||
} | ||
// "record" is keyword since java 14 | ||
public static record A() { | ||
} | ||
// it cannot be used as class name in java syntax | ||
public static class record { | ||
} | ||
} | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["keyword", "public"], | ||
["keyword", "class"], | ||
["class-name", ["Main"]], | ||
["punctuation", "{"], | ||
|
||
["comment", "// \"record\" is used as variable name, but Prism marked it keyword"], | ||
|
||
["keyword", "public"], | ||
["keyword", "static"], | ||
["keyword", "void"], | ||
["function", "main"], | ||
["punctuation", "("], | ||
["class-name", ["String"]], | ||
["punctuation", "["], | ||
["punctuation", "]"], | ||
" record", | ||
["punctuation", ")"], | ||
["punctuation", "{"], | ||
|
||
["class-name", ["System"]], | ||
["punctuation", "."], | ||
"out", | ||
["punctuation", "."], | ||
["function", "println"], | ||
["punctuation", "("], | ||
"record", | ||
["punctuation", ")"], | ||
["punctuation", ";"], | ||
|
||
["punctuation", "}"], | ||
|
||
["comment", "// \"record\" is used as method name, but Prism marked it keyword"], | ||
|
||
["keyword", "public"], | ||
["keyword", "void"], | ||
["function", "record"], | ||
["punctuation", "("], | ||
["class-name", ["String"]], | ||
" aaa", | ||
["punctuation", ")"], | ||
["punctuation", "{"], | ||
|
||
["punctuation", "}"], | ||
|
||
["comment", "// \"record\" is keyword since java 14"], | ||
|
||
["keyword", "public"], | ||
["keyword", "static"], | ||
["keyword", "record"], | ||
["class-name", ["A"]], | ||
["punctuation", "("], | ||
["punctuation", ")"], | ||
["punctuation", "{"], | ||
|
||
["punctuation", "}"], | ||
|
||
["comment", "// it cannot be used as class name in java syntax"], | ||
|
||
["keyword", "public"], | ||
["keyword", "static"], | ||
["keyword", "class"], | ||
" record ", | ||
["punctuation", "{"], | ||
|
||
["punctuation", "}"], | ||
|
||
["punctuation", "}"] | ||
] |