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
Copy file name to clipboardExpand all lines: test/jdk/tools/sincechecker/SinceChecker.java
+16-5
Original file line number
Diff line number
Diff line change
@@ -49,24 +49,35 @@
49
49
importjava.util.stream.Collectors;
50
50
51
51
/*
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
53
58
54
59
Real since value of an API element is computed as the oldest release in which the given API element was introduced. That is:
55
60
- for modules, classes and interfaces, the release in which the element with the given qualified name was introduced
56
61
- for constructors, the release in which the constructor with the given VM descriptor was introduced
57
62
- 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
58
63
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
+
59
67
Effective since value of an API element is computed as follows:
60
68
- if the given element has a `@since` tag in its javadoc, it is used
61
69
- in all other cases, return the effective since value of the enclosing element
62
70
63
71
Special Handling for preview method:
64
72
- When an element is still marked as preview, the `@since` should be the first JDK release where the element was added.
65
73
- 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
0 commit comments