summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala2
-rw-r--r--test/files/jvm/beanInfo.check6
-rw-r--r--test/files/jvm/beanInfo/C_1.scala9
-rw-r--r--test/files/jvm/beanInfo/Test_2.scala17
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}")
+ }
+}