summaryrefslogtreecommitdiff
path: root/test/files/run/t1459generic
diff options
context:
space:
mode:
authorSeth Tisue <seth@tisue.net>2017-02-16 14:14:39 -0800
committerSeth Tisue <seth@tisue.net>2017-02-16 14:34:18 -0800
commit04c45e15f198c3e33b0e6709fb8ca5267f129fac (patch)
tree215307f083dba29d2c53c83ca3702c8d4a34d27f /test/files/run/t1459generic
parent6be69d6d5e710e2022772a326a48baf093a70508 (diff)
parent096502880900d8daa75d813c63ac88aa50c25ef0 (diff)
downloadscala-04c45e15f198c3e33b0e6709fb8ca5267f129fac.tar.gz
scala-04c45e15f198c3e33b0e6709fb8ca5267f129fac.tar.bz2
scala-04c45e15f198c3e33b0e6709fb8ca5267f129fac.zip
Merge commit '0965028809' into merge-2.11.x-to-2.12.x-20170214
Diffstat (limited to 'test/files/run/t1459generic')
-rw-r--r--test/files/run/t1459generic/Impl.scala4
-rw-r--r--test/files/run/t1459generic/Test.java10
-rw-r--r--test/files/run/t1459generic/VarargGeneric.java7
3 files changed, 21 insertions, 0 deletions
diff --git a/test/files/run/t1459generic/Impl.scala b/test/files/run/t1459generic/Impl.scala
new file mode 100644
index 0000000000..9234e70456
--- /dev/null
+++ b/test/files/run/t1459generic/Impl.scala
@@ -0,0 +1,4 @@
+class Impl extends VarargGeneric[String] {
+ def genericOne(x: String, arg: String): String = x + arg
+ def genericVar(x: String, args: String*): String = x + args.head
+}
diff --git a/test/files/run/t1459generic/Test.java b/test/files/run/t1459generic/Test.java
new file mode 100644
index 0000000000..a97158796b
--- /dev/null
+++ b/test/files/run/t1459generic/Test.java
@@ -0,0 +1,10 @@
+public class Test {
+ public static void main(String[] args) throws Exception {
+ VarargGeneric vg = new Impl();
+ System.out.println(vg.genericOne("a", "b"));
+ System.out.println(vg.genericVar("a", "b"));
+ // should not result in java.lang.AbstractMethodError: Impl.genericVar(Ljava/lang/Object;[Ljava/lang/String;)Ljava/lang/String;
+ // --> genericVar needs a varargs bridge (scala -> java varargs) and a standard generics bridge
+ // (for comparison, including genericOne, which needs only a generics bridge)
+ }
+}
diff --git a/test/files/run/t1459generic/VarargGeneric.java b/test/files/run/t1459generic/VarargGeneric.java
new file mode 100644
index 0000000000..9b37a0fe3f
--- /dev/null
+++ b/test/files/run/t1459generic/VarargGeneric.java
@@ -0,0 +1,7 @@
+public interface VarargGeneric<T> {
+ String genericOne(T x, String args);
+ // we cannot annotate this with @SafeVarargs, because
+ // it's in an interface. so that's why a warning from
+ // javac appears in the checkfile.
+ String genericVar(T x, String... args);
+}