diff options
-rw-r--r-- | sources/scalac/backend/jvm/GenJVM.java | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/sources/scalac/backend/jvm/GenJVM.java b/sources/scalac/backend/jvm/GenJVM.java index 2a7c4f5c52..d711b1de81 100644 --- a/sources/scalac/backend/jvm/GenJVM.java +++ b/sources/scalac/backend/jvm/GenJVM.java @@ -1357,13 +1357,7 @@ class GenJVM { } addScalaAttr(mirrorClass, pickle); - try { - String fileName = javaFileName(mirrorName); - mirrorClass.writeTo(fileName); - global.operation("wrote " + fileName); - } catch (java.io.IOException e) { - throw global.fail(e.getMessage()); - } + writeClassFile(mirrorClass); } /** @@ -1650,13 +1644,7 @@ class GenJVM { else addScalaAttr(clazz, pickle); - try { - String fileName = javaFileName(clazz.getName()); - clazz.writeTo(fileName); - global.operation("wrote " + fileName); - } catch (java.io.IOException e) { - throw global.fail(e.getMessage()); - } + writeClassFile(clazz); } /** @@ -1718,6 +1706,21 @@ class GenJVM { global.log("leaving method"); } + /// I/O + ////////////////////////////////////////////////////////////////////// + + /** Writes the given class to a file. */ + protected void writeClassFile(JClass clazz) { + String fileName = javaFileName(clazz.getName()); + try { + clazz.writeTo(fileName); + global.operation("wrote " + fileName); + } catch (IOException exception) { + if (global.debug) exception.printStackTrace(); + global.error("could not write file " + fileName); + } + } + /// Misc. ////////////////////////////////////////////////////////////////////// |