diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala | 6 | ||||
-rw-r--r-- | test/files/jvm/lib/nest.jar.desired.sha1 | 1 | ||||
-rw-r--r-- | test/files/jvm/nest.check | 3 | ||||
-rw-r--r-- | test/files/jvm/nest.java | 17 | ||||
-rw-r--r-- | test/files/jvm/nest.scala | 17 |
5 files changed, 44 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala index 8aebde24c2..822c1fa35c 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala @@ -698,6 +698,12 @@ abstract class ClassfileParser { .newAliasType(NoPos, pool.getName(nameIndex).toTypeName) .setInfo(pool.getClassSymbol(innerIndex).tpe) getScope(jflags).enter(innerAlias) + + if ((jflags & JAVA_ACC_STATIC) != 0) { + val innerVal = staticModule.newValue(NoPos, pool.getName(nameIndex).toTermName) + .setInfo(pool.getClassSymbol(innerIndex).linkedModuleOfClass.moduleClass.thisType) + staticDefs.enter(innerVal) + } } } } diff --git a/test/files/jvm/lib/nest.jar.desired.sha1 b/test/files/jvm/lib/nest.jar.desired.sha1 new file mode 100644 index 0000000000..b9b4065db6 --- /dev/null +++ b/test/files/jvm/lib/nest.jar.desired.sha1 @@ -0,0 +1 @@ +4141e6f277e97f81079f81910a7b2b4d6c0127b7 ?nest.jar diff --git a/test/files/jvm/nest.check b/test/files/jvm/nest.check new file mode 100644 index 0000000000..445369969e --- /dev/null +++ b/test/files/jvm/nest.check @@ -0,0 +1,3 @@ +2 +3 +10 diff --git a/test/files/jvm/nest.java b/test/files/jvm/nest.java new file mode 100644 index 0000000000..dfb011732c --- /dev/null +++ b/test/files/jvm/nest.java @@ -0,0 +1,17 @@ +package a; + + +/** This file is needed for test 'nest.scala'. It should + * be compiled with javac and packaged into lib/nest.jar + */ +public class nest { + public static class best { + public static class rest { + public static rest test = new rest(); + public static int x = 10; + public int inc(int i) { + return i + 1; + } + } + } +} diff --git a/test/files/jvm/nest.scala b/test/files/jvm/nest.scala new file mode 100644 index 0000000000..ebd3ee490a --- /dev/null +++ b/test/files/jvm/nest.scala @@ -0,0 +1,17 @@ +//############################################################################ +// Test Scala interaction with Java nested classes and static members. +//############################################################################ +// $Id: inner.scala 8902 2006-10-10 10:58:10 +0200 (Tue, 10 Oct 2006) mihaylov $ + +/** found in nest.jar, compiled from nest.java */ +import a._; + +object Test extends Application { + val x = nest.best.rest.test + Console.println(x.inc(1)) + + val o = new nest.best; + val r = new nest.best.rest; + Console.println(nest.best.rest.test.inc(2)) + Console.println(nest.best.rest.x) +} |