summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/GenICode.scala12
-rw-r--r--test/files/run/exceptions-2.check18
-rw-r--r--test/files/run/exceptions-2.scala3
3 files changed, 9 insertions, 24 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
index 19dc40af97..84ae7f7cde 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
@@ -436,15 +436,15 @@ abstract class GenICode extends SubComponent {
case Typed(Ident(nme.WILDCARD), tpt) => Pair(tpt.tpe.symbol, {
ctx: Context =>
ctx.bb.emit(DROP(REFERENCE(tpt.tpe.symbol)));
- val ctx1 = genLoad(finalizer, ctx, UNIT);
- genLoad(body, ctx1, kind);
+ val ctx1 = genLoad(body, ctx, kind);
+ genLoad(finalizer, ctx1, UNIT);
})
case Ident(nme.WILDCARD) => Pair(definitions.ThrowableClass, {
ctx: Context =>
ctx.bb.emit(DROP(REFERENCE(definitions.ThrowableClass)));
- val ctx1 = genLoad(finalizer, ctx, UNIT);
- genLoad(body, ctx1, kind)
+ val ctx1 = genLoad(body, ctx, kind);
+ genLoad(finalizer, ctx1, UNIT);
})
case Bind(name, _) =>
@@ -454,8 +454,8 @@ abstract class GenICode extends SubComponent {
Pair(pat.symbol.tpe.symbol, {
ctx: Context =>
ctx.bb.emit(STORE_LOCAL(exception), pat.pos);
- val ctx1 = genLoad(finalizer, ctx, UNIT);
- genLoad(body, ctx1, kind)
+ val ctx1 = genLoad(body, ctx, kind);
+ genLoad(finalizer, ctx1, UNIT);
})
}
diff --git a/test/files/run/exceptions-2.check b/test/files/run/exceptions-2.check
index 3a461f1287..bb9c3dcd92 100644
--- a/test/files/run/exceptions-2.check
+++ b/test/files/run/exceptions-2.check
@@ -5,8 +5,8 @@ nested2:
Innermost finally
Outermost finally
mixed:
-Finally!
10
+Finally!
withValue1:
Oh, oh
10
@@ -14,21 +14,7 @@ method2:
10
Exception occurred
method3:
-Exception occurred with stack trace:
-java.lang.NullPointerException
- at Test$.method3(exceptions-2.scala:108)
- at Test$$anonfun$5.apply(exceptions-2.scala:180)
- at Test$$anonfun$5.apply(exceptions-2.scala:180)
- at Test$.execute(exceptions-2.scala:157)
- at Test$.main(exceptions-2.scala:180)
- at Test.main(exceptions-2.scala)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
- at java.lang.reflect.Method.invoke(Method.java:585)
- at scala.tools.nsc.ObjectRunner$.run(ObjectRunner.scala:27)
- at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:62)
- at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
+Cought an NPE
tryFinallyTry:
Silently ignore exception in finally
valInFinally:
diff --git a/test/files/run/exceptions-2.scala b/test/files/run/exceptions-2.scala
index e006bc053d..bc374a1c49 100644
--- a/test/files/run/exceptions-2.scala
+++ b/test/files/run/exceptions-2.scala
@@ -111,8 +111,7 @@ object Test {
}
} catch {
case npe: NullPointerException =>
- Console.println("Exception occurred with stack trace:");
- npe.printStackTrace();
+ Console.println("Cought an NPE");
}
def withValue1: Unit = {