Skip to content

Commit

Permalink
pullrequest feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
xeno-by committed Feb 4, 2013
1 parent adf50a3 commit 0bcdf71
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1042,6 +1042,7 @@ abstract class ClassfileParser {
def parseExceptions(len: Int) { def parseExceptions(len: Int) {
val nClasses = in.nextChar val nClasses = in.nextChar
for (n <- 0 until nClasses) { for (n <- 0 until nClasses) {
// FIXME: this performs an equivalent of getExceptionTypes instead of getGenericExceptionTypes (SI-7065)
val cls = pool.getClassSymbol(in.nextChar.toInt) val cls = pool.getClassSymbol(in.nextChar.toInt)
sym.addThrowsAnnotation(cls) sym.addThrowsAnnotation(cls)
} }
Expand Down
10 changes: 5 additions & 5 deletions src/reflect/scala/reflect/internal/AnnotationInfos.scala
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ trait AnnotationInfos extends api.Annotations { self: SymbolTable =>
case ThrownException(exc) => exc case ThrownException(exc) => exc
} }


def addThrowsAnnotation(excSym: Symbol): Self = { def addThrowsAnnotation(throwableSym: Symbol): Self = {
val excTpe = if (excSym.isMonomorphicType) excSym.tpe else { val throwableTpe = if (throwableSym.isMonomorphicType) throwableSym.tpe else {
debuglog(s"Encountered polymorphic exception `${excSym.fullName}` while parsing class file.") debuglog(s"Encountered polymorphic exception `${throwableSym.fullName}` while parsing class file.")
// in case we encounter polymorphic exception the best we can do is to convert that type to // in case we encounter polymorphic exception the best we can do is to convert that type to
// monomorphic one by introducing existentials, see SI-7009 for details // monomorphic one by introducing existentials, see SI-7009 for details
existentialAbstraction(excSym.typeParams, excSym.tpe) existentialAbstraction(throwableSym.typeParams, throwableSym.tpe)
} }
val throwsAnn = AnnotationInfo(appliedType(definitions.ThrowsClass, excTpe), List(Literal(Constant(excTpe))), Nil) val throwsAnn = AnnotationInfo(appliedType(definitions.ThrowsClass, throwableTpe), List(Literal(Constant(throwableTpe))), Nil)
withAnnotations(List(throwsAnn)) withAnnotations(List(throwsAnn))
} }


Expand Down
2 changes: 1 addition & 1 deletion src/reflect/scala/reflect/runtime/JavaMirrors.scala
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ private[reflect] trait JavaMirrors extends internal.SymbolTable with api.JavaUni
*/ */
private def copyAnnotations(sym: Symbol, jann: AnnotatedElement) { private def copyAnnotations(sym: Symbol, jann: AnnotatedElement) {
sym setAnnotations (jann.getAnnotations map JavaAnnotationProxy).toList sym setAnnotations (jann.getAnnotations map JavaAnnotationProxy).toList
// FIXME: we're not using getGenericExceptionTypes here to be consistent with ClassfileParser // SI-7065: we're not using getGenericExceptionTypes here to be consistent with ClassfileParser
val jexTpes = jann match { val jexTpes = jann match {
case jm: jMethod => jm.getExceptionTypes.toList case jm: jMethod => jm.getExceptionTypes.toList
case jconstr: jConstructor[_] => jconstr.getExceptionTypes.toList case jconstr: jConstructor[_] => jconstr.getExceptionTypes.toList
Expand Down

0 comments on commit 0bcdf71

Please sign in to comment.