You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| `module` | Report on the modules being compared |
306
+
| `package` | Report on the modules and packages being compared |
307
+
| `type` | Report on the modules, packages, and classes and interfaces being compared |
308
+
| `time` | Report the time taken to perform the comparison and generate the reports |
309
+
| `options` | Report how the command-line options are processed |
310
+
238
311
<aid="option-at">`@`*filename*</a>
239
312
: Reads options from a file. To shorten or simplify the `apidiff` command, you can specify
240
313
one or more files that contain arguments for the `apidiff` command. This lets you create
241
-
`apidiff` commands of any length on any operating system.
314
+
`apidiff` commands of any length on any operating system. The syntax for the contents
315
+
of the file is similar to that for other JDK commands, like `javac` and `javadoc`.
242
316
243
317
## Exit Status
244
318
@@ -256,7 +330,7 @@ The `--help` and `--version` options exit with a status of 0.
256
330
## The Current API
257
331
258
332
The current API is the API specified by the most recent `--api` option on the command line,
259
-
and is the API for which any API-specific options will apply.
333
+
and is the API for which any subsequent API-specific options will apply.
260
334
261
335
The "current API" is cancelled when any option is given that is not specific to
262
336
any one API. Additional options for an API can be given by repeating the `--api`
@@ -299,6 +373,16 @@ module part.
299
373
in the unnamed module, and so either all patterns must include a module part,
300
374
or none must.
301
375
376
+
For example,
377
+
378
+
*`java.base/java.nio.**` matches all types in the `java.nio` packages
379
+
and corresponding subpackages, in the `java.base` module
380
+
*`java.compiler/**` matches all packages and types in the `java.compiler`
381
+
module
382
+
383
+
Depending on how you invoke `apidiff`, you may need to quote the pattern
384
+
to prevent the `*` characters being interpreted by a command shell.
385
+
302
386
## Notes
303
387
304
388
A "notes" file is used to specify links to be injected into the generated report
@@ -395,11 +479,15 @@ as generated by the standard JDK makefiles.
395
479
396
480
In conjunction with this option, use the `jdk-docs` option to specify the name
397
481
of the docs bundle to be compared, when there is more than one. Note this option
398
-
applies to all instances to be compared, and is not specific to the
399
-
[current API](#the-current-api). Use the `--compare-doc-comments` and
400
-
`--compare-api-descriptions` as needed to indicate the comparisons to be included
401
-
in the report. If neither are specified, `--compare-api-descriptions` is
402
-
the default.
482
+
applies to all instances to be compared, and need only be given once;
483
+
it is not specific to the [current API](#the-current-api).
484
+
Use the `--compare-doc-comments` and `--compare-api-descriptions` as needed
485
+
to indicate the comparisons to be included in the report.
486
+
If neither are specified, `--compare-api-descriptions` is the default.
487
+
488
+
While the `--jdk-build` option provides a convenient way to have the tool
489
+
automatically generate the equivalent underlying options, you can instead
490
+
specify those options directly.
403
491
404
492
* If you just want to compare some or all of the declarations in different
405
493
instances of JDK, without comparing the documentation comments or API documentation,
@@ -456,7 +544,7 @@ can use `--verbose options`, possibly implicitly as part of `--verbose all`.
456
544
When comparing any generated API documentation, the comparison is sensitive to any
457
545
variations caused by the version of `javadoc` used to generate the documentation.
458
546
Therefore, it is highly recommended to use the same version of `javadoc` to generate
459
-
all the versions of the documentation to be compared. When building JDK, although
547
+
the documentation for all the versions to be compared. When building JDK, although
460
548
the standard `docs` and `docs-jdk` targets will use the version of `javadoc` in the
461
549
same repository, you can specify the version of JDK to be used for targets like
462
550
`docs-reference-api` with the `--with-docs-reference-jdk` option to `configure`,
@@ -470,6 +558,46 @@ CSR request, when there is no change in `javadoc` in the versions being compared
470
558
it is reasonable to use the standard `docs` or `docs-jdk` targets to generate the API
471
559
documentation to be compared.
472
560
561
+
### Comparing non-JDK APIs
562
+
563
+
If the API does not define any modules, use an appropriate combination of the
564
+
`--source-path`, `--class-path`, and `--api-directory` options.
565
+
You can put either the compiled classes or a JAR file on the class path.
566
+
If you want to compare documentation comments, put the source files on the
567
+
source path. If you want to compare the API documentation, use the
568
+
`--api-directory` to specify the root directory of the documentation.
569
+
570
+
For example, to set up an API to be able to compare the API documentation
571
+
associated with a JAR file:
572
+
573
+
--api before --class-path build/example.jar --api-directory build/docs/api
574
+
575
+
To set up an API to be able to compare the documentation comments for a project:
576
+
577
+
--api before --source-path src/main/java
578
+
579
+
In both cases, you can specify any additional dependencies on the class path.
580
+
581
+
If the API defines one or more modules, use an appropriate combination of the
582
+
`--module-source-path`, `--module-path`, and `--api-directory` options.
583
+
You can put either the module or a directory of modules on the module path,
584
+
where a module is anything that can be recognized as such by `javac`.
585
+
If you want to compare documentation comments, put the source files on the
586
+
module source path. If you want to compare the API documentation, use the
587
+
`--api-directory` to specify the root directory of the documentation.
588
+
589
+
For example, to set up an API to be able to compare the API documentation
590
+
associated with the modules for a project:
591
+
592
+
--api before --module-path build/modules --api-directory build/docs/api
593
+
594
+
To set up an API to be able to compare the documentation comments for a
595
+
project that defines a module called `com.example`:
596
+
597
+
--api before --module-source-path com.example=src/main/java
598
+
599
+
In both cases, you can specify any additional dependencies on the module path.
600
+
473
601
### Comparing documentation comments or API descriptions
474
602
475
603
As well as comparing the declarations found in source files or compiled class files,
@@ -510,9 +638,11 @@ The tool does _not_ attempt to run `javadoc` locally to generate the page on the
510
638
[Java Language Model API]: https://docs.oracle.com/en/java/javase/17/docs/api/java.compiler/javax/lang/model/package-summary.html
511
639
[Compiler Tree API]: https://docs.oracle.com/en/java/javase/17/docs/api/jdk.compiler/com/sun/source/doctree/package-summary.html
512
640
513
-
## Example
641
+
## Examples
514
642
515
-
To compare APIs in the `java.base` module in JDK builds `/local/baseline-jdk` and `/local/updated-jdk`, and place the result in the directory `out`, run the following command:
643
+
To compare APIs in the `java.base` module in JDK builds `/local/baseline-jdk`
644
+
and `/local/updated-jdk`, and place the result in the directory `out`,
645
+
run the following command:
516
646
517
647
```
518
648
bin/apidiff \
@@ -526,3 +656,30 @@ bin/apidiff \
526
656
--include 'java.base/**'
527
657
```
528
658
659
+
To compare the changes for the fix for an issue such as JDK-8330183,
660
+
using two separate configurations in the same repo, use a command like this:
0 commit comments