diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2014-05-13 15:13:39 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@gmail.com> | 2014-05-13 17:38:47 +0200 |
commit | d430b03bc11c8fb279d9601fd33f5ac3ab48ed80 (patch) | |
tree | 7a7b965ab3d26040e9448ecff2f1237f763d166d | |
parent | 9e1b464d44d2402211b905d6d89cf4004090fe43 (diff) | |
download | scala-d430b03bc11c8fb279d9601fd33f5ac3ab48ed80.tar.gz scala-d430b03bc11c8fb279d9601fd33f5ac3ab48ed80.tar.bz2 scala-d430b03bc11c8fb279d9601fd33f5ac3ab48ed80.zip |
Fix BeanInfo generation for GenBCode
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala | 2 | ||||
-rw-r--r-- | test/files/jvm/beanInfo.check | 6 | ||||
-rw-r--r-- | test/files/jvm/beanInfo/C_1.scala | 9 | ||||
-rw-r--r-- | test/files/jvm/beanInfo/Test_2.scala | 17 |
4 files changed, 33 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala index f800dbf9cd..1ede914288 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala @@ -1108,7 +1108,7 @@ abstract class BCodeHelpers extends BCodeTypes with BytecodeWriters { constructor.visitVarInsn(asm.Opcodes.ALOAD, 0) // push the class - constructor.visitLdcInsn(exemplar(cls).c) + constructor.visitLdcInsn(exemplar(cls).c.toASMType) // push the string array of field information constructor.visitLdcInsn(new java.lang.Integer(fieldList.length)) diff --git a/test/files/jvm/beanInfo.check b/test/files/jvm/beanInfo.check new file mode 100644 index 0000000000..d74e127711 --- /dev/null +++ b/test/files/jvm/beanInfo.check @@ -0,0 +1,6 @@ +property descriptors +x -- int -- public int p.C.x() -- null +y -- class java.lang.String -- public java.lang.String p.C.y() -- public void p.C.y_$eq(java.lang.String) +z -- class scala.collection.immutable.List -- public scala.collection.immutable.List p.C.z() -- public void p.C.z_$eq(scala.collection.immutable.List) +method descriptors +f -- public p.C p.C.f() diff --git a/test/files/jvm/beanInfo/C_1.scala b/test/files/jvm/beanInfo/C_1.scala new file mode 100644 index 0000000000..a338abea1d --- /dev/null +++ b/test/files/jvm/beanInfo/C_1.scala @@ -0,0 +1,9 @@ +package p + +@scala.beans.BeanInfo +class C { + val x: Int = 0 + var y: String = "" + var z: List[_] = Nil + def f: C = ??? +} diff --git a/test/files/jvm/beanInfo/Test_2.scala b/test/files/jvm/beanInfo/Test_2.scala new file mode 100644 index 0000000000..fa9b6e1391 --- /dev/null +++ b/test/files/jvm/beanInfo/Test_2.scala @@ -0,0 +1,17 @@ +object Test extends App { + val info = java.beans.Introspector.getBeanInfo(classOf[p.C]) + + println("property descriptors") + + val pds = info.getPropertyDescriptors + for (pd <- pds) { + println(s"${pd.getName} -- ${pd.getPropertyType} -- ${pd.getReadMethod} -- ${pd.getWriteMethod}") + } + + println("method descriptors") + + val mds = info.getMethodDescriptors + for (md <- mds) { + println(s"${md.getName} -- ${md.getMethod}") + } +} |