test/langtools/tools/javac/generics/inference/CaptureUpperBoundDeref.java
author phh
Sat, 30 Nov 2019 14:33:05 -0800
changeset 59330 5b96c12f909d
parent 47216 71c04702a3d5
permissions -rw-r--r--
8234541: C1 emits an empty message when it inlines successfully Summary: Use "inline" as the message when successfull Reviewed-by: thartmann, mdoerr Contributed-by: navy.xliu@gmail.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42819
4ce83e629dc1 8075793: Source incompatibility for inference using -source 7
dlsmith
parents:
diff changeset
     1
/*
4ce83e629dc1 8075793: Source incompatibility for inference using -source 7
dlsmith
parents:
diff changeset
     2
 * @test /nodynamiccopyright/
4ce83e629dc1 8075793: Source incompatibility for inference using -source 7
dlsmith
parents:
diff changeset
     3
 * @bug 8075793
4ce83e629dc1 8075793: Source incompatibility for inference using -source 7
dlsmith
parents:
diff changeset
     4
 * @summary Capture variable as an inference upper bound followed by a member reference
4ce83e629dc1 8075793: Source incompatibility for inference using -source 7
dlsmith
parents:
diff changeset
     5
 * @compile/fail/ref=CaptureUpperBoundDeref.out -XDrawDiagnostics CaptureUpperBoundDeref.java
4ce83e629dc1 8075793: Source incompatibility for inference using -source 7
dlsmith
parents:
diff changeset
     6
 * @compile -Xlint:-options -source 7 CaptureUpperBoundDeref.java
4ce83e629dc1 8075793: Source incompatibility for inference using -source 7
dlsmith
parents:
diff changeset
     7
 */
4ce83e629dc1 8075793: Source incompatibility for inference using -source 7
dlsmith
parents:
diff changeset
     8
4ce83e629dc1 8075793: Source incompatibility for inference using -source 7
dlsmith
parents:
diff changeset
     9
class CaptureUpperBoundDeref {
4ce83e629dc1 8075793: Source incompatibility for inference using -source 7
dlsmith
parents:
diff changeset
    10
4ce83e629dc1 8075793: Source incompatibility for inference using -source 7
dlsmith
parents:
diff changeset
    11
    interface Wrapper<T> {
4ce83e629dc1 8075793: Source incompatibility for inference using -source 7
dlsmith
parents:
diff changeset
    12
        I<T> get();
4ce83e629dc1 8075793: Source incompatibility for inference using -source 7
dlsmith
parents:
diff changeset
    13
    }
4ce83e629dc1 8075793: Source incompatibility for inference using -source 7
dlsmith
parents:
diff changeset
    14
4ce83e629dc1 8075793: Source incompatibility for inference using -source 7
dlsmith
parents:
diff changeset
    15
    interface I<T> {}
4ce83e629dc1 8075793: Source incompatibility for inference using -source 7
dlsmith
parents:
diff changeset
    16
4ce83e629dc1 8075793: Source incompatibility for inference using -source 7
dlsmith
parents:
diff changeset
    17
    <T> T m(I<? super T> arg) { return null; }
4ce83e629dc1 8075793: Source incompatibility for inference using -source 7
dlsmith
parents:
diff changeset
    18
4ce83e629dc1 8075793: Source incompatibility for inference using -source 7
dlsmith
parents:
diff changeset
    19
    void test(Wrapper<? super String> w) {
4ce83e629dc1 8075793: Source incompatibility for inference using -source 7
dlsmith
parents:
diff changeset
    20
        m(w.get()).substring(0);
4ce83e629dc1 8075793: Source incompatibility for inference using -source 7
dlsmith
parents:
diff changeset
    21
    }
4ce83e629dc1 8075793: Source incompatibility for inference using -source 7
dlsmith
parents:
diff changeset
    22
}