diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2013-07-23 17:52:56 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2013-07-23 19:48:09 +0200 |
commit | 2864c7f2d744661b2ffc528c1180ad0596a07483 (patch) | |
tree | 2a1619677087adad03057b7021f2efbe53095ed2 /src | |
parent | fc4b464faeb43c3e2917b11a95c4f84481c443f7 (diff) | |
download | scala-2864c7f2d744661b2ffc528c1180ad0596a07483.tar.gz scala-2864c7f2d744661b2ffc528c1180ad0596a07483.tar.bz2 scala-2864c7f2d744661b2ffc528c1180ad0596a07483.zip |
brings JavaMirrors up to speed with ClassfileParser
Apparently there are still discrepancies between how the vanilla compiler
turns class files into symbols and how the reflective compiler does it.
Working on bringing these guys in sync, one bug at a time.
Diffstat (limited to 'src')
-rw-r--r-- | src/reflect/scala/reflect/runtime/JavaMirrors.scala | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/reflect/scala/reflect/runtime/JavaMirrors.scala b/src/reflect/scala/reflect/runtime/JavaMirrors.scala index 55f08f0586..9ecc5c6084 100644 --- a/src/reflect/scala/reflect/runtime/JavaMirrors.scala +++ b/src/reflect/scala/reflect/runtime/JavaMirrors.scala @@ -673,8 +673,10 @@ private[reflect] trait JavaMirrors extends internal.SymbolTable with api.JavaUni val parents = try { parentsLevel += 1 val jsuperclazz = jclazz.getGenericSuperclass - val superclazz = if (jsuperclazz == null) AnyClass.tpe else typeToScala(jsuperclazz) - superclazz :: (jclazz.getGenericInterfaces.toList map typeToScala) + val ifaces = jclazz.getGenericInterfaces.toList map typeToScala + val isAnnotation = (jclazz.getModifiers & JAVA_ACC_ANNOTATION) != 0 + if (isAnnotation) AnnotationClass.tpe :: ClassfileAnnotationClass.tpe :: ifaces + else (if (jsuperclazz == null) AnyClass.tpe else typeToScala(jsuperclazz)) :: ifaces } finally { parentsLevel -= 1 } @@ -686,6 +688,11 @@ private[reflect] trait JavaMirrors extends internal.SymbolTable with api.JavaUni def enter(sym: Symbol, mods: Int) = (if (jModifier.isStatic(mods)) module.moduleClass else clazz).info.decls enter sym + def enterEmptyCtorIfNecessary(): Unit = { + if (jclazz.getConstructors.isEmpty) + clazz.info.decls.enter(clazz.newClassConstructor(NoPosition)) + } + for (jinner <- jclazz.getDeclaredClasses) { jclassAsScala(jinner) // inner class is entered as a side-effect // no need to call enter explicitly @@ -702,6 +709,8 @@ private[reflect] trait JavaMirrors extends internal.SymbolTable with api.JavaUni for (jconstr <- jclazz.getConstructors) enter(jconstrAsScala(jconstr), jconstr.getModifiers) + enterEmptyCtorIfNecessary() + } :: pendingLoadActions if (parentsLevel == 0) { |