aboutsummaryrefslogtreecommitdiff
path: root/tests/pos-java-interop
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2017-01-10 23:26:02 +0100
committerGuillaume Martres <smarter@ubuntu.com>2017-01-11 13:51:32 +0100
commit50268a1847d58deeb65c3a762e0b99b2d99ccb67 (patch)
tree9776ffa111ef1b98d138294e57cd313929a8c6ff /tests/pos-java-interop
parentbe6464366fdbccc12623970445d8d5e8deff3f3f (diff)
downloaddotty-50268a1847d58deeb65c3a762e0b99b2d99ccb67.tar.gz
dotty-50268a1847d58deeb65c3a762e0b99b2d99ccb67.tar.bz2
dotty-50268a1847d58deeb65c3a762e0b99b2d99ccb67.zip
Partially fix Java interop for emitted inner classes
The backend uses `rawname` to define the "inner name" of an InnerClass entry in a classfile, this should be the simple name of the class before any mangling takes place. Fixing this allows Java code to reference dotty inner classes, except if they're defined in objects which is still broken until https://github.com/DarkDimius/scala/pull/4 is merged and a new backend is published.
Diffstat (limited to 'tests/pos-java-interop')
-rw-r--r--tests/pos-java-interop/innerClass/Outer.scala8
-rw-r--r--tests/pos-java-interop/innerClass/Test.java9
2 files changed, 17 insertions, 0 deletions
diff --git a/tests/pos-java-interop/innerClass/Outer.scala b/tests/pos-java-interop/innerClass/Outer.scala
new file mode 100644
index 000000000..b47d91cc1
--- /dev/null
+++ b/tests/pos-java-interop/innerClass/Outer.scala
@@ -0,0 +1,8 @@
+class Outer {
+ class InnerInClass
+
+ def inner() = new InnerInClass
+}
+object Outer {
+ class InnerInObject
+}
diff --git a/tests/pos-java-interop/innerClass/Test.java b/tests/pos-java-interop/innerClass/Test.java
new file mode 100644
index 000000000..53bb826d7
--- /dev/null
+++ b/tests/pos-java-interop/innerClass/Test.java
@@ -0,0 +1,9 @@
+public class Test {
+ public static void test() {
+ Outer outer = new Outer();
+ Outer.InnerInClass innerInClass = outer.inner();
+
+ // Does not work yet, requires https://github.com/DarkDimius/scala/pull/4
+ // Outer.InnerInObject innerInObject = new Outer.InnerInObject();
+ }
+}