diff options
author | Paul Phillips <paulp@improving.org> | 2012-03-03 19:18:11 -0800 |
---|---|---|
committer | Hubert Plociniczak <hubert.plociniczak@gmail.com> | 2012-06-01 17:24:48 +0200 |
commit | de82f9a04a69a68118c513bda2bee9cd03560db0 (patch) | |
tree | 06708b79fee43b471e697e3a76157d90a2979c86 /test | |
parent | dcf69769c11d3e62e41cf64e5dbe3c6b56beb77a (diff) | |
download | scala-de82f9a04a69a68118c513bda2bee9cd03560db0.tar.gz scala-de82f9a04a69a68118c513bda2bee9cd03560db0.tar.bz2 scala-de82f9a04a69a68118c513bda2bee9cd03560db0.zip |
Overcame trait/protected/java limitation.
I think this fixes SI-2296, the inability to access java protected
members from a trait which extends a java class. Counterexamples
appreciated. Closes SI-2296. Review by @dragos.
cherry-picked and adapted from f708b87e55.
Diffstat (limited to 'test')
-rw-r--r-- | test/files/run/t2296a.check | 2 | ||||
-rw-r--r-- | test/files/run/t2296a/J.java | 7 | ||||
-rw-r--r-- | test/files/run/t2296a/S.scala | 18 | ||||
-rw-r--r-- | test/files/run/t2296b.check | 2 | ||||
-rw-r--r-- | test/files/run/t2296b/J_1.java | 7 | ||||
-rw-r--r-- | test/files/run/t2296b/S_2.scala | 18 |
6 files changed, 54 insertions, 0 deletions
diff --git a/test/files/run/t2296a.check b/test/files/run/t2296a.check new file mode 100644 index 0000000000..f75aec9d81 --- /dev/null +++ b/test/files/run/t2296a.check @@ -0,0 +1,2 @@ +J.foo() +J.foo() diff --git a/test/files/run/t2296a/J.java b/test/files/run/t2296a/J.java new file mode 100644 index 0000000000..78ff3e9804 --- /dev/null +++ b/test/files/run/t2296a/J.java @@ -0,0 +1,7 @@ +package j; + +public class J { + protected void foo() { + System.out.println("J.foo()"); + } +}
\ No newline at end of file diff --git a/test/files/run/t2296a/S.scala b/test/files/run/t2296a/S.scala new file mode 100644 index 0000000000..532d038a42 --- /dev/null +++ b/test/files/run/t2296a/S.scala @@ -0,0 +1,18 @@ +package s { + import j.J + + trait S extends J { + def bar() { + foo() + } + } + + class SC extends J with S +} + +object Test { + def main(args : Array[String]) { + (new s.SC).bar() + (new s.S { }).bar() + } +}
\ No newline at end of file diff --git a/test/files/run/t2296b.check b/test/files/run/t2296b.check new file mode 100644 index 0000000000..f75aec9d81 --- /dev/null +++ b/test/files/run/t2296b.check @@ -0,0 +1,2 @@ +J.foo() +J.foo() diff --git a/test/files/run/t2296b/J_1.java b/test/files/run/t2296b/J_1.java new file mode 100644 index 0000000000..4c91d47073 --- /dev/null +++ b/test/files/run/t2296b/J_1.java @@ -0,0 +1,7 @@ +package j; + +public class J_1 { + protected void foo() { + System.out.println("J.foo()"); + } +}
\ No newline at end of file diff --git a/test/files/run/t2296b/S_2.scala b/test/files/run/t2296b/S_2.scala new file mode 100644 index 0000000000..6cdb0cfaba --- /dev/null +++ b/test/files/run/t2296b/S_2.scala @@ -0,0 +1,18 @@ +package s { + import j.J_1 + + trait S extends J_1 { + def bar() { + foo() + } + } + + class SC extends J_1 with S +} + +object Test { + def main(args : Array[String]) { + (new s.SC).bar() + (new s.S { }).bar() + } +} |