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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • repo-valhalla
    • repo-valhalla
    • tools
    • generic
    • generic

      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()

            sadayapalam Srikanth Adayapalam (Inactive)
            sadayapalam Srikanth Adayapalam (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: