@@ -22,13 +22,17 @@ object TastyInspector:
22
22
/** Load and process TASTy files using TASTy reflect
23
23
*
24
24
* @param tastyFiles List of paths of `.tasty` files
25
+ *
26
+ * @return boolean value indicating whether the process succeeded
25
27
*/
26
28
def inspectTastyFiles (tastyFiles : List [String ])(inspector : Inspector ): Boolean =
27
29
inspectAllTastyFiles(tastyFiles, Nil , Nil )(inspector)
28
30
29
31
/** Load and process TASTy files in a `jar` file using TASTy reflect
30
32
*
31
33
* @param jars Path of `.jar` file
34
+ *
35
+ * @return boolean value indicating whether the process succeeded
32
36
*/
33
37
def inspectTastyFilesInJar (jar : String )(inspector : Inspector ): Boolean =
34
38
inspectAllTastyFiles(Nil , List (jar), Nil )(inspector)
@@ -38,6 +42,8 @@ object TastyInspector:
38
42
* @param tastyFiles List of paths of `.tasty` files
39
43
* @param jars List of path of `.jar` files
40
44
* @param dependenciesClasspath Classpath with extra dependencies needed to load class in the `.tasty` files
45
+ *
46
+ * @return boolean value indicating whether the process succeeded
41
47
*/
42
48
def inspectAllTastyFiles (tastyFiles : List [String ], jars : List [String ], dependenciesClasspath : List [String ])(inspector : Inspector ): Boolean =
43
49
def checkFile (fileName : String , ext : String ): Unit =
@@ -49,7 +55,7 @@ object TastyInspector:
49
55
tastyFiles.foreach(checkFile(_, " tasty" ))
50
56
jars.foreach(checkFile(_, " jar" ))
51
57
val files = tastyFiles ::: jars
52
- files.nonEmpty && inspectFiles(dependenciesClasspath, files)(inspector)
58
+ inspectFiles(dependenciesClasspath, files)(inspector)
53
59
54
60
private def inspectorDriver (inspector : Inspector ) =
55
61
class InspectorDriver extends Driver :
@@ -100,11 +106,11 @@ object TastyInspector:
100
106
101
107
102
108
private def inspectFiles (classpath : List [String ], classes : List [String ])(inspector : Inspector ): Boolean =
103
- if ( classes.isEmpty)
104
- throw new IllegalArgumentException ( " Parameter classes should no be empty " )
105
-
106
- val reporter = inspectorDriver(inspector).process(inspectorArgs(classpath, classes))
107
- reporter.hasErrors
109
+ classes match
110
+ case Nil => true
111
+ case _ =>
112
+ val reporter = inspectorDriver(inspector).process(inspectorArgs(classpath, classes))
113
+ ! reporter.hasErrors
108
114
109
115
end inspectFiles
110
116
0 commit comments