Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8258535

jvm.ClassReader should set the accessor to the corresponding record component

XMLWordPrintable

    • b24
    • generic
    • generic
    • Verified

      A DESCRIPTION OF THE PROBLEM :
      During annotation processing TypeElement#getRecordComponents returns empty list for Records which are located in another jar.

      In Java 16.ea.28 TypeElement#getRecordComponents works correctly. However, the returned RecordComponentModel returns null for RecordComponentElement#getAccessor

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      To reproduce on Java 15:

      1. git clone https://github.com/filiphr/mapstruct-2294.git
      2. Make sure that you have setup Java 15
      3. Run: export MAVEN_OPTS="--enable-preview" && ./mvnw clean verify

      To reproduce on Java 16.ea.28:

      1. git clone https://github.com/filiphr/mapstruct-2294.git
      2. Make sure that you have setup Java 15
      3. Run: export MAVEN_OPTS="--enable-preview" && ./mvnw clean verify -Djava.version=16

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Expected a successful compilation
      ACTUAL -
      On Java 15 the result will be a compilation error coming from the TestProcessor (part of the project)
      because TypeElement#getRecordComponents does not return any record components for records coming from another jar (not in the compilation round).

      The error message will be: "Record element source.SourceInAnotherPackage has no record components"

      On Java 16 the result will be a compilation error coming from the TestProcessor (part of the project)
      because `RecordComponentElement#getAccessor` returns `null` for records coming from another jar (not in the compilation round).

      The error message will be: "Record component data from record element source.SourceInAnotherPackage has no accessor"


      ---------- BEGIN SOURCE ----------
      https://github.com/filiphr/mapstruct-2294
      ---------- END SOURCE ----------

      FREQUENCY : always


            vromero Vicente Arturo Romero Zaldivar
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: