1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462
|
/*
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 7112427 8012295 8025633 8026567 8061305 8081854 8150130 8162363
* 8167967 8172528 8175200 8178830 8182257 8186332 8182765 8025091
* 8203791 8184205 8249633 8261976
* @summary Test of the JavaFX doclet features.
* @library ../../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
* @build javadoc.tester.*
* @run main TestJavaFX
*/
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import javadoc.tester.JavadocTester;
public class TestJavaFX extends JavadocTester {
public static void main(String... args) throws Exception {
var tester = new TestJavaFX();
tester.setAutomaticCheckAccessibility(false);
tester.setAutomaticCheckLinks(false);
tester.runTests();
}
@Test
public void test1() {
javadoc("-d", "out1",
"-sourcepath", testSrc,
"-javafx",
"--disable-javafx-strict-checks",
"-Xdoclint:all,-missing",
"-package",
"pkg1");
checkExit(Exit.OK);
checkOutput("pkg1/C.html", true,
"""
<dt>See Also:</dt>
<dd>
<ul class="tag-list">
<li><a href="#getRate()"><code>getRate()</code></a></li>
<li><a href="#setRate(double)"><code>setRate(double)</code></a></li>
</ul>
</dd>""",
"""
<div class="member-signature"><span class="modifiers">public final</span> <\
span class="return-type">void</span> <span class="element-name">setRate</span><wbr>\
<span class="parameters">(double value)</span></div>
<div class="block">Sets the value of the <code>rate</code> property.</div>
<dl class="notes">
<dt>Property description:</dt>""",
"""
<div class="member-signature"><span class="modifiers">public final</span> <\
span class="return-type">double</span> <span class="element-name">getRate</span>()<\
/div>
<div class="block">Gets the value of the <code>rate</code> property.</div>
<dl class="notes">
<dt>Property description:</dt>""",
"""
<div class="col-first odd-row-color"><code>final <a href="C.DoubleProperty.html" title\
="class in pkg1">C.DoubleProperty</a></code></div>
<div class="col-second odd-row-color"><code><a href="#rateProperty" class="membe\
r-name-link">rate</a></code></div>
<div class="col-last odd-row-color">
<div class="block">Defines the direction/speed at which the <code>Timeline</code> is expected to
be played.</div>""",
"<dt>Default value:</dt>",
"""
<dt>Since:</dt>
<dd>JavaFX 8.0</dd>""",
"<dt>Property description:</dt>",
"""
<div class="col-second even-row-color method-summary-table method-summary-table-\
tab2 method-summary-table-tab4"><code><a href="#setTestMethodProperty()" class="\
member-name-link">setTestMethodProperty</a>()</code></div>""",
"""
<div class="col-second even-row-color"><code><a href="#pausedProperty" class="me\
mber-name-link">paused</a></code></div>
<div class="col-last even-row-color">
<div class="block">Defines if paused.</div>""",
"""
<section class="detail" id="pausedProperty">
<h3>paused</h3>
<div class="member-signature"><span class="modifiers">public final</span> <\
span class="return-type"><a href="C.BooleanProperty.html" title="class in pkg1">\
C.BooleanProperty</a></span> <span class="element-name">pausedProperty</span></div>
<div class="block">Defines if paused. The second line.</div>""",
"""
<section class="detail" id="isPaused()">
<h3>isPaused</h3>
<div class="member-signature"><span class="modifiers">public final</span> <\
span class="return-type">double</span> <span class="element-name">isPaused<\
/span>()</div>
<div class="block">Gets the value of the <code>paused</code> property.</div>""",
"""
<section class="detail" id="setPaused(boolean)">
<h3>setPaused</h3>
<div class="member-signature"><span class="modifiers">public final</span> <\
span class="return-type">void</span> <span class="element-name">setPaused</\
span><wbr><span class="parameters">(boolean value)</span></div>
<div class="block">Sets the value of the <code>paused</code> property.</div>
<dl class="notes">
<dt>Property description:</dt>
<dd>Defines if paused. The second line.</dd>
<dt>Default value:</dt>
<dd>false</dd>""",
"""
<section class="detail" id="isPaused()">
<h3>isPaused</h3>
<div class="member-signature"><span class="modifiers">public final</span> <\
span class="return-type">double</span> <span class="element-name">isPaused<\
/span>()</div>
<div class="block">Gets the value of the <code>paused</code> property.</div>
<dl class="notes">
<dt>Property description:</dt>
<dd>Defines if paused. The second line.</dd>
<dt>Default value:</dt>
<dd>false</dd>""",
"""
<section class="detail" id="rateProperty">
<h3>rate</h3>
<div class="member-signature"><span class="modifiers">public final</span> <\
span class="return-type"><a href="C.DoubleProperty.html" title="class in pkg1">C\
.DoubleProperty</a></span> <span class="element-name">rateProperty</span></div>
<div class="block">Defines the direction/speed at which the <code>Timeline</code> is expected to
be played. This is the second line.</div>""",
"""
<section class="detail" id="setRate(double)">
<h3>setRate</h3>
<div class="member-signature"><span class="modifiers">public final</span> <\
span class="return-type">void</span> <span class="element-name">setRate</sp\
an><wbr><span class="parameters">(double value)</span></div>
<div class="block">Sets the value of the <code>rate</code> property.</div>
<dl class="notes">
<dt>Property description:</dt>
<dd>Defines the direction/speed at which the <code>Timeline</code> is expected to
be played. This is the second line.</dd>
<dt>Default value:</dt>
<dd>11</dd>
<dt>Parameters:</dt>
<dd><code>value</code> - the value for the <code>rate</code> property</dd>
<dt>Since:</dt>
<dd>JavaFX 8.0</dd>""",
"""
<section class="detail" id="getRate()">
<h3>getRate</h3>
<div class="member-signature"><span class="modifiers">public final</span> <\
span class="return-type">double</span> <span class="element-name">getRate</span>()<\
/div>
<div class="block">Gets the value of the <code>rate</code> property.</div>
<dl class="notes">
<dt>Property description:</dt>
<dd>Defines the direction/speed at which the <code>Timeline</code> is expected to
be played. This is the second line.</dd>
<dt>Default value:</dt>
<dd>11</dd>
<dt>Returns:</dt>
<dd>the value of the <code>rate</code> property</dd>
<dt>Since:</dt>
<dd>JavaFX 8.0</dd>""",
"""
<section class="property-summary" id="property-summary">
<h2>Property Summary</h2>
<div class="caption"><span>Properties</span></div>
<div class="summary-table three-column-summary">""",
"""
<div class="col-first even-row-color"><code>final <a href="C.BooleanProperty.html" title="class in pkg1">C.BooleanProperty</a></code></div>
""",
"""
<div class="col-first odd-row-color"><code>final <a href="C.DoubleProperty.html" title="class in pkg1">C.DoubleProperty</a></code></div>
""");
checkOutput("pkg1/C.html", false,
"A()",
"""
<h2>Property Summary</h2>
<div id="method-summary-table">
<div class="table-tabs" role="tablist" aria-orientation="horizontal">\
<button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-cont\
rols="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" o\
nclick="show('method-summary-table', 'method-summary-table', 3)" class="active-t\
able-tab">All Methods</button>\
<button id="method-summary-table-tab2" role="tab" aria-selected="false" aria-con\
trols="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)"\
onclick="show('method-summary-table', 'method-summary-table-tab2', 3)" class="t\
able-tab">Instance Methods</button>\
<button id="method-summary-table-tab4" role="tab" aria-selected="false" aria-con\
trols="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)"\
onclick="show('method-summary-table', 'method-summary-table-tab4', 3)" class="t\
able-tab">Concrete Methods</button>\
</div>""",
"""
<tr id="i0" class="even-row-color">
<td class="col-first"><code><a href="C.BooleanProperty.html" title="class in pkg1">C.BooleanProperty</a></code></td>
""",
"""
<tr id="i1" class="odd-row-color">
<td class="col-first"><code><a href="C.DoubleProperty.html" title="class in pkg1">C.DoubleProperty</a></code></td>
""");
checkOutput("index-all.html", true,
"""
<div class="block">Gets the value of the <code>paused</code> property.</div>""",
"""
<div class="block">Defines if paused.</div>""");
checkOutput("pkg1/D.html", true,
"""
<h3 id="properties-inherited-from-class-pkg1.C">Properties inherited from class&\
nbsp;pkg1.<a href="C.html" title="class in pkg1">C</a></h3>
<code><a href="C.html#pausedProperty">paused</a>, <a href="C.html#rateProperty">rate</a></code></div>""");
checkOutput("pkg1/D.html", false, "shouldNotAppear");
}
/*
* Test with -javafx option enabled, to ensure property getters and setters
* are treated correctly.
*/
@Test
public void test2() {
javadoc("-d", "out2a",
"-sourcepath", testSrc,
"-javafx",
"--disable-javafx-strict-checks",
"--no-platform-links",
"-Xdoclint:all,-missing",
"-package",
"pkg2");
checkExit(Exit.OK);
checkOutput("pkg2/Test.html", true,
"""
<section class="property-details" id="property-detail">
<h2>Property Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="betaProperty">
<h3>beta</h3>
<div class="member-signature"><span class="modifiers">public</span> <span c\
lass="return-type">java.lang.Object</span> <span class="element-name">betaProperty<\
/span></div>
<dl class="notes">
<dt>See Also:</dt>
<dd>
<ul class="tag-list">
<li><a href="#betaProperty()"><code>betaProperty()</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="gammaProperty">
<h3>gamma</h3>
<div class="member-signature"><span class="modifiers">public final</span> <\
span class="return-type">java.util.List<java.lang.String></span> <spa\
n class="element-name">gammaProperty</span></div>
<dl class="notes">
<dt>See Also:</dt>
<dd>
<ul class="tag-list">
<li><a href="#gammaProperty()"><code>gammaProperty()</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="deltaProperty">
<h3>delta</h3>
<div class="member-signature"><span class="modifiers">public final</span> <\
span class="return-type">java.util.List<java.util.Set<? super java.lang.Ob\
ject>></span> <span class="element-name">deltaProperty</span></div>
<dl class="notes">
<dt>See Also:</dt>
<dd>
<ul class="tag-list">
<li><a href="#deltaProperty()"><code>deltaProperty()</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
</ul>
</section>""",
"""
<section class="property-summary" id="property-summary">
<h2>Property Summary</h2>
<div class="caption"><span>Properties</span></div>
<div class="summary-table three-column-summary">""");
checkOutput("pkg2/Test.html", false,
"""
<h2>Property Summary</h2>
<div id="method-summary-table">
<div class="table-tabs" role="tablist" aria-orientation="horizontal">\
<button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-cont\
rols="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" o\
nclick="show('method-summary-table', 'method-summary-table', 3)" class="active-t\
able-tab">All Methods</button>\
<button id="method-summary-table-tab2" role="tab" aria-selected="false" aria-con\
trols="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)"\
onclick="show('method-summary-table', 'method-summary-table-tab2', 3)" class="t\
able-tab">Instance Methods</button>\
<button id="method-summary-table-tab4" role="tab" aria-selected="false" aria-con\
trols="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)"\
onclick="show('method-summary-table', 'method-summary-table-tab4', 3)" class="t\
able-tab">Concrete Methods</button>\
</div>""");
}
/*
* Test without -javafx option, to ensure property getters and setters
* are treated just like any other java method.
*/
@Test
public void test3() {
javadoc("-d", "out2b",
"-sourcepath", testSrc,
"--no-platform-links",
"-package",
"pkg2");
checkExit(Exit.OK);
checkOutput("pkg2/Test.html", false, "<h2>Property Summary</h2>");
checkOutput("pkg2/Test.html", true,
"""
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Method</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color method-summary-table method-summary-table-t\
ab2 method-summary-table-tab4"><code><T> java.lang.Object</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-\
tab2 method-summary-table-tab4"><code><a href="#alphaProperty(java.util.List)" c\
lass="member-name-link">alphaProperty</a><wbr>(java.util.List<T> foo)\
</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-ta\
b2 method-summary-table-tab4"> </div>
<div class="col-first odd-row-color method-summary-table method-summary-table-ta\
b2 method-summary-table-tab4"><code>java.lang.Object</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-t\
ab2 method-summary-table-tab4"><code><a href="#betaProperty()" class="member-nam\
e-link">betaProperty</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab\
2 method-summary-table-tab4"> </div>
<div class="col-first even-row-color method-summary-table method-summary-table-t\
ab2 method-summary-table-tab4"><code>final java.util.List<wbr><java.util.Set&\
lt;? super java.lang.Object>></code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-\
tab2 method-summary-table-tab4"><code><a href="#deltaProperty()" class="member-n\
ame-link">deltaProperty</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-ta\
b2 method-summary-table-tab4"> </div>
<div class="col-first odd-row-color method-summary-table method-summary-table-ta\
b2 method-summary-table-tab4"><code>final java.util.List<wbr><java.lang.Strin\
g></code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-t\
ab2 method-summary-table-tab4"><code><a href="#gammaProperty()" class="member-na\
me-link">gammaProperty</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab\
2 method-summary-table-tab4"> </div>"""
);
}
/*
* Force the doclet to emit a warning when processing a synthesized,
* DocComment, and ensure that the run succeeds, using the newer
* --javafx flag.
*/
@Test
public void test4() {
javadoc("-d", "out4",
"--javafx",
"--disable-javafx-strict-checks",
"-Xdoclint:none",
"-sourcepath", testSrc,
"-package",
"pkg4");
checkExit(Exit.OK);
// make sure the doclet indeed emits the warning
checkOutput(Output.OUT, true, "C.java:31: warning: invalid input: '<'");
}
/*
* Verify that no warnings are produced on methods that may have synthesized comments.
*/
@Test
public void test5() throws IOException {
Path src5 = Files.createDirectories(Path.of("src5").resolve("pkg"));
Files.writeString(src5.resolve("MyClass.java"),
"""
package pkg;
// The following import not required with --disable-javafx-strict-checks
// import javafx.beans.property.*;
/**
* This is my class.
*/
public class MyClass {
/**
* This is my property that enables something
*/
private BooleanProperty something = new SimpleBooleanProperty(false);
public final boolean isSomething() {
return something.get();
}
public final void setSomething(boolean val) {
something.set(val);
}
public final BooleanProperty somethingProperty() {
return something;
}
/** Dummy declaration. */
public class BooleanProperty { }
}
""");
javadoc("-d", "out5",
"--javafx",
"--disable-javafx-strict-checks",
"--no-platform-links",
"-Xdoclint:all,-missing",
"--source-path", "src5",
"pkg");
checkExit(Exit.OK);
checkOutput(Output.OUT, false,
": warning:",
"no comment");
}
}
|