From 432d7b86cb7c46d0415b8c06bf8045e309c63f03 Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Sat, 4 Aug 2012 11:08:10 +0200 Subject: SI-6178 reflective invocation of magic symbols In Scala there are some methods that only exist in symbol tables, but don't have corresponding method entries in Java class files. To the best of my knowledge, these methods can be subdivided into five groups: 1) stuff weaved onto Any, AnyVal and AnyRef (aka Object), 2) magic methods that Scala exposes to fix Java arrays, 3) magic methods declared on Scala primitive value classes, 4) compile-time methods (such as classOf and all kinds of macros), 5) miscellaneous stuff (currently only String_+). To support these magic symbols, I've modified the `checkMemberOf` validator to special case Any/AnyVal/AnyRef methods and adjusted MethodMirror and ConstructorMirror classes to use special invokers for those instead of relying on Java reflection. Support for value classes will arrive in the subsequent commit, because it requires some unrelated changes to the mirror API (currently mirrors only support AnyRefs as their targets). --- .../files/run/reflection-magicsymbols-invoke.check | 124 +++++++++++++++++++++ .../files/run/reflection-magicsymbols-invoke.scala | 94 ++++++++++++++++ test/files/run/t6178.check | 1 + test/files/run/t6178.scala | 7 ++ 4 files changed, 226 insertions(+) create mode 100644 test/files/run/reflection-magicsymbols-invoke.check create mode 100644 test/files/run/reflection-magicsymbols-invoke.scala create mode 100644 test/files/run/t6178.check create mode 100644 test/files/run/t6178.scala (limited to 'test') diff --git a/test/files/run/reflection-magicsymbols-invoke.check b/test/files/run/reflection-magicsymbols-invoke.check new file mode 100644 index 0000000000..a180ed806e --- /dev/null +++ b/test/files/run/reflection-magicsymbols-invoke.check @@ -0,0 +1,124 @@ +============ +Any +it's important to print the list of Any's members +if some of them change (possibly, adding and/or removing magic symbols), we must update this test +method !=: (x$1: Any)Boolean +method ##: ()Int +method ==: (x$1: Any)Boolean +method asInstanceOf: [T0]=> T0 +method equals: (x$1: Any)Boolean +method getClass: ()java.lang.Class[_] +method hashCode: ()Int +method isInstanceOf: [T0]=> Boolean +method toString: ()java.lang.String +testing Any.!=: false +testing Any.##: 50 +testing Any.==: true +testing Any.asInstanceOf: class scala.ScalaReflectionException: Any.asInstanceOf requires a type argument, it cannot be invoked with mirrors +testing Any.asInstanceOf: class scala.ScalaReflectionException: scala.Any.asInstanceOf[T0]: T0 takes 0 arguments +testing Any.equals: true +testing Any.getClass: class java.lang.String +testing Any.hashCode: 50 +testing Any.isInstanceOf: class scala.ScalaReflectionException: Any.isInstanceOf requires a type argument, it cannot be invoked with mirrors +testing Any.isInstanceOf: class scala.ScalaReflectionException: scala.Any.isInstanceOf[T0]: Boolean takes 0 arguments +testing Any.toString: 2 +============ +AnyVal +it's important to print the list of AnyVal's members +if some of them change (possibly, adding and/or removing magic symbols), we must update this test +constructor AnyVal: ()AnyVal +method getClass: ()Class[_ <: AnyVal] +testing AnyVal.: class java.lang.InstantiationException: null +testing AnyVal.getClass: class scala.ScalaReflectionException: expected a member of class Integer, you provided method scala.AnyVal.getClass +============ +AnyRef +it's important to print the list of AnyRef's members +if some of them change (possibly, adding and/or removing magic symbols), we must update this test +constructor Object: ()java.lang.Object +method !=: (x$1: Any)Boolean +method !=: (x$1: AnyRef)Boolean +method ##: ()Int +method $asInstanceOf: [T0]()T0 +method $isInstanceOf: [T0]()Boolean +method ==: (x$1: Any)Boolean +method ==: (x$1: AnyRef)Boolean +method asInstanceOf: [T0]=> T0 +method clone: ()java.lang.Object +method eq: (x$1: AnyRef)Boolean +method equals: (x$1: Any)Boolean +method finalize: ()Unit +method getClass: ()java.lang.Class[_] +method hashCode: ()Int +method isInstanceOf: [T0]=> Boolean +method ne: (x$1: AnyRef)Boolean +method notify: ()Unit +method notifyAll: ()Unit +method synchronized: [T0](x$1: T0)T0 +method toString: ()java.lang.String +method wait: ()Unit +method wait: (x$1: Long)Unit +method wait: (x$1: Long, x$2: Int)Unit +testing Object.!=: false +testing Object.##: 50 +testing Object.$asInstanceOf: class scala.ScalaReflectionException: AnyRef.$asInstanceOf is an internal method, it cannot be invoked with mirrors +testing Object.$asInstanceOf: class scala.ScalaReflectionException: java.lang.Object.$asInstanceOf[T0](): T0 takes 0 arguments +testing Object.$isInstanceOf: class scala.ScalaReflectionException: AnyRef.$isInstanceOf is an internal method, it cannot be invoked with mirrors +testing Object.$isInstanceOf: class scala.ScalaReflectionException: java.lang.Object.$isInstanceOf[T0](): Boolean takes 0 arguments +testing Object.==: true +testing Object.clone: class java.lang.CloneNotSupportedException: java.lang.String +testing Object.eq: true +testing Object.equals: true +testing Object.finalize: null +testing Object.getClass: class java.lang.String +testing Object.hashCode: 50 +testing Object.ne: false +testing Object.notify: class java.lang.IllegalMonitorStateException: null +testing Object.notifyAll: class java.lang.IllegalMonitorStateException: null +testing Object.synchronized: 2 +testing Object.toString: 2 +TODO: also test AnyRef.wait overloads +============ +Array +it's important to print the list of Array's members +if some of them change (possibly, adding and/or removing magic symbols), we must update this test +constructor Array: (_length: Int)Array[T] +constructor Object: ()java.lang.Object +method !=: (x$1: Any)Boolean +method !=: (x$1: AnyRef)Boolean +method ##: ()Int +method $asInstanceOf: [T0]()T0 +method $isInstanceOf: [T0]()Boolean +method ==: (x$1: Any)Boolean +method ==: (x$1: AnyRef)Boolean +method apply: (i: )T +method asInstanceOf: [T0]=> T0 +method clone: ()Array[T] +method eq: (x$1: AnyRef)Boolean +method equals: (x$1: Any)Boolean +method finalize: ()Unit +method getClass: ()java.lang.Class[_] +method hashCode: ()Int +method isInstanceOf: [T0]=> Boolean +method length: => Int +method ne: (x$1: AnyRef)Boolean +method notify: ()Unit +method notifyAll: ()Unit +method synchronized: [T0](x$1: T0)T0 +method toString: ()java.lang.String +method update: (i: , x: )Unit +method wait: ()Unit +method wait: (x$1: Long)Unit +method wait: (x$1: Long, x$2: Int)Unit +value _length: Int +testing Array.length: 2 +testing Array.apply: 1 +testing Array.update: () +testing Array.clone: List(1, 2) +============ +Other +testing String.+: 23 +============ +CTM +testing Predef.classOf: class scala.ScalaReflectionException: Predef.classOf is a compile-time function, it cannot be invoked with mirrors +testing Predef.classOf: class scala.ScalaReflectionException: scala.Predef.classOf[T]: Class[T] takes 0 arguments +testing Universe.reify: class scala.ScalaReflectionException: scala.reflect.base.Universe.reify is a macro, i.e. a compile-time function, it cannot be invoked with mirrors diff --git a/test/files/run/reflection-magicsymbols-invoke.scala b/test/files/run/reflection-magicsymbols-invoke.scala new file mode 100644 index 0000000000..61ecc6458d --- /dev/null +++ b/test/files/run/reflection-magicsymbols-invoke.scala @@ -0,0 +1,94 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.universe.definitions._ +import scala.reflect.runtime.{currentMirror => cm} + +object Test extends App { + def key(sym: Symbol) = sym + ": " + sym.typeSignature + def test(tpe: Type, receiver: Any, method: String, args: Any*) { + def wrap[T](op: => T) = + try { + var result = op.asInstanceOf[AnyRef] + if (scala.runtime.ScalaRunTime.isArray(result)) + result = scala.runtime.ScalaRunTime.toObjectArray(result).toList + println(result) + } catch { + case ex: Throwable => + val realex = scala.reflect.runtime.ReflectionUtils.unwrapThrowable(ex) + println(realex.getClass + ": " + realex.getMessage) + } + print(s"testing ${tpe.typeSymbol.name}.$method: ") + wrap({ + if (method == nme.CONSTRUCTOR.toString) { + val ctor = tpe.declaration(nme.CONSTRUCTOR).asMethod + cm.reflectClass(ctor.owner.asClass).reflectConstructor(ctor)(args: _*) + } else { + val meth = tpe.declaration(newTermName(method).encodedName.toTermName).asMethod + cm.reflect(receiver).reflectMethod(meth)(args: _*) + } + }) + } + + println("============\nAny") + println("it's important to print the list of Any's members") + println("if some of them change (possibly, adding and/or removing magic symbols), we must update this test") + typeOf[Any].members.toList.sortBy(key).foreach(sym => println(key(sym))) + test(typeOf[Any], "2", "!=", "2") + test(typeOf[Any], "2", "##") + test(typeOf[Any], "2", "==", "2") + test(typeOf[Any], "2", "asInstanceOf") + test(typeOf[Any], "2", "asInstanceOf", typeOf[String]) + test(typeOf[Any], "2", "equals", "2") + test(typeOf[Any], "2", "getClass") + test(typeOf[Any], "2", "hashCode") + test(typeOf[Any], "2", "isInstanceOf") + test(typeOf[Any], "2", "isInstanceOf", typeOf[String]) + test(typeOf[Any], "2", "toString") + + println("============\nAnyVal") + println("it's important to print the list of AnyVal's members") + println("if some of them change (possibly, adding and/or removing magic symbols), we must update this test") + typeOf[AnyVal].declarations.toList.sortBy(key).foreach(sym => println(key(sym))) + test(typeOf[AnyVal], null, "") + test(typeOf[AnyVal], 2, "getClass") + + println("============\nAnyRef") + println("it's important to print the list of AnyRef's members") + println("if some of them change (possibly, adding and/or removing magic symbols), we must update this test") + typeOf[AnyRef].members.toList.sortBy(key).foreach(sym => println(key(sym))) + test(typeOf[AnyRef], "2", "!=", "2") + test(typeOf[AnyRef], "2", "##") + test(typeOf[AnyRef], "2", "$asInstanceOf") + test(typeOf[AnyRef], "2", "$asInstanceOf", typeOf[String]) + test(typeOf[AnyRef], "2", "$isInstanceOf") + test(typeOf[AnyRef], "2", "$isInstanceOf", typeOf[String]) + test(typeOf[AnyRef], "2", "==", "2") + test(typeOf[AnyRef], "2", "clone") + test(typeOf[AnyRef], "2", "eq", "2") + test(typeOf[AnyRef], "2", "equals", "2") + test(typeOf[AnyRef], "2", "finalize") + test(typeOf[AnyRef], "2", "getClass") + test(typeOf[AnyRef], "2", "hashCode") + test(typeOf[AnyRef], "2", "ne", "2") + test(typeOf[AnyRef], "2", "notify") + test(typeOf[AnyRef], "2", "notifyAll") + test(typeOf[AnyRef], "2", "synchronized", "2") + test(typeOf[AnyRef], "2", "toString") + println("TODO: also test AnyRef.wait overloads") + + println("============\nArray") + println("it's important to print the list of Array's members") + println("if some of them change (possibly, adding and/or removing magic symbols), we must update this test") + ArrayClass.typeSignature.members.toList.sortBy(key).foreach(sym => println(key(sym))) + test(ArrayClass.typeSignature, Array(1, 2), "length") + test(ArrayClass.typeSignature, Array(1, 2), "apply", 0) + test(ArrayClass.typeSignature, Array(1, 2), "update", 0, 0) + test(ArrayClass.typeSignature, Array(1, 2), "clone") + + println("============\nOther") + test(typeOf[String], "2", "+", 3) + + println("============\nCTM") + test(PredefModule.moduleClass.typeSignature, Predef, "classOf") + test(PredefModule.moduleClass.typeSignature, Predef, "classOf", typeOf[String]) + test(typeOf[scala.reflect.base.Universe], scala.reflect.runtime.universe, "reify", "2") +} \ No newline at end of file diff --git a/test/files/run/t6178.check b/test/files/run/t6178.check new file mode 100644 index 0000000000..d8263ee986 --- /dev/null +++ b/test/files/run/t6178.check @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/test/files/run/t6178.scala b/test/files/run/t6178.scala new file mode 100644 index 0000000000..0b4cf0bbf5 --- /dev/null +++ b/test/files/run/t6178.scala @@ -0,0 +1,7 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} + +object Test extends App { + val plus = typeOf[java.lang.String].member(newTermName("$plus")).asMethod + println(cm.reflect("").reflectMethod(plus).apply("2")) +} \ No newline at end of file -- cgit v1.2.3 From 3aa221e28c3ae0381b876448e3174f0c527e9abc Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Sun, 5 Aug 2012 20:02:39 +0200 Subject: SI-6179 mirrors now work with value classes mirrors now carry a class tag of the receiver, so that they can detect value classes being reflected upon and adjust accordingly (e.g. allow Int_+ for ints, but disallow it for Integers). Surprisingly enough derived value classes (SIP-15 guys that inherit from AnyVal) have been working all along, so no modification were required to fix them. --- src/reflect/scala/reflect/api/Mirrors.scala | 6 +- src/reflect/scala/reflect/internal/StdNames.scala | 6 + .../scala/reflect/runtime/JavaMirrors.scala | 74 +- .../run/reflection-valueclasses-derived.check | 3 + .../run/reflection-valueclasses-derived.scala | 12 + test/files/run/reflection-valueclasses-magic.check | 1456 ++++++++++++++++++++ test/files/run/reflection-valueclasses-magic.scala | 110 ++ .../run/reflection-valueclasses-standard.check | 27 + .../run/reflection-valueclasses-standard.scala | 21 + 9 files changed, 1681 insertions(+), 34 deletions(-) create mode 100644 test/files/run/reflection-valueclasses-derived.check create mode 100644 test/files/run/reflection-valueclasses-derived.scala create mode 100644 test/files/run/reflection-valueclasses-magic.check create mode 100644 test/files/run/reflection-valueclasses-magic.scala create mode 100644 test/files/run/reflection-valueclasses-standard.check create mode 100644 test/files/run/reflection-valueclasses-standard.scala (limited to 'test') diff --git a/src/reflect/scala/reflect/api/Mirrors.scala b/src/reflect/scala/reflect/api/Mirrors.scala index a4d86cf1fd..41acd73492 100644 --- a/src/reflect/scala/reflect/api/Mirrors.scala +++ b/src/reflect/scala/reflect/api/Mirrors.scala @@ -91,7 +91,7 @@ trait Mirrors { self: Universe => trait FieldMirror { /** The object containing the field */ - def receiver: AnyRef + def receiver: Any /** The field symbol representing the field. * @@ -125,7 +125,7 @@ trait Mirrors { self: Universe => trait MethodMirror { /** The receiver object of the method */ - def receiver: AnyRef + def receiver: Any /** The method symbol representing the method */ def symbol: MethodSymbol @@ -226,7 +226,7 @@ trait Mirrors { self: Universe => * Such a mirror can be used to further reflect against the members of the object * to get/set fields, invoke methods and inspect inner classes and objects. */ - def reflect(obj: Any): InstanceMirror + def reflect[T: ClassTag](obj: T): InstanceMirror /** Reflects against a static class symbol and returns a mirror * that can be used to create instances of the class, inspect its companion object or perform further reflections. diff --git a/src/reflect/scala/reflect/internal/StdNames.scala b/src/reflect/scala/reflect/internal/StdNames.scala index 67456cf86b..689a4dd37a 100644 --- a/src/reflect/scala/reflect/internal/StdNames.scala +++ b/src/reflect/scala/reflect/internal/StdNames.scala @@ -937,6 +937,12 @@ trait StdNames { case _ => NO_NAME } + def primitiveMethodName(name: Name): TermName = + primitiveInfixMethodName(name) match { + case NO_NAME => primitivePostfixMethodName(name) + case name => name + } + /** Translate a String into a list of simple TypeNames and TermNames. * In all segments before the last, type/term is determined by whether * the following separator char is '.' or '#'. In the last segment, diff --git a/src/reflect/scala/reflect/runtime/JavaMirrors.scala b/src/reflect/scala/reflect/runtime/JavaMirrors.scala index 83fbee97cc..3a18c60720 100644 --- a/src/reflect/scala/reflect/runtime/JavaMirrors.scala +++ b/src/reflect/scala/reflect/runtime/JavaMirrors.scala @@ -20,7 +20,7 @@ import internal.Flags._ //import scala.tools.nsc.util.ScalaClassLoader._ import ReflectionUtils.{singletonInstance} import language.existentials -import scala.runtime.ScalaRunTime +import scala.runtime.{ScalaRunTime, BoxesRunTime} trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: SymbolTable => @@ -133,7 +133,7 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym """.trim.stripMargin) private def ErrorSetImmutableField(wannabe: Symbol) = throw new ScalaReflectionException(s"cannot set an immutable field ${wannabe.name}") - def reflect(obj: Any): InstanceMirror = new JavaInstanceMirror(obj.asInstanceOf[AnyRef]) + def reflect[T: ClassTag](obj: T): InstanceMirror = new JavaInstanceMirror(obj) def reflectClass(cls: ClassSymbol): ClassMirror = { if (!cls.isStatic) ErrorInnerClass(cls) @@ -155,7 +155,7 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym private def checkMemberOf(wannabe: Symbol, owner: ClassSymbol) { if (wannabe.owner == AnyClass || wannabe.owner == AnyRefClass || wannabe.owner == ObjectClass) { - // do nothing + // do nothing } else if (wannabe.owner == AnyValClass) { if (!owner.isPrimitiveValueClass && !owner.isDerivedValueClass) ErrorNotMember(wannabe, owner) } else { @@ -163,10 +163,15 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym } } - private class JavaInstanceMirror(obj: AnyRef) + private def preciseClass[T: ClassTag](instance: T) = { + val staticClazz = classTag[T].runtimeClass + val dynamicClazz = instance.getClass + if (staticClazz.isPrimitive) staticClazz else dynamicClazz + } + + private class JavaInstanceMirror[T: ClassTag](val instance: T) extends InstanceMirror { - def instance = obj - def symbol = wholemirror.classSymbol(obj.getClass) + def symbol = wholemirror.classSymbol(preciseClass(instance)) def reflectField(field: TermSymbol): FieldMirror = { checkMemberOf(field, symbol) if ((field.isMethod && !field.isAccessor) || field.isModule) ErrorNotField(field) @@ -179,26 +184,26 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym catch { case _: NoSuchFieldException => ErrorNonExistentField(field1) } - new JavaFieldMirror(obj, field1) + new JavaFieldMirror(instance, field1) } def reflectMethod(method: MethodSymbol): MethodMirror = { checkMemberOf(method, symbol) - mkJavaMethodMirror(obj, method) + mkJavaMethodMirror(instance, method) } def reflectClass(cls: ClassSymbol): ClassMirror = { if (cls.isStatic) ErrorStaticClass(cls) checkMemberOf(cls, symbol) - new JavaClassMirror(instance, cls) + new JavaClassMirror(instance.asInstanceOf[AnyRef], cls) } def reflectModule(mod: ModuleSymbol): ModuleMirror = { if (mod.isStatic) ErrorStaticModule(mod) checkMemberOf(mod, symbol) - new JavaModuleMirror(instance, mod) + new JavaModuleMirror(instance.asInstanceOf[AnyRef], mod) } - override def toString = s"instance mirror for $obj" + override def toString = s"instance mirror for $instance" } - private class JavaFieldMirror(val receiver: AnyRef, val symbol: TermSymbol) + private class JavaFieldMirror(val receiver: Any, val symbol: TermSymbol) extends FieldMirror { lazy val jfield = { val jfield = fieldToJava(symbol) @@ -255,12 +260,12 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym // that's because we want to have decent performance // therefore we move special cases into separate subclasses // rather than have them on a hot path them in a unified implementation of the `apply` method - private def mkJavaMethodMirror(receiver: AnyRef, symbol: MethodSymbol): JavaMethodMirror = { + private def mkJavaMethodMirror[T: ClassTag](receiver: T, symbol: MethodSymbol): JavaMethodMirror = { if (isMagicMethod(symbol)) new JavaMagicMethodMirror(receiver, symbol) else new JavaVanillaMethodMirror(receiver, symbol) } - private abstract class JavaMethodMirror(val receiver: AnyRef, val symbol: MethodSymbol) + private abstract class JavaMethodMirror(val symbol: MethodSymbol) extends MethodMirror { lazy val jmeth = { val jmeth = methodToJava(symbol) @@ -271,13 +276,13 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym override def toString = s"method mirror for ${showMethodSig(symbol)} (bound to $receiver)" } - private class JavaVanillaMethodMirror(receiver: AnyRef, symbol: MethodSymbol) - extends JavaMethodMirror(receiver, symbol) { + private class JavaVanillaMethodMirror(val receiver: Any, symbol: MethodSymbol) + extends JavaMethodMirror(symbol) { def apply(args: Any*): Any = jmeth.invoke(receiver, args.asInstanceOf[Seq[AnyRef]]: _*) } - private class JavaMagicMethodMirror(receiver: AnyRef, symbol: MethodSymbol) - extends JavaMethodMirror(receiver, symbol) { + private class JavaMagicMethodMirror[T: ClassTag](val receiver: T, symbol: MethodSymbol) + extends JavaMethodMirror(symbol) { def apply(args: Any*): Any = { // checking type conformance is too much of a hassle, so we don't do it here // actually it's not even necessary, because we manually dispatch arguments to magic methods below @@ -293,37 +298,44 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym throw new ScalaReflectionException(s"${showMethodSig(symbol)} takes $n_arguments $s_arguments") } + def objReceiver = receiver.asInstanceOf[AnyRef] def objArg0 = args(0).asInstanceOf[AnyRef] def objArgs = args.asInstanceOf[Seq[AnyRef]] def fail(msg: String) = throw new ScalaReflectionException(msg + ", it cannot be invoked with mirrors") + def invokeMagicPrimitiveMethod = { + val jmeths = classOf[BoxesRunTime].getDeclaredMethods.filter(_.getName == nme.primitiveMethodName(symbol.name).toString) + assert(jmeths.length == 1, jmeths.toList) + jmeths.head.invoke(null, (objReceiver +: objArgs): _*) + } + symbol match { - case Any_== | Object_== => ScalaRunTime.inlinedEquals(receiver, objArg0) - case Any_!= | Object_!= => !ScalaRunTime.inlinedEquals(receiver, objArg0) - case Any_## | Object_## => ScalaRunTime.hash(receiver) + case Any_== | Object_== => ScalaRunTime.inlinedEquals(objReceiver, objArg0) + case Any_!= | Object_!= => !ScalaRunTime.inlinedEquals(objReceiver, objArg0) + case Any_## | Object_## => ScalaRunTime.hash(objReceiver) case Any_equals => receiver.equals(objArg0) case Any_hashCode => receiver.hashCode case Any_toString => receiver.toString - case Object_eq => receiver eq objArg0 - case Object_ne => receiver ne objArg0 - case Object_synchronized => receiver.synchronized(objArg0) - case sym if isGetClass(sym) => receiver.getClass + case Object_eq => objReceiver eq objArg0 + case Object_ne => objReceiver ne objArg0 + case Object_synchronized => objReceiver.synchronized(objArg0) + case sym if isGetClass(sym) => preciseClass(receiver) case Any_asInstanceOf => fail("Any.asInstanceOf requires a type argument") case Any_isInstanceOf => fail("Any.isInstanceOf requires a type argument") case Object_asInstanceOf => fail("AnyRef.$asInstanceOf is an internal method") case Object_isInstanceOf => fail("AnyRef.$isInstanceOf is an internal method") - case Array_length => ScalaRunTime.array_length(receiver) - case Array_apply => ScalaRunTime.array_apply(receiver, args(0).asInstanceOf[Int]) - case Array_update => ScalaRunTime.array_update(receiver, args(0).asInstanceOf[Int], args(1)) - case Array_clone => ScalaRunTime.array_clone(receiver) + case Array_length => ScalaRunTime.array_length(objReceiver) + case Array_apply => ScalaRunTime.array_apply(objReceiver, args(0).asInstanceOf[Int]) + case Array_update => ScalaRunTime.array_update(objReceiver, args(0).asInstanceOf[Int], args(1)) + case Array_clone => ScalaRunTime.array_clone(objReceiver) case sym if isStringConcat(sym) => receiver.toString + objArg0 - case sym if isMagicPrimitiveMethod(sym) => fail("implementation restriction: ${symbol.fullName} is a magic primitive method") + case sym if isMagicPrimitiveMethod(sym) => invokeMagicPrimitiveMethod case sym if sym == Predef_classOf => fail("Predef.classOf is a compile-time function") case sym if sym.isTermMacro => fail(s"${symbol.fullName} is a macro, i.e. a compile-time function") case _ => assert(false, this) } } - } + } private class JavaConstructorMirror(val outer: AnyRef, val symbol: MethodSymbol) extends MethodMirror { diff --git a/test/files/run/reflection-valueclasses-derived.check b/test/files/run/reflection-valueclasses-derived.check new file mode 100644 index 0000000000..bfcfcade5e --- /dev/null +++ b/test/files/run/reflection-valueclasses-derived.check @@ -0,0 +1,3 @@ +4 +class C +C@2 diff --git a/test/files/run/reflection-valueclasses-derived.scala b/test/files/run/reflection-valueclasses-derived.scala new file mode 100644 index 0000000000..6b08f987ba --- /dev/null +++ b/test/files/run/reflection-valueclasses-derived.scala @@ -0,0 +1,12 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} + +class C(val x: Int) extends AnyVal { + def foo(y: Int) = x + y +} + +object Test extends App { + println(cm.reflect(new C(2)).reflectMethod(typeOf[C].member(newTermName("foo")).asMethod)(2)) + println(cm.reflect(new C(2)).reflectMethod(typeOf[C].member(newTermName("getClass")).asMethod)()) + println(cm.reflect(new C(2)).reflectMethod(typeOf[C].member(newTermName("toString")).asMethod)()) +} \ No newline at end of file diff --git a/test/files/run/reflection-valueclasses-magic.check b/test/files/run/reflection-valueclasses-magic.check new file mode 100644 index 0000000000..8ecad3eb91 --- /dev/null +++ b/test/files/run/reflection-valueclasses-magic.check @@ -0,0 +1,1456 @@ +============ +Byte +it's important to print the list of Byte's members +if some of them change (possibly, adding and/or removing magic symbols), we must update this test +constructor Byte: ()Byte +method !=: (x$1: Any)Boolean +method !=: (x: Byte)Boolean +method !=: (x: Char)Boolean +method !=: (x: Double)Boolean +method !=: (x: Float)Boolean +method !=: (x: Int)Boolean +method !=: (x: Long)Boolean +method !=: (x: Short)Boolean +method ##: ()Int +method %: (x: Byte)Int +method %: (x: Char)Int +method %: (x: Double)Double +method %: (x: Float)Float +method %: (x: Int)Int +method %: (x: Long)Long +method %: (x: Short)Int +method &: (x: Byte)Int +method &: (x: Char)Int +method &: (x: Int)Int +method &: (x: Long)Long +method &: (x: Short)Int +method *: (x: Byte)Int +method *: (x: Char)Int +method *: (x: Double)Double +method *: (x: Float)Float +method *: (x: Int)Int +method *: (x: Long)Long +method *: (x: Short)Int +method +: (x: Byte)Int +method +: (x: Char)Int +method +: (x: Double)Double +method +: (x: Float)Float +method +: (x: Int)Int +method +: (x: Long)Long +method +: (x: Short)Int +method +: (x: String)String +method -: (x: Byte)Int +method -: (x: Char)Int +method -: (x: Double)Double +method -: (x: Float)Float +method -: (x: Int)Int +method -: (x: Long)Long +method -: (x: Short)Int +method /: (x: Byte)Int +method /: (x: Char)Int +method /: (x: Double)Double +method /: (x: Float)Float +method /: (x: Int)Int +method /: (x: Long)Long +method /: (x: Short)Int +method <: (x: Byte)Boolean +method <: (x: Char)Boolean +method <: (x: Double)Boolean +method <: (x: Float)Boolean +method <: (x: Int)Boolean +method <: (x: Long)Boolean +method <: (x: Short)Boolean +method <<: (x: Int)Int +method <<: (x: Long)Int +method <=: (x: Byte)Boolean +method <=: (x: Char)Boolean +method <=: (x: Double)Boolean +method <=: (x: Float)Boolean +method <=: (x: Int)Boolean +method <=: (x: Long)Boolean +method <=: (x: Short)Boolean +method ==: (x$1: Any)Boolean +method ==: (x: Byte)Boolean +method ==: (x: Char)Boolean +method ==: (x: Double)Boolean +method ==: (x: Float)Boolean +method ==: (x: Int)Boolean +method ==: (x: Long)Boolean +method ==: (x: Short)Boolean +method >: (x: Byte)Boolean +method >: (x: Char)Boolean +method >: (x: Double)Boolean +method >: (x: Float)Boolean +method >: (x: Int)Boolean +method >: (x: Long)Boolean +method >: (x: Short)Boolean +method >=: (x: Byte)Boolean +method >=: (x: Char)Boolean +method >=: (x: Double)Boolean +method >=: (x: Float)Boolean +method >=: (x: Int)Boolean +method >=: (x: Long)Boolean +method >=: (x: Short)Boolean +method >>: (x: Int)Int +method >>: (x: Long)Int +method >>>: (x: Int)Int +method >>>: (x: Long)Int +method ^: (x: Byte)Int +method ^: (x: Char)Int +method ^: (x: Int)Int +method ^: (x: Long)Long +method ^: (x: Short)Int +method asInstanceOf: [T0]=> T0 +method equals: (x$1: Any)Boolean +method getClass: ()Class[Byte] +method hashCode: ()Int +method isInstanceOf: [T0]=> Boolean +method toByte: => Byte +method toChar: => Char +method toDouble: => Double +method toFloat: => Float +method toInt: => Int +method toLong: => Long +method toShort: => Short +method toString: ()java.lang.String +method unary_+: => Int +method unary_-: => Int +method unary_~: => Int +method |: (x: Byte)Int +method |: (x: Char)Int +method |: (x: Int)Int +method |: (x: Long)Long +method |: (x: Short)Int +testing Byte.toByte() with receiver = 2 and args = List(): [class java.lang.Byte] =======> 2 +testing Byte.toShort() with receiver = 2 and args = List(): [class java.lang.Short] =======> 2 +testing Byte.toChar() with receiver = 2 and args = List(): [class java.lang.Character] =======>  +testing Byte.toInt() with receiver = 2 and args = List(): [class java.lang.Integer] =======> 2 +testing Byte.toLong() with receiver = 2 and args = List(): [class java.lang.Long] =======> 2 +testing Byte.toFloat() with receiver = 2 and args = List(): [class java.lang.Float] =======> 2.0 +testing Byte.toDouble() with receiver = 2 and args = List(): [class java.lang.Double] =======> 2.0 +testing Byte.==(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Byte.==(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Byte.==(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Byte.==(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Byte.==(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Byte.==(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Byte.==(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Byte.!=(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Byte.!=(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Byte.!=(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Byte.!=(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Byte.!=(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Byte.!=(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Byte.!=(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Byte.<(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Byte.<(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Byte.<(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Byte.<(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Byte.<(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Byte.<(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Byte.<(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Byte.<=(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Byte.<=(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Byte.<=(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Byte.<=(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Byte.<=(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Byte.<=(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Byte.<=(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Byte.>(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Byte.>(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Byte.>(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Byte.>(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Byte.>(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Byte.>(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Byte.>(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Byte.>=(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Byte.>=(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Byte.>=(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Byte.>=(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Byte.>=(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Byte.>=(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Byte.>=(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Byte.+(String) with receiver = 2 and args = List(2 class java.lang.String): [class java.lang.String] =======> 22 +testing Byte.+(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 4 +testing Byte.+(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 4 +testing Byte.+(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Integer] =======> 4 +testing Byte.+(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 4 +testing Byte.+(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 4 +testing Byte.+(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 4.0 +testing Byte.+(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 4.0 +testing Byte.-(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 0 +testing Byte.-(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 0 +testing Byte.-(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Integer] =======> 0 +testing Byte.-(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 0 +testing Byte.-(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 0 +testing Byte.-(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 0.0 +testing Byte.-(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 0.0 +testing Byte.*(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 4 +testing Byte.*(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 4 +testing Byte.*(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Integer] =======> 4 +testing Byte.*(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 4 +testing Byte.*(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 4 +testing Byte.*(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 4.0 +testing Byte.*(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 4.0 +testing Byte./(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 1 +testing Byte./(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 1 +testing Byte./(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Integer] =======> 1 +testing Byte./(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 1 +testing Byte./(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 1 +testing Byte./(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 1.0 +testing Byte./(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 1.0 +testing Byte.%(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 0 +testing Byte.%(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 0 +testing Byte.%(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Integer] =======> 0 +testing Byte.%(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 0 +testing Byte.%(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 0 +testing Byte.%(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 0.0 +testing Byte.%(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 0.0 +============ +Short +it's important to print the list of Byte's members +if some of them change (possibly, adding and/or removing magic symbols), we must update this test +constructor Short: ()Short +method !=: (x$1: Any)Boolean +method !=: (x: Byte)Boolean +method !=: (x: Char)Boolean +method !=: (x: Double)Boolean +method !=: (x: Float)Boolean +method !=: (x: Int)Boolean +method !=: (x: Long)Boolean +method !=: (x: Short)Boolean +method ##: ()Int +method %: (x: Byte)Int +method %: (x: Char)Int +method %: (x: Double)Double +method %: (x: Float)Float +method %: (x: Int)Int +method %: (x: Long)Long +method %: (x: Short)Int +method &: (x: Byte)Int +method &: (x: Char)Int +method &: (x: Int)Int +method &: (x: Long)Long +method &: (x: Short)Int +method *: (x: Byte)Int +method *: (x: Char)Int +method *: (x: Double)Double +method *: (x: Float)Float +method *: (x: Int)Int +method *: (x: Long)Long +method *: (x: Short)Int +method +: (x: Byte)Int +method +: (x: Char)Int +method +: (x: Double)Double +method +: (x: Float)Float +method +: (x: Int)Int +method +: (x: Long)Long +method +: (x: Short)Int +method +: (x: String)String +method -: (x: Byte)Int +method -: (x: Char)Int +method -: (x: Double)Double +method -: (x: Float)Float +method -: (x: Int)Int +method -: (x: Long)Long +method -: (x: Short)Int +method /: (x: Byte)Int +method /: (x: Char)Int +method /: (x: Double)Double +method /: (x: Float)Float +method /: (x: Int)Int +method /: (x: Long)Long +method /: (x: Short)Int +method <: (x: Byte)Boolean +method <: (x: Char)Boolean +method <: (x: Double)Boolean +method <: (x: Float)Boolean +method <: (x: Int)Boolean +method <: (x: Long)Boolean +method <: (x: Short)Boolean +method <<: (x: Int)Int +method <<: (x: Long)Int +method <=: (x: Byte)Boolean +method <=: (x: Char)Boolean +method <=: (x: Double)Boolean +method <=: (x: Float)Boolean +method <=: (x: Int)Boolean +method <=: (x: Long)Boolean +method <=: (x: Short)Boolean +method ==: (x$1: Any)Boolean +method ==: (x: Byte)Boolean +method ==: (x: Char)Boolean +method ==: (x: Double)Boolean +method ==: (x: Float)Boolean +method ==: (x: Int)Boolean +method ==: (x: Long)Boolean +method ==: (x: Short)Boolean +method >: (x: Byte)Boolean +method >: (x: Char)Boolean +method >: (x: Double)Boolean +method >: (x: Float)Boolean +method >: (x: Int)Boolean +method >: (x: Long)Boolean +method >: (x: Short)Boolean +method >=: (x: Byte)Boolean +method >=: (x: Char)Boolean +method >=: (x: Double)Boolean +method >=: (x: Float)Boolean +method >=: (x: Int)Boolean +method >=: (x: Long)Boolean +method >=: (x: Short)Boolean +method >>: (x: Int)Int +method >>: (x: Long)Int +method >>>: (x: Int)Int +method >>>: (x: Long)Int +method ^: (x: Byte)Int +method ^: (x: Char)Int +method ^: (x: Int)Int +method ^: (x: Long)Long +method ^: (x: Short)Int +method asInstanceOf: [T0]=> T0 +method equals: (x$1: Any)Boolean +method getClass: ()Class[Short] +method hashCode: ()Int +method isInstanceOf: [T0]=> Boolean +method toByte: => Byte +method toChar: => Char +method toDouble: => Double +method toFloat: => Float +method toInt: => Int +method toLong: => Long +method toShort: => Short +method toString: ()java.lang.String +method unary_+: => Int +method unary_-: => Int +method unary_~: => Int +method |: (x: Byte)Int +method |: (x: Char)Int +method |: (x: Int)Int +method |: (x: Long)Long +method |: (x: Short)Int +testing Short.toByte() with receiver = 2 and args = List(): [class java.lang.Byte] =======> 2 +testing Short.toShort() with receiver = 2 and args = List(): [class java.lang.Short] =======> 2 +testing Short.toChar() with receiver = 2 and args = List(): [class java.lang.Character] =======>  +testing Short.toInt() with receiver = 2 and args = List(): [class java.lang.Integer] =======> 2 +testing Short.toLong() with receiver = 2 and args = List(): [class java.lang.Long] =======> 2 +testing Short.toFloat() with receiver = 2 and args = List(): [class java.lang.Float] =======> 2.0 +testing Short.toDouble() with receiver = 2 and args = List(): [class java.lang.Double] =======> 2.0 +testing Short.==(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Short.==(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Short.==(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Short.==(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Short.==(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Short.==(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Short.==(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Short.!=(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Short.!=(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Short.!=(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Short.!=(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Short.!=(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Short.!=(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Short.!=(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Short.<(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Short.<(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Short.<(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Short.<(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Short.<(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Short.<(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Short.<(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Short.<=(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Short.<=(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Short.<=(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Short.<=(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Short.<=(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Short.<=(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Short.<=(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Short.>(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Short.>(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Short.>(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Short.>(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Short.>(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Short.>(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Short.>(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Short.>=(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Short.>=(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Short.>=(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Short.>=(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Short.>=(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Short.>=(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Short.>=(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Short.+(String) with receiver = 2 and args = List(2 class java.lang.String): [class java.lang.String] =======> 22 +testing Short.+(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 4 +testing Short.+(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 4 +testing Short.+(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Integer] =======> 4 +testing Short.+(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 4 +testing Short.+(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 4 +testing Short.+(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 4.0 +testing Short.+(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 4.0 +testing Short.-(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 0 +testing Short.-(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 0 +testing Short.-(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Integer] =======> 0 +testing Short.-(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 0 +testing Short.-(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 0 +testing Short.-(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 0.0 +testing Short.-(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 0.0 +testing Short.*(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 4 +testing Short.*(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 4 +testing Short.*(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Integer] =======> 4 +testing Short.*(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 4 +testing Short.*(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 4 +testing Short.*(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 4.0 +testing Short.*(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 4.0 +testing Short./(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 1 +testing Short./(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 1 +testing Short./(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Integer] =======> 1 +testing Short./(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 1 +testing Short./(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 1 +testing Short./(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 1.0 +testing Short./(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 1.0 +testing Short.%(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 0 +testing Short.%(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 0 +testing Short.%(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Integer] =======> 0 +testing Short.%(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 0 +testing Short.%(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 0 +testing Short.%(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 0.0 +testing Short.%(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 0.0 +============ +Char +it's important to print the list of Byte's members +if some of them change (possibly, adding and/or removing magic symbols), we must update this test +constructor Char: ()Char +method !=: (x$1: Any)Boolean +method !=: (x: Byte)Boolean +method !=: (x: Char)Boolean +method !=: (x: Double)Boolean +method !=: (x: Float)Boolean +method !=: (x: Int)Boolean +method !=: (x: Long)Boolean +method !=: (x: Short)Boolean +method ##: ()Int +method %: (x: Byte)Int +method %: (x: Char)Int +method %: (x: Double)Double +method %: (x: Float)Float +method %: (x: Int)Int +method %: (x: Long)Long +method %: (x: Short)Int +method &: (x: Byte)Int +method &: (x: Char)Int +method &: (x: Int)Int +method &: (x: Long)Long +method &: (x: Short)Int +method *: (x: Byte)Int +method *: (x: Char)Int +method *: (x: Double)Double +method *: (x: Float)Float +method *: (x: Int)Int +method *: (x: Long)Long +method *: (x: Short)Int +method +: (x: Byte)Int +method +: (x: Char)Int +method +: (x: Double)Double +method +: (x: Float)Float +method +: (x: Int)Int +method +: (x: Long)Long +method +: (x: Short)Int +method +: (x: String)String +method -: (x: Byte)Int +method -: (x: Char)Int +method -: (x: Double)Double +method -: (x: Float)Float +method -: (x: Int)Int +method -: (x: Long)Long +method -: (x: Short)Int +method /: (x: Byte)Int +method /: (x: Char)Int +method /: (x: Double)Double +method /: (x: Float)Float +method /: (x: Int)Int +method /: (x: Long)Long +method /: (x: Short)Int +method <: (x: Byte)Boolean +method <: (x: Char)Boolean +method <: (x: Double)Boolean +method <: (x: Float)Boolean +method <: (x: Int)Boolean +method <: (x: Long)Boolean +method <: (x: Short)Boolean +method <<: (x: Int)Int +method <<: (x: Long)Int +method <=: (x: Byte)Boolean +method <=: (x: Char)Boolean +method <=: (x: Double)Boolean +method <=: (x: Float)Boolean +method <=: (x: Int)Boolean +method <=: (x: Long)Boolean +method <=: (x: Short)Boolean +method ==: (x$1: Any)Boolean +method ==: (x: Byte)Boolean +method ==: (x: Char)Boolean +method ==: (x: Double)Boolean +method ==: (x: Float)Boolean +method ==: (x: Int)Boolean +method ==: (x: Long)Boolean +method ==: (x: Short)Boolean +method >: (x: Byte)Boolean +method >: (x: Char)Boolean +method >: (x: Double)Boolean +method >: (x: Float)Boolean +method >: (x: Int)Boolean +method >: (x: Long)Boolean +method >: (x: Short)Boolean +method >=: (x: Byte)Boolean +method >=: (x: Char)Boolean +method >=: (x: Double)Boolean +method >=: (x: Float)Boolean +method >=: (x: Int)Boolean +method >=: (x: Long)Boolean +method >=: (x: Short)Boolean +method >>: (x: Int)Int +method >>: (x: Long)Int +method >>>: (x: Int)Int +method >>>: (x: Long)Int +method ^: (x: Byte)Int +method ^: (x: Char)Int +method ^: (x: Int)Int +method ^: (x: Long)Long +method ^: (x: Short)Int +method asInstanceOf: [T0]=> T0 +method equals: (x$1: Any)Boolean +method getClass: ()Class[Char] +method hashCode: ()Int +method isInstanceOf: [T0]=> Boolean +method toByte: => Byte +method toChar: => Char +method toDouble: => Double +method toFloat: => Float +method toInt: => Int +method toLong: => Long +method toShort: => Short +method toString: ()java.lang.String +method unary_+: => Int +method unary_-: => Int +method unary_~: => Int +method |: (x: Byte)Int +method |: (x: Char)Int +method |: (x: Int)Int +method |: (x: Long)Long +method |: (x: Short)Int +testing Char.toByte() with receiver =  and args = List(): [class java.lang.Byte] =======> 2 +testing Char.toShort() with receiver =  and args = List(): [class java.lang.Short] =======> 2 +testing Char.toChar() with receiver =  and args = List(): [class java.lang.Character] =======>  +testing Char.toInt() with receiver =  and args = List(): [class java.lang.Integer] =======> 2 +testing Char.toLong() with receiver =  and args = List(): [class java.lang.Long] =======> 2 +testing Char.toFloat() with receiver =  and args = List(): [class java.lang.Float] =======> 2.0 +testing Char.toDouble() with receiver =  and args = List(): [class java.lang.Double] =======> 2.0 +testing Char.==(Byte) with receiver =  and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Char.==(Short) with receiver =  and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Char.==(Char) with receiver =  and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Char.==(Int) with receiver =  and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Char.==(Long) with receiver =  and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Char.==(Float) with receiver =  and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Char.==(Double) with receiver =  and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Char.!=(Byte) with receiver =  and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Char.!=(Short) with receiver =  and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Char.!=(Char) with receiver =  and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Char.!=(Int) with receiver =  and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Char.!=(Long) with receiver =  and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Char.!=(Float) with receiver =  and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Char.!=(Double) with receiver =  and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Char.<(Byte) with receiver =  and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Char.<(Short) with receiver =  and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Char.<(Char) with receiver =  and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Char.<(Int) with receiver =  and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Char.<(Long) with receiver =  and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Char.<(Float) with receiver =  and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Char.<(Double) with receiver =  and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Char.<=(Byte) with receiver =  and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Char.<=(Short) with receiver =  and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Char.<=(Char) with receiver =  and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Char.<=(Int) with receiver =  and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Char.<=(Long) with receiver =  and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Char.<=(Float) with receiver =  and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Char.<=(Double) with receiver =  and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Char.>(Byte) with receiver =  and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Char.>(Short) with receiver =  and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Char.>(Char) with receiver =  and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Char.>(Int) with receiver =  and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Char.>(Long) with receiver =  and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Char.>(Float) with receiver =  and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Char.>(Double) with receiver =  and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Char.>=(Byte) with receiver =  and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Char.>=(Short) with receiver =  and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Char.>=(Char) with receiver =  and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Char.>=(Int) with receiver =  and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Char.>=(Long) with receiver =  and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Char.>=(Float) with receiver =  and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Char.>=(Double) with receiver =  and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Char.+(String) with receiver =  and args = List(2 class java.lang.String): [class java.lang.String] =======> 2 +testing Char.+(Byte) with receiver =  and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 4 +testing Char.+(Short) with receiver =  and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 4 +testing Char.+(Char) with receiver =  and args = List( class java.lang.Character): [class java.lang.Integer] =======> 4 +testing Char.+(Int) with receiver =  and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 4 +testing Char.+(Long) with receiver =  and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 4 +testing Char.+(Float) with receiver =  and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 4.0 +testing Char.+(Double) with receiver =  and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 4.0 +testing Char.-(Byte) with receiver =  and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 0 +testing Char.-(Short) with receiver =  and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 0 +testing Char.-(Char) with receiver =  and args = List( class java.lang.Character): [class java.lang.Integer] =======> 0 +testing Char.-(Int) with receiver =  and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 0 +testing Char.-(Long) with receiver =  and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 0 +testing Char.-(Float) with receiver =  and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 0.0 +testing Char.-(Double) with receiver =  and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 0.0 +testing Char.*(Byte) with receiver =  and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 4 +testing Char.*(Short) with receiver =  and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 4 +testing Char.*(Char) with receiver =  and args = List( class java.lang.Character): [class java.lang.Integer] =======> 4 +testing Char.*(Int) with receiver =  and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 4 +testing Char.*(Long) with receiver =  and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 4 +testing Char.*(Float) with receiver =  and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 4.0 +testing Char.*(Double) with receiver =  and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 4.0 +testing Char./(Byte) with receiver =  and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 1 +testing Char./(Short) with receiver =  and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 1 +testing Char./(Char) with receiver =  and args = List( class java.lang.Character): [class java.lang.Integer] =======> 1 +testing Char./(Int) with receiver =  and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 1 +testing Char./(Long) with receiver =  and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 1 +testing Char./(Float) with receiver =  and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 1.0 +testing Char./(Double) with receiver =  and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 1.0 +testing Char.%(Byte) with receiver =  and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 0 +testing Char.%(Short) with receiver =  and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 0 +testing Char.%(Char) with receiver =  and args = List( class java.lang.Character): [class java.lang.Integer] =======> 0 +testing Char.%(Int) with receiver =  and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 0 +testing Char.%(Long) with receiver =  and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 0 +testing Char.%(Float) with receiver =  and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 0.0 +testing Char.%(Double) with receiver =  and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 0.0 +============ +Int +it's important to print the list of Byte's members +if some of them change (possibly, adding and/or removing magic symbols), we must update this test +constructor Int: ()Int +method !=: (x$1: Any)Boolean +method !=: (x: Byte)Boolean +method !=: (x: Char)Boolean +method !=: (x: Double)Boolean +method !=: (x: Float)Boolean +method !=: (x: Int)Boolean +method !=: (x: Long)Boolean +method !=: (x: Short)Boolean +method ##: ()Int +method %: (x: Byte)Int +method %: (x: Char)Int +method %: (x: Double)Double +method %: (x: Float)Float +method %: (x: Int)Int +method %: (x: Long)Long +method %: (x: Short)Int +method &: (x: Byte)Int +method &: (x: Char)Int +method &: (x: Int)Int +method &: (x: Long)Long +method &: (x: Short)Int +method *: (x: Byte)Int +method *: (x: Char)Int +method *: (x: Double)Double +method *: (x: Float)Float +method *: (x: Int)Int +method *: (x: Long)Long +method *: (x: Short)Int +method +: (x: Byte)Int +method +: (x: Char)Int +method +: (x: Double)Double +method +: (x: Float)Float +method +: (x: Int)Int +method +: (x: Long)Long +method +: (x: Short)Int +method +: (x: String)String +method -: (x: Byte)Int +method -: (x: Char)Int +method -: (x: Double)Double +method -: (x: Float)Float +method -: (x: Int)Int +method -: (x: Long)Long +method -: (x: Short)Int +method /: (x: Byte)Int +method /: (x: Char)Int +method /: (x: Double)Double +method /: (x: Float)Float +method /: (x: Int)Int +method /: (x: Long)Long +method /: (x: Short)Int +method <: (x: Byte)Boolean +method <: (x: Char)Boolean +method <: (x: Double)Boolean +method <: (x: Float)Boolean +method <: (x: Int)Boolean +method <: (x: Long)Boolean +method <: (x: Short)Boolean +method <<: (x: Int)Int +method <<: (x: Long)Int +method <=: (x: Byte)Boolean +method <=: (x: Char)Boolean +method <=: (x: Double)Boolean +method <=: (x: Float)Boolean +method <=: (x: Int)Boolean +method <=: (x: Long)Boolean +method <=: (x: Short)Boolean +method ==: (x$1: Any)Boolean +method ==: (x: Byte)Boolean +method ==: (x: Char)Boolean +method ==: (x: Double)Boolean +method ==: (x: Float)Boolean +method ==: (x: Int)Boolean +method ==: (x: Long)Boolean +method ==: (x: Short)Boolean +method >: (x: Byte)Boolean +method >: (x: Char)Boolean +method >: (x: Double)Boolean +method >: (x: Float)Boolean +method >: (x: Int)Boolean +method >: (x: Long)Boolean +method >: (x: Short)Boolean +method >=: (x: Byte)Boolean +method >=: (x: Char)Boolean +method >=: (x: Double)Boolean +method >=: (x: Float)Boolean +method >=: (x: Int)Boolean +method >=: (x: Long)Boolean +method >=: (x: Short)Boolean +method >>: (x: Int)Int +method >>: (x: Long)Int +method >>>: (x: Int)Int +method >>>: (x: Long)Int +method ^: (x: Byte)Int +method ^: (x: Char)Int +method ^: (x: Int)Int +method ^: (x: Long)Long +method ^: (x: Short)Int +method asInstanceOf: [T0]=> T0 +method equals: (x$1: Any)Boolean +method getClass: ()Class[Int] +method hashCode: ()Int +method isInstanceOf: [T0]=> Boolean +method toByte: => Byte +method toChar: => Char +method toDouble: => Double +method toFloat: => Float +method toInt: => Int +method toLong: => Long +method toShort: => Short +method toString: ()java.lang.String +method unary_+: => Int +method unary_-: => Int +method unary_~: => Int +method |: (x: Byte)Int +method |: (x: Char)Int +method |: (x: Int)Int +method |: (x: Long)Long +method |: (x: Short)Int +testing Int.toByte() with receiver = 2 and args = List(): [class java.lang.Byte] =======> 2 +testing Int.toShort() with receiver = 2 and args = List(): [class java.lang.Short] =======> 2 +testing Int.toChar() with receiver = 2 and args = List(): [class java.lang.Character] =======>  +testing Int.toInt() with receiver = 2 and args = List(): [class java.lang.Integer] =======> 2 +testing Int.toLong() with receiver = 2 and args = List(): [class java.lang.Long] =======> 2 +testing Int.toFloat() with receiver = 2 and args = List(): [class java.lang.Float] =======> 2.0 +testing Int.toDouble() with receiver = 2 and args = List(): [class java.lang.Double] =======> 2.0 +testing Int.==(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Int.==(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Int.==(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Int.==(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Int.==(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Int.==(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Int.==(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Int.!=(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Int.!=(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Int.!=(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Int.!=(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Int.!=(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Int.!=(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Int.!=(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Int.<(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Int.<(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Int.<(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Int.<(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Int.<(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Int.<(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Int.<(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Int.<=(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Int.<=(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Int.<=(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Int.<=(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Int.<=(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Int.<=(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Int.<=(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Int.>(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Int.>(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Int.>(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Int.>(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Int.>(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Int.>(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Int.>(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Int.>=(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Int.>=(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Int.>=(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Int.>=(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Int.>=(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Int.>=(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Int.>=(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Int.+(String) with receiver = 2 and args = List(2 class java.lang.String): [class java.lang.String] =======> 22 +testing Int.+(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 4 +testing Int.+(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 4 +testing Int.+(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Integer] =======> 4 +testing Int.+(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 4 +testing Int.+(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 4 +testing Int.+(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 4.0 +testing Int.+(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 4.0 +testing Int.-(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 0 +testing Int.-(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 0 +testing Int.-(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Integer] =======> 0 +testing Int.-(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 0 +testing Int.-(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 0 +testing Int.-(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 0.0 +testing Int.-(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 0.0 +testing Int.*(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 4 +testing Int.*(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 4 +testing Int.*(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Integer] =======> 4 +testing Int.*(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 4 +testing Int.*(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 4 +testing Int.*(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 4.0 +testing Int.*(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 4.0 +testing Int./(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 1 +testing Int./(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 1 +testing Int./(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Integer] =======> 1 +testing Int./(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 1 +testing Int./(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 1 +testing Int./(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 1.0 +testing Int./(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 1.0 +testing Int.%(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 0 +testing Int.%(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 0 +testing Int.%(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Integer] =======> 0 +testing Int.%(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 0 +testing Int.%(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 0 +testing Int.%(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 0.0 +testing Int.%(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 0.0 +============ +Long +it's important to print the list of Byte's members +if some of them change (possibly, adding and/or removing magic symbols), we must update this test +constructor Long: ()Long +method !=: (x$1: Any)Boolean +method !=: (x: Byte)Boolean +method !=: (x: Char)Boolean +method !=: (x: Double)Boolean +method !=: (x: Float)Boolean +method !=: (x: Int)Boolean +method !=: (x: Long)Boolean +method !=: (x: Short)Boolean +method ##: ()Int +method %: (x: Byte)Long +method %: (x: Char)Long +method %: (x: Double)Double +method %: (x: Float)Float +method %: (x: Int)Long +method %: (x: Long)Long +method %: (x: Short)Long +method &: (x: Byte)Long +method &: (x: Char)Long +method &: (x: Int)Long +method &: (x: Long)Long +method &: (x: Short)Long +method *: (x: Byte)Long +method *: (x: Char)Long +method *: (x: Double)Double +method *: (x: Float)Float +method *: (x: Int)Long +method *: (x: Long)Long +method *: (x: Short)Long +method +: (x: Byte)Long +method +: (x: Char)Long +method +: (x: Double)Double +method +: (x: Float)Float +method +: (x: Int)Long +method +: (x: Long)Long +method +: (x: Short)Long +method +: (x: String)String +method -: (x: Byte)Long +method -: (x: Char)Long +method -: (x: Double)Double +method -: (x: Float)Float +method -: (x: Int)Long +method -: (x: Long)Long +method -: (x: Short)Long +method /: (x: Byte)Long +method /: (x: Char)Long +method /: (x: Double)Double +method /: (x: Float)Float +method /: (x: Int)Long +method /: (x: Long)Long +method /: (x: Short)Long +method <: (x: Byte)Boolean +method <: (x: Char)Boolean +method <: (x: Double)Boolean +method <: (x: Float)Boolean +method <: (x: Int)Boolean +method <: (x: Long)Boolean +method <: (x: Short)Boolean +method <<: (x: Int)Long +method <<: (x: Long)Long +method <=: (x: Byte)Boolean +method <=: (x: Char)Boolean +method <=: (x: Double)Boolean +method <=: (x: Float)Boolean +method <=: (x: Int)Boolean +method <=: (x: Long)Boolean +method <=: (x: Short)Boolean +method ==: (x$1: Any)Boolean +method ==: (x: Byte)Boolean +method ==: (x: Char)Boolean +method ==: (x: Double)Boolean +method ==: (x: Float)Boolean +method ==: (x: Int)Boolean +method ==: (x: Long)Boolean +method ==: (x: Short)Boolean +method >: (x: Byte)Boolean +method >: (x: Char)Boolean +method >: (x: Double)Boolean +method >: (x: Float)Boolean +method >: (x: Int)Boolean +method >: (x: Long)Boolean +method >: (x: Short)Boolean +method >=: (x: Byte)Boolean +method >=: (x: Char)Boolean +method >=: (x: Double)Boolean +method >=: (x: Float)Boolean +method >=: (x: Int)Boolean +method >=: (x: Long)Boolean +method >=: (x: Short)Boolean +method >>: (x: Int)Long +method >>: (x: Long)Long +method >>>: (x: Int)Long +method >>>: (x: Long)Long +method ^: (x: Byte)Long +method ^: (x: Char)Long +method ^: (x: Int)Long +method ^: (x: Long)Long +method ^: (x: Short)Long +method asInstanceOf: [T0]=> T0 +method equals: (x$1: Any)Boolean +method getClass: ()Class[Long] +method hashCode: ()Int +method isInstanceOf: [T0]=> Boolean +method toByte: => Byte +method toChar: => Char +method toDouble: => Double +method toFloat: => Float +method toInt: => Int +method toLong: => Long +method toShort: => Short +method toString: ()java.lang.String +method unary_+: => Long +method unary_-: => Long +method unary_~: => Long +method |: (x: Byte)Long +method |: (x: Char)Long +method |: (x: Int)Long +method |: (x: Long)Long +method |: (x: Short)Long +testing Long.toByte() with receiver = 2 and args = List(): [class java.lang.Byte] =======> 2 +testing Long.toShort() with receiver = 2 and args = List(): [class java.lang.Short] =======> 2 +testing Long.toChar() with receiver = 2 and args = List(): [class java.lang.Character] =======>  +testing Long.toInt() with receiver = 2 and args = List(): [class java.lang.Integer] =======> 2 +testing Long.toLong() with receiver = 2 and args = List(): [class java.lang.Long] =======> 2 +testing Long.toFloat() with receiver = 2 and args = List(): [class java.lang.Float] =======> 2.0 +testing Long.toDouble() with receiver = 2 and args = List(): [class java.lang.Double] =======> 2.0 +testing Long.==(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Long.==(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Long.==(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Long.==(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Long.==(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Long.==(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Long.==(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Long.!=(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Long.!=(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Long.!=(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Long.!=(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Long.!=(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Long.!=(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Long.!=(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Long.<(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Long.<(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Long.<(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Long.<(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Long.<(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Long.<(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Long.<(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Long.<=(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Long.<=(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Long.<=(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Long.<=(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Long.<=(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Long.<=(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Long.<=(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Long.>(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Long.>(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Long.>(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Long.>(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Long.>(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Long.>(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Long.>(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Long.>=(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Long.>=(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Long.>=(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Long.>=(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Long.>=(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Long.>=(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Long.>=(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Long.+(String) with receiver = 2 and args = List(2 class java.lang.String): [class java.lang.String] =======> 22 +testing Long.+(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Long] =======> 4 +testing Long.+(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Long] =======> 4 +testing Long.+(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Long] =======> 4 +testing Long.+(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Long] =======> 4 +testing Long.+(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 4 +testing Long.+(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 4.0 +testing Long.+(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 4.0 +testing Long.-(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Long] =======> 0 +testing Long.-(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Long] =======> 0 +testing Long.-(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Long] =======> 0 +testing Long.-(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Long] =======> 0 +testing Long.-(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 0 +testing Long.-(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 0.0 +testing Long.-(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 0.0 +testing Long.*(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Long] =======> 4 +testing Long.*(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Long] =======> 4 +testing Long.*(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Long] =======> 4 +testing Long.*(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Long] =======> 4 +testing Long.*(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 4 +testing Long.*(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 4.0 +testing Long.*(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 4.0 +testing Long./(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Long] =======> 1 +testing Long./(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Long] =======> 1 +testing Long./(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Long] =======> 1 +testing Long./(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Long] =======> 1 +testing Long./(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 1 +testing Long./(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 1.0 +testing Long./(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 1.0 +testing Long.%(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Long] =======> 0 +testing Long.%(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Long] =======> 0 +testing Long.%(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Long] =======> 0 +testing Long.%(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Long] =======> 0 +testing Long.%(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 0 +testing Long.%(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 0.0 +testing Long.%(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 0.0 +============ +Float +it's important to print the list of Byte's members +if some of them change (possibly, adding and/or removing magic symbols), we must update this test +constructor Float: ()Float +method !=: (x$1: Any)Boolean +method !=: (x: Byte)Boolean +method !=: (x: Char)Boolean +method !=: (x: Double)Boolean +method !=: (x: Float)Boolean +method !=: (x: Int)Boolean +method !=: (x: Long)Boolean +method !=: (x: Short)Boolean +method ##: ()Int +method %: (x: Byte)Float +method %: (x: Char)Float +method %: (x: Double)Double +method %: (x: Float)Float +method %: (x: Int)Float +method %: (x: Long)Float +method %: (x: Short)Float +method *: (x: Byte)Float +method *: (x: Char)Float +method *: (x: Double)Double +method *: (x: Float)Float +method *: (x: Int)Float +method *: (x: Long)Float +method *: (x: Short)Float +method +: (x: Byte)Float +method +: (x: Char)Float +method +: (x: Double)Double +method +: (x: Float)Float +method +: (x: Int)Float +method +: (x: Long)Float +method +: (x: Short)Float +method +: (x: String)String +method -: (x: Byte)Float +method -: (x: Char)Float +method -: (x: Double)Double +method -: (x: Float)Float +method -: (x: Int)Float +method -: (x: Long)Float +method -: (x: Short)Float +method /: (x: Byte)Float +method /: (x: Char)Float +method /: (x: Double)Double +method /: (x: Float)Float +method /: (x: Int)Float +method /: (x: Long)Float +method /: (x: Short)Float +method <: (x: Byte)Boolean +method <: (x: Char)Boolean +method <: (x: Double)Boolean +method <: (x: Float)Boolean +method <: (x: Int)Boolean +method <: (x: Long)Boolean +method <: (x: Short)Boolean +method <=: (x: Byte)Boolean +method <=: (x: Char)Boolean +method <=: (x: Double)Boolean +method <=: (x: Float)Boolean +method <=: (x: Int)Boolean +method <=: (x: Long)Boolean +method <=: (x: Short)Boolean +method ==: (x$1: Any)Boolean +method ==: (x: Byte)Boolean +method ==: (x: Char)Boolean +method ==: (x: Double)Boolean +method ==: (x: Float)Boolean +method ==: (x: Int)Boolean +method ==: (x: Long)Boolean +method ==: (x: Short)Boolean +method >: (x: Byte)Boolean +method >: (x: Char)Boolean +method >: (x: Double)Boolean +method >: (x: Float)Boolean +method >: (x: Int)Boolean +method >: (x: Long)Boolean +method >: (x: Short)Boolean +method >=: (x: Byte)Boolean +method >=: (x: Char)Boolean +method >=: (x: Double)Boolean +method >=: (x: Float)Boolean +method >=: (x: Int)Boolean +method >=: (x: Long)Boolean +method >=: (x: Short)Boolean +method asInstanceOf: [T0]=> T0 +method equals: (x$1: Any)Boolean +method getClass: ()Class[Float] +method hashCode: ()Int +method isInstanceOf: [T0]=> Boolean +method toByte: => Byte +method toChar: => Char +method toDouble: => Double +method toFloat: => Float +method toInt: => Int +method toLong: => Long +method toShort: => Short +method toString: ()java.lang.String +method unary_+: => Float +method unary_-: => Float +testing Float.toByte() with receiver = 2.0 and args = List(): [class java.lang.Byte] =======> 2 +testing Float.toShort() with receiver = 2.0 and args = List(): [class java.lang.Short] =======> 2 +testing Float.toChar() with receiver = 2.0 and args = List(): [class java.lang.Character] =======>  +testing Float.toInt() with receiver = 2.0 and args = List(): [class java.lang.Integer] =======> 2 +testing Float.toLong() with receiver = 2.0 and args = List(): [class java.lang.Long] =======> 2 +testing Float.toFloat() with receiver = 2.0 and args = List(): [class java.lang.Float] =======> 2.0 +testing Float.toDouble() with receiver = 2.0 and args = List(): [class java.lang.Double] =======> 2.0 +testing Float.==(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Float.==(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Float.==(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Float.==(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Float.==(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Float.==(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Float.==(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Float.!=(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Float.!=(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Float.!=(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Float.!=(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Float.!=(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Float.!=(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Float.!=(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Float.<(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Float.<(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Float.<(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Float.<(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Float.<(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Float.<(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Float.<(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Float.<=(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Float.<=(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Float.<=(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Float.<=(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Float.<=(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Float.<=(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Float.<=(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Float.>(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Float.>(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Float.>(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Float.>(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Float.>(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Float.>(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Float.>(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Float.>=(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Float.>=(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Float.>=(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Float.>=(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Float.>=(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Float.>=(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Float.>=(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Float.+(String) with receiver = 2.0 and args = List(2 class java.lang.String): [class java.lang.String] =======> 2.02 +testing Float.+(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Float] =======> 4.0 +testing Float.+(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Float] =======> 4.0 +testing Float.+(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Float] =======> 4.0 +testing Float.+(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Float] =======> 4.0 +testing Float.+(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Float] =======> 4.0 +testing Float.+(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 4.0 +testing Float.+(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 4.0 +testing Float.-(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Float] =======> 0.0 +testing Float.-(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Float] =======> 0.0 +testing Float.-(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Float] =======> 0.0 +testing Float.-(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Float] =======> 0.0 +testing Float.-(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Float] =======> 0.0 +testing Float.-(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 0.0 +testing Float.-(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 0.0 +testing Float.*(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Float] =======> 4.0 +testing Float.*(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Float] =======> 4.0 +testing Float.*(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Float] =======> 4.0 +testing Float.*(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Float] =======> 4.0 +testing Float.*(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Float] =======> 4.0 +testing Float.*(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 4.0 +testing Float.*(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 4.0 +testing Float./(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Float] =======> 1.0 +testing Float./(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Float] =======> 1.0 +testing Float./(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Float] =======> 1.0 +testing Float./(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Float] =======> 1.0 +testing Float./(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Float] =======> 1.0 +testing Float./(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 1.0 +testing Float./(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 1.0 +testing Float.%(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Float] =======> 0.0 +testing Float.%(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Float] =======> 0.0 +testing Float.%(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Float] =======> 0.0 +testing Float.%(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Float] =======> 0.0 +testing Float.%(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Float] =======> 0.0 +testing Float.%(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 0.0 +testing Float.%(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 0.0 +============ +Double +it's important to print the list of Byte's members +if some of them change (possibly, adding and/or removing magic symbols), we must update this test +constructor Double: ()Double +method !=: (x$1: Any)Boolean +method !=: (x: Byte)Boolean +method !=: (x: Char)Boolean +method !=: (x: Double)Boolean +method !=: (x: Float)Boolean +method !=: (x: Int)Boolean +method !=: (x: Long)Boolean +method !=: (x: Short)Boolean +method ##: ()Int +method %: (x: Byte)Double +method %: (x: Char)Double +method %: (x: Double)Double +method %: (x: Float)Double +method %: (x: Int)Double +method %: (x: Long)Double +method %: (x: Short)Double +method *: (x: Byte)Double +method *: (x: Char)Double +method *: (x: Double)Double +method *: (x: Float)Double +method *: (x: Int)Double +method *: (x: Long)Double +method *: (x: Short)Double +method +: (x: Byte)Double +method +: (x: Char)Double +method +: (x: Double)Double +method +: (x: Float)Double +method +: (x: Int)Double +method +: (x: Long)Double +method +: (x: Short)Double +method +: (x: String)String +method -: (x: Byte)Double +method -: (x: Char)Double +method -: (x: Double)Double +method -: (x: Float)Double +method -: (x: Int)Double +method -: (x: Long)Double +method -: (x: Short)Double +method /: (x: Byte)Double +method /: (x: Char)Double +method /: (x: Double)Double +method /: (x: Float)Double +method /: (x: Int)Double +method /: (x: Long)Double +method /: (x: Short)Double +method <: (x: Byte)Boolean +method <: (x: Char)Boolean +method <: (x: Double)Boolean +method <: (x: Float)Boolean +method <: (x: Int)Boolean +method <: (x: Long)Boolean +method <: (x: Short)Boolean +method <=: (x: Byte)Boolean +method <=: (x: Char)Boolean +method <=: (x: Double)Boolean +method <=: (x: Float)Boolean +method <=: (x: Int)Boolean +method <=: (x: Long)Boolean +method <=: (x: Short)Boolean +method ==: (x$1: Any)Boolean +method ==: (x: Byte)Boolean +method ==: (x: Char)Boolean +method ==: (x: Double)Boolean +method ==: (x: Float)Boolean +method ==: (x: Int)Boolean +method ==: (x: Long)Boolean +method ==: (x: Short)Boolean +method >: (x: Byte)Boolean +method >: (x: Char)Boolean +method >: (x: Double)Boolean +method >: (x: Float)Boolean +method >: (x: Int)Boolean +method >: (x: Long)Boolean +method >: (x: Short)Boolean +method >=: (x: Byte)Boolean +method >=: (x: Char)Boolean +method >=: (x: Double)Boolean +method >=: (x: Float)Boolean +method >=: (x: Int)Boolean +method >=: (x: Long)Boolean +method >=: (x: Short)Boolean +method asInstanceOf: [T0]=> T0 +method equals: (x$1: Any)Boolean +method getClass: ()Class[Double] +method hashCode: ()Int +method isInstanceOf: [T0]=> Boolean +method toByte: => Byte +method toChar: => Char +method toDouble: => Double +method toFloat: => Float +method toInt: => Int +method toLong: => Long +method toShort: => Short +method toString: ()java.lang.String +method unary_+: => Double +method unary_-: => Double +testing Double.toByte() with receiver = 2.0 and args = List(): [class java.lang.Byte] =======> 2 +testing Double.toShort() with receiver = 2.0 and args = List(): [class java.lang.Short] =======> 2 +testing Double.toChar() with receiver = 2.0 and args = List(): [class java.lang.Character] =======>  +testing Double.toInt() with receiver = 2.0 and args = List(): [class java.lang.Integer] =======> 2 +testing Double.toLong() with receiver = 2.0 and args = List(): [class java.lang.Long] =======> 2 +testing Double.toFloat() with receiver = 2.0 and args = List(): [class java.lang.Float] =======> 2.0 +testing Double.toDouble() with receiver = 2.0 and args = List(): [class java.lang.Double] =======> 2.0 +testing Double.==(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Double.==(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Double.==(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Double.==(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Double.==(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Double.==(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Double.==(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Double.!=(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Double.!=(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Double.!=(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Double.!=(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Double.!=(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Double.!=(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Double.!=(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Double.<(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Double.<(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Double.<(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Double.<(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Double.<(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Double.<(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Double.<(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Double.<=(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Double.<=(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Double.<=(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Double.<=(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Double.<=(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Double.<=(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Double.<=(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Double.>(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Double.>(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Double.>(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Double.>(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Double.>(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Double.>(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Double.>(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Double.>=(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Double.>=(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Double.>=(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Double.>=(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Double.>=(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Double.>=(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Double.>=(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Double.+(String) with receiver = 2.0 and args = List(2 class java.lang.String): [class java.lang.String] =======> 2.02 +testing Double.+(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Double] =======> 4.0 +testing Double.+(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Double] =======> 4.0 +testing Double.+(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Double] =======> 4.0 +testing Double.+(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Double] =======> 4.0 +testing Double.+(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Double] =======> 4.0 +testing Double.+(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Double] =======> 4.0 +testing Double.+(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 4.0 +testing Double.-(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Double] =======> 0.0 +testing Double.-(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Double] =======> 0.0 +testing Double.-(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Double] =======> 0.0 +testing Double.-(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Double] =======> 0.0 +testing Double.-(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Double] =======> 0.0 +testing Double.-(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Double] =======> 0.0 +testing Double.-(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 0.0 +testing Double.*(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Double] =======> 4.0 +testing Double.*(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Double] =======> 4.0 +testing Double.*(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Double] =======> 4.0 +testing Double.*(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Double] =======> 4.0 +testing Double.*(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Double] =======> 4.0 +testing Double.*(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Double] =======> 4.0 +testing Double.*(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 4.0 +testing Double./(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Double] =======> 1.0 +testing Double./(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Double] =======> 1.0 +testing Double./(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Double] =======> 1.0 +testing Double./(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Double] =======> 1.0 +testing Double./(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Double] =======> 1.0 +testing Double./(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Double] =======> 1.0 +testing Double./(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 1.0 +testing Double.%(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Double] =======> 0.0 +testing Double.%(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Double] =======> 0.0 +testing Double.%(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Double] =======> 0.0 +testing Double.%(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Double] =======> 0.0 +testing Double.%(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Double] =======> 0.0 +testing Double.%(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Double] =======> 0.0 +testing Double.%(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 0.0 +============ +Boolean +it's important to print the list of Byte's members +if some of them change (possibly, adding and/or removing magic symbols), we must update this test +constructor Boolean: ()Boolean +method !=: (x$1: Any)Boolean +method !=: (x: Boolean)Boolean +method ##: ()Int +method &&: (x: Boolean)Boolean +method &: (x: Boolean)Boolean +method ==: (x$1: Any)Boolean +method ==: (x: Boolean)Boolean +method ^: (x: Boolean)Boolean +method asInstanceOf: [T0]=> T0 +method equals: (x$1: Any)Boolean +method getClass: ()Class[Boolean] +method hashCode: ()Int +method isInstanceOf: [T0]=> Boolean +method toString: ()java.lang.String +method unary_!: => Boolean +method |: (x: Boolean)Boolean +method ||: (x: Boolean)Boolean +testing Boolean.unary_!() with receiver = true and args = List(): [class java.lang.Boolean] =======> false +testing Boolean.==(Boolean) with receiver = true and args = List(true class java.lang.Boolean): [class java.lang.Boolean] =======> true +testing Boolean.!=(Boolean) with receiver = true and args = List(true class java.lang.Boolean): [class java.lang.Boolean] =======> false +testing Boolean.||(Boolean) with receiver = true and args = List(true class java.lang.Boolean): [class java.lang.Boolean] =======> true +testing Boolean.&&(Boolean) with receiver = true and args = List(true class java.lang.Boolean): [class java.lang.Boolean] =======> true +testing Boolean.|(Boolean) with receiver = true and args = List(true class java.lang.Boolean): [class java.lang.Boolean] =======> true +testing Boolean.&(Boolean) with receiver = true and args = List(true class java.lang.Boolean): [class java.lang.Boolean] =======> true +testing Boolean.^(Boolean) with receiver = true and args = List(true class java.lang.Boolean): [class java.lang.Boolean] =======> false +============ +Unit +it's important to print the list of Byte's members +if some of them change (possibly, adding and/or removing magic symbols), we must update this test +constructor Unit: ()Unit +method !=: (x$1: Any)Boolean +method ##: ()Int +method ==: (x$1: Any)Boolean +method asInstanceOf: [T0]=> T0 +method equals: (x$1: Any)Boolean +method getClass: ()Class[Unit] +method hashCode: ()Int +method isInstanceOf: [T0]=> Boolean +method toString: ()java.lang.String diff --git a/test/files/run/reflection-valueclasses-magic.scala b/test/files/run/reflection-valueclasses-magic.scala new file mode 100644 index 0000000000..f9feb2d504 --- /dev/null +++ b/test/files/run/reflection-valueclasses-magic.scala @@ -0,0 +1,110 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.universe.definitions._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.reflect.ClassTag + +object Test extends App { + def key(sym: Symbol) = { + sym match { + // initialize parameter symbols + case meth: MethodSymbol => meth.params.flatten.map(_.typeSignature) + } + sym + ": " + sym.typeSignature + } + + def convert(value: Any, tpe: Type) = { + import scala.runtime.BoxesRunTime._ + if (tpe =:= typeOf[Byte]) toByte(value) + else if (tpe =:= typeOf[Short]) toShort(value) + else if (tpe =:= typeOf[Char]) toCharacter(value) + else if (tpe =:= typeOf[Int]) toInteger(value) + else if (tpe =:= typeOf[Long]) toLong(value) + else if (tpe =:= typeOf[Float]) toFloat(value) + else if (tpe =:= typeOf[Double]) toDouble(value) + else if (tpe =:= typeOf[String]) value.toString + else if (tpe =:= typeOf[Boolean]) value.asInstanceOf[Boolean] + else throw new Exception(s"not supported: value = $value, tpe = $tpe") + } + + def test[T: ClassTag](tpe: Type, receiver: T, method: String, args: Any*) { + def wrap[T](op: => T) = + try { + var result = op.asInstanceOf[AnyRef] + if (scala.runtime.ScalaRunTime.isArray(result)) + result = scala.runtime.ScalaRunTime.toObjectArray(result).toList + println(s"[${result.getClass}] =======> $result") + } catch { + case ex: Throwable => + val realex = scala.reflect.runtime.ReflectionUtils.unwrapThrowable(ex) + println(realex.getClass + ": " + realex.getMessage) + } + val meth = tpe.declaration(newTermName(method).encodedName.toTermName) + val testees = if (meth.isMethod) List(meth.asMethod) else meth.asTerm.alternatives.map(_.asMethod) + testees foreach (testee => { + val convertedArgs = args.zipWithIndex.map { case (arg, i) => convert(arg, testee.params.flatten.apply(i).typeSignature) } + print(s"testing ${tpe.typeSymbol.name}.$method(${testee.params.flatten.map(_.typeSignature).mkString(','.toString)}) with receiver = $receiver and args = ${convertedArgs.map(arg => arg + ' '.toString + arg.getClass).toList}: ") + wrap(cm.reflect(receiver).reflectMethod(testee)(convertedArgs: _*)) + }) + } + def header(tpe: Type) { + println(s"============\n$tpe") + println("it's important to print the list of Byte's members") + println("if some of them change (possibly, adding and/or removing magic symbols), we must update this test") + tpe.members.toList.sortBy(key).foreach(sym => println(key(sym))) + } + + def testNumeric[T: ClassTag](tpe: Type, value: T) { + header(tpe) + List("toByte", "toShort", "toChar", "toInt", "toLong", "toFloat", "toDouble") foreach (meth => test(tpe, value, meth)) + test(tpe, value, "==", 2) + test(tpe, value, "!=", 2) + test(tpe, value, "<", 2) + test(tpe, value, "<=", 2) + test(tpe, value, ">", 2) + test(tpe, value, ">=", 2) + test(tpe, value, "+", 2) + test(tpe, value, "-", 2) + test(tpe, value, "*", 2) + test(tpe, value, "/", 2) + test(tpe, value, "%", 2) + } + + def testIntegral[T: ClassTag](tpe: Type, value: T) { + testNumeric(tpe, value) + test(tpe, value, "unary_~") + test(tpe, value, "unary_+") + test(tpe, value, "unary_-") + test(tpe, value, "<<", 2) + test(tpe, value, ">>", 2) + test(tpe, value, ">>>", 2) + test(tpe, value, "|", 2) + test(tpe, value, "&", 2) + test(tpe, value, "^", 2) + } + + def testBoolean() { + header(typeOf[Boolean]) + test(typeOf[Boolean], true, "unary_!") + test(typeOf[Boolean], true, "==", true) + test(typeOf[Boolean], true, "!=", true) + test(typeOf[Boolean], true, "||", true) + test(typeOf[Boolean], true, "&&", true) + test(typeOf[Boolean], true, "|", true) + test(typeOf[Boolean], true, "&", true) + test(typeOf[Boolean], true, "^", true) + } + + def testUnit() { + header(typeOf[Unit]) + } + + testNumeric(typeOf[Byte], 2.toByte) + testNumeric(typeOf[Short], 2.toShort) + testNumeric(typeOf[Char], 2.toChar) + testNumeric(typeOf[Int], 2.toInt) + testNumeric(typeOf[Long], 2.toLong) + testNumeric(typeOf[Float], 2.toFloat) + testNumeric(typeOf[Double], 2.toDouble) + testBoolean() + testUnit() +} \ No newline at end of file diff --git a/test/files/run/reflection-valueclasses-standard.check b/test/files/run/reflection-valueclasses-standard.check new file mode 100644 index 0000000000..060ab55406 --- /dev/null +++ b/test/files/run/reflection-valueclasses-standard.check @@ -0,0 +1,27 @@ +========byte======== +byte +2 +========short======== +short +2 +========int======== +int +2 +========long======== +long +2 +========float======== +float +2.0 +========double======== +double +2.0 +========char======== +char +2 +========boolean======== +boolean +true +========void======== +void +() diff --git a/test/files/run/reflection-valueclasses-standard.scala b/test/files/run/reflection-valueclasses-standard.scala new file mode 100644 index 0000000000..18a3d1fa04 --- /dev/null +++ b/test/files/run/reflection-valueclasses-standard.scala @@ -0,0 +1,21 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.reflect.{ClassTag, classTag} + +object Test extends App { + def test[T: ClassTag: TypeTag](x: T) = { + println(s"========${classTag[T].runtimeClass}========") + println(cm.reflect(x).reflectMethod(typeOf[T].member(newTermName("getClass")).asMethod)()) + println(cm.reflect(x).reflectMethod(typeOf[T].member(newTermName("toString")).asMethod)()) + } + + test(2.toByte) + test(2.toShort) + test(2.toInt) + test(2.toLong) + test(2.toFloat) + test(2.toDouble) + test('2') + test(true) + test(()) +} \ No newline at end of file -- cgit v1.2.3 From 3c4f4865f6420f98a7ed502257bc65387951e26c Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Mon, 6 Aug 2012 17:40:28 +0200 Subject: SI-6181 method mirrors now support by-name args Arguments provided in by-name positions are now automatically wrapped in Function0 instances by method mirrors. --- src/reflect/scala/reflect/runtime/JavaMirrors.scala | 10 ++++++++++ test/files/run/t6181.check | 1 + test/files/run/t6181.scala | 8 ++++++++ 3 files changed, 19 insertions(+) create mode 100644 test/files/run/t6181.check create mode 100644 test/files/run/t6181.scala (limited to 'test') diff --git a/src/reflect/scala/reflect/runtime/JavaMirrors.scala b/src/reflect/scala/reflect/runtime/JavaMirrors.scala index 3a18c60720..1698e99dae 100644 --- a/src/reflect/scala/reflect/runtime/JavaMirrors.scala +++ b/src/reflect/scala/reflect/runtime/JavaMirrors.scala @@ -21,6 +21,7 @@ import internal.Flags._ import ReflectionUtils.{singletonInstance} import language.existentials import scala.runtime.{ScalaRunTime, BoxesRunTime} +import scala.reflect.internal.util.Collections._ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: SymbolTable => @@ -262,6 +263,7 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym // rather than have them on a hot path them in a unified implementation of the `apply` method private def mkJavaMethodMirror[T: ClassTag](receiver: T, symbol: MethodSymbol): JavaMethodMirror = { if (isMagicMethod(symbol)) new JavaMagicMethodMirror(receiver, symbol) + else if (symbol.params.flatten exists (p => isByNameParamType(p.info))) new JavaByNameMethodMirror(receiver, symbol) else new JavaVanillaMethodMirror(receiver, symbol) } @@ -281,6 +283,14 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym def apply(args: Any*): Any = jmeth.invoke(receiver, args.asInstanceOf[Seq[AnyRef]]: _*) } + private class JavaByNameMethodMirror(val receiver: Any, symbol: MethodSymbol) + extends JavaMethodMirror(symbol) { + def apply(args: Any*): Any = { + val transformed = map2(args.toList, symbol.params.flatten)((arg, param) => if (isByNameParamType(param.info)) () => arg else arg) + jmeth.invoke(receiver, transformed.asInstanceOf[Seq[AnyRef]]: _*) + } + } + private class JavaMagicMethodMirror[T: ClassTag](val receiver: T, symbol: MethodSymbol) extends JavaMethodMirror(symbol) { def apply(args: Any*): Any = { diff --git a/test/files/run/t6181.check b/test/files/run/t6181.check new file mode 100644 index 0000000000..d8263ee986 --- /dev/null +++ b/test/files/run/t6181.check @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/test/files/run/t6181.scala b/test/files/run/t6181.scala new file mode 100644 index 0000000000..fb23eaff63 --- /dev/null +++ b/test/files/run/t6181.scala @@ -0,0 +1,8 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} + +object Test extends App { + class C { def test(x: => Int) = println(x) } + val mm = cm.reflect(new C).reflectMethod(typeOf[C].member(newTermName("test")).asMethod) + mm(2) +} \ No newline at end of file -- cgit v1.2.3 From 3cbe07f3e3ddb7201d1d174399d14d4a69df52fd Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Mon, 6 Aug 2012 17:55:12 +0200 Subject: sanity check for reflectConstructor In 911bbc4 I've completely overlooked the fact that reflectConstructor exists and that is also needs sanity checks. Now reflectConstructor checks that the incoming symbol is actually a ctor, and that it is actually a ctor of the class reflected by the current mirror. --- src/reflect/scala/reflect/runtime/JavaMirrors.scala | 9 +++++++-- test/files/run/reflection-sanitychecks.check | 4 ++++ test/files/run/reflection-sanitychecks.scala | 4 ++++ 3 files changed, 15 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/src/reflect/scala/reflect/runtime/JavaMirrors.scala b/src/reflect/scala/reflect/runtime/JavaMirrors.scala index 1698e99dae..f9407d5b1b 100644 --- a/src/reflect/scala/reflect/runtime/JavaMirrors.scala +++ b/src/reflect/scala/reflect/runtime/JavaMirrors.scala @@ -126,13 +126,14 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym private def ErrorStaticClass(wannabe: Symbol) = throw new ScalaReflectionException(s"$wannabe is a static class, use reflectClass on a RuntimeMirror to obtain its ClassMirror") private def ErrorStaticModule(wannabe: Symbol) = throw new ScalaReflectionException(s"$wannabe is a static module, use reflectModule on a RuntimeMirror to obtain its ModuleMirror") private def ErrorNotMember(wannabe: Symbol, owner: Symbol) = throw new ScalaReflectionException(s"expected a member of $owner, you provided ${wannabe.kind} ${wannabe.fullName}") - private def ErrorNotField(wannabe: Symbol) = throw new ScalaReflectionException(s"expected a field or an accessor method symbol, you provided $wannabe}") + private def ErrorNotField(wannabe: Symbol) = throw new ScalaReflectionException(s"expected a field or an accessor method symbol, you provided $wannabe") private def ErrorNonExistentField(wannabe: Symbol) = throw new ScalaReflectionException(s""" |Scala field ${wannabe.name} isn't represented as a Java field, neither it has a Java accessor method |note that private parameters of class constructors don't get mapped onto fields and/or accessors, |unless they are used outside of their declaring constructors. """.trim.stripMargin) private def ErrorSetImmutableField(wannabe: Symbol) = throw new ScalaReflectionException(s"cannot set an immutable field ${wannabe.name}") + private def ErrorNotConstructor(wannabe: Symbol, owner: Symbol) = throw new ScalaReflectionException(s"expected a constructor of $owner, you provided $wannabe") def reflect[T: ClassTag](obj: T): InstanceMirror = new JavaInstanceMirror(obj) @@ -379,7 +380,11 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym extends JavaTemplateMirror with ClassMirror { def erasure = symbol def isStatic = false - def reflectConstructor(constructor: MethodSymbol) = new JavaConstructorMirror(outer, constructor) + def reflectConstructor(constructor: MethodSymbol) = { + if (!constructor.isClassConstructor) ErrorNotConstructor(constructor, symbol) + if (!symbol.info.decls.toList.contains(constructor)) ErrorNotConstructor(constructor, symbol) + new JavaConstructorMirror(outer, constructor) + } def companion: Option[ModuleMirror] = symbol.companionModule match { case module: ModuleSymbol => Some(new JavaModuleMirror(outer, module)) case _ => None diff --git a/test/files/run/reflection-sanitychecks.check b/test/files/run/reflection-sanitychecks.check index d977e0ed66..4881285bc0 100644 --- a/test/files/run/reflection-sanitychecks.check +++ b/test/files/run/reflection-sanitychecks.check @@ -1,8 +1,12 @@ field: 1 method: 2 +constructor #1: scala.ScalaReflectionException: expected a constructor of class C, you provided method bar +constructor #2: an instance of class C class: CC object: java.lang.Error: inner and nested modules are not supported yet field: scala.ScalaReflectionException: expected a member of class C, you provided value D.foo method: scala.ScalaReflectionException: expected a member of class C, you provided method D.bar +constructor #1: scala.ScalaReflectionException: expected a constructor of class C, you provided method bar +constructor #2: scala.ScalaReflectionException: expected a constructor of class C, you provided constructor D class: scala.ScalaReflectionException: expected a member of class C, you provided class D.C object: scala.ScalaReflectionException: expected a member of class C, you provided object D.O diff --git a/test/files/run/reflection-sanitychecks.scala b/test/files/run/reflection-sanitychecks.scala index e95d130460..b0982fc2fc 100644 --- a/test/files/run/reflection-sanitychecks.scala +++ b/test/files/run/reflection-sanitychecks.scala @@ -3,6 +3,7 @@ class C { def bar = 2 class C { override def toString = "CC" } object O { override def toString = "CO" } + override def toString = "an instance of class C" } class D { @@ -10,6 +11,7 @@ class D { def bar = 4 class C { override def toString = "DC" } object O { override def toString = "DO" } + override def toString = "an instance of class D" } object Test extends App { @@ -21,6 +23,8 @@ object Test extends App { def failsafe(action: => Any): Any = try action catch { case ex: Throwable => ex.toString } println("field: " + failsafe(im.reflectField(tpe.member(newTermName("foo")).asTerm).get)) println("method: " + failsafe(im.reflectMethod(tpe.member(newTermName("bar")).asMethod)())) + println("constructor #1: " + failsafe(cm.reflectClass(im.symbol).reflectConstructor(tpe.member(newTermName("bar")).asMethod)())) + println("constructor #2: " + failsafe(cm.reflectClass(im.symbol).reflectConstructor(tpe.member(newTermName("")).asMethod)())) println("class: " + failsafe(im.reflectClass(tpe.member(newTypeName("C")).asClass).reflectConstructor(typeOf[C].member(newTypeName("C")).asClass.typeSignature.member(newTermName("")).asMethod)())) println("object: " + failsafe(im.reflectModule(tpe.member(newTermName("O")).asModule).instance)) } -- cgit v1.2.3 From 7bcb9da47362ba862a695f7c82c0095a8205e3e2 Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Mon, 6 Aug 2012 19:37:07 +0200 Subject: mirrors now support overriden fields and methods Previously `checkMemberOf` was blocking base fields and methods that are overriden in receiver.getClass. Now this is fixed. The fix also uncovered an issue with field mirrors. Currently their `get` and `set` methods don't respect overriding and always return field values from a base class. After discussing this on a reflection meeting, we decided that this behavior is desirable and that for overriding people should use reflectMethod and then apply on getters/setters. See the discussion at: https://github.com/scala/scala/pull/1054. --- src/reflect/scala/reflect/api/Mirrors.scala | 16 +++++++++ .../scala/reflect/runtime/JavaMirrors.scala | 6 +++- test/files/run/reflection-sanitychecks.check | 42 +++++++++++++++------- test/files/run/reflection-sanitychecks.scala | 35 ++++++++++++------ 4 files changed, 76 insertions(+), 23 deletions(-) (limited to 'test') diff --git a/src/reflect/scala/reflect/api/Mirrors.scala b/src/reflect/scala/reflect/api/Mirrors.scala index 41acd73492..8f69ab526b 100644 --- a/src/reflect/scala/reflect/api/Mirrors.scala +++ b/src/reflect/scala/reflect/api/Mirrors.scala @@ -33,6 +33,14 @@ trait Mirrors { self: Universe => /** Reflects against a field symbol and returns a mirror * that can be used to get and, if appropriate, set the value of the field. * + * FieldMirrors are the only way to get at private[this] vals and vars and + * might be useful to inspect the data of underlying Java fields. + * For all other uses, it's better to go through the fields accessor. + * + * In particular, there should be no need to ever access a field mirror + * when reflecting on just the public members of a class or trait. + * Note also that only accessor MethodMirrors, but not FieldMirrors will accurately reflect overriding behavior. + * * To get a field symbol by the name of the field you would like to reflect, * use `.symbol.typeSignature.member(newTermName()).asTerm.accessed`. * For further information about member lookup refer to `Symbol.typeSignature`. @@ -107,6 +115,10 @@ trait Mirrors { self: Universe => * Scala reflection uses reflection capabilities of the underlying platform, * so `FieldMirror.get` might throw platform-specific exceptions associated * with getting a field or invoking a getter method of the field. + * + * If `symbol` represents a field of a base class with respect to the class of the receiver, + * and this base field is overriden in the class of the receiver, then this method will retrieve + * the value of the base field. To achieve overriding behavior, use reflectMethod on an accessor. */ def get: Any @@ -117,6 +129,10 @@ trait Mirrors { self: Universe => * Scala reflection uses reflection capabilities of the underlying platform, * so `FieldMirror.get` might throw platform-specific exceptions associated * with setting a field or invoking a setter method of the field. + * + * If `symbol` represents a field of a base class with respect to the class of the receiver, + * and this base field is overriden in the class of the receiver, then this method will set + * the value of the base field. To achieve overriding behavior, use reflectMethod on an accessor. */ def set(value: Any): Unit } diff --git a/src/reflect/scala/reflect/runtime/JavaMirrors.scala b/src/reflect/scala/reflect/runtime/JavaMirrors.scala index f9407d5b1b..d671225c37 100644 --- a/src/reflect/scala/reflect/runtime/JavaMirrors.scala +++ b/src/reflect/scala/reflect/runtime/JavaMirrors.scala @@ -161,7 +161,11 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym } else if (wannabe.owner == AnyValClass) { if (!owner.isPrimitiveValueClass && !owner.isDerivedValueClass) ErrorNotMember(wannabe, owner) } else { - if (!owner.info.member(wannabe.name).alternatives.contains(wannabe)) ErrorNotMember(wannabe, owner) + def isMemberOf(wannabe: Symbol, owner: ClassSymbol): Boolean = { + val isNonShadowedMember = owner.info.member(wannabe.name).alternatives.contains(wannabe) + isNonShadowedMember || owner.info.baseClasses.tail.exists(base => isMemberOf(wannabe, base.asClass)) + } + if (!isMemberOf(wannabe, owner)) ErrorNotMember(wannabe, owner) } } diff --git a/test/files/run/reflection-sanitychecks.check b/test/files/run/reflection-sanitychecks.check index 4881285bc0..a1df486b51 100644 --- a/test/files/run/reflection-sanitychecks.check +++ b/test/files/run/reflection-sanitychecks.check @@ -1,12 +1,30 @@ -field: 1 -method: 2 -constructor #1: scala.ScalaReflectionException: expected a constructor of class C, you provided method bar -constructor #2: an instance of class C -class: CC -object: java.lang.Error: inner and nested modules are not supported yet -field: scala.ScalaReflectionException: expected a member of class C, you provided value D.foo -method: scala.ScalaReflectionException: expected a member of class C, you provided method D.bar -constructor #1: scala.ScalaReflectionException: expected a constructor of class C, you provided method bar -constructor #2: scala.ScalaReflectionException: expected a constructor of class C, you provided constructor D -class: scala.ScalaReflectionException: expected a member of class C, you provided class D.C -object: scala.ScalaReflectionException: expected a member of class C, you provided object D.O +=========members of C in a mirror of D========= +field #1: 11 +method #1: 22 +field #2: 13 +method #2: 14 +constructor #1: scala.ScalaReflectionException: expected a constructor of class D, you provided method bar +constructor #2: scala.ScalaReflectionException: expected a constructor of class D, you provided constructor C +class: CC +object: java.lang.Error: inner and nested modules are not supported yet + +=========members of D in a mirror of D========= +field #1: 21 +method #1: 22 +field #2: 13 +method #2: 14 +constructor #1: scala.ScalaReflectionException: expected a constructor of class D, you provided method bar +constructor #2: an instance of class D +class: CC +object: java.lang.Error: inner and nested modules are not supported yet + +=========members of E in a mirror of D========= +field #1: scala.ScalaReflectionException: expected a member of class D, you provided value E.foo +method #1: scala.ScalaReflectionException: expected a member of class D, you provided method E.bar +field #2: scala.ScalaReflectionException: expected a member of class D, you provided value E.quux +method #2: scala.ScalaReflectionException: expected a member of class D, you provided method E.baz +constructor #1: scala.ScalaReflectionException: expected a constructor of class D, you provided method bar +constructor #2: scala.ScalaReflectionException: expected a constructor of class D, you provided constructor E +class: scala.ScalaReflectionException: expected a member of class D, you provided class E.C +object: scala.ScalaReflectionException: expected a member of class D, you provided object E.O + diff --git a/test/files/run/reflection-sanitychecks.scala b/test/files/run/reflection-sanitychecks.scala index b0982fc2fc..f817f23731 100644 --- a/test/files/run/reflection-sanitychecks.scala +++ b/test/files/run/reflection-sanitychecks.scala @@ -1,34 +1,49 @@ class C { - val foo = 1 - def bar = 2 + val foo = 11 + def bar = 12 + val quux = 13 + def baz = 14 class C { override def toString = "CC" } object O { override def toString = "CO" } override def toString = "an instance of class C" } -class D { - val foo = 3 - def bar = 4 - class C { override def toString = "DC" } - object O { override def toString = "DO" } +class D extends C { + override val foo = 21 + override def bar = 22 override def toString = "an instance of class D" } +class E { + val foo = 31 + def bar = 32 + val quux = 33 + def baz = 34 + class C { override def toString = "EC" } + object O { override def toString = "EO" } + override def toString = "an instance of class E" +} + object Test extends App { import scala.reflect.runtime.universe._ import scala.reflect.runtime.{currentMirror => cm} - val im = cm.reflect(new C) + val im = cm.reflect(new D) def test(tpe: Type): Unit = { def failsafe(action: => Any): Any = try action catch { case ex: Throwable => ex.toString } - println("field: " + failsafe(im.reflectField(tpe.member(newTermName("foo")).asTerm).get)) - println("method: " + failsafe(im.reflectMethod(tpe.member(newTermName("bar")).asMethod)())) + println(s"=========members of ${tpe.typeSymbol.name} in a mirror of D=========") + println("field #1: " + failsafe(im.reflectField(tpe.member(newTermName("foo")).asTerm).get)) + println("method #1: " + failsafe(im.reflectMethod(tpe.member(newTermName("bar")).asMethod)())) + println("field #2: " + failsafe(im.reflectField(tpe.member(newTermName("quux")).asTerm).get)) + println("method #2: " + failsafe(im.reflectMethod(tpe.member(newTermName("baz")).asMethod)())) println("constructor #1: " + failsafe(cm.reflectClass(im.symbol).reflectConstructor(tpe.member(newTermName("bar")).asMethod)())) println("constructor #2: " + failsafe(cm.reflectClass(im.symbol).reflectConstructor(tpe.member(newTermName("")).asMethod)())) println("class: " + failsafe(im.reflectClass(tpe.member(newTypeName("C")).asClass).reflectConstructor(typeOf[C].member(newTypeName("C")).asClass.typeSignature.member(newTermName("")).asMethod)())) println("object: " + failsafe(im.reflectModule(tpe.member(newTermName("O")).asModule).instance)) + println() } test(typeOf[C]) test(typeOf[D]) + test(typeOf[E]) } \ No newline at end of file -- cgit v1.2.3 From cac52ac3e3bd34dfc6540968c30d3e861799f9e4 Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Mon, 6 Aug 2012 21:53:42 +0200 Subject: SI-6199 unit-returning methods now return unit Since Scala reflection relies on Java reflection to perform member invocations, it inherits some of the quirks of the underlying platform. One of such quirks is returning null when invoking a void-returning method. This is now fixed by introducing a check after calling invoke. --- src/compiler/scala/tools/reflect/ToolBoxFactory.scala | 3 ++- src/reflect/scala/reflect/runtime/JavaMirrors.scala | 12 +++++++++--- test/files/run/reflection-magicsymbols-invoke.check | 2 +- test/files/run/t6199-mirror.check | 1 + test/files/run/t6199-mirror.scala | 7 +++++++ test/files/run/t6199-toolbox.check | 1 + test/files/run/t6199-toolbox.scala | 8 ++++++++ 7 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 test/files/run/t6199-mirror.check create mode 100644 test/files/run/t6199-mirror.scala create mode 100644 test/files/run/t6199-toolbox.check create mode 100644 test/files/run/t6199-toolbox.scala (limited to 'test') diff --git a/src/compiler/scala/tools/reflect/ToolBoxFactory.scala b/src/compiler/scala/tools/reflect/ToolBoxFactory.scala index 9987931cf3..eeec973299 100644 --- a/src/compiler/scala/tools/reflect/ToolBoxFactory.scala +++ b/src/compiler/scala/tools/reflect/ToolBoxFactory.scala @@ -256,7 +256,8 @@ abstract class ToolBoxFactory[U <: JavaUniverse](val u: U) { factorySelf => // } val (singleton, jmeth) = compileExpr(expr) val result = jmeth.invoke(singleton, thunks map (_.asInstanceOf[AnyRef]): _*) - result + if (jmeth.getReturnType == java.lang.Void.TYPE) () + else result } def parseExpr(code: String): Tree = { diff --git a/src/reflect/scala/reflect/runtime/JavaMirrors.scala b/src/reflect/scala/reflect/runtime/JavaMirrors.scala index d671225c37..e48c933584 100644 --- a/src/reflect/scala/reflect/runtime/JavaMirrors.scala +++ b/src/reflect/scala/reflect/runtime/JavaMirrors.scala @@ -280,19 +280,25 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym jmeth } + def jinvoke(jmeth: jMethod, receiver: Any, args: Seq[Any]): Any = { + val result = jmeth.invoke(receiver, args.asInstanceOf[Seq[AnyRef]]: _*) + if (jmeth.getReturnType == java.lang.Void.TYPE) () + else result + } + override def toString = s"method mirror for ${showMethodSig(symbol)} (bound to $receiver)" } private class JavaVanillaMethodMirror(val receiver: Any, symbol: MethodSymbol) extends JavaMethodMirror(symbol) { - def apply(args: Any*): Any = jmeth.invoke(receiver, args.asInstanceOf[Seq[AnyRef]]: _*) + def apply(args: Any*): Any = jinvoke(jmeth, receiver, args) } private class JavaByNameMethodMirror(val receiver: Any, symbol: MethodSymbol) extends JavaMethodMirror(symbol) { def apply(args: Any*): Any = { val transformed = map2(args.toList, symbol.params.flatten)((arg, param) => if (isByNameParamType(param.info)) () => arg else arg) - jmeth.invoke(receiver, transformed.asInstanceOf[Seq[AnyRef]]: _*) + jinvoke(jmeth, receiver, transformed) } } @@ -321,7 +327,7 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym def invokeMagicPrimitiveMethod = { val jmeths = classOf[BoxesRunTime].getDeclaredMethods.filter(_.getName == nme.primitiveMethodName(symbol.name).toString) assert(jmeths.length == 1, jmeths.toList) - jmeths.head.invoke(null, (objReceiver +: objArgs): _*) + jinvoke(jmeths.head, null, objReceiver +: objArgs) } symbol match { diff --git a/test/files/run/reflection-magicsymbols-invoke.check b/test/files/run/reflection-magicsymbols-invoke.check index a180ed806e..674716adfe 100644 --- a/test/files/run/reflection-magicsymbols-invoke.check +++ b/test/files/run/reflection-magicsymbols-invoke.check @@ -68,7 +68,7 @@ testing Object.==: true testing Object.clone: class java.lang.CloneNotSupportedException: java.lang.String testing Object.eq: true testing Object.equals: true -testing Object.finalize: null +testing Object.finalize: () testing Object.getClass: class java.lang.String testing Object.hashCode: 50 testing Object.ne: false diff --git a/test/files/run/t6199-mirror.check b/test/files/run/t6199-mirror.check new file mode 100644 index 0000000000..ec969b5b93 --- /dev/null +++ b/test/files/run/t6199-mirror.check @@ -0,0 +1 @@ +() diff --git a/test/files/run/t6199-mirror.scala b/test/files/run/t6199-mirror.scala new file mode 100644 index 0000000000..772a384542 --- /dev/null +++ b/test/files/run/t6199-mirror.scala @@ -0,0 +1,7 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} + +object Test extends App { + class C { def foo = () } + println(cm.reflect(new C).reflectMethod(typeOf[C].member(newTermName("foo")).asMethod)()) +} \ No newline at end of file diff --git a/test/files/run/t6199-toolbox.check b/test/files/run/t6199-toolbox.check new file mode 100644 index 0000000000..ec969b5b93 --- /dev/null +++ b/test/files/run/t6199-toolbox.check @@ -0,0 +1 @@ +() diff --git a/test/files/run/t6199-toolbox.scala b/test/files/run/t6199-toolbox.scala new file mode 100644 index 0000000000..14670f8e21 --- /dev/null +++ b/test/files/run/t6199-toolbox.scala @@ -0,0 +1,8 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends App { + val tb = cm.mkToolBox() + println(tb.runExpr(Literal(Constant(())))) +} \ No newline at end of file -- cgit v1.2.3