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
3232 )
3333 or
3434 documentable instanceof ClassOrInterface and
35+ not documentable instanceof Record and
3536 not exists ( TypeVariable tv | tv .getGenericType ( ) = documentable |
3637 "<" + tv .getName ( ) + ">" = paramTag .getParamName ( )
3738 ) and
3839 msg =
3940 "@param tag \"" + paramTag .getParamName ( ) +
4041 "\" 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 ( ) + "\"."
4153 else
4254 // The tag has no value at all.
4355 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> {}
120120 */
121121 interface GenericInterface <T > {}
122122
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 ) {}
124136}
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 1212| Test.java:112:6:112:12 | @param | @param tag "<X>" does not match any actual type parameter of type "GenericClass". |
1313| Test.java:118:6:118:12 | @param | @param tag "T" does not match any actual type parameter of type "GenericInterface". |
1414| 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