[jdk11u-dev] RFR: 8236210: javac generates wrong annotation for fields generated from record components

Goetz Lindenmaier goetz at openjdk.java.net
Thu Jan 20 21:50:50 UTC 2022


On Mon, 17 Jan 2022 22:26:33 GMT, Liam Miller-Cushon <cushon at openjdk.org> wrote:

> This is a backport of [JDK-8236210: javac generates wrong annotation for fields generated from record components](https://bugs.openjdk.java.net/browse/JDK-8236210)
> 
> This is a partial backport.
> 
> * The focus of JDK-8236210 was a bug with records and most of the diff was to logic that was added to deal with records. However the patch also included a fix to the logic for checking annotation applicability in `Check.annotationApplicable` that fixes a bug with annotations on `var`, so I backported the part that is relevant to Java 11.
> * I added a test for the issue specific to `var`, since the original test is for records and cannot be backported.
> 
> Testing: x86 build, affected tests, tier1

Hi Liam,
your change does not build with Java 10:
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java:3092: error: cannot find symbol
        return targets.isEmpty() || targets.isPresent() && !targets.get().isEmpty();
                      ^
  symbol:   method isEmpty()
  location: variable targets of type Optional<Set<Name>>

See also DEFAULT_ACCEPTABLE_BOOT_VERSIONS in make/autoconf/version-numbers

-------------

PR: https://git.openjdk.java.net/jdk11u-dev/pull/771


More information about the jdk-updates-dev mailing list