From e3107465c3e8ac80d1cc6a759e2f3298c2531424 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Tue, 1 Jul 2014 16:28:24 +0200 Subject: Fix InnerClass / EnclosingMethod attributes This commit seems bigger than it is. Most of it is tests, and moving some code around. The actual changes are small, but a bit subtle. The InnerClass and EnclosingMethod attributes should now be close to the JVM spec (which is summarized in BTypes.scala). New tests make sure that changes to these attributes, and changes to the way Java reflection sees Scala classfiles, don't go unnoticed. A new file, BCodeAsmCommon, holds code that's shared between the two backend (it could hold more, future work). In general, the difficulty with emitting InnerClass / EnclosingMethod is that we need to find out source-level properties. We need to make sure to do enough phase-travelling, and work around destructive changes to the ownerchain in lambdalift (we use originalOwner a lot). The change to JavaMirrors is prompted by the change to the EnclosingMethod attribute, which changes Java reflection's answer to getEnclosingMethod and getEnclosingConstructor. Classes defined in field initializers no longer have an enclosing method, just an enclosing class, which broke an assumption in JavaMirrors. There's one change in erasure. Before this change, when an object declaration implements / overrides a method, and a bridge is required, then the bridge method was actually a ModuleSymbol (it would get the lateMETHOD flag and be emitted as a method anyway). This is confusing, when iterating through the members of a class, you can find two modules with the same name, and one of them doesn't have a module class. Now, such bridge methods will be MethodSymbols. Removed Symbol.originalEnclosingMethod, that is a backend thing and doesn't need to live in the symbol API. --- test/files/run/t5256c.check | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/files/run/t5256c.check') diff --git a/test/files/run/t5256c.check b/test/files/run/t5256c.check index 7fcd0eb722..3eb7b13a97 100644 --- a/test/files/run/t5256c.check +++ b/test/files/run/t5256c.check @@ -2,5 +2,5 @@ class A$1 Test.A$1 java.lang.Object { def foo(): Nothing - def (): A$1 + def (): Test.A$1 } -- cgit v1.2.3