diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2014-07-01 16:28:24 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@gmail.com> | 2014-09-01 14:29:17 +0200 |
commit | e3107465c3e8ac80d1cc6a759e2f3298c2531424 (patch) | |
tree | 5aacf420f8845cabed5088b2209ed1e5a9b74c51 /test/files/jvm/javaReflection.check | |
parent | 2606bd921e434a6d8edb21f7f04dbfb10045026e (diff) | |
download | scala-e3107465c3e8ac80d1cc6a759e2f3298c2531424.tar.gz scala-e3107465c3e8ac80d1cc6a759e2f3298c2531424.tar.bz2 scala-e3107465c3e8ac80d1cc6a759e2f3298c2531424.zip |
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.
Diffstat (limited to 'test/files/jvm/javaReflection.check')
-rw-r--r-- | test/files/jvm/javaReflection.check | 259 |
1 files changed, 259 insertions, 0 deletions
diff --git a/test/files/jvm/javaReflection.check b/test/files/jvm/javaReflection.check new file mode 100644 index 0000000000..aeb894f741 --- /dev/null +++ b/test/files/jvm/javaReflection.check @@ -0,0 +1,259 @@ +#partest !-Ydelambdafy:method +A$$anonfun$$lessinit$greater$1 / null (canon) / $anonfun$$lessinit$greater$1 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / class A (cls) / public A(int) (constr) / null (meth) +- properties : true (local) / false (member) +A$$anonfun$$lessinit$greater$1$$anonfun$apply$1 / null (canon) / $anonfun$apply$1 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / class A$$anonfun$$lessinit$greater$1 (cls) / null (constr) / public final scala.Function0 A$$anonfun$$lessinit$greater$1.apply() (meth) +- properties : true (local) / false (member) +A$$anonfun$2 / null (canon) / $anonfun$2 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / class A (cls) / null (constr) / null (meth) +- properties : true (local) / false (member) +A$$anonfun$3 / null (canon) / $anonfun$3 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / class A (cls) / null (constr) / null (meth) +- properties : true (local) / false (member) +A$$anonfun$4 / null (canon) / $anonfun$4 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / class A (cls) / null (constr) / null (meth) +- properties : true (local) / false (member) +A$$anonfun$f$1 / null (canon) / $anonfun$f$1 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / class A (cls) / null (constr) / public java.lang.Object A.f() (meth) +- properties : true (local) / false (member) +A$$anonfun$f$2 / null (canon) / $anonfun$f$2 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / class A (cls) / null (constr) / public java.lang.Object A.f() (meth) +- properties : true (local) / false (member) +A$D$$anonfun$1 / null (canon) / anonfun$1 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / class A$D$ (cls) / null (constr) / null (meth) +- properties : true (local) / false (member) +AO$$anonfun$5 / null (canon) / anonfun$5 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / class AO$ (cls) / null (constr) / null (meth) +- properties : true (local) / false (member) +AT$$anonfun$6 / null (canon) / $anonfun$6 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / interface AT (cls) / null (constr) / null (meth) +- properties : true (local) / false (member) +#partest -Ydelambdafy:method +A$D$lambda$1 / A$D$lambda$1 (canon) / A$D$lambda$1 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth) +- properties : false (local) / false (member) +A$lambda$$$anonfun$7$1 / A$lambda$$$anonfun$7$1 (canon) / A$lambda$$$anonfun$7$1 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth) +- properties : false (local) / false (member) +A$lambda$$$lessinit$greater$1 / A$lambda$$$lessinit$greater$1 (canon) / A$lambda$$$lessinit$greater$1 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth) +- properties : false (local) / false (member) +A$lambda$$f$1 / A$lambda$$f$1 (canon) / A$lambda$$f$1 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth) +- properties : false (local) / false (member) +A$lambda$$f$2 / A$lambda$$f$2 (canon) / A$lambda$$f$2 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth) +- properties : false (local) / false (member) +A$lambda$1 / A$lambda$1 (canon) / A$lambda$1 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth) +- properties : false (local) / false (member) +A$lambda$2 / A$lambda$2 (canon) / A$lambda$2 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth) +- properties : false (local) / false (member) +A$lambda$3 / A$lambda$3 (canon) / A$lambda$3 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth) +- properties : false (local) / false (member) +AO$lambda$1 / AO$lambda$1 (canon) / AO$lambda$1 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth) +- properties : false (local) / false (member) +AT$class$lambda$1 / AT$class$lambda$1 (canon) / AT$class$lambda$1 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth) +- properties : false (local) / false (member) +#partest +A / A (canon) / A (simple) +- declared cls: List(class A$B, interface A$C, class A$D$) +- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth) +- properties : false (local) / false (member) +A$$anon$1 / null (canon) / $anon$1 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / class A (cls) / null (constr) / null (meth) +- properties : true (local) / false (member) +A$$anon$3 / null (canon) / $anon$3 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / class A (cls) / null (constr) / null (meth) +- properties : true (local) / false (member) +A$$anon$4 / null (canon) / $anon$4 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / class A (cls) / null (constr) / public java.lang.Object A.f() (meth) +- properties : true (local) / false (member) +A$$anon$5 / null (canon) / $anon$5 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / class A (cls) / null (constr) / public java.lang.Object A.f() (meth) +- properties : true (local) / false (member) +A$$anon$6 / null (canon) / $anon$6 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / class A (cls) / null (constr) / null (meth) +- properties : true (local) / false (member) +A$$anon$7 / null (canon) / $anon$7 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / class A (cls) / public A(int) (constr) / null (meth) +- properties : true (local) / false (member) +A$B / A.B (canon) / B (simple) +- declared cls: List() +- enclosing : class A (declaring cls) / class A (cls) / null (constr) / null (meth) +- properties : false (local) / true (member) +A$C / A.C (canon) / C (simple) +- declared cls: List() +- enclosing : class A (declaring cls) / class A (cls) / null (constr) / null (meth) +- properties : false (local) / true (member) +A$D$ / A.D$ (canon) / D$ (simple) +- declared cls: List(class A$D$B, interface A$D$C, class A$D$D$) +- enclosing : class A (declaring cls) / class A (cls) / null (constr) / null (meth) +- properties : false (local) / true (member) +A$D$$anon$2 / null (canon) / anon$2 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / class A$D$ (cls) / null (constr) / null (meth) +- properties : true (local) / false (member) +A$D$B / Malformed class name (canon) / Malformed class name (simple) +- declared cls: List() +- enclosing : class A$D$ (declaring cls) / class A$D$ (cls) / null (constr) / null (meth) +- properties : false (local) / true (member) +A$D$C / Malformed class name (canon) / Malformed class name (simple) +- declared cls: List() +- enclosing : class A$D$ (declaring cls) / class A$D$ (cls) / null (constr) / null (meth) +- properties : false (local) / true (member) +A$D$D$ / Malformed class name (canon) / Malformed class name (simple) +- declared cls: List() +- enclosing : class A$D$ (declaring cls) / class A$D$ (cls) / null (constr) / null (meth) +- properties : false (local) / true (member) +A$D$KB$1 / null (canon) / Malformed class name (simple) +- declared cls: List() +- enclosing : null (declaring cls) / class A$D$ (cls) / null (constr) / public void A$D$.f() (meth) +- properties : Malformed class name (local) / false (member) +A$E$1 / null (canon) / E$1 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / class A (cls) / null (constr) / public java.lang.Object A.f() (meth) +- properties : true (local) / false (member) +A$F$1 / null (canon) / F$1 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / class A (cls) / null (constr) / public java.lang.Object A.f() (meth) +- properties : true (local) / false (member) +A$G$2$ / null (canon) / G$2$ (simple) +- declared cls: List() +- enclosing : null (declaring cls) / class A (cls) / null (constr) / public java.lang.Object A.f() (meth) +- properties : true (local) / false (member) +A$H$1 / null (canon) / H$1 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / class A (cls) / null (constr) / public java.lang.Object A.f() (meth) +- properties : true (local) / false (member) +A$I$1 / null (canon) / I$1 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / class A (cls) / null (constr) / public java.lang.Object A.f() (meth) +- properties : true (local) / false (member) +A$J$2$ / null (canon) / J$2$ (simple) +- declared cls: List() +- enclosing : null (declaring cls) / class A (cls) / null (constr) / public java.lang.Object A.f() (meth) +- properties : true (local) / false (member) +A$K$1 / null (canon) / K$1 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / class A (cls) / null (constr) / null (meth) +- properties : true (local) / false (member) +A$L$1 / null (canon) / L$1 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / class A (cls) / null (constr) / null (meth) +- properties : true (local) / false (member) +A$M$2$ / null (canon) / M$2$ (simple) +- declared cls: List() +- enclosing : null (declaring cls) / class A (cls) / null (constr) / null (meth) +- properties : true (local) / false (member) +A$N$1 / null (canon) / N$1 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / class A (cls) / null (constr) / null (meth) +- properties : true (local) / false (member) +A$O$1 / null (canon) / O$1 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / class A (cls) / null (constr) / null (meth) +- properties : true (local) / false (member) +A$P$2$ / null (canon) / P$2$ (simple) +- declared cls: List() +- enclosing : null (declaring cls) / class A (cls) / null (constr) / null (meth) +- properties : true (local) / false (member) +A$Q$1 / null (canon) / Q$1 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / class A (cls) / public A(int) (constr) / null (meth) +- properties : true (local) / false (member) +A$R$1 / null (canon) / R$1 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / class A (cls) / public A(int) (constr) / null (meth) +- properties : true (local) / false (member) +A$S$2$ / null (canon) / S$2$ (simple) +- declared cls: List() +- enclosing : null (declaring cls) / class A (cls) / public A(int) (constr) / null (meth) +- properties : true (local) / false (member) +AO / AO (canon) / AO (simple) +- declared cls: List(class AO$B, interface AO$C, class AO$D$) +- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth) +- properties : false (local) / false (member) +AO$ / AO$ (canon) / AO$ (simple) +- declared cls: List() +- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth) +- properties : false (local) / false (member) +AO$$anon$8 / null (canon) / anon$8 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / class AO$ (cls) / null (constr) / null (meth) +- properties : true (local) / false (member) +AO$B / AO.B (canon) / B (simple) +- declared cls: List() +- enclosing : class AO (declaring cls) / class AO (cls) / null (constr) / null (meth) +- properties : false (local) / true (member) +AO$C / AO.C (canon) / C (simple) +- declared cls: List() +- enclosing : class AO (declaring cls) / class AO (cls) / null (constr) / null (meth) +- properties : false (local) / true (member) +AO$D$ / AO.D$ (canon) / D$ (simple) +- declared cls: List() +- enclosing : class AO (declaring cls) / class AO (cls) / null (constr) / null (meth) +- properties : false (local) / true (member) +AT / AT (canon) / AT (simple) +- declared cls: List(class AT$B, interface AT$C, class AT$D$) +- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth) +- properties : false (local) / false (member) +AT$$anon$9 / null (canon) / $anon$9 (simple) +- declared cls: List() +- enclosing : null (declaring cls) / interface AT (cls) / null (constr) / null (meth) +- properties : true (local) / false (member) +AT$B / AT.B (canon) / B (simple) +- declared cls: List() +- enclosing : interface AT (declaring cls) / interface AT (cls) / null (constr) / null (meth) +- properties : false (local) / true (member) +AT$C / AT.C (canon) / C (simple) +- declared cls: List() +- enclosing : interface AT (declaring cls) / interface AT (cls) / null (constr) / null (meth) +- properties : false (local) / true (member) +AT$D$ / AT.D$ (canon) / D$ (simple) +- declared cls: List() +- enclosing : interface AT (declaring cls) / interface AT (cls) / null (constr) / null (meth) +- properties : false (local) / true (member) +AT$class / AT$class (canon) / AT$class (simple) +- declared cls: List() +- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth) +- properties : false (local) / false (member) +T / T (canon) / T (simple) +- declared cls: List() +- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth) +- properties : false (local) / false (member) +T$class / T$class (canon) / T$class (simple) +- declared cls: List() +- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth) +- properties : false (local) / false (member) |