11package com .typesafe .tools .mima .core
2- import scala .reflect .ClassTag
2+
3+ import scala .reflect .{ ClassTag , classTag }
34import java .util .regex .Pattern
45
56object ProblemFilters {
67
78 private case class ExcludeByName [P <: ProblemRef : ClassTag ](name : String ) extends ProblemFilter {
89 private [this ] val pattern = Pattern .compile(name.split(" \\ *" , - 1 ).map(Pattern .quote).mkString(" .*" ))
10+
911 override def apply (problem : Problem ): Boolean = {
10- ! (implicitly[ ClassTag [ P ] ].runtimeClass.isAssignableFrom(problem.getClass) &&
12+ ! (classTag[ P ].runtimeClass.isAssignableFrom(problem.getClass) &&
1113 pattern.matcher(problem.matchName.getOrElse(" " )).matches)
1214 }
1315
14- override def toString (): String = """ ExcludeByName[%s]("%s") """ .format(implicitly[ ClassTag [ P ]] .runtimeClass.getSimpleName, name)
16+ override def toString () = s """ ExcludeByName[ ${classTag[ P ] .runtimeClass.getSimpleName} ](" $ name") """
1517 }
1618
17- def exclude [P <: ProblemRef : ClassTag ](name : String ): ProblemFilter = {
18- ExcludeByName [P ](name)
19- }
19+ def exclude [P <: ProblemRef : ClassTag ](name : String ): ProblemFilter = ExcludeByName [P ](name)
2020
2121 /**
2222 * Creates exclude filter by taking name of a problem and name of a match (e.g. class/method name).
@@ -26,12 +26,12 @@ object ProblemFilters {
2626 * @throws ClassNotFoundException if the class corresponding to the problem cannot be located
2727 */
2828 def exclude (problemName : String , name : String ): ProblemFilter = {
29- val problemClass : Class [_ <: ProblemRef ] = Class .forName(" com.typesafe.tools.mima.core." + problemName).asInstanceOf [Class [_ <: ProblemRef ]]
29+ val problemClass : Class [_ <: ProblemRef ] =
30+ Class .forName(s " com.typesafe.tools.mima.core. $problemName" ).asInstanceOf [Class [_ <: ProblemRef ]]
3031 exclude(name)(ClassTag (problemClass))
3132 }
3233
3334 @ deprecated(" Replace with ProblemFilters.exclude[Problem](\" my.package.*\" )" , " 0.1.15" )
34- def excludePackage (packageName : String ): ProblemFilter = {
35- exclude[Problem ](packageName + " .*" )
36- }
35+ def excludePackage (packageName : String ): ProblemFilter = exclude[Problem ](s " $packageName.* " )
36+
3737}
0 commit comments