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

__WithField seems to have trouble if the value type is a generic type.

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: repo-valhalla
    • Fix Version/s: repo-valhalla
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      Reported by Remi in Valhalla-dev:

      The following program fails to compile:

      public final __ByValue class GenBug<E> {
        private final boolean value;
        
        private GenBug() {
          value = false;
          throw new AssertionError();
        }

        public static <E> GenBug<E> create() {
          GenBug<E> bug = __MakeDefault GenBug<E>();
          bug = __WithField(bug.value, true);
          return bug;
        }
      }

      X.java:11: error: incompatible types: GenBug<E#1> cannot be converted to GenBug<E#2>
          bug = __WithField(bug.value, true);
                ^
        where E#1,E#2 are type-variables:
          E#1 extends Object declared in class GenBug
          E#2 extends Object declared in method <E#2>create()

        Attachments

          Activity

            People

            • Assignee:
              sadayapalam Srikanth Adayapalam
              Reporter:
              sadayapalam Srikanth Adayapalam
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: