.scala-fortify_2.11.11.1.1.4.source-code.VersionSpecificHelpers.scala Maven / Gradle / Ivy
The newest version!
/*
* Copyright © 2016-2024 Lightbend, Inc. All rights reserved.
* No information contained herein may be reproduced or transmitted in any form
* or by any means without the express written permission of Lightbend, Inc.
*/
package com.lightbend.tools.fortify.plugin
import scala.reflect.internal.Flags
import scala.tools.nsc
trait VersionSpecificHelpers[T <: nsc.symtab.SymbolTable] {
val global: T
import global._
def hasSynthesizeImplInSubclassFlag(sym: Symbol) =
false
def isImplClass(sym: Symbol) =
sym.isImplClass
def isLateDeferred(sym: Symbol) =
sym.hasFlag(Flags.lateDEFERRED)
// the ENUM/JAVA_ENUM (it got renamed) flag didn't get reliably set until
// 2.11.7 (scala/scala#4566), so we take an entirely different approach.
def hasJavaEnumFlag(sym: Symbol) =
sym.superClass eq definitions.JavaEnumClass
// didn't exist until 2.11.8
def isDelambdafyTarget(sym: Symbol) =
sym.isArtifact && sym.isMethod && sym.name.containsName("$anonfun")
}
object VersionSpecificHelpers {
implicit class AsScala[T](it: java.util.Iterator[T]) {
def asScala: scala.Iterator[T] =
scala.collection.JavaConverters.asScalaIteratorConverter(it).asScala
}
def newStoreReporter(s: nsc.Settings): nsc.reporters.StoreReporter =
new nsc.reporters.StoreReporter
def makeRegex(s: String, ss: Seq[String]) =
new scala.util.matching.Regex(s, ss: _*)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy