equal
deleted
inserted
replaced
47 def jars: List[JFile] = static_jars ::: dynamic_jars |
47 def jars: List[JFile] = static_jars ::: dynamic_jars |
48 override def toString: String = jars.mkString("Classpath(", ", ", ")") |
48 override def toString: String = jars.mkString("Classpath(", ", ", ")") |
49 |
49 |
50 def platform_path: String = jars.map(_.getPath).mkString(JFile.pathSeparator) |
50 def platform_path: String = jars.map(_.getPath).mkString(JFile.pathSeparator) |
51 |
51 |
52 val classloader: ClassLoader = |
52 val class_loader: ClassLoader = |
53 { |
53 { |
54 val this_classloader = this.getClass.getClassLoader |
54 val this_class_loader = this.getClass.getClassLoader |
55 if (dynamic_jars.isEmpty) this_classloader |
55 if (dynamic_jars.isEmpty) this_class_loader |
56 else { |
56 else { |
57 new URLClassLoader(dynamic_jars.map(File.url).toArray, this_classloader) { |
57 new URLClassLoader(dynamic_jars.map(File.url).toArray, this_class_loader) { |
58 override def finalize(): Unit = { |
58 override def finalize(): Unit = { |
59 for (jar <- dynamic_jars) { |
59 for (jar <- dynamic_jars) { |
60 try { jar.delete() } |
60 try { jar.delete() } |
61 catch { case _: Throwable => } |
61 catch { case _: Throwable => } |
62 } |
62 } |
67 |
67 |
68 private def init_services(where: String, names: List[String]): List[Classpath.Service_Class] = { |
68 private def init_services(where: String, names: List[String]): List[Classpath.Service_Class] = { |
69 for (name <- names) yield { |
69 for (name <- names) yield { |
70 def err(msg: String): Nothing = |
70 def err(msg: String): Nothing = |
71 error("Bad Isabelle/Scala service " + quote(name) + " in " + where + "\n" + msg) |
71 error("Bad Isabelle/Scala service " + quote(name) + " in " + where + "\n" + msg) |
72 try { Class.forName(name, true, classloader).asInstanceOf[Classpath.Service_Class] } |
72 try { Class.forName(name, true, class_loader).asInstanceOf[Classpath.Service_Class] } |
73 catch { |
73 catch { |
74 case _: ClassNotFoundException => err("Class not found") |
74 case _: ClassNotFoundException => err("Class not found") |
75 case exn: Throwable => err(Exn.message(exn)) |
75 case exn: Throwable => err(Exn.message(exn)) |
76 } |
76 } |
77 } |
77 } |