RFR: JDK-8267936: PreserveAllAnnotations option isn't tested
David Holmes
david.holmes at oracle.com
Wed Jun 2 05:56:55 UTC 2021
On 2/06/2021 3:47 pm, Jaroslav Tulach wrote:
> On Tue, 1 Jun 2021 09:30:40 GMT, Jaroslav Tulach <github.com+26887752+JaroslavTulach at openjdk.org> wrote:
>
>> There doesn't seem to be much support for the complete changes in #4245. To get at least something useful from that endeavor I have extracted the test for existing behavior of `-XX:+PreserveAllAnnotations` and I am offering it in this pull request without any changes to the JVM behavior.
>
> Right Peter, the `AnnotationTypeChangedToRuntimeTest` mimics closely the use-case:
>
>> JVM as a late-binding runtime ... There are exceptions to the rule such
> as compile-time constants, ... and also annotation uses where the
> information from one source file (annotation retention) is baked into
> compilation artifacts of other source files (`RuntimeVisibleAnnotations`
> vs. `RuntimeInvisibleAnnotations`). `PreserveAllAnnotations` option helps to
> overcome the situation
>
> Great formulation of the problem. The late binding allows people to ignore time of compilation when thinking about the running system. Ignoring time makes the mental model of the overall system easier. But when certain information is _baked_ elsewhere, ignoring time is may no longer be possible as the sequence of actions becomes important - an up to date system may see relics of the past (old values of compile-time constants and annotation not being visible even their most recent retention is `RUNTIME`).
>
> This PR isn't going to modify behavior of the `-XX:+PreserveAllAnnotations` option in any way. It only provides a test. Having a test is better than having none. Can we consider this PR reviewed? Can somebody with enough merit mark this _change as properly reviewed_? Can somebody restart the _Windows aarch64 - Build_ - the error seems unrelated?
Sorry Jaroslav but I don't really see this test as a basic functional
test of the PreserveAllAnnotations flag. There is no need for any
dynamic retention mode switch. All you need as I've said previously is a
class with all the CLASS retention annotations of interest (8 IIRC)
applied and a programs that reads them, and either expects to find them
or not, based on the PreserveAllAnnotations flag. I get that you are
just trying to not waste a test you already developed.
The Windows build issue seems to be a software configuration issue on
the Github machines and is outside of our control. I've no idea how to
report issues to the Github folk.
David
> -------------
>
> PR: https://git.openjdk.java.net/jdk/pull/4280
>
More information about the core-libs-dev
mailing list