|
50 | 50 |
|
51 | 51 | /*
|
52 | 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. |
| 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 we handle versioning of Preview API, so there may be two versions (we use a class with two fields for preview and stable) - |
| 55 | + one when it was introduced as a preview, and one when it went out of preview. More on that below) |
56 | 56 |
|
57 |
| -At the end of this step we have a map of the Real since values |
| 57 | + -- For each Element, we compute the unique ID, look into the map, and if there's nothing, record the current version as the originating version. |
| 58 | + -- At the end of this step we have a map of the Real since values |
58 | 59 |
|
59 |
| - Real since value of an API element is computed as the oldest release in which the given API element was introduced. That is: |
| 60 | +- In the second step, we would look at "effective" `@since` tags in the mainline sources, which we get from the `src.zip` file (if the test run doesn't have it, we throw a `jtreg.SkippedException`) |
| 61 | + and 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. |
| 62 | +
|
| 63 | + --In this step we limit the tool to only check the specific MODULE whose name was passed as an argument in the test. In that module, we look for unqualified exports and test those packages. |
| 64 | +
|
| 65 | +note on real vs effective `@since`: |
| 66 | +
|
| 67 | +Real since value of an API element is computed as the oldest release in which the given API element was introduced. That is: |
60 | 68 | - for modules, classes and interfaces, the release in which the element with the given qualified name was introduced
|
61 | 69 | - for constructors, the release in which the constructor with the given VM descriptor was introduced
|
62 | 70 | - 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
|
63 | 71 |
|
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 |
| -
|
67 | 72 | Effective since value of an API element is computed as follows:
|
68 | 73 | - if the given element has a `@since` tag in its javadoc, it is used
|
69 | 74 | - in all other cases, return the effective since value of the enclosing element
|
|
72 | 77 | - When an element is still marked as preview, the `@since` should be the first JDK release where the element was added.
|
73 | 78 | - If the element is no longer marked as preview, the `@since` should be the first JDK release where it was no longer preview.
|
74 | 79 |
|
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 |
| 80 | +note: The `<unique-Element-ID>` for methods looks like `method: <erased-return-descriptor> <binary-name-of-enclosing-class>.<method-name>(<ParameterDescriptor>)`. |
| 81 | +it is somewhat inspired from the VM Method Descriptors. But we use the erased return so that methods that were later generified remain the same. |
77 | 82 | */
|
78 | 83 |
|
79 | 84 |
|
|
0 commit comments