public interface Scalafix
To obtain an instance of Scalafix, use one of the static factory methods.
| Modifier and Type | Method and Description |
|---|---|
static Scalafix |
classloadInstance(java.lang.ClassLoader classLoader)
JVM runtime reflection method helper to classload an instance of
Scalafix. |
static Scalafix |
fetchAndClassloadInstance(java.lang.String scalaBinaryVersion)
Fetch JARs containing an implementation of
Scalafix using Coursier and classload an instance of it via
runtime reflection. |
static Scalafix |
fetchAndClassloadInstance(java.lang.String requestedScalaVersion,
java.util.List<coursierapi.Repository> repositories)
Fetch JARs containing an implementation of
Scalafix from the provided repositories using Coursier and
classload an instance of it via runtime reflection. |
java.lang.String |
mainHelp(int screenWidth)
Get --help message for running the Scalafix command-line interface.
|
ScalafixArguments |
newArguments() |
java.lang.String |
scala211()
Deprecated.
|
java.lang.String |
scala212()
The Scala 2.12 version in
supportedScalaVersions() |
java.lang.String |
scala213()
The Scala 2.13 version in
supportedScalaVersions() |
java.lang.String |
scala3LTS()
The Scala 3 LTS version in
supportedScalaVersions() |
java.lang.String |
scala3Next()
The Scala 3 Next version in
supportedScalaVersions() |
java.lang.String |
scalafixVersion()
The release version of the current Scalafix API instance.
|
java.lang.String |
scalametaVersion()
The recommended Scalameta version to match the current Scalafix API instance.
|
java.lang.String |
scalaVersion()
The exact Scala versions used
|
java.lang.String[] |
supportedScalaVersions()
The exact Scala versions that are supported
|
ScalafixArguments newArguments()
ScalafixArguments.java.lang.String mainHelp(int screenWidth)
screenWidth - The width of the screen, used for wrapping long sentences
into multiple lines.java.lang.String scalaVersion()
java.lang.String scalafixVersion()
java.lang.String scalametaVersion()
java.lang.String[] supportedScalaVersions()
@Deprecated java.lang.String scala211()
java.lang.String scala212()
supportedScalaVersions()java.lang.String scala213()
supportedScalaVersions()java.lang.String scala3LTS()
supportedScalaVersions()java.lang.String scala3Next()
supportedScalaVersions()static Scalafix fetchAndClassloadInstance(java.lang.String scalaBinaryVersion) throws ScalafixException
Scalafix using Coursier and classload an instance of it via
runtime reflection.
The custom classloader optionally provided with ScalafixArguments.withToolClasspath(java.util.List<java.net.URL>) to compile and
classload external rules must have the classloader of the returned instance as ancestor to share a common
loaded instance of `scalafix-core`, and therefore have been compiled against the requested Scala binary version.
requestedScalaVersion - The Scala version ("3.3.4" for example) available in the classloader of the
returned instance. To be able to run advanced semantic rules using the Scala
Presentation Compiler such as ExplicitResultTypes, this must match the version
that the target classpath was built with, as provided with
ScalafixArguments.withScalaVersion(java.lang.String).Scalafix interface.ScalafixException - in case of errors during artifact resolution/fetching.static Scalafix fetchAndClassloadInstance(java.lang.String requestedScalaVersion, java.util.List<coursierapi.Repository> repositories) throws ScalafixException
Scalafix from the provided repositories using Coursier and
classload an instance of it via runtime reflection.
The custom classloader optionally provided with ScalafixArguments.withToolClasspath(java.util.List<java.net.URL>) to compile and
classload external rules must have the classloader of the returned instance as ancestor to share a common
loaded instance of `scalafix-core`, and therefore have been compiled against the requested Scala binary version.
requestedScalaVersion - The Scala version ("3.3.4" for example) available in the classloader of the
returned instance. To be able to run advanced semantic rules using the Scala
Presentation Compiler such as ExplicitResultTypes, this must match the version
that the target classpath was built with, as provided with
ScalafixArguments.withScalaVersion(java.lang.String).repositories - Maven/Ivy repositories to fetch the JARs from.Scalafix interface.ScalafixException - in case of errors during artifact resolution/fetching.static Scalafix classloadInstance(java.lang.ClassLoader classLoader) throws ScalafixException
Scalafix.
The custom classloader optionally provided with ScalafixArguments.withToolClasspath(java.util.List<java.net.URL>) to compile and
classload external rules must have the provided classloader as ancestor to share a common loaded instance
of `scalafix-core`, and therefore must have been compiled against the same Scala binary version as
the one in the classLoader provided here.
Unless you have an advanced use-case, prefer the high-level overloads that cannot cause runtime errors due to an invalid classloader hierarchy.
classLoader - Classloader containing the full Scalafix classpath, including the scalafix-cli module. To be
able to run advanced semantic rules using the Scala Presentation Compiler such as
ExplicitResultTypes, this Scala binary version in that classloader should match the one that
the target classpath was built with, as provided with
ScalafixArguments.withScalaVersion(java.lang.String).Scalafix interface.ScalafixException - in case of errors during classloading, most likely caused
by an incorrect classloader argument.