private def changedClasses()

in ideaSupport/src/main/scala/org/jetbrains/sbtidea/instrumentation/ManipulateBytecode.scala [52:73]


  private def changedClasses(currentStamps: Stamps, previousStamps: Stamps, converter: FileConverter): Seq[Path] = {
    def changed(current: Stamp, previous: Option[Stamp]): Boolean =
      previous match {
        case Some(previous) =>
          (current.getHash.asScala, previous.getHash.asScala) match {
            case (Some(curr), Some(prev)) => curr != prev
            case (Some(_), None) => true
            case (None, _) => false
          }
        case None => true
      }

    object ClassFile {
      def unapply(vf: VirtualFileRef): Option[Path] =
        Option(converter.toPath(vf)).filter(_.toString.endsWith(".class"))
    }

    val previousProducts = previousStamps.products
    currentStamps.products.collect {
      case (vf @ ClassFile(path), stamp) if changed(stamp, previousProducts.get(vf)) => path
    }.toSeq
  }