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

javac shouldn't allow type variable references from local static declarations

    Details

    • Subcomponent:
    • Resolved In Build:
      b07

      Description

      test cases:

      class Box<T> {
          static <U> Box<U> make(U val) {
              interface Checker {
                  void check(U val); // compile-time error
              }
              return null;
          }
      }

      class LocalEnum {
        static <U> U getAndSet(U u) {
          enum X {
            A;
            U u;
          }
          U old = X.A.u;
          X.A.u = u;
          return old;
        }
      }

      class LocalRecord {
        static <U> void test() {
          record R() {
            U get() {return null;}
          }
        }
      }

      reported in amber-dev by Tagir: https://mail.openjdk.java.net/pipermail/amber-dev/2020-June/006235.html

        Attachments

          Activity

            People

            • Assignee:
              vromero Vicente Arturo Romero Zaldivar
              Reporter:
              vromero Vicente Arturo Romero Zaldivar
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: