Skip to content

Commit f347aec

Browse files
committed
renamed files to give them more unique filenames - add more to the comment at the beginning of the file
1 parent 0e5dcad commit f347aec

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

test/jdk/TEST.groups

+1-1
Original file line numberDiff line numberDiff line change
@@ -666,4 +666,4 @@ jdk_core_no_security = \
666666

667667
# Set of tests for `@since` checks in source code documentation
668668
jdk_since_check = \
669-
tools/sincechecker/testjavabase/SinceChecker.java
669+
tools/sincechecker/testjavabase/CheckSince_javaBase.java

test/jdk/tools/sincechecker/SinceValidator.java renamed to test/jdk/tools/sincechecker/SinceChecker.java

+16-5
Original file line numberDiff line numberDiff line change
@@ -49,24 +49,35 @@
4949
import java.util.stream.Collectors;
5050

5151
/*
52-
The `@since` checker verifies that for every API element, the real since value and the effective since value are the same, and reports an error if they are not.
52+
The `@since` checker works as a two-step process:
53+
- in the first step, we process JDKs 9-current, only classfiles, producing a map ``<unique-Element-ID``> => ``<version(s)-where-it-was-introduced>``.
54+
("version(s)", because there's versioning of Preview API, so there may be two versions (we use a class with two fields for preview and stable) - one when it was introduced as a preview, and one when it went out of preview. More on that below)
55+
For each Element, compute the unique ID, look into the map, and if there's nothing, record the current version as the originating version.
56+
57+
At the end of this step we have a map of the Real since values
5358
5459
Real since value of an API element is computed as the oldest release in which the given API element was introduced. That is:
5560
- for modules, classes and interfaces, the release in which the element with the given qualified name was introduced
5661
- for constructors, the release in which the constructor with the given VM descriptor was introduced
5762
- for methods and fields, the release in which the given method or field with the given VM descriptor became a member of its enclosing class or interface, whether direct or inherited
5863
64+
- in the second step, we would look at "effective" `@since` tags in the mainline sources, and the `@since` checker verifies that for every API element,
65+
the real since value and the effective since value are the same,and reports an error if they are not.
66+
5967
Effective since value of an API element is computed as follows:
6068
- if the given element has a `@since` tag in its javadoc, it is used
6169
- in all other cases, return the effective since value of the enclosing element
6270
6371
Special Handling for preview method:
6472
- When an element is still marked as preview, the `@since` should be the first JDK release where the element was added.
6573
- If the element is no longer marked as preview, the `@since` should be the first JDK release where it was no longer preview.
74+
75+
note: The `<unique-Element-ID>` for methods looks like `method: <return-descriptor> <binary-name-of-enclosing-class>.<method-name>(<ParameterDescriptor>)`.
76+
it is somewhat inspired from the VM Method Descriptors
6677
*/
6778

6879

69-
public class SinceValidator {
80+
public class SinceChecker {
7081
private final Map<String, Set<String>> LEGACY_PREVIEW_METHODS = new HashMap<>();
7182
private final Map<String, IntroducedIn> classDictionary = new HashMap<>();
7283
private final JavaCompiler tool;
@@ -76,11 +87,11 @@ public static void main(String[] args) throws Exception {
7687
if (args.length == 0) {
7788
throw new SkippedException("Test module not specified");
7889
}
79-
SinceValidator sinceCheckerTestHelper = new SinceValidator();
90+
SinceChecker sinceCheckerTestHelper = new SinceChecker();
8091
sinceCheckerTestHelper.testThisModule(args[0]);
8192
}
8293

83-
private SinceValidator() throws IOException {
94+
private SinceChecker() throws IOException {
8495
tool = ToolProvider.getSystemJavaCompiler();
8596
for (int i = 9; i <= Runtime.version().feature(); i++) {
8697
JavacTask ct = (JavacTask) tool.getTask(null, null, null,
@@ -531,7 +542,7 @@ private final class EffectiveSourceSinceHelper implements AutoCloseable {
531542
private final Set<String> seenLookupElements = new HashSet<>();
532543
private final Map<String, Version> signature2Source = new HashMap<>();
533544

534-
public static EffectiveSourceSinceHelper create(JavacTask mainTask, Collection<? extends Path> sourceLocations, SinceValidator validator) {
545+
public static EffectiveSourceSinceHelper create(JavacTask mainTask, Collection<? extends Path> sourceLocations, SinceChecker validator) {
535546
StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null);
536547
try {
537548
fm.setLocationFromPaths(StandardLocation.MODULE_SOURCE_PATH, sourceLocations);

test/jdk/tools/sincechecker/testjavabase/SinceChecker.java renamed to test/jdk/tools/sincechecker/testjavabase/CheckSince_javaBase.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
* @modules jdk.compiler/com.sun.tools.javac.api
3131
* jdk.compiler/com.sun.tools.javac.util
3232
* jdk.compiler/com.sun.tools.javac.code
33-
* @run main SinceValidator java.base
33+
* @run main SinceChecker java.base
3434
*/
3535

36-
public class SinceChecker {
36+
public class CheckSince_javaBase {
3737
}

0 commit comments

Comments
 (0)