From be493483b55548f06b5bebff689b99208272a4a9 Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Wed, 3 Oct 2012 23:22:53 +0200 Subject: removes extraneous methods from api.Mirrors We decided to give up on providing symbol table traversal facilities in the current incarnation of mirrors. Let's be consistent with ourselves. --- src/reflect/scala/reflect/api/Mirrors.scala | 31 ---------------------- .../scala/reflect/runtime/JavaMirrors.scala | 11 +------- 2 files changed, 1 insertion(+), 41 deletions(-) (limited to 'src') diff --git a/src/reflect/scala/reflect/api/Mirrors.scala b/src/reflect/scala/reflect/api/Mirrors.scala index bff899daa4..bfd60dfba0 100644 --- a/src/reflect/scala/reflect/api/Mirrors.scala +++ b/src/reflect/scala/reflect/api/Mirrors.scala @@ -166,9 +166,6 @@ trait Mirrors { self: Universe => /** A mirror that reflects the instance or static parts of a runtime class */ trait TemplateMirror { - /** The runtime class reflected by this mirror */ - def runtimeClass: RuntimeClass - /** True if the mirror represents the static part * of a runtime class or the companion object of a Scala class. * One has: @@ -180,18 +177,6 @@ trait Mirrors { self: Universe => /** The Scala symbol corresponding to the reflected runtime class or object */ def symbol: Symbol - - /** Optionally, the mirror of the companion reflected by this mirror. - * If this mirror reflects a Scala object, the mirror for the companion class, or None - * if the mirror represents a Scala object that comes without a class. - * Otherwise, if the mirror represents the static part of a runtime class, the - * mirror representing the instance part of the same class. - * Otherwise, if the mirror represents a Scala instance class, the mirror for the companion - * object of that class, or None if no such object exists. - * Otherwise, if the mirror represents a runtime instance class, a mirror representing the static - * part of the same class. - */ - def companion: Option[TemplateMirror] } /** A mirror that reflects a Scala object definition or the static parts of a runtime class */ @@ -205,14 +190,6 @@ trait Mirrors { self: Universe => * If this mirror reflects the static part of a runtime class, returns `null`. */ def instance: Any - - /** Optionally, the mirror of the companion class if the object reflected by this mirror. - * If this mirror reflects a Scala object, the mirror for the companion class, or None - * if the mirror represents a Scala object that comes without a class. - * Otherwise, if the mirror represents the static part of a runtime class, the - * mirror representing the instance part of the same class. - */ - override def companion: Option[ClassMirror] } /** A mirror that reflects the instance parts of a runtime class */ @@ -232,14 +209,6 @@ trait Mirrors { self: Universe => * It must be a member (declared or inherited) of the class underlying this mirror. */ def reflectConstructor(constructor: MethodSymbol): MethodMirror - - /** Optionally, the mirror of the companion object of the class reflected by this mirror. - * If this mirror represents a Scala instance class, the mirror for the companion - * object of that class, or None if no such object exists. - * Otherwise, if the mirror represents a runtime instance class, a mirror representing the static - * part of the same class. - */ - override def companion: Option[ModuleMirror] } /** A mirror that reflects instances and static classes */ diff --git a/src/reflect/scala/reflect/runtime/JavaMirrors.scala b/src/reflect/scala/reflect/runtime/JavaMirrors.scala index b917eac779..e5ff9d62f2 100644 --- a/src/reflect/scala/reflect/runtime/JavaMirrors.scala +++ b/src/reflect/scala/reflect/runtime/JavaMirrors.scala @@ -446,8 +446,7 @@ private[reflect] trait JavaMirrors extends internal.SymbolTable with api.JavaUni extends TemplateMirror { def outer: AnyRef def erasure: ClassSymbol - lazy val runtimeClass = classToJava(erasure) - lazy val signature = typeToScala(runtimeClass) + lazy val signature = typeToScala(classToJava(erasure)) } private class JavaClassMirror(val outer: AnyRef, val symbol: ClassSymbol) @@ -458,10 +457,6 @@ private[reflect] trait JavaMirrors extends internal.SymbolTable with api.JavaUni checkConstructorOf(constructor, symbol) new JavaConstructorMirror(outer, constructor) } - def companion: Option[ModuleMirror] = symbol.companionModule match { - case module: ModuleSymbol => Some(new JavaModuleMirror(outer, module)) - case _ => None - } override def toString = s"class mirror for ${symbol.fullName} (bound to $outer)" } @@ -476,10 +471,6 @@ private[reflect] trait JavaMirrors extends internal.SymbolTable with api.JavaUni if (outer == null) staticSingletonInstance(classToJava(symbol.moduleClass.asClass)) else innerSingletonInstance(outer, symbol.name) } - def companion: Option[ClassMirror] = symbol.companionClass match { - case cls: ClassSymbol => Some(new JavaClassMirror(outer, cls)) - case _ => None - } override def toString = s"module mirror for ${symbol.fullName} (bound to $outer)" } -- cgit v1.2.3