aboutsummaryrefslogtreecommitdiff
path: root/stage1
diff options
context:
space:
mode:
authorChristopher Vogt <oss.nsp@cvogt.org>2017-02-14 00:18:54 -0500
committerChristopher Vogt <oss.nsp@cvogt.org>2017-02-14 00:34:48 -0500
commit465b9bfc84c21c0a599362624fa46febfa5e09c8 (patch)
tree1e7454417fe13cff7ebf425ca3beac709b341c86 /stage1
parent349e4b3546973a30f2823fa5461767322a606d9a (diff)
downloadcbt-465b9bfc84c21c0a599362624fa46febfa5e09c8.tar.gz
cbt-465b9bfc84c21c0a599362624fa46febfa5e09c8.tar.bz2
cbt-465b9bfc84c21c0a599362624fa46febfa5e09c8.zip
ignore classes in randomly nested subdirectories
useful for `dotty run <file>`
Diffstat (limited to 'stage1')
-rw-r--r--stage1/Stage1Lib.scala21
1 files changed, 13 insertions, 8 deletions
diff --git a/stage1/Stage1Lib.scala b/stage1/Stage1Lib.scala
index 67c1f4e..d44f30b 100644
--- a/stage1/Stage1Lib.scala
+++ b/stage1/Stage1Lib.scala
@@ -156,14 +156,19 @@ class Stage1Lib( logger: Logger ) extends BaseLib{
.collect{
// no $ to avoid inner classes
case path if !path.contains("$") && path.endsWith(".class") =>
- classLoader.loadClass(
- path
- .stripSuffix(".class")
- .stripPrefix(targetDirectory.getPath)
- .stripPrefix(File.separator) // 1 for the slash
- .replace(File.separator, ".")
- )
- }.filter(
+ try{
+ classLoader.loadClass(
+ path
+ .stripSuffix(".class")
+ .stripPrefix(targetDirectory.getPath)
+ .stripPrefix(File.separator) // 1 for the slash
+ .replace(File.separator, ".")
+ )
+ } catch {
+ case e: ClassNotFoundException => null
+ case e: NoClassDefFoundError => null
+ }
+ }.filterNot(_ == null).filter(
_.getDeclaredMethods().exists( m =>
m.getName == "main"
&& m.getParameterTypes.toList == List(arrayClass)