jdk

Форк
0
235 строк · 5.0 Кб
1
/*
2
 * Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
 *
5
 * This code is free software; you can redistribute it and/or modify it
6
 * under the terms of the GNU General Public License version 2 only, as
7
 * published by the Free Software Foundation.
8
 *
9
 * This code is distributed in the hope that it will be useful, but WITHOUT
10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12
 * version 2 for more details (a copy is included in the LICENSE file that
13
 * accompanied this code).
14
 *
15
 * You should have received a copy of the GNU General Public License version
16
 * 2 along with this work; if not, write to the Free Software Foundation,
17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
 *
19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
 * or visit www.oracle.com if you need additional information or have any
21
 * questions.
22
 */
23

24
/*
25
 * @test
26
 * @bug 7021614 8031212 8273244 8284908 8200337 8288619
27
 * @summary extend com.sun.source API to support parsing javadoc comments
28
 * @modules jdk.compiler/com.sun.tools.javac.api
29
 *          jdk.compiler/com.sun.tools.javac.file
30
 *          jdk.compiler/com.sun.tools.javac.tree
31
 *          jdk.compiler/com.sun.tools.javac.util
32
 * @build DocCommentTester
33
 * @run main DocCommentTester SeeTest.java
34
 */
35

36
class SeeTest {
37
    /**
38
     * abc.
39
     * @see "String"
40
     */
41
    void quoted_text() { }
42
/*
43
DocComment[DOC_COMMENT, pos:1
44
  firstSentence: 1
45
    Text[TEXT, pos:1, abc.]
46
  body: empty
47
  block tags: 1
48
    See[SEE, pos:7
49
      reference: 1
50
        Text[TEXT, pos:12, "String"]
51
    ]
52
]
53
*/
54

55
    /**
56
     * Test '@' in quoted string.
57
     * @see "{@code}"
58
     */
59
    void at_sign_in_quoted_string() { }
60
/*
61
DocComment[DOC_COMMENT, pos:1
62
  firstSentence: 1
63
    Text[TEXT, pos:1, Test_'@'_in_quoted_string.]
64
  body: empty
65
  block tags: 1
66
    See[SEE, pos:29
67
      reference: 1
68
        Text[TEXT, pos:34, "{@code}"]
69
    ]
70
]
71
*/
72

73
    /**
74
     * Test new line before quoted string.
75
     * @see
76
     *    "{@code}"
77
     */
78
    @PrettyCheck(false)
79
    void new_line_before_quoted_string() { }
80
/*
81
DocComment[DOC_COMMENT, pos:1
82
  firstSentence: 1
83
    Text[TEXT, pos:1, Test_new_line_before_quoted_string.]
84
  body: empty
85
  block tags: 1
86
    See[SEE, pos:38
87
      reference: 1
88
        Text[TEXT, pos:47, "{@code}"]
89
    ]
90
]
91
*/
92

93
    /**
94
     * abc.
95
     * @see <a href="url">url</a>
96
     */
97
    void url() { }
98
/*
99
DocComment[DOC_COMMENT, pos:1
100
  firstSentence: 1
101
    Text[TEXT, pos:1, abc.]
102
  body: empty
103
  block tags: 1
104
    See[SEE, pos:7
105
      reference: 3
106
        StartElement[START_ELEMENT, pos:12
107
          name:a
108
          attributes: 1
109
            Attribute[ATTRIBUTE, pos:15
110
              name: href
111
              vkind: DOUBLE
112
              value: 1
113
                Text[TEXT, pos:21, url]
114
            ]
115
        ]
116
        Text[TEXT, pos:26, url]
117
        EndElement[END_ELEMENT, pos:29, a]
118
    ]
119
]
120
*/
121

122
    /**
123
     * abc.
124
     * @see String text
125
     */
126
    void string() { }
127
/*
128
DocComment[DOC_COMMENT, pos:1
129
  firstSentence: 1
130
    Text[TEXT, pos:1, abc.]
131
  body: empty
132
  block tags: 1
133
    See[SEE, pos:7
134
      reference: 2
135
        Reference[REFERENCE, pos:12, String]
136
        Text[TEXT, pos:19, text]
137
    ]
138
]
139
*/
140

141
    /**
142
     * abc.
143
     * @see java.lang.String text
144
     */
145
    void j_l_string() { }
146
/*
147
DocComment[DOC_COMMENT, pos:1
148
  firstSentence: 1
149
    Text[TEXT, pos:1, abc.]
150
  body: empty
151
  block tags: 1
152
    See[SEE, pos:7
153
      reference: 2
154
        Reference[REFERENCE, pos:12, java.lang.String]
155
        Text[TEXT, pos:29, text]
156
    ]
157
]
158
*/
159

160
    /**
161
     * abc.
162
     * @see java.lang.String#length text
163
     */
164
    void j_l_string_length() { }
165
/*
166
DocComment[DOC_COMMENT, pos:1
167
  firstSentence: 1
168
    Text[TEXT, pos:1, abc.]
169
  body: empty
170
  block tags: 1
171
    See[SEE, pos:7
172
      reference: 2
173
        Reference[REFERENCE, pos:12, java.lang.String#length]
174
        Text[TEXT, pos:36, text]
175
    ]
176
]
177
*/
178

179
    /**
180
     * abc.
181
     * @see java.lang.String#matches(String regex) text
182
     */
183
    void j_l_string_matches() { }
184
/*
185
DocComment[DOC_COMMENT, pos:1
186
  firstSentence: 1
187
    Text[TEXT, pos:1, abc.]
188
  body: empty
189
  block tags: 1
190
    See[SEE, pos:7
191
      reference: 2
192
        Reference[REFERENCE, pos:12, java.lang.String#matches(String_regex)]
193
        Text[TEXT, pos:51, text]
194
    ]
195
]
196
*/
197

198
    /**
199
     * abc.
200
     * @see java.lang.String##fragment text
201
     */
202
    void j_l_string_anchor() { }
203
/*
204
DocComment[DOC_COMMENT, pos:1
205
  firstSentence: 1
206
    Text[TEXT, pos:1, abc.]
207
  body: empty
208
  block tags: 1
209
    See[SEE, pos:7
210
      reference: 2
211
        Reference[REFERENCE, pos:12, java.lang.String##fragment]
212
        Text[TEXT, pos:39, text]
213
    ]
214
]
215
*/
216

217
    /**
218
     * abc.
219
     * @see 123 text
220
     */
221
    void bad_numeric() { }
222
/*
223
DocComment[DOC_COMMENT, pos:1
224
  firstSentence: 1
225
    Text[TEXT, pos:1, abc.]
226
  body: empty
227
  block tags: 1
228
    Erroneous[ERRONEOUS, pos:7, prefPos:19
229
      code: compiler.err.dc.unexpected.content
230
      body: @see_123_text
231
    ]
232
]
233
*/
234

235
}
236

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.