File tree Expand file tree Collapse file tree 5 files changed +34
-1
lines changed
test/query-tests/SpuriousJavadocParam Expand file tree Collapse file tree 5 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -32,12 +32,24 @@ where
32
32
)
33
33
or
34
34
documentable instanceof ClassOrInterface and
35
+ not documentable instanceof Record and
35
36
not exists ( TypeVariable tv | tv .getGenericType ( ) = documentable |
36
37
"<" + tv .getName ( ) + ">" = paramTag .getParamName ( )
37
38
) and
38
39
msg =
39
40
"@param tag \"" + paramTag .getParamName ( ) +
40
41
"\" does not match any actual type parameter of type \"" + documentable .getName ( ) + "\"."
42
+ or
43
+ documentable instanceof Record and
44
+ not exists ( TypeVariable tv | tv .getGenericType ( ) = documentable |
45
+ "<" + tv .getName ( ) + ">" = paramTag .getParamName ( )
46
+ ) and
47
+ not documentable .( Record ) .getCanonicalConstructor ( ) .getAParameter ( ) .getName ( ) =
48
+ paramTag .getParamName ( ) and
49
+ msg =
50
+ "@param tag \"" + paramTag .getParamName ( ) +
51
+ "\" does not match any actual type parameter or record parameter of record \"" +
52
+ documentable .getName ( ) + "\"."
41
53
else
42
54
// The tag has no value at all.
43
55
msg = "This @param tag does not have a value."
Original file line number Diff line number Diff line change
1
+ ---
2
+ category : minorAnalysis
3
+ ---
4
+ * The ` java/unknown-javadoc-parameter ` now accepts ` @param ` tags that apply to the parameters of a
5
+ record.
Original file line number Diff line number Diff line change @@ -120,5 +120,17 @@ class GenericClass<T> {}
120
120
*/
121
121
interface GenericInterface <T > {}
122
122
123
- // Diagnostic Matches: Incomplete inheritance relation for type java.lang.Object and supertype none
123
+ /**
124
+ * @param i exists
125
+ * @param k does not
126
+ */
127
+ static record SomeRecord (int i , int j ) {}
128
+
129
+ /**
130
+ * @param <T> exists
131
+ * @param <U> does not
132
+ * @param i exists
133
+ * @param k does not
134
+ */
135
+ static record GenericRecord <T >(int i , int j ) {}
124
136
}
Original file line number Diff line number Diff line change
1
+ //semmle-extractor-options: --javac-args -source 16 -target 16
Original file line number Diff line number Diff line change 12
12
| Test.java:112:6:112:12 | @param | @param tag "<X>" does not match any actual type parameter of type "GenericClass". |
13
13
| Test.java:118:6:118:12 | @param | @param tag "T" does not match any actual type parameter of type "GenericInterface". |
14
14
| Test.java:119:6:119:12 | @param | @param tag "<X>" does not match any actual type parameter of type "GenericInterface". |
15
+ | Test.java:125:6:125:12 | @param | @param tag "k" does not match any actual type parameter or record parameter of record "SomeRecord". |
16
+ | Test.java:131:6:131:12 | @param | @param tag "<U>" does not match any actual type parameter or record parameter of record "GenericRecord". |
17
+ | Test.java:133:6:133:12 | @param | @param tag "k" does not match any actual type parameter or record parameter of record "GenericRecord". |
You can’t perform that action at this time.
0 commit comments