diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/reflect/scala/reflect/api/Mirrors.scala | 2 | ||||
-rw-r--r-- | src/reflect/scala/reflect/runtime/JavaMirrors.scala | 6 |
2 files changed, 3 insertions, 5 deletions
diff --git a/src/reflect/scala/reflect/api/Mirrors.scala b/src/reflect/scala/reflect/api/Mirrors.scala index 8f69ab526b..f2f96645e3 100644 --- a/src/reflect/scala/reflect/api/Mirrors.scala +++ b/src/reflect/scala/reflect/api/Mirrors.scala @@ -242,6 +242,8 @@ 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. */ + // we need a ClassTag here to preserve boxity of primitives + // the class tag lets us tell apart `mirror.reflect(2)` and `mirror.reflect(new Integer(2))` def reflect[T: ClassTag](obj: T): InstanceMirror /** Reflects against a static class symbol and returns a mirror diff --git a/src/reflect/scala/reflect/runtime/JavaMirrors.scala b/src/reflect/scala/reflect/runtime/JavaMirrors.scala index e48c933584..2bf57d61cc 100644 --- a/src/reflect/scala/reflect/runtime/JavaMirrors.scala +++ b/src/reflect/scala/reflect/runtime/JavaMirrors.scala @@ -161,11 +161,7 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym } else if (wannabe.owner == AnyValClass) { if (!owner.isPrimitiveValueClass && !owner.isDerivedValueClass) ErrorNotMember(wannabe, owner) } else { - 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) + if (!(owner.info.baseClasses contains wannabe.owner)) ErrorNotMember(wannabe, owner) } } |