From cb7fe71fdf2fc7bf79cb231d2aabc82892d00140 Mon Sep 17 00:00:00 2001 From: extempore Date: Wed, 22 Jun 2011 22:00:53 +0000 Subject: [PATCH] Everything builds for me, but apparently not for jenkins. First attempt to solve mystery: explicitly set return type of Any#getClass() to Class[_ <: Any] rather than allowing java's to be used. I'm guessing that somehow it materializes as Class[_ <: Any] sometimes and Class[_ <: AnyRef] other times. Review by moors. git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@25138 5e8d7ff9-d8ef-0310-90f0-a4852d11357a --- src/compiler/scala/reflect/internal/Definitions.scala | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/compiler/scala/reflect/internal/Definitions.scala b/src/compiler/scala/reflect/internal/Definitions.scala index 77146b746..30e47ec2c 100644 --- a/src/compiler/scala/reflect/internal/Definitions.scala +++ b/src/compiler/scala/reflect/internal/Definitions.scala @@ -832,10 +832,13 @@ trait Definitions /*extends reflect.generic.StandardDefinitions*/ { // Since getClass is not actually a polymorphic method, this requires compiler // participation. At the "Any" level, the return type is Class[_] as it is in // java.lang.Object. Java also special cases the return type. - Any_getClass = ( - newMethod(AnyClass, nme.getClass_, Nil, getMember(ObjectClass, nme.getClass_).tpe.resultType) - setFlag DEFERRED - ) + Any_getClass = { + val eparams = typeParamsToExistentials(ClassClass, ClassClass.typeParams) + eparams.head setInfo TypeBounds.empty + val tpe = existentialAbstraction(eparams, appliedType(ClassClass.tpe, List(eparams.head.tpe))) + + newMethod(AnyClass, nme.getClass_, Nil, tpe) setFlag DEFERRED + } Any_isInstanceOf = newPolyMethod( AnyClass, nme.isInstanceOf_, tparam => NullaryMethodType(booltype)) setFlag FINAL Any_asInstanceOf = newPolyMethod(