diff --git a/build.sbt b/build.sbt index 357401143f..d44988be74 100644 --- a/build.sbt +++ b/build.sbt @@ -187,7 +187,7 @@ lazy val zincTesting = (project in internalPath / "zinc-testing") publishArtifact := false, libraryDependencies ++= Seq(scalaCheck, scalatest, junit, sjsonnewScalaJson.value) ) - .configure(addSbtLm, addSbtUtilTesting) + .configure(addSbtLmCore, addSbtLmIvy, addSbtUtilTesting) lazy val zincCompile = (project in file("zinc-compile")) .dependsOn(zincCompileCore, zincCompileCore % "test->test") @@ -250,7 +250,7 @@ lazy val zincIvyIntegration = (project in internalPath / "zinc-ivy-integration") name := "zinc Ivy Integration", compileOrder := sbt.CompileOrder.ScalaThenJava ) - .configure(addSbtLm) + .configure(addSbtLmCore, addSbtLmIvyTest) // sbt-side interface to compiler. Calls compiler-side interface reflectively lazy val zincCompileCore = (project in internalPath / "zinc-compile-core") @@ -266,7 +266,10 @@ lazy val zincCompileCore = (project in internalPath / "zinc-compile-core") .settings( name := "zinc Compile Core", libraryDependencies ++= Seq(scalaCompiler.value % Test, launcherInterface, parserCombinator), - unmanagedJars in Test := Seq(packageSrc in compilerBridge in Compile value).classpath + unmanagedJars in Test := Seq(packageSrc in compilerBridge in Compile value).classpath, + managedSourceDirectories in Compile += + baseDirectory.value / "src" / "main" / "contraband-java", + sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-java" ) .configure(addSbtUtilLogging, addSbtIO, addSbtUtilControl) @@ -302,6 +305,9 @@ lazy val compilerInterface = (project in internalPath / "compiler-interface") (baseDirectory.value / "other"), (baseDirectory.value / "type") ), + managedSourceDirectories in Compile += + baseDirectory.value / "src" / "main" / "contraband-java", + sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-java", crossPaths := false, autoScalaLibrary := false, altPublishSettings diff --git a/internal/compiler-bridge/src/main/scala/xsbt/ExtractAPI.scala b/internal/compiler-bridge/src/main/scala/xsbt/ExtractAPI.scala index 399d58d216..a1df6aa256 100644 --- a/internal/compiler-bridge/src/main/scala/xsbt/ExtractAPI.scala +++ b/internal/compiler-bridge/src/main/scala/xsbt/ExtractAPI.scala @@ -173,10 +173,10 @@ class ExtractAPI[GlobalType <: Global]( private def thisPath(sym: Symbol) = path(pathComponents(sym, Constants.thisPath :: Nil)) private def path(components: List[PathComponent]) = - new xsbti.api.Path(components.toArray[PathComponent]) + xsbti.api.Path.of(components.toArray[PathComponent]) private def pathComponents(sym: Symbol, postfix: List[PathComponent]): List[PathComponent] = { if (sym == NoSymbol || sym.isRoot || sym.isEmptyPackageClass || sym.isRootPackage) postfix - else pathComponents(sym.owner, new xsbti.api.Id(simpleName(sym)) :: postfix) + else pathComponents(sym.owner, xsbti.api.Id.of(simpleName(sym)) :: postfix) } private def types(in: Symbol, t: List[Type]): Array[xsbti.api.Type] = t.toArray[Type].map(processType(in, _)) @@ -191,24 +191,25 @@ class ExtractAPI[GlobalType <: Global]( reference(sym) } } else if (sym.isRoot || sym.isRootPackage) Constants.emptyType - else new xsbti.api.Projection(processType(in, pre), simpleName(sym)) + else xsbti.api.Projection.of(processType(in, pre), simpleName(sym)) } private def reference(sym: Symbol): xsbti.api.ParameterRef = - new xsbti.api.ParameterRef(tparamID(sym)) + xsbti.api.ParameterRef.of(tparamID(sym)) // The compiler only pickles static annotations, so only include these in the API. // This way, the API is not sensitive to whether we compiled from source or loaded from classfile. // (When looking at the sources we see all annotations, but when loading from classes we only see the pickled (static) ones.) private def mkAnnotations(in: Symbol, as: List[AnnotationInfo]): Array[xsbti.api.Annotation] = staticAnnotations(as).toArray.map { a => - new xsbti.api.Annotation( + xsbti.api.Annotation.of( processType(in, a.atp), if (a.assocs.isEmpty) - Array(new xsbti.api.AnnotationArgument("", a.args.mkString("(", ",", ")"))) // what else to do with a Tree? + Array(xsbti.api.AnnotationArgument.of("", a.args.mkString("(", ",", ")"))) // what else to do with a Tree? else a.assocs .map { - case (name, value) => new xsbti.api.AnnotationArgument(name.toString, value.toString) + case (name, value) => + xsbti.api.AnnotationArgument.of(name.toString, value.toString) } .toArray[xsbti.api.AnnotationArgument] ) @@ -234,7 +235,7 @@ class ExtractAPI[GlobalType <: Global]( valueParameters: List[xsbti.api.ParameterList]): xsbti.api.Def = { def parameterList(syms: List[Symbol]): xsbti.api.ParameterList = { val isImplicitList = syms match { case head :: _ => isImplicit(head); case _ => false } - new xsbti.api.ParameterList(syms.map(parameterS).toArray, isImplicitList) + xsbti.api.ParameterList.of(syms.map(parameterS).toArray, isImplicitList) } t match { case PolyType(typeParams0, base) => @@ -247,13 +248,13 @@ class ExtractAPI[GlobalType <: Global]( build(resultType, typeParams, valueParameters) case returnType => val retType = processType(in, dropConst(returnType)) - new xsbti.api.Def(simpleName(s), - getAccess(s), - getModifiers(s), - annotations(in, s), - typeParams, - valueParameters.reverse.toArray, - retType) + xsbti.api.Def.of(simpleName(s), + getAccess(s), + getModifiers(s), + annotations(in, s), + typeParams, + valueParameters.reverse.toArray, + retType) } } def parameterS(s: Symbol): xsbti.api.MethodParameter = { @@ -274,7 +275,7 @@ class ExtractAPI[GlobalType <: Global]( (tpe.typeArgs.head, ByName) else (tpe, Plain) - new xsbti.api.MethodParameter(name, processType(in, t), hasDefault(paramSym), special) + xsbti.api.MethodParameter.of(name, processType(in, t), hasDefault(paramSym), special) } val t = viewer(in).memberInfo(s) build(t, Array(), Nil) @@ -313,16 +314,16 @@ class ExtractAPI[GlobalType <: Global]( val as = annotations(in, s) if (s.isAliasType) - new xsbti.api.TypeAlias(name, access, modifiers, as, typeParams, processType(in, tpe)) + xsbti.api.TypeAlias.of(name, access, modifiers, as, typeParams, processType(in, tpe)) else if (s.isAbstractType) { val bounds = tpe.bounds - new xsbti.api.TypeDeclaration(name, - access, - modifiers, - as, - typeParams, - processType(in, bounds.lo), - processType(in, bounds.hi)) + xsbti.api.TypeDeclaration.of(name, + access, + modifiers, + as, + typeParams, + processType(in, bounds.lo), + processType(in, bounds.hi)) } else error("Unknown type member" + s) } @@ -375,9 +376,9 @@ class ExtractAPI[GlobalType <: Global]( bases: List[Type], declared: List[Symbol], inherited: List[Symbol]): xsbti.api.Structure = { - new xsbti.api.Structure(lzy(types(s, bases)), - lzy(processDefinitions(s, declared)), - lzy(processDefinitions(s, inherited))) + xsbti.api.Structure.of(lzy(types(s, bases)), + lzy(processDefinitions(s, declared)), + lzy(processDefinitions(s, inherited))) } private def processDefinitions(in: Symbol, defs: List[Symbol]): Array[xsbti.api.ClassDefinition] = @@ -388,8 +389,8 @@ class ExtractAPI[GlobalType <: Global]( } private def definition(in: Symbol, sym: Symbol): Option[xsbti.api.ClassDefinition] = { - def mkVar = Some(fieldDef(in, sym, keepConst = false, new xsbti.api.Var(_, _, _, _, _))) - def mkVal = Some(fieldDef(in, sym, keepConst = true, new xsbti.api.Val(_, _, _, _, _))) + def mkVar = Some(fieldDef(in, sym, keepConst = false, xsbti.api.Var.of(_, _, _, _, _))) + def mkVal = Some(fieldDef(in, sym, keepConst = true, xsbti.api.Val.of(_, _, _, _, _))) if (isClass(sym)) if (ignoreClass(sym)) None else Some(classLike(in, sym)) else if (sym.isNonClassType) @@ -438,9 +439,9 @@ class ExtractAPI[GlobalType <: Global]( val within = c.privateWithin val qualifier = if (within == NoSymbol) Constants.unqualified - else new xsbti.api.IdQualifier(within.fullName) - if (c.hasFlag(Flags.PROTECTED)) new xsbti.api.Protected(qualifier) - else new xsbti.api.Private(qualifier) + else xsbti.api.IdQualifier.of(within.fullName) + if (c.hasFlag(Flags.PROTECTED)) xsbti.api.Protected.of(qualifier) + else xsbti.api.Private.of(qualifier) } } @@ -465,10 +466,10 @@ class ExtractAPI[GlobalType <: Global]( dealiased match { case NoPrefix => Constants.emptyType - case ThisType(sym) => new xsbti.api.Singleton(thisPath(sym)) + case ThisType(sym) => xsbti.api.Singleton.of(thisPath(sym)) case SingleType(pre, sym) => projectionType(in, pre, sym) case ConstantType(constant) => - new xsbti.api.Constant(processType(in, constant.tpe), constant.stringValue) + xsbti.api.Constant.of(processType(in, constant.tpe), constant.stringValue) /* explaining the special-casing of references to refinement classes (https://support.typesafe.com/tickets/1882) * @@ -509,7 +510,7 @@ class ExtractAPI[GlobalType <: Global]( else base else - new xsbti.api.Parameterized(base, types(in, args)) + xsbti.api.Parameterized.of(base, types(in, args)) case SuperType(thistpe: Type, supertpe: Type) => warning("sbt-api: Super type (not implemented): this=" + thistpe + ", super=" + supertpe); Constants.emptyType @@ -517,14 +518,14 @@ class ExtractAPI[GlobalType <: Global]( at.annotations match { case Nil => processType(in, at.underlying) case annots => - new xsbti.api.Annotated(processType(in, at.underlying), mkAnnotations(in, annots)) + xsbti.api.Annotated.of(processType(in, at.underlying), mkAnnotations(in, annots)) } case rt: CompoundType => structure(rt, rt.typeSymbol) case t: ExistentialType => makeExistentialType(in, t) case NoType => Constants.emptyType // this can happen when there is an error that will be reported by a later phase case PolyType(typeParams, resultType) => - new xsbti.api.Polymorphic(processType(in, resultType), typeParameters(in, typeParams)) + xsbti.api.Polymorphic.of(processType(in, resultType), typeParameters(in, typeParams)) case NullaryMethodType(_) => warning("sbt-api: Unexpected nullary method type " + in + " in " + in.owner); Constants.emptyType @@ -537,7 +538,7 @@ class ExtractAPI[GlobalType <: Global]( try { val typeVariablesConverted = typeParameters(in, typeVariables) val qualifiedConverted = processType(in, qualified) - new xsbti.api.Existential(qualifiedConverted, typeVariablesConverted) + xsbti.api.Existential.of(qualifiedConverted, typeVariablesConverted) } finally { existentialRenamings.leaveExistentialTypeVariables(typeVariables) } @@ -554,19 +555,19 @@ class ExtractAPI[GlobalType <: Global]( if (varianceInt < 0) Contravariant else if (varianceInt > 0) Covariant else Invariant viewer(in).memberInfo(s) match { case TypeBounds(low, high) => - new xsbti.api.TypeParameter(tparamID(s), - annots, - typeParameters(in, s), - variance, - processType(in, low), - processType(in, high)) + xsbti.api.TypeParameter.of(tparamID(s), + annots, + typeParameters(in, s), + variance, + processType(in, low), + processType(in, high)) case PolyType(typeParams, base) => - new xsbti.api.TypeParameter(tparamID(s), - annots, - typeParameters(in, typeParams), - variance, - processType(in, base.bounds.lo), - processType(in, base.bounds.hi)) + xsbti.api.TypeParameter.of(tparamID(s), + annots, + typeParameters(in, typeParams), + variance, + processType(in, base.bounds.lo), + processType(in, base.bounds.hi)) case x => error("Unknown type parameter info: " + x.getClass) } } @@ -629,7 +630,7 @@ class ExtractAPI[GlobalType <: Global]( val tParams = typeParameters(in, sym) // look at class symbol val selfType = lzy(this.selfType(in, sym)) def constructClass(structure: xsbti.api.Lazy[Structure]): ClassLike = { - new xsbti.api.ClassLike( + xsbti.api.ClassLike.of( name, acc, modifiers, @@ -652,7 +653,7 @@ class ExtractAPI[GlobalType <: Global]( _mainClasses += name } - val classDef = new xsbti.api.ClassLikeDef( + val classDef = xsbti.api.ClassLikeDef.of( name, acc, modifiers, @@ -690,14 +691,14 @@ class ExtractAPI[GlobalType <: Global]( } } private object Constants { - val local = new xsbti.api.ThisQualifier - val public = new xsbti.api.Public - val privateLocal = new xsbti.api.Private(local) - val protectedLocal = new xsbti.api.Protected(local) - val unqualified = new xsbti.api.Unqualified - val emptyPath = new xsbti.api.Path(Array()) - val thisPath = new xsbti.api.This - val emptyType = new xsbti.api.EmptyType + val local = xsbti.api.ThisQualifier.of() + val public = xsbti.api.Public.of() + val privateLocal = xsbti.api.Private.of(local) + val protectedLocal = xsbti.api.Protected.of(local) + val unqualified = xsbti.api.Unqualified.of() + val emptyPath = xsbti.api.Path.of(Array()) + val thisPath = xsbti.api.This.of() + val emptyType = xsbti.api.EmptyType.of() } private def simpleName(s: Symbol): String = { diff --git a/internal/compiler-bridge/src/main/scala/xsbt/Message.scala b/internal/compiler-bridge/src/main/scala/xsbt/Message.scala index efb471933c..2295af33c9 100644 --- a/internal/compiler-bridge/src/main/scala/xsbt/Message.scala +++ b/internal/compiler-bridge/src/main/scala/xsbt/Message.scala @@ -7,6 +7,10 @@ package xsbt +import java.util.function.Supplier + object Message { - def apply[T](s: => T) = new xsbti.F0[T] { def apply() = s } + def apply[T](s: => T): Supplier[T] = new Supplier[T] { + override def get(): T = s + } } diff --git a/internal/compiler-bridge/src/test/scala/xsbt/ExtractAPISpecification.scala b/internal/compiler-bridge/src/test/scala/xsbt/ExtractAPISpecification.scala index 99f18172b6..0864e966a1 100644 --- a/internal/compiler-bridge/src/test/scala/xsbt/ExtractAPISpecification.scala +++ b/internal/compiler-bridge/src/test/scala/xsbt/ExtractAPISpecification.scala @@ -196,7 +196,7 @@ class ExtractAPISpecification extends UnitSpec { List(srcX, srcY, srcC1, srcC2, srcC3, srcC4, srcC5, srcC6, srcC7, srcC8) ) .map(_.head) - val emptyType = new EmptyType + val emptyType = EmptyType.of() def hasSelfType(c: ClassLike): Boolean = c.selfType != emptyType val (withSelfType, withoutSelfType) = apis.partition(hasSelfType) diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/Access.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Access.java new file mode 100644 index 0000000000..5566adb534 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Access.java @@ -0,0 +1,32 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public abstract class Access implements java.io.Serializable { + + + protected Access() { + super(); + + } + + + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof Access)) { + return false; + } else { + Access o = (Access)obj; + return true; + } + } + public int hashCode() { + return 37 * (17 + "xsbti.api.Access".hashCode()); + } + public String toString() { + return "Access(" + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/AnalyzedClass.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/AnalyzedClass.java new file mode 100644 index 0000000000..60542a4b7f --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/AnalyzedClass.java @@ -0,0 +1,76 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class AnalyzedClass implements java.io.Serializable { + + public static AnalyzedClass create(long _compilationTimestamp, String _name, xsbti.api.Lazy _api, int _apiHash, NameHash[] _nameHashes, boolean _hasMacro) { + return new AnalyzedClass(_compilationTimestamp, _name, _api, _apiHash, _nameHashes, _hasMacro); + } + public static AnalyzedClass of(long _compilationTimestamp, String _name, xsbti.api.Lazy _api, int _apiHash, NameHash[] _nameHashes, boolean _hasMacro) { + return new AnalyzedClass(_compilationTimestamp, _name, _api, _apiHash, _nameHashes, _hasMacro); + } + + private long compilationTimestamp; + private String name; + private xsbti.api.Lazy api; + private int apiHash; + private NameHash[] nameHashes; + private boolean hasMacro; + protected AnalyzedClass(long _compilationTimestamp, String _name, xsbti.api.Lazy _api, int _apiHash, NameHash[] _nameHashes, boolean _hasMacro) { + super(); + compilationTimestamp = _compilationTimestamp; + name = _name; + api = _api; + apiHash = _apiHash; + nameHashes = _nameHashes; + hasMacro = _hasMacro; + } + public long compilationTimestamp() { + return this.compilationTimestamp; + } + public String name() { + return this.name; + } + public Companions api() { + return this.api.get(); + } + public int apiHash() { + return this.apiHash; + } + public NameHash[] nameHashes() { + return this.nameHashes; + } + public boolean hasMacro() { + return this.hasMacro; + } + public AnalyzedClass withCompilationTimestamp(long compilationTimestamp) { + return new AnalyzedClass(compilationTimestamp, name, api, apiHash, nameHashes, hasMacro); + } + public AnalyzedClass withName(String name) { + return new AnalyzedClass(compilationTimestamp, name, api, apiHash, nameHashes, hasMacro); + } + public AnalyzedClass withApi(xsbti.api.Lazy api) { + return new AnalyzedClass(compilationTimestamp, name, api, apiHash, nameHashes, hasMacro); + } + public AnalyzedClass withApiHash(int apiHash) { + return new AnalyzedClass(compilationTimestamp, name, api, apiHash, nameHashes, hasMacro); + } + public AnalyzedClass withNameHashes(NameHash[] nameHashes) { + return new AnalyzedClass(compilationTimestamp, name, api, apiHash, nameHashes, hasMacro); + } + public AnalyzedClass withHasMacro(boolean hasMacro) { + return new AnalyzedClass(compilationTimestamp, name, api, apiHash, nameHashes, hasMacro); + } + public boolean equals(Object obj) { + return this == obj; // We have lazy members, so use object identity to avoid circularity. + } + public int hashCode() { + return super.hashCode(); // Avoid evaluating lazy members in hashCode to avoid circularity. + } + public String toString() { + return super.toString(); // Avoid evaluating lazy members in toString to avoid circularity. + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/Annotated.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Annotated.java new file mode 100644 index 0000000000..1d772e70eb --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Annotated.java @@ -0,0 +1,51 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class Annotated extends xsbti.api.Type { + + public static Annotated create(Type _baseType, Annotation[] _annotations) { + return new Annotated(_baseType, _annotations); + } + public static Annotated of(Type _baseType, Annotation[] _annotations) { + return new Annotated(_baseType, _annotations); + } + + private Type baseType; + private Annotation[] annotations; + protected Annotated(Type _baseType, Annotation[] _annotations) { + super(); + baseType = _baseType; + annotations = _annotations; + } + public Type baseType() { + return this.baseType; + } + public Annotation[] annotations() { + return this.annotations; + } + public Annotated withBaseType(Type baseType) { + return new Annotated(baseType, annotations); + } + public Annotated withAnnotations(Annotation[] annotations) { + return new Annotated(baseType, annotations); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof Annotated)) { + return false; + } else { + Annotated o = (Annotated)obj; + return baseType().equals(o.baseType()) && java.util.Arrays.deepEquals(annotations(), o.annotations()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (17 + "xsbti.api.Annotated".hashCode()) + baseType().hashCode()) + annotations().hashCode()); + } + public String toString() { + return "Annotated(" + "baseType: " + baseType() + ", " + "annotations: " + annotations() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/Annotation.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Annotation.java new file mode 100644 index 0000000000..a6f93e9b2a --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Annotation.java @@ -0,0 +1,51 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class Annotation implements java.io.Serializable { + + public static Annotation create(Type _base, AnnotationArgument[] _arguments) { + return new Annotation(_base, _arguments); + } + public static Annotation of(Type _base, AnnotationArgument[] _arguments) { + return new Annotation(_base, _arguments); + } + + private Type base; + private AnnotationArgument[] arguments; + protected Annotation(Type _base, AnnotationArgument[] _arguments) { + super(); + base = _base; + arguments = _arguments; + } + public Type base() { + return this.base; + } + public AnnotationArgument[] arguments() { + return this.arguments; + } + public Annotation withBase(Type base) { + return new Annotation(base, arguments); + } + public Annotation withArguments(AnnotationArgument[] arguments) { + return new Annotation(base, arguments); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof Annotation)) { + return false; + } else { + Annotation o = (Annotation)obj; + return base().equals(o.base()) && java.util.Arrays.deepEquals(arguments(), o.arguments()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (17 + "xsbti.api.Annotation".hashCode()) + base().hashCode()) + arguments().hashCode()); + } + public String toString() { + return "Annotation(" + "base: " + base() + ", " + "arguments: " + arguments() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/AnnotationArgument.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/AnnotationArgument.java new file mode 100644 index 0000000000..f2212d8da7 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/AnnotationArgument.java @@ -0,0 +1,51 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class AnnotationArgument implements java.io.Serializable { + + public static AnnotationArgument create(String _name, String _value) { + return new AnnotationArgument(_name, _value); + } + public static AnnotationArgument of(String _name, String _value) { + return new AnnotationArgument(_name, _value); + } + + private String name; + private String value; + protected AnnotationArgument(String _name, String _value) { + super(); + name = _name; + value = _value; + } + public String name() { + return this.name; + } + public String value() { + return this.value; + } + public AnnotationArgument withName(String name) { + return new AnnotationArgument(name, value); + } + public AnnotationArgument withValue(String value) { + return new AnnotationArgument(name, value); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof AnnotationArgument)) { + return false; + } else { + AnnotationArgument o = (AnnotationArgument)obj; + return name().equals(o.name()) && value().equals(o.value()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (17 + "xsbti.api.AnnotationArgument".hashCode()) + name().hashCode()) + value().hashCode()); + } + public String toString() { + return "AnnotationArgument(" + "name: " + name() + ", " + "value: " + value() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/ClassDefinition.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/ClassDefinition.java new file mode 100644 index 0000000000..9d9aa1a399 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/ClassDefinition.java @@ -0,0 +1,32 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public abstract class ClassDefinition extends xsbti.api.Definition { + + + protected ClassDefinition(String _name, Access _access, Modifiers _modifiers, Annotation[] _annotations) { + super(_name, _access, _modifiers, _annotations); + + } + + + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof ClassDefinition)) { + return false; + } else { + ClassDefinition o = (ClassDefinition)obj; + return name().equals(o.name()) && access().equals(o.access()) && modifiers().equals(o.modifiers()) && java.util.Arrays.deepEquals(annotations(), o.annotations()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (37 * (37 * (17 + "xsbti.api.ClassDefinition".hashCode()) + name().hashCode()) + access().hashCode()) + modifiers().hashCode()) + annotations().hashCode()); + } + public String toString() { + return "ClassDefinition(" + "name: " + name() + ", " + "access: " + access() + ", " + "modifiers: " + modifiers() + ", " + "annotations: " + annotations() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/ClassLike.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/ClassLike.java new file mode 100644 index 0000000000..a3ce3a87bc --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/ClassLike.java @@ -0,0 +1,96 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class ClassLike extends xsbti.api.Definition { + + public static ClassLike create(String _name, Access _access, Modifiers _modifiers, Annotation[] _annotations, DefinitionType _definitionType, xsbti.api.Lazy _selfType, xsbti.api.Lazy _structure, String[] _savedAnnotations, Type[] _childrenOfSealedClass, boolean _topLevel, TypeParameter[] _typeParameters) { + return new ClassLike(_name, _access, _modifiers, _annotations, _definitionType, _selfType, _structure, _savedAnnotations, _childrenOfSealedClass, _topLevel, _typeParameters); + } + public static ClassLike of(String _name, Access _access, Modifiers _modifiers, Annotation[] _annotations, DefinitionType _definitionType, xsbti.api.Lazy _selfType, xsbti.api.Lazy _structure, String[] _savedAnnotations, Type[] _childrenOfSealedClass, boolean _topLevel, TypeParameter[] _typeParameters) { + return new ClassLike(_name, _access, _modifiers, _annotations, _definitionType, _selfType, _structure, _savedAnnotations, _childrenOfSealedClass, _topLevel, _typeParameters); + } + + private DefinitionType definitionType; + private xsbti.api.Lazy selfType; + private xsbti.api.Lazy structure; + private String[] savedAnnotations; + private Type[] childrenOfSealedClass; + private boolean topLevel; + private TypeParameter[] typeParameters; + protected ClassLike(String _name, Access _access, Modifiers _modifiers, Annotation[] _annotations, DefinitionType _definitionType, xsbti.api.Lazy _selfType, xsbti.api.Lazy _structure, String[] _savedAnnotations, Type[] _childrenOfSealedClass, boolean _topLevel, TypeParameter[] _typeParameters) { + super(_name, _access, _modifiers, _annotations); + definitionType = _definitionType; + selfType = _selfType; + structure = _structure; + savedAnnotations = _savedAnnotations; + childrenOfSealedClass = _childrenOfSealedClass; + topLevel = _topLevel; + typeParameters = _typeParameters; + } + public DefinitionType definitionType() { + return this.definitionType; + } + public Type selfType() { + return this.selfType.get(); + } + public Structure structure() { + return this.structure.get(); + } + public String[] savedAnnotations() { + return this.savedAnnotations; + } + public Type[] childrenOfSealedClass() { + return this.childrenOfSealedClass; + } + public boolean topLevel() { + return this.topLevel; + } + public TypeParameter[] typeParameters() { + return this.typeParameters; + } + public ClassLike withName(String name) { + return new ClassLike(name, access(), modifiers(), annotations(), definitionType, selfType, structure, savedAnnotations, childrenOfSealedClass, topLevel, typeParameters); + } + public ClassLike withAccess(Access access) { + return new ClassLike(name(), access, modifiers(), annotations(), definitionType, selfType, structure, savedAnnotations, childrenOfSealedClass, topLevel, typeParameters); + } + public ClassLike withModifiers(Modifiers modifiers) { + return new ClassLike(name(), access(), modifiers, annotations(), definitionType, selfType, structure, savedAnnotations, childrenOfSealedClass, topLevel, typeParameters); + } + public ClassLike withAnnotations(Annotation[] annotations) { + return new ClassLike(name(), access(), modifiers(), annotations, definitionType, selfType, structure, savedAnnotations, childrenOfSealedClass, topLevel, typeParameters); + } + public ClassLike withDefinitionType(DefinitionType definitionType) { + return new ClassLike(name(), access(), modifiers(), annotations(), definitionType, selfType, structure, savedAnnotations, childrenOfSealedClass, topLevel, typeParameters); + } + public ClassLike withSelfType(xsbti.api.Lazy selfType) { + return new ClassLike(name(), access(), modifiers(), annotations(), definitionType, selfType, structure, savedAnnotations, childrenOfSealedClass, topLevel, typeParameters); + } + public ClassLike withStructure(xsbti.api.Lazy structure) { + return new ClassLike(name(), access(), modifiers(), annotations(), definitionType, selfType, structure, savedAnnotations, childrenOfSealedClass, topLevel, typeParameters); + } + public ClassLike withSavedAnnotations(String[] savedAnnotations) { + return new ClassLike(name(), access(), modifiers(), annotations(), definitionType, selfType, structure, savedAnnotations, childrenOfSealedClass, topLevel, typeParameters); + } + public ClassLike withChildrenOfSealedClass(Type[] childrenOfSealedClass) { + return new ClassLike(name(), access(), modifiers(), annotations(), definitionType, selfType, structure, savedAnnotations, childrenOfSealedClass, topLevel, typeParameters); + } + public ClassLike withTopLevel(boolean topLevel) { + return new ClassLike(name(), access(), modifiers(), annotations(), definitionType, selfType, structure, savedAnnotations, childrenOfSealedClass, topLevel, typeParameters); + } + public ClassLike withTypeParameters(TypeParameter[] typeParameters) { + return new ClassLike(name(), access(), modifiers(), annotations(), definitionType, selfType, structure, savedAnnotations, childrenOfSealedClass, topLevel, typeParameters); + } + public boolean equals(Object obj) { + return this == obj; // We have lazy members, so use object identity to avoid circularity. + } + public int hashCode() { + return super.hashCode(); // Avoid evaluating lazy members in hashCode to avoid circularity. + } + public String toString() { + return super.toString(); // Avoid evaluating lazy members in toString to avoid circularity. + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/ClassLikeDef.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/ClassLikeDef.java new file mode 100644 index 0000000000..fd8d3879a8 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/ClassLikeDef.java @@ -0,0 +1,58 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class ClassLikeDef extends xsbti.api.ParameterizedDefinition { + + public static ClassLikeDef create(String _name, Access _access, Modifiers _modifiers, Annotation[] _annotations, TypeParameter[] _typeParameters, DefinitionType _definitionType) { + return new ClassLikeDef(_name, _access, _modifiers, _annotations, _typeParameters, _definitionType); + } + public static ClassLikeDef of(String _name, Access _access, Modifiers _modifiers, Annotation[] _annotations, TypeParameter[] _typeParameters, DefinitionType _definitionType) { + return new ClassLikeDef(_name, _access, _modifiers, _annotations, _typeParameters, _definitionType); + } + + private DefinitionType definitionType; + protected ClassLikeDef(String _name, Access _access, Modifiers _modifiers, Annotation[] _annotations, TypeParameter[] _typeParameters, DefinitionType _definitionType) { + super(_name, _access, _modifiers, _annotations, _typeParameters); + definitionType = _definitionType; + } + public DefinitionType definitionType() { + return this.definitionType; + } + public ClassLikeDef withName(String name) { + return new ClassLikeDef(name, access(), modifiers(), annotations(), typeParameters(), definitionType); + } + public ClassLikeDef withAccess(Access access) { + return new ClassLikeDef(name(), access, modifiers(), annotations(), typeParameters(), definitionType); + } + public ClassLikeDef withModifiers(Modifiers modifiers) { + return new ClassLikeDef(name(), access(), modifiers, annotations(), typeParameters(), definitionType); + } + public ClassLikeDef withAnnotations(Annotation[] annotations) { + return new ClassLikeDef(name(), access(), modifiers(), annotations, typeParameters(), definitionType); + } + public ClassLikeDef withTypeParameters(TypeParameter[] typeParameters) { + return new ClassLikeDef(name(), access(), modifiers(), annotations(), typeParameters, definitionType); + } + public ClassLikeDef withDefinitionType(DefinitionType definitionType) { + return new ClassLikeDef(name(), access(), modifiers(), annotations(), typeParameters(), definitionType); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof ClassLikeDef)) { + return false; + } else { + ClassLikeDef o = (ClassLikeDef)obj; + return name().equals(o.name()) && access().equals(o.access()) && modifiers().equals(o.modifiers()) && java.util.Arrays.deepEquals(annotations(), o.annotations()) && java.util.Arrays.deepEquals(typeParameters(), o.typeParameters()) && definitionType().equals(o.definitionType()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "xsbti.api.ClassLikeDef".hashCode()) + name().hashCode()) + access().hashCode()) + modifiers().hashCode()) + annotations().hashCode()) + typeParameters().hashCode()) + definitionType().hashCode()); + } + public String toString() { + return "ClassLikeDef(" + "name: " + name() + ", " + "access: " + access() + ", " + "modifiers: " + modifiers() + ", " + "annotations: " + annotations() + ", " + "typeParameters: " + typeParameters() + ", " + "definitionType: " + definitionType() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/Companions.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Companions.java new file mode 100644 index 0000000000..48f8bddce4 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Companions.java @@ -0,0 +1,51 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class Companions implements java.io.Serializable { + + public static Companions create(ClassLike _classApi, ClassLike _objectApi) { + return new Companions(_classApi, _objectApi); + } + public static Companions of(ClassLike _classApi, ClassLike _objectApi) { + return new Companions(_classApi, _objectApi); + } + + private ClassLike classApi; + private ClassLike objectApi; + protected Companions(ClassLike _classApi, ClassLike _objectApi) { + super(); + classApi = _classApi; + objectApi = _objectApi; + } + public ClassLike classApi() { + return this.classApi; + } + public ClassLike objectApi() { + return this.objectApi; + } + public Companions withClassApi(ClassLike classApi) { + return new Companions(classApi, objectApi); + } + public Companions withObjectApi(ClassLike objectApi) { + return new Companions(classApi, objectApi); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof Companions)) { + return false; + } else { + Companions o = (Companions)obj; + return classApi().equals(o.classApi()) && objectApi().equals(o.objectApi()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (17 + "xsbti.api.Companions".hashCode()) + classApi().hashCode()) + objectApi().hashCode()); + } + public String toString() { + return "Companions(" + "classApi: " + classApi() + ", " + "objectApi: " + objectApi() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/Constant.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Constant.java new file mode 100644 index 0000000000..b28b2dbdcb --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Constant.java @@ -0,0 +1,51 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class Constant extends xsbti.api.Type { + + public static Constant create(Type _baseType, String _value) { + return new Constant(_baseType, _value); + } + public static Constant of(Type _baseType, String _value) { + return new Constant(_baseType, _value); + } + + private Type baseType; + private String value; + protected Constant(Type _baseType, String _value) { + super(); + baseType = _baseType; + value = _value; + } + public Type baseType() { + return this.baseType; + } + public String value() { + return this.value; + } + public Constant withBaseType(Type baseType) { + return new Constant(baseType, value); + } + public Constant withValue(String value) { + return new Constant(baseType, value); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof Constant)) { + return false; + } else { + Constant o = (Constant)obj; + return baseType().equals(o.baseType()) && value().equals(o.value()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (17 + "xsbti.api.Constant".hashCode()) + baseType().hashCode()) + value().hashCode()); + } + public String toString() { + return "Constant(" + "baseType: " + baseType() + ", " + "value: " + value() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/Def.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Def.java new file mode 100644 index 0000000000..36bb14ade1 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Def.java @@ -0,0 +1,66 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class Def extends xsbti.api.ParameterizedDefinition { + + public static Def create(String _name, Access _access, Modifiers _modifiers, Annotation[] _annotations, TypeParameter[] _typeParameters, ParameterList[] _valueParameters, Type _returnType) { + return new Def(_name, _access, _modifiers, _annotations, _typeParameters, _valueParameters, _returnType); + } + public static Def of(String _name, Access _access, Modifiers _modifiers, Annotation[] _annotations, TypeParameter[] _typeParameters, ParameterList[] _valueParameters, Type _returnType) { + return new Def(_name, _access, _modifiers, _annotations, _typeParameters, _valueParameters, _returnType); + } + + private ParameterList[] valueParameters; + private Type returnType; + protected Def(String _name, Access _access, Modifiers _modifiers, Annotation[] _annotations, TypeParameter[] _typeParameters, ParameterList[] _valueParameters, Type _returnType) { + super(_name, _access, _modifiers, _annotations, _typeParameters); + valueParameters = _valueParameters; + returnType = _returnType; + } + public ParameterList[] valueParameters() { + return this.valueParameters; + } + public Type returnType() { + return this.returnType; + } + public Def withName(String name) { + return new Def(name, access(), modifiers(), annotations(), typeParameters(), valueParameters, returnType); + } + public Def withAccess(Access access) { + return new Def(name(), access, modifiers(), annotations(), typeParameters(), valueParameters, returnType); + } + public Def withModifiers(Modifiers modifiers) { + return new Def(name(), access(), modifiers, annotations(), typeParameters(), valueParameters, returnType); + } + public Def withAnnotations(Annotation[] annotations) { + return new Def(name(), access(), modifiers(), annotations, typeParameters(), valueParameters, returnType); + } + public Def withTypeParameters(TypeParameter[] typeParameters) { + return new Def(name(), access(), modifiers(), annotations(), typeParameters, valueParameters, returnType); + } + public Def withValueParameters(ParameterList[] valueParameters) { + return new Def(name(), access(), modifiers(), annotations(), typeParameters(), valueParameters, returnType); + } + public Def withReturnType(Type returnType) { + return new Def(name(), access(), modifiers(), annotations(), typeParameters(), valueParameters, returnType); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof Def)) { + return false; + } else { + Def o = (Def)obj; + return name().equals(o.name()) && access().equals(o.access()) && modifiers().equals(o.modifiers()) && java.util.Arrays.deepEquals(annotations(), o.annotations()) && java.util.Arrays.deepEquals(typeParameters(), o.typeParameters()) && java.util.Arrays.deepEquals(valueParameters(), o.valueParameters()) && returnType().equals(o.returnType()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "xsbti.api.Def".hashCode()) + name().hashCode()) + access().hashCode()) + modifiers().hashCode()) + annotations().hashCode()) + typeParameters().hashCode()) + valueParameters().hashCode()) + returnType().hashCode()); + } + public String toString() { + return "Def(" + "name: " + name() + ", " + "access: " + access() + ", " + "modifiers: " + modifiers() + ", " + "annotations: " + annotations() + ", " + "typeParameters: " + typeParameters() + ", " + "valueParameters: " + valueParameters() + ", " + "returnType: " + returnType() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/Definition.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Definition.java new file mode 100644 index 0000000000..4e3917038d --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Definition.java @@ -0,0 +1,50 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public abstract class Definition implements java.io.Serializable { + + + private String name; + private Access access; + private Modifiers modifiers; + private Annotation[] annotations; + protected Definition(String _name, Access _access, Modifiers _modifiers, Annotation[] _annotations) { + super(); + name = _name; + access = _access; + modifiers = _modifiers; + annotations = _annotations; + } + public String name() { + return this.name; + } + public Access access() { + return this.access; + } + public Modifiers modifiers() { + return this.modifiers; + } + public Annotation[] annotations() { + return this.annotations; + } + + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof Definition)) { + return false; + } else { + Definition o = (Definition)obj; + return name().equals(o.name()) && access().equals(o.access()) && modifiers().equals(o.modifiers()) && java.util.Arrays.deepEquals(annotations(), o.annotations()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (37 * (37 * (17 + "xsbti.api.Definition".hashCode()) + name().hashCode()) + access().hashCode()) + modifiers().hashCode()) + annotations().hashCode()); + } + public String toString() { + return "Definition(" + "name: " + name() + ", " + "access: " + access() + ", " + "modifiers: " + modifiers() + ", " + "annotations: " + annotations() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/DefinitionType.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/DefinitionType.java new file mode 100644 index 0000000000..aec03ab9a1 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/DefinitionType.java @@ -0,0 +1,14 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public enum DefinitionType { + + Trait, + ClassDef, + Module, + PackageModule; + +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/DependencyContext.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/DependencyContext.java new file mode 100644 index 0000000000..d5504a6b43 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/DependencyContext.java @@ -0,0 +1,39 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +/** + * Enumeration of existing dependency contexts. + * Dependency contexts represent the various kind of dependencies that + * can exist between symbols. + */ +public enum DependencyContext { + /** + * Represents a direct dependency between two symbols : + * object Foo + * object Bar { def foo = Foo } + */ + DependencyByMemberRef, + /** + * Represents an inheritance dependency between two symbols : + * class A + * class B extends A + */ + DependencyByInheritance, + /** + * Represents an inheritance dependency between a local class + * and a non local class: + * // A.scala + * class A + * // B.scala + * class B { + * def foo = { + * class Local extends A + * } + * } + */ + LocalDependencyByInheritance; + + } diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/EmptyType.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/EmptyType.java new file mode 100644 index 0000000000..cc1e32a228 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/EmptyType.java @@ -0,0 +1,38 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class EmptyType extends xsbti.api.Type { + + public static EmptyType create() { + return new EmptyType(); + } + public static EmptyType of() { + return new EmptyType(); + } + + protected EmptyType() { + super(); + + } + + + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof EmptyType)) { + return false; + } else { + EmptyType o = (EmptyType)obj; + return true; + } + } + public int hashCode() { + return 37 * (17 + "xsbti.api.EmptyType".hashCode()); + } + public String toString() { + return "EmptyType(" + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/Existential.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Existential.java new file mode 100644 index 0000000000..cc82127119 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Existential.java @@ -0,0 +1,51 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class Existential extends xsbti.api.Type { + + public static Existential create(Type _baseType, TypeParameter[] _clause) { + return new Existential(_baseType, _clause); + } + public static Existential of(Type _baseType, TypeParameter[] _clause) { + return new Existential(_baseType, _clause); + } + + private Type baseType; + private TypeParameter[] clause; + protected Existential(Type _baseType, TypeParameter[] _clause) { + super(); + baseType = _baseType; + clause = _clause; + } + public Type baseType() { + return this.baseType; + } + public TypeParameter[] clause() { + return this.clause; + } + public Existential withBaseType(Type baseType) { + return new Existential(baseType, clause); + } + public Existential withClause(TypeParameter[] clause) { + return new Existential(baseType, clause); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof Existential)) { + return false; + } else { + Existential o = (Existential)obj; + return baseType().equals(o.baseType()) && java.util.Arrays.deepEquals(clause(), o.clause()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (17 + "xsbti.api.Existential".hashCode()) + baseType().hashCode()) + clause().hashCode()); + } + public String toString() { + return "Existential(" + "baseType: " + baseType() + ", " + "clause: " + clause() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/ExternalDependency.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/ExternalDependency.java new file mode 100644 index 0000000000..290cd671b3 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/ExternalDependency.java @@ -0,0 +1,67 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class ExternalDependency implements java.io.Serializable { + + public static ExternalDependency create(String _sourceClassName, String _targetProductClassName, xsbti.api.AnalyzedClass _targetClass, xsbti.api.DependencyContext _context) { + return new ExternalDependency(_sourceClassName, _targetProductClassName, _targetClass, _context); + } + public static ExternalDependency of(String _sourceClassName, String _targetProductClassName, xsbti.api.AnalyzedClass _targetClass, xsbti.api.DependencyContext _context) { + return new ExternalDependency(_sourceClassName, _targetProductClassName, _targetClass, _context); + } + + private String sourceClassName; + private String targetProductClassName; + private xsbti.api.AnalyzedClass targetClass; + private xsbti.api.DependencyContext context; + protected ExternalDependency(String _sourceClassName, String _targetProductClassName, xsbti.api.AnalyzedClass _targetClass, xsbti.api.DependencyContext _context) { + super(); + sourceClassName = _sourceClassName; + targetProductClassName = _targetProductClassName; + targetClass = _targetClass; + context = _context; + } + public String sourceClassName() { + return this.sourceClassName; + } + public String targetProductClassName() { + return this.targetProductClassName; + } + public xsbti.api.AnalyzedClass targetClass() { + return this.targetClass; + } + public xsbti.api.DependencyContext context() { + return this.context; + } + public ExternalDependency withSourceClassName(String sourceClassName) { + return new ExternalDependency(sourceClassName, targetProductClassName, targetClass, context); + } + public ExternalDependency withTargetProductClassName(String targetProductClassName) { + return new ExternalDependency(sourceClassName, targetProductClassName, targetClass, context); + } + public ExternalDependency withTargetClass(xsbti.api.AnalyzedClass targetClass) { + return new ExternalDependency(sourceClassName, targetProductClassName, targetClass, context); + } + public ExternalDependency withContext(xsbti.api.DependencyContext context) { + return new ExternalDependency(sourceClassName, targetProductClassName, targetClass, context); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof ExternalDependency)) { + return false; + } else { + ExternalDependency o = (ExternalDependency)obj; + return sourceClassName().equals(o.sourceClassName()) && targetProductClassName().equals(o.targetProductClassName()) && targetClass().equals(o.targetClass()) && context().equals(o.context()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (37 * (37 * (17 + "xsbti.api.ExternalDependency".hashCode()) + sourceClassName().hashCode()) + targetProductClassName().hashCode()) + targetClass().hashCode()) + context().hashCode()); + } + public String toString() { + return "ExternalDependency(" + "sourceClassName: " + sourceClassName() + ", " + "targetProductClassName: " + targetProductClassName() + ", " + "targetClass: " + targetClass() + ", " + "context: " + context() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/FieldLike.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/FieldLike.java new file mode 100644 index 0000000000..13cce119b8 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/FieldLike.java @@ -0,0 +1,35 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public abstract class FieldLike extends xsbti.api.ClassDefinition { + + + private Type tpe; + protected FieldLike(String _name, Access _access, Modifiers _modifiers, Annotation[] _annotations, Type _tpe) { + super(_name, _access, _modifiers, _annotations); + tpe = _tpe; + } + public Type tpe() { + return this.tpe; + } + + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof FieldLike)) { + return false; + } else { + FieldLike o = (FieldLike)obj; + return name().equals(o.name()) && access().equals(o.access()) && modifiers().equals(o.modifiers()) && java.util.Arrays.deepEquals(annotations(), o.annotations()) && tpe().equals(o.tpe()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (37 * (37 * (37 * (17 + "xsbti.api.FieldLike".hashCode()) + name().hashCode()) + access().hashCode()) + modifiers().hashCode()) + annotations().hashCode()) + tpe().hashCode()); + } + public String toString() { + return "FieldLike(" + "name: " + name() + ", " + "access: " + access() + ", " + "modifiers: " + modifiers() + ", " + "annotations: " + annotations() + ", " + "tpe: " + tpe() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/Id.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Id.java new file mode 100644 index 0000000000..506b659e5a --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Id.java @@ -0,0 +1,43 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class Id extends xsbti.api.PathComponent { + + public static Id create(String _id) { + return new Id(_id); + } + public static Id of(String _id) { + return new Id(_id); + } + + private String id; + protected Id(String _id) { + super(); + id = _id; + } + public String id() { + return this.id; + } + public Id withId(String id) { + return new Id(id); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof Id)) { + return false; + } else { + Id o = (Id)obj; + return id().equals(o.id()); + } + } + public int hashCode() { + return 37 * (37 * (17 + "xsbti.api.Id".hashCode()) + id().hashCode()); + } + public String toString() { + return "Id(" + "id: " + id() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/IdQualifier.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/IdQualifier.java new file mode 100644 index 0000000000..9d9f2e56be --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/IdQualifier.java @@ -0,0 +1,43 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class IdQualifier extends xsbti.api.Qualifier { + + public static IdQualifier create(String _value) { + return new IdQualifier(_value); + } + public static IdQualifier of(String _value) { + return new IdQualifier(_value); + } + + private String value; + protected IdQualifier(String _value) { + super(); + value = _value; + } + public String value() { + return this.value; + } + public IdQualifier withValue(String value) { + return new IdQualifier(value); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof IdQualifier)) { + return false; + } else { + IdQualifier o = (IdQualifier)obj; + return value().equals(o.value()); + } + } + public int hashCode() { + return 37 * (37 * (17 + "xsbti.api.IdQualifier".hashCode()) + value().hashCode()); + } + public String toString() { + return "IdQualifier(" + "value: " + value() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/InternalDependency.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/InternalDependency.java new file mode 100644 index 0000000000..0090d7dce7 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/InternalDependency.java @@ -0,0 +1,59 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class InternalDependency implements java.io.Serializable { + + public static InternalDependency create(String _sourceClassName, String _targetClassName, xsbti.api.DependencyContext _context) { + return new InternalDependency(_sourceClassName, _targetClassName, _context); + } + public static InternalDependency of(String _sourceClassName, String _targetClassName, xsbti.api.DependencyContext _context) { + return new InternalDependency(_sourceClassName, _targetClassName, _context); + } + + private String sourceClassName; + private String targetClassName; + private xsbti.api.DependencyContext context; + protected InternalDependency(String _sourceClassName, String _targetClassName, xsbti.api.DependencyContext _context) { + super(); + sourceClassName = _sourceClassName; + targetClassName = _targetClassName; + context = _context; + } + public String sourceClassName() { + return this.sourceClassName; + } + public String targetClassName() { + return this.targetClassName; + } + public xsbti.api.DependencyContext context() { + return this.context; + } + public InternalDependency withSourceClassName(String sourceClassName) { + return new InternalDependency(sourceClassName, targetClassName, context); + } + public InternalDependency withTargetClassName(String targetClassName) { + return new InternalDependency(sourceClassName, targetClassName, context); + } + public InternalDependency withContext(xsbti.api.DependencyContext context) { + return new InternalDependency(sourceClassName, targetClassName, context); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof InternalDependency)) { + return false; + } else { + InternalDependency o = (InternalDependency)obj; + return sourceClassName().equals(o.sourceClassName()) && targetClassName().equals(o.targetClassName()) && context().equals(o.context()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (37 * (17 + "xsbti.api.InternalDependency".hashCode()) + sourceClassName().hashCode()) + targetClassName().hashCode()) + context().hashCode()); + } + public String toString() { + return "InternalDependency(" + "sourceClassName: " + sourceClassName() + ", " + "targetClassName: " + targetClassName() + ", " + "context: " + context() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/MethodParameter.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/MethodParameter.java new file mode 100644 index 0000000000..da1180181c --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/MethodParameter.java @@ -0,0 +1,67 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class MethodParameter implements java.io.Serializable { + + public static MethodParameter create(String _name, Type _tpe, boolean _hasDefault, ParameterModifier _modifier) { + return new MethodParameter(_name, _tpe, _hasDefault, _modifier); + } + public static MethodParameter of(String _name, Type _tpe, boolean _hasDefault, ParameterModifier _modifier) { + return new MethodParameter(_name, _tpe, _hasDefault, _modifier); + } + + private String name; + private Type tpe; + private boolean hasDefault; + private ParameterModifier modifier; + protected MethodParameter(String _name, Type _tpe, boolean _hasDefault, ParameterModifier _modifier) { + super(); + name = _name; + tpe = _tpe; + hasDefault = _hasDefault; + modifier = _modifier; + } + public String name() { + return this.name; + } + public Type tpe() { + return this.tpe; + } + public boolean hasDefault() { + return this.hasDefault; + } + public ParameterModifier modifier() { + return this.modifier; + } + public MethodParameter withName(String name) { + return new MethodParameter(name, tpe, hasDefault, modifier); + } + public MethodParameter withTpe(Type tpe) { + return new MethodParameter(name, tpe, hasDefault, modifier); + } + public MethodParameter withHasDefault(boolean hasDefault) { + return new MethodParameter(name, tpe, hasDefault, modifier); + } + public MethodParameter withModifier(ParameterModifier modifier) { + return new MethodParameter(name, tpe, hasDefault, modifier); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof MethodParameter)) { + return false; + } else { + MethodParameter o = (MethodParameter)obj; + return name().equals(o.name()) && tpe().equals(o.tpe()) && (hasDefault() == o.hasDefault()) && modifier().equals(o.modifier()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (37 * (37 * (17 + "xsbti.api.MethodParameter".hashCode()) + name().hashCode()) + tpe().hashCode()) + (new Boolean(hasDefault())).hashCode()) + modifier().hashCode()); + } + public String toString() { + return "MethodParameter(" + "name: " + name() + ", " + "tpe: " + tpe() + ", " + "hasDefault: " + hasDefault() + ", " + "modifier: " + modifier() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/NameHash.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/NameHash.java new file mode 100644 index 0000000000..41b0841ef2 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/NameHash.java @@ -0,0 +1,59 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class NameHash implements java.io.Serializable { + + public static NameHash create(String _name, xsbti.UseScope _scope, int _hash) { + return new NameHash(_name, _scope, _hash); + } + public static NameHash of(String _name, xsbti.UseScope _scope, int _hash) { + return new NameHash(_name, _scope, _hash); + } + + private String name; + private xsbti.UseScope scope; + private int hash; + protected NameHash(String _name, xsbti.UseScope _scope, int _hash) { + super(); + name = _name; + scope = _scope; + hash = _hash; + } + public String name() { + return this.name; + } + public xsbti.UseScope scope() { + return this.scope; + } + public int hash() { + return this.hash; + } + public NameHash withName(String name) { + return new NameHash(name, scope, hash); + } + public NameHash withScope(xsbti.UseScope scope) { + return new NameHash(name, scope, hash); + } + public NameHash withHash(int hash) { + return new NameHash(name, scope, hash); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof NameHash)) { + return false; + } else { + NameHash o = (NameHash)obj; + return name().equals(o.name()) && scope().equals(o.scope()) && (hash() == o.hash()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (37 * (17 + "xsbti.api.NameHash".hashCode()) + name().hashCode()) + scope().hashCode()) + (new Integer(hash())).hashCode()); + } + public String toString() { + return "NameHash(" + "name: " + name() + ", " + "scope: " + scope() + ", " + "hash: " + hash() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/Package.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Package.java new file mode 100644 index 0000000000..5613be533d --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Package.java @@ -0,0 +1,43 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class Package implements java.io.Serializable { + + public static Package create(String _name) { + return new Package(_name); + } + public static Package of(String _name) { + return new Package(_name); + } + + private String name; + protected Package(String _name) { + super(); + name = _name; + } + public String name() { + return this.name; + } + public Package withName(String name) { + return new Package(name); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof Package)) { + return false; + } else { + Package o = (Package)obj; + return name().equals(o.name()); + } + } + public int hashCode() { + return 37 * (37 * (17 + "xsbti.api.Package".hashCode()) + name().hashCode()); + } + public String toString() { + return "Package(" + "name: " + name() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/ParameterList.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/ParameterList.java new file mode 100644 index 0000000000..e49dfe4afe --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/ParameterList.java @@ -0,0 +1,51 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class ParameterList implements java.io.Serializable { + + public static ParameterList create(MethodParameter[] _parameters, boolean _isImplicit) { + return new ParameterList(_parameters, _isImplicit); + } + public static ParameterList of(MethodParameter[] _parameters, boolean _isImplicit) { + return new ParameterList(_parameters, _isImplicit); + } + + private MethodParameter[] parameters; + private boolean isImplicit; + protected ParameterList(MethodParameter[] _parameters, boolean _isImplicit) { + super(); + parameters = _parameters; + isImplicit = _isImplicit; + } + public MethodParameter[] parameters() { + return this.parameters; + } + public boolean isImplicit() { + return this.isImplicit; + } + public ParameterList withParameters(MethodParameter[] parameters) { + return new ParameterList(parameters, isImplicit); + } + public ParameterList withIsImplicit(boolean isImplicit) { + return new ParameterList(parameters, isImplicit); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof ParameterList)) { + return false; + } else { + ParameterList o = (ParameterList)obj; + return java.util.Arrays.deepEquals(parameters(), o.parameters()) && (isImplicit() == o.isImplicit()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (17 + "xsbti.api.ParameterList".hashCode()) + parameters().hashCode()) + (new Boolean(isImplicit())).hashCode()); + } + public String toString() { + return "ParameterList(" + "parameters: " + parameters() + ", " + "isImplicit: " + isImplicit() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/ParameterModifier.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/ParameterModifier.java new file mode 100644 index 0000000000..3a74d8aa27 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/ParameterModifier.java @@ -0,0 +1,13 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public enum ParameterModifier { + + Repeated, + Plain, + ByName; + +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/ParameterRef.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/ParameterRef.java new file mode 100644 index 0000000000..eaa8e41e86 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/ParameterRef.java @@ -0,0 +1,43 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class ParameterRef extends xsbti.api.Type { + + public static ParameterRef create(String _id) { + return new ParameterRef(_id); + } + public static ParameterRef of(String _id) { + return new ParameterRef(_id); + } + + private String id; + protected ParameterRef(String _id) { + super(); + id = _id; + } + public String id() { + return this.id; + } + public ParameterRef withId(String id) { + return new ParameterRef(id); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof ParameterRef)) { + return false; + } else { + ParameterRef o = (ParameterRef)obj; + return id().equals(o.id()); + } + } + public int hashCode() { + return 37 * (37 * (17 + "xsbti.api.ParameterRef".hashCode()) + id().hashCode()); + } + public String toString() { + return "ParameterRef(" + "id: " + id() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/Parameterized.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Parameterized.java new file mode 100644 index 0000000000..cb2921c362 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Parameterized.java @@ -0,0 +1,51 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class Parameterized extends xsbti.api.Type { + + public static Parameterized create(Type _baseType, Type[] _typeArguments) { + return new Parameterized(_baseType, _typeArguments); + } + public static Parameterized of(Type _baseType, Type[] _typeArguments) { + return new Parameterized(_baseType, _typeArguments); + } + + private Type baseType; + private Type[] typeArguments; + protected Parameterized(Type _baseType, Type[] _typeArguments) { + super(); + baseType = _baseType; + typeArguments = _typeArguments; + } + public Type baseType() { + return this.baseType; + } + public Type[] typeArguments() { + return this.typeArguments; + } + public Parameterized withBaseType(Type baseType) { + return new Parameterized(baseType, typeArguments); + } + public Parameterized withTypeArguments(Type[] typeArguments) { + return new Parameterized(baseType, typeArguments); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof Parameterized)) { + return false; + } else { + Parameterized o = (Parameterized)obj; + return baseType().equals(o.baseType()) && java.util.Arrays.deepEquals(typeArguments(), o.typeArguments()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (17 + "xsbti.api.Parameterized".hashCode()) + baseType().hashCode()) + typeArguments().hashCode()); + } + public String toString() { + return "Parameterized(" + "baseType: " + baseType() + ", " + "typeArguments: " + typeArguments() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/ParameterizedDefinition.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/ParameterizedDefinition.java new file mode 100644 index 0000000000..eadd8ab9c7 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/ParameterizedDefinition.java @@ -0,0 +1,35 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public abstract class ParameterizedDefinition extends xsbti.api.ClassDefinition { + + + private TypeParameter[] typeParameters; + protected ParameterizedDefinition(String _name, Access _access, Modifiers _modifiers, Annotation[] _annotations, TypeParameter[] _typeParameters) { + super(_name, _access, _modifiers, _annotations); + typeParameters = _typeParameters; + } + public TypeParameter[] typeParameters() { + return this.typeParameters; + } + + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof ParameterizedDefinition)) { + return false; + } else { + ParameterizedDefinition o = (ParameterizedDefinition)obj; + return name().equals(o.name()) && access().equals(o.access()) && modifiers().equals(o.modifiers()) && java.util.Arrays.deepEquals(annotations(), o.annotations()) && java.util.Arrays.deepEquals(typeParameters(), o.typeParameters()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (37 * (37 * (37 * (17 + "xsbti.api.ParameterizedDefinition".hashCode()) + name().hashCode()) + access().hashCode()) + modifiers().hashCode()) + annotations().hashCode()) + typeParameters().hashCode()); + } + public String toString() { + return "ParameterizedDefinition(" + "name: " + name() + ", " + "access: " + access() + ", " + "modifiers: " + modifiers() + ", " + "annotations: " + annotations() + ", " + "typeParameters: " + typeParameters() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/Path.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Path.java new file mode 100644 index 0000000000..439f614609 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Path.java @@ -0,0 +1,43 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class Path implements java.io.Serializable { + + public static Path create(PathComponent[] _components) { + return new Path(_components); + } + public static Path of(PathComponent[] _components) { + return new Path(_components); + } + + private PathComponent[] components; + protected Path(PathComponent[] _components) { + super(); + components = _components; + } + public PathComponent[] components() { + return this.components; + } + public Path withComponents(PathComponent[] components) { + return new Path(components); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof Path)) { + return false; + } else { + Path o = (Path)obj; + return java.util.Arrays.deepEquals(components(), o.components()); + } + } + public int hashCode() { + return 37 * (37 * (17 + "xsbti.api.Path".hashCode()) + components().hashCode()); + } + public String toString() { + return "Path(" + "components: " + components() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/PathComponent.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/PathComponent.java new file mode 100644 index 0000000000..e14755708e --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/PathComponent.java @@ -0,0 +1,32 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public abstract class PathComponent implements java.io.Serializable { + + + protected PathComponent() { + super(); + + } + + + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof PathComponent)) { + return false; + } else { + PathComponent o = (PathComponent)obj; + return true; + } + } + public int hashCode() { + return 37 * (17 + "xsbti.api.PathComponent".hashCode()); + } + public String toString() { + return "PathComponent(" + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/Polymorphic.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Polymorphic.java new file mode 100644 index 0000000000..8b12dd0f07 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Polymorphic.java @@ -0,0 +1,51 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class Polymorphic extends xsbti.api.Type { + + public static Polymorphic create(Type _baseType, TypeParameter[] _parameters) { + return new Polymorphic(_baseType, _parameters); + } + public static Polymorphic of(Type _baseType, TypeParameter[] _parameters) { + return new Polymorphic(_baseType, _parameters); + } + + private Type baseType; + private TypeParameter[] parameters; + protected Polymorphic(Type _baseType, TypeParameter[] _parameters) { + super(); + baseType = _baseType; + parameters = _parameters; + } + public Type baseType() { + return this.baseType; + } + public TypeParameter[] parameters() { + return this.parameters; + } + public Polymorphic withBaseType(Type baseType) { + return new Polymorphic(baseType, parameters); + } + public Polymorphic withParameters(TypeParameter[] parameters) { + return new Polymorphic(baseType, parameters); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof Polymorphic)) { + return false; + } else { + Polymorphic o = (Polymorphic)obj; + return baseType().equals(o.baseType()) && java.util.Arrays.deepEquals(parameters(), o.parameters()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (17 + "xsbti.api.Polymorphic".hashCode()) + baseType().hashCode()) + parameters().hashCode()); + } + public String toString() { + return "Polymorphic(" + "baseType: " + baseType() + ", " + "parameters: " + parameters() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/Private.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Private.java new file mode 100644 index 0000000000..eec014cacf --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Private.java @@ -0,0 +1,40 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class Private extends xsbti.api.Qualified { + + public static Private create(Qualifier _qualifier) { + return new Private(_qualifier); + } + public static Private of(Qualifier _qualifier) { + return new Private(_qualifier); + } + + protected Private(Qualifier _qualifier) { + super(_qualifier); + + } + + public Private withQualifier(Qualifier qualifier) { + return new Private(qualifier); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof Private)) { + return false; + } else { + Private o = (Private)obj; + return qualifier().equals(o.qualifier()); + } + } + public int hashCode() { + return 37 * (37 * (17 + "xsbti.api.Private".hashCode()) + qualifier().hashCode()); + } + public String toString() { + return "Private(" + "qualifier: " + qualifier() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/Projection.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Projection.java new file mode 100644 index 0000000000..e33cc8a853 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Projection.java @@ -0,0 +1,51 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class Projection extends xsbti.api.Type { + + public static Projection create(Type _prefix, String _id) { + return new Projection(_prefix, _id); + } + public static Projection of(Type _prefix, String _id) { + return new Projection(_prefix, _id); + } + + private Type prefix; + private String id; + protected Projection(Type _prefix, String _id) { + super(); + prefix = _prefix; + id = _id; + } + public Type prefix() { + return this.prefix; + } + public String id() { + return this.id; + } + public Projection withPrefix(Type prefix) { + return new Projection(prefix, id); + } + public Projection withId(String id) { + return new Projection(prefix, id); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof Projection)) { + return false; + } else { + Projection o = (Projection)obj; + return prefix().equals(o.prefix()) && id().equals(o.id()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (17 + "xsbti.api.Projection".hashCode()) + prefix().hashCode()) + id().hashCode()); + } + public String toString() { + return "Projection(" + "prefix: " + prefix() + ", " + "id: " + id() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/Protected.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Protected.java new file mode 100644 index 0000000000..ff844cc2b8 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Protected.java @@ -0,0 +1,40 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class Protected extends xsbti.api.Qualified { + + public static Protected create(Qualifier _qualifier) { + return new Protected(_qualifier); + } + public static Protected of(Qualifier _qualifier) { + return new Protected(_qualifier); + } + + protected Protected(Qualifier _qualifier) { + super(_qualifier); + + } + + public Protected withQualifier(Qualifier qualifier) { + return new Protected(qualifier); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof Protected)) { + return false; + } else { + Protected o = (Protected)obj; + return qualifier().equals(o.qualifier()); + } + } + public int hashCode() { + return 37 * (37 * (17 + "xsbti.api.Protected".hashCode()) + qualifier().hashCode()); + } + public String toString() { + return "Protected(" + "qualifier: " + qualifier() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/Public.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Public.java new file mode 100644 index 0000000000..198d4bb759 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Public.java @@ -0,0 +1,38 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class Public extends xsbti.api.Access { + + public static Public create() { + return new Public(); + } + public static Public of() { + return new Public(); + } + + protected Public() { + super(); + + } + + + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof Public)) { + return false; + } else { + Public o = (Public)obj; + return true; + } + } + public int hashCode() { + return 37 * (17 + "xsbti.api.Public".hashCode()); + } + public String toString() { + return "Public(" + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/Qualified.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Qualified.java new file mode 100644 index 0000000000..e77952d264 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Qualified.java @@ -0,0 +1,35 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public abstract class Qualified extends xsbti.api.Access { + + + private Qualifier qualifier; + protected Qualified(Qualifier _qualifier) { + super(); + qualifier = _qualifier; + } + public Qualifier qualifier() { + return this.qualifier; + } + + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof Qualified)) { + return false; + } else { + Qualified o = (Qualified)obj; + return qualifier().equals(o.qualifier()); + } + } + public int hashCode() { + return 37 * (37 * (17 + "xsbti.api.Qualified".hashCode()) + qualifier().hashCode()); + } + public String toString() { + return "Qualified(" + "qualifier: " + qualifier() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/Qualifier.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Qualifier.java new file mode 100644 index 0000000000..5a2c2677bb --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Qualifier.java @@ -0,0 +1,32 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public abstract class Qualifier implements java.io.Serializable { + + + protected Qualifier() { + super(); + + } + + + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof Qualifier)) { + return false; + } else { + Qualifier o = (Qualifier)obj; + return true; + } + } + public int hashCode() { + return 37 * (17 + "xsbti.api.Qualifier".hashCode()); + } + public String toString() { + return "Qualifier(" + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/Singleton.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Singleton.java new file mode 100644 index 0000000000..7c35df7520 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Singleton.java @@ -0,0 +1,43 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class Singleton extends xsbti.api.Type { + + public static Singleton create(Path _path) { + return new Singleton(_path); + } + public static Singleton of(Path _path) { + return new Singleton(_path); + } + + private Path path; + protected Singleton(Path _path) { + super(); + path = _path; + } + public Path path() { + return this.path; + } + public Singleton withPath(Path path) { + return new Singleton(path); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof Singleton)) { + return false; + } else { + Singleton o = (Singleton)obj; + return path().equals(o.path()); + } + } + public int hashCode() { + return 37 * (37 * (17 + "xsbti.api.Singleton".hashCode()) + path().hashCode()); + } + public String toString() { + return "Singleton(" + "path: " + path() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/Structure.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Structure.java new file mode 100644 index 0000000000..2f2e6239da --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Structure.java @@ -0,0 +1,52 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class Structure extends xsbti.api.Type { + + public static Structure create(xsbti.api.Lazy _parents, xsbti.api.Lazy _declared, xsbti.api.Lazy _inherited) { + return new Structure(_parents, _declared, _inherited); + } + public static Structure of(xsbti.api.Lazy _parents, xsbti.api.Lazy _declared, xsbti.api.Lazy _inherited) { + return new Structure(_parents, _declared, _inherited); + } + + private xsbti.api.Lazy parents; + private xsbti.api.Lazy declared; + private xsbti.api.Lazy inherited; + protected Structure(xsbti.api.Lazy _parents, xsbti.api.Lazy _declared, xsbti.api.Lazy _inherited) { + super(); + parents = _parents; + declared = _declared; + inherited = _inherited; + } + public Type[] parents() { + return this.parents.get(); + } + public ClassDefinition[] declared() { + return this.declared.get(); + } + public ClassDefinition[] inherited() { + return this.inherited.get(); + } + public Structure withParents(xsbti.api.Lazy parents) { + return new Structure(parents, declared, inherited); + } + public Structure withDeclared(xsbti.api.Lazy declared) { + return new Structure(parents, declared, inherited); + } + public Structure withInherited(xsbti.api.Lazy inherited) { + return new Structure(parents, declared, inherited); + } + public boolean equals(Object obj) { + return this == obj; // We have lazy members, so use object identity to avoid circularity. + } + public int hashCode() { + return super.hashCode(); // Avoid evaluating lazy members in hashCode to avoid circularity. + } + public String toString() { + return super.toString(); // Avoid evaluating lazy members in toString to avoid circularity. + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/Super.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Super.java new file mode 100644 index 0000000000..4658d5bf65 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Super.java @@ -0,0 +1,43 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class Super extends xsbti.api.PathComponent { + + public static Super create(Path _qualifier) { + return new Super(_qualifier); + } + public static Super of(Path _qualifier) { + return new Super(_qualifier); + } + + private Path qualifier; + protected Super(Path _qualifier) { + super(); + qualifier = _qualifier; + } + public Path qualifier() { + return this.qualifier; + } + public Super withQualifier(Path qualifier) { + return new Super(qualifier); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof Super)) { + return false; + } else { + Super o = (Super)obj; + return qualifier().equals(o.qualifier()); + } + } + public int hashCode() { + return 37 * (37 * (17 + "xsbti.api.Super".hashCode()) + qualifier().hashCode()); + } + public String toString() { + return "Super(" + "qualifier: " + qualifier() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/This.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/This.java new file mode 100644 index 0000000000..63a3f02707 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/This.java @@ -0,0 +1,38 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class This extends xsbti.api.PathComponent { + + public static This create() { + return new This(); + } + public static This of() { + return new This(); + } + + protected This() { + super(); + + } + + + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof This)) { + return false; + } else { + This o = (This)obj; + return true; + } + } + public int hashCode() { + return 37 * (17 + "xsbti.api.This".hashCode()); + } + public String toString() { + return "This(" + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/ThisQualifier.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/ThisQualifier.java new file mode 100644 index 0000000000..b4db84bdfb --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/ThisQualifier.java @@ -0,0 +1,38 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class ThisQualifier extends xsbti.api.Qualifier { + + public static ThisQualifier create() { + return new ThisQualifier(); + } + public static ThisQualifier of() { + return new ThisQualifier(); + } + + protected ThisQualifier() { + super(); + + } + + + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof ThisQualifier)) { + return false; + } else { + ThisQualifier o = (ThisQualifier)obj; + return true; + } + } + public int hashCode() { + return 37 * (17 + "xsbti.api.ThisQualifier".hashCode()); + } + public String toString() { + return "ThisQualifier(" + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/Type.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Type.java new file mode 100644 index 0000000000..d48defee82 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Type.java @@ -0,0 +1,32 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public abstract class Type implements java.io.Serializable { + + + protected Type() { + super(); + + } + + + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof Type)) { + return false; + } else { + Type o = (Type)obj; + return true; + } + } + public int hashCode() { + return 37 * (17 + "xsbti.api.Type".hashCode()); + } + public String toString() { + return "Type(" + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/TypeAlias.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/TypeAlias.java new file mode 100644 index 0000000000..6efb49e0ec --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/TypeAlias.java @@ -0,0 +1,58 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class TypeAlias extends xsbti.api.TypeMember { + + public static TypeAlias create(String _name, Access _access, Modifiers _modifiers, Annotation[] _annotations, TypeParameter[] _typeParameters, Type _tpe) { + return new TypeAlias(_name, _access, _modifiers, _annotations, _typeParameters, _tpe); + } + public static TypeAlias of(String _name, Access _access, Modifiers _modifiers, Annotation[] _annotations, TypeParameter[] _typeParameters, Type _tpe) { + return new TypeAlias(_name, _access, _modifiers, _annotations, _typeParameters, _tpe); + } + + private Type tpe; + protected TypeAlias(String _name, Access _access, Modifiers _modifiers, Annotation[] _annotations, TypeParameter[] _typeParameters, Type _tpe) { + super(_name, _access, _modifiers, _annotations, _typeParameters); + tpe = _tpe; + } + public Type tpe() { + return this.tpe; + } + public TypeAlias withName(String name) { + return new TypeAlias(name, access(), modifiers(), annotations(), typeParameters(), tpe); + } + public TypeAlias withAccess(Access access) { + return new TypeAlias(name(), access, modifiers(), annotations(), typeParameters(), tpe); + } + public TypeAlias withModifiers(Modifiers modifiers) { + return new TypeAlias(name(), access(), modifiers, annotations(), typeParameters(), tpe); + } + public TypeAlias withAnnotations(Annotation[] annotations) { + return new TypeAlias(name(), access(), modifiers(), annotations, typeParameters(), tpe); + } + public TypeAlias withTypeParameters(TypeParameter[] typeParameters) { + return new TypeAlias(name(), access(), modifiers(), annotations(), typeParameters, tpe); + } + public TypeAlias withTpe(Type tpe) { + return new TypeAlias(name(), access(), modifiers(), annotations(), typeParameters(), tpe); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof TypeAlias)) { + return false; + } else { + TypeAlias o = (TypeAlias)obj; + return name().equals(o.name()) && access().equals(o.access()) && modifiers().equals(o.modifiers()) && java.util.Arrays.deepEquals(annotations(), o.annotations()) && java.util.Arrays.deepEquals(typeParameters(), o.typeParameters()) && tpe().equals(o.tpe()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "xsbti.api.TypeAlias".hashCode()) + name().hashCode()) + access().hashCode()) + modifiers().hashCode()) + annotations().hashCode()) + typeParameters().hashCode()) + tpe().hashCode()); + } + public String toString() { + return "TypeAlias(" + "name: " + name() + ", " + "access: " + access() + ", " + "modifiers: " + modifiers() + ", " + "annotations: " + annotations() + ", " + "typeParameters: " + typeParameters() + ", " + "tpe: " + tpe() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/TypeDeclaration.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/TypeDeclaration.java new file mode 100644 index 0000000000..ee51d23596 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/TypeDeclaration.java @@ -0,0 +1,66 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class TypeDeclaration extends xsbti.api.TypeMember { + + public static TypeDeclaration create(String _name, Access _access, Modifiers _modifiers, Annotation[] _annotations, TypeParameter[] _typeParameters, Type _lowerBound, Type _upperBound) { + return new TypeDeclaration(_name, _access, _modifiers, _annotations, _typeParameters, _lowerBound, _upperBound); + } + public static TypeDeclaration of(String _name, Access _access, Modifiers _modifiers, Annotation[] _annotations, TypeParameter[] _typeParameters, Type _lowerBound, Type _upperBound) { + return new TypeDeclaration(_name, _access, _modifiers, _annotations, _typeParameters, _lowerBound, _upperBound); + } + + private Type lowerBound; + private Type upperBound; + protected TypeDeclaration(String _name, Access _access, Modifiers _modifiers, Annotation[] _annotations, TypeParameter[] _typeParameters, Type _lowerBound, Type _upperBound) { + super(_name, _access, _modifiers, _annotations, _typeParameters); + lowerBound = _lowerBound; + upperBound = _upperBound; + } + public Type lowerBound() { + return this.lowerBound; + } + public Type upperBound() { + return this.upperBound; + } + public TypeDeclaration withName(String name) { + return new TypeDeclaration(name, access(), modifiers(), annotations(), typeParameters(), lowerBound, upperBound); + } + public TypeDeclaration withAccess(Access access) { + return new TypeDeclaration(name(), access, modifiers(), annotations(), typeParameters(), lowerBound, upperBound); + } + public TypeDeclaration withModifiers(Modifiers modifiers) { + return new TypeDeclaration(name(), access(), modifiers, annotations(), typeParameters(), lowerBound, upperBound); + } + public TypeDeclaration withAnnotations(Annotation[] annotations) { + return new TypeDeclaration(name(), access(), modifiers(), annotations, typeParameters(), lowerBound, upperBound); + } + public TypeDeclaration withTypeParameters(TypeParameter[] typeParameters) { + return new TypeDeclaration(name(), access(), modifiers(), annotations(), typeParameters, lowerBound, upperBound); + } + public TypeDeclaration withLowerBound(Type lowerBound) { + return new TypeDeclaration(name(), access(), modifiers(), annotations(), typeParameters(), lowerBound, upperBound); + } + public TypeDeclaration withUpperBound(Type upperBound) { + return new TypeDeclaration(name(), access(), modifiers(), annotations(), typeParameters(), lowerBound, upperBound); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof TypeDeclaration)) { + return false; + } else { + TypeDeclaration o = (TypeDeclaration)obj; + return name().equals(o.name()) && access().equals(o.access()) && modifiers().equals(o.modifiers()) && java.util.Arrays.deepEquals(annotations(), o.annotations()) && java.util.Arrays.deepEquals(typeParameters(), o.typeParameters()) && lowerBound().equals(o.lowerBound()) && upperBound().equals(o.upperBound()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "xsbti.api.TypeDeclaration".hashCode()) + name().hashCode()) + access().hashCode()) + modifiers().hashCode()) + annotations().hashCode()) + typeParameters().hashCode()) + lowerBound().hashCode()) + upperBound().hashCode()); + } + public String toString() { + return "TypeDeclaration(" + "name: " + name() + ", " + "access: " + access() + ", " + "modifiers: " + modifiers() + ", " + "annotations: " + annotations() + ", " + "typeParameters: " + typeParameters() + ", " + "lowerBound: " + lowerBound() + ", " + "upperBound: " + upperBound() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/TypeMember.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/TypeMember.java new file mode 100644 index 0000000000..8968e8eb44 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/TypeMember.java @@ -0,0 +1,32 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public abstract class TypeMember extends xsbti.api.ParameterizedDefinition { + + + protected TypeMember(String _name, Access _access, Modifiers _modifiers, Annotation[] _annotations, TypeParameter[] _typeParameters) { + super(_name, _access, _modifiers, _annotations, _typeParameters); + + } + + + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof TypeMember)) { + return false; + } else { + TypeMember o = (TypeMember)obj; + return name().equals(o.name()) && access().equals(o.access()) && modifiers().equals(o.modifiers()) && java.util.Arrays.deepEquals(annotations(), o.annotations()) && java.util.Arrays.deepEquals(typeParameters(), o.typeParameters()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (37 * (37 * (37 * (17 + "xsbti.api.TypeMember".hashCode()) + name().hashCode()) + access().hashCode()) + modifiers().hashCode()) + annotations().hashCode()) + typeParameters().hashCode()); + } + public String toString() { + return "TypeMember(" + "name: " + name() + ", " + "access: " + access() + ", " + "modifiers: " + modifiers() + ", " + "annotations: " + annotations() + ", " + "typeParameters: " + typeParameters() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/TypeParameter.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/TypeParameter.java new file mode 100644 index 0000000000..5d130833dd --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/TypeParameter.java @@ -0,0 +1,83 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class TypeParameter implements java.io.Serializable { + + public static TypeParameter create(String _id, Annotation[] _annotations, TypeParameter[] _typeParameters, Variance _variance, Type _lowerBound, Type _upperBound) { + return new TypeParameter(_id, _annotations, _typeParameters, _variance, _lowerBound, _upperBound); + } + public static TypeParameter of(String _id, Annotation[] _annotations, TypeParameter[] _typeParameters, Variance _variance, Type _lowerBound, Type _upperBound) { + return new TypeParameter(_id, _annotations, _typeParameters, _variance, _lowerBound, _upperBound); + } + + private String id; + private Annotation[] annotations; + private TypeParameter[] typeParameters; + private Variance variance; + private Type lowerBound; + private Type upperBound; + protected TypeParameter(String _id, Annotation[] _annotations, TypeParameter[] _typeParameters, Variance _variance, Type _lowerBound, Type _upperBound) { + super(); + id = _id; + annotations = _annotations; + typeParameters = _typeParameters; + variance = _variance; + lowerBound = _lowerBound; + upperBound = _upperBound; + } + public String id() { + return this.id; + } + public Annotation[] annotations() { + return this.annotations; + } + public TypeParameter[] typeParameters() { + return this.typeParameters; + } + public Variance variance() { + return this.variance; + } + public Type lowerBound() { + return this.lowerBound; + } + public Type upperBound() { + return this.upperBound; + } + public TypeParameter withId(String id) { + return new TypeParameter(id, annotations, typeParameters, variance, lowerBound, upperBound); + } + public TypeParameter withAnnotations(Annotation[] annotations) { + return new TypeParameter(id, annotations, typeParameters, variance, lowerBound, upperBound); + } + public TypeParameter withTypeParameters(TypeParameter[] typeParameters) { + return new TypeParameter(id, annotations, typeParameters, variance, lowerBound, upperBound); + } + public TypeParameter withVariance(Variance variance) { + return new TypeParameter(id, annotations, typeParameters, variance, lowerBound, upperBound); + } + public TypeParameter withLowerBound(Type lowerBound) { + return new TypeParameter(id, annotations, typeParameters, variance, lowerBound, upperBound); + } + public TypeParameter withUpperBound(Type upperBound) { + return new TypeParameter(id, annotations, typeParameters, variance, lowerBound, upperBound); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof TypeParameter)) { + return false; + } else { + TypeParameter o = (TypeParameter)obj; + return id().equals(o.id()) && java.util.Arrays.deepEquals(annotations(), o.annotations()) && java.util.Arrays.deepEquals(typeParameters(), o.typeParameters()) && variance().equals(o.variance()) && lowerBound().equals(o.lowerBound()) && upperBound().equals(o.upperBound()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "xsbti.api.TypeParameter".hashCode()) + id().hashCode()) + annotations().hashCode()) + typeParameters().hashCode()) + variance().hashCode()) + lowerBound().hashCode()) + upperBound().hashCode()); + } + public String toString() { + return "TypeParameter(" + "id: " + id() + ", " + "annotations: " + annotations() + ", " + "typeParameters: " + typeParameters() + ", " + "variance: " + variance() + ", " + "lowerBound: " + lowerBound() + ", " + "upperBound: " + upperBound() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/Unqualified.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Unqualified.java new file mode 100644 index 0000000000..77f82a2d1d --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Unqualified.java @@ -0,0 +1,38 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class Unqualified extends xsbti.api.Qualifier { + + public static Unqualified create() { + return new Unqualified(); + } + public static Unqualified of() { + return new Unqualified(); + } + + protected Unqualified() { + super(); + + } + + + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof Unqualified)) { + return false; + } else { + Unqualified o = (Unqualified)obj; + return true; + } + } + public int hashCode() { + return 37 * (17 + "xsbti.api.Unqualified".hashCode()); + } + public String toString() { + return "Unqualified(" + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/Val.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Val.java new file mode 100644 index 0000000000..ee8bd73daa --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Val.java @@ -0,0 +1,52 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class Val extends xsbti.api.FieldLike { + + public static Val create(String _name, Access _access, Modifiers _modifiers, Annotation[] _annotations, Type _tpe) { + return new Val(_name, _access, _modifiers, _annotations, _tpe); + } + public static Val of(String _name, Access _access, Modifiers _modifiers, Annotation[] _annotations, Type _tpe) { + return new Val(_name, _access, _modifiers, _annotations, _tpe); + } + + protected Val(String _name, Access _access, Modifiers _modifiers, Annotation[] _annotations, Type _tpe) { + super(_name, _access, _modifiers, _annotations, _tpe); + + } + + public Val withName(String name) { + return new Val(name, access(), modifiers(), annotations(), tpe()); + } + public Val withAccess(Access access) { + return new Val(name(), access, modifiers(), annotations(), tpe()); + } + public Val withModifiers(Modifiers modifiers) { + return new Val(name(), access(), modifiers, annotations(), tpe()); + } + public Val withAnnotations(Annotation[] annotations) { + return new Val(name(), access(), modifiers(), annotations, tpe()); + } + public Val withTpe(Type tpe) { + return new Val(name(), access(), modifiers(), annotations(), tpe); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof Val)) { + return false; + } else { + Val o = (Val)obj; + return name().equals(o.name()) && access().equals(o.access()) && modifiers().equals(o.modifiers()) && java.util.Arrays.deepEquals(annotations(), o.annotations()) && tpe().equals(o.tpe()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (37 * (37 * (37 * (17 + "xsbti.api.Val".hashCode()) + name().hashCode()) + access().hashCode()) + modifiers().hashCode()) + annotations().hashCode()) + tpe().hashCode()); + } + public String toString() { + return "Val(" + "name: " + name() + ", " + "access: " + access() + ", " + "modifiers: " + modifiers() + ", " + "annotations: " + annotations() + ", " + "tpe: " + tpe() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/Var.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Var.java new file mode 100644 index 0000000000..17cfb10216 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Var.java @@ -0,0 +1,52 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public final class Var extends xsbti.api.FieldLike { + + public static Var create(String _name, Access _access, Modifiers _modifiers, Annotation[] _annotations, Type _tpe) { + return new Var(_name, _access, _modifiers, _annotations, _tpe); + } + public static Var of(String _name, Access _access, Modifiers _modifiers, Annotation[] _annotations, Type _tpe) { + return new Var(_name, _access, _modifiers, _annotations, _tpe); + } + + protected Var(String _name, Access _access, Modifiers _modifiers, Annotation[] _annotations, Type _tpe) { + super(_name, _access, _modifiers, _annotations, _tpe); + + } + + public Var withName(String name) { + return new Var(name, access(), modifiers(), annotations(), tpe()); + } + public Var withAccess(Access access) { + return new Var(name(), access, modifiers(), annotations(), tpe()); + } + public Var withModifiers(Modifiers modifiers) { + return new Var(name(), access(), modifiers, annotations(), tpe()); + } + public Var withAnnotations(Annotation[] annotations) { + return new Var(name(), access(), modifiers(), annotations, tpe()); + } + public Var withTpe(Type tpe) { + return new Var(name(), access(), modifiers(), annotations(), tpe); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof Var)) { + return false; + } else { + Var o = (Var)obj; + return name().equals(o.name()) && access().equals(o.access()) && modifiers().equals(o.modifiers()) && java.util.Arrays.deepEquals(annotations(), o.annotations()) && tpe().equals(o.tpe()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (37 * (37 * (37 * (17 + "xsbti.api.Var".hashCode()) + name().hashCode()) + access().hashCode()) + modifiers().hashCode()) + annotations().hashCode()) + tpe().hashCode()); + } + public String toString() { + return "Var(" + "name: " + name() + ", " + "access: " + access() + ", " + "modifiers: " + modifiers() + ", " + "annotations: " + annotations() + ", " + "tpe: " + tpe() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/api/Variance.java b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Variance.java new file mode 100644 index 0000000000..7fb8438b6e --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/api/Variance.java @@ -0,0 +1,13 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.api; +public enum Variance { + + Contravariant, + Covariant, + Invariant; + +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/compile/ClassFileManagerType.java b/internal/compiler-interface/src/main/contraband-java/xsbti/compile/ClassFileManagerType.java new file mode 100644 index 0000000000..3d4782907d --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/compile/ClassFileManagerType.java @@ -0,0 +1,32 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.compile; +public abstract class ClassFileManagerType implements java.io.Serializable { + + + protected ClassFileManagerType() { + super(); + + } + + + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof ClassFileManagerType)) { + return false; + } else { + ClassFileManagerType o = (ClassFileManagerType)obj; + return true; + } + } + public int hashCode() { + return 37 * (17 + "xsbti.compile.ClassFileManagerType".hashCode()); + } + public String toString() { + return "ClassFileManagerType(" + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/compile/ClasspathOptions.java b/internal/compiler-interface/src/main/contraband-java/xsbti/compile/ClasspathOptions.java new file mode 100644 index 0000000000..c69f26279e --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/compile/ClasspathOptions.java @@ -0,0 +1,99 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.compile; +/** + * Define modifications to classpaths based on the {@link ScalaInstance} used for + * compilation. This class tells how to instrument the classpaths given certain Scala + * compiler-related parameters. Usually, values are all false for Java compilation. + */ +public final class ClasspathOptions implements java.io.Serializable { + + public static ClasspathOptions create(boolean _bootLibrary, boolean _compiler, boolean _extra, boolean _autoBoot, boolean _filterLibrary) { + return new ClasspathOptions(_bootLibrary, _compiler, _extra, _autoBoot, _filterLibrary); + } + public static ClasspathOptions of(boolean _bootLibrary, boolean _compiler, boolean _extra, boolean _autoBoot, boolean _filterLibrary) { + return new ClasspathOptions(_bootLibrary, _compiler, _extra, _autoBoot, _filterLibrary); + } + /** + * If true, includes the Scala library on the boot classpath. + * This should usually be true. + */ + private boolean bootLibrary; + /** + * If true, includes the Scala compiler on the standard classpath. + * This is typically false and is instead managed by the build tool or environment. + */ + private boolean compiler; + /** + * If true, includes extra jars from the Scala instance on the standard classpath. + * This is typically false and is instead managed by the build tool or environment. + */ + private boolean extra; + /** + * If true, automatically configures the boot classpath. + * This should usually be true. + */ + private boolean autoBoot; + /** + * If true, the Scala library jar is filtered from the standard classpath. + * This should usually be true because the library should be included on the boot classpath of the Scala compiler and not the standard classpath. + */ + private boolean filterLibrary; + protected ClasspathOptions(boolean _bootLibrary, boolean _compiler, boolean _extra, boolean _autoBoot, boolean _filterLibrary) { + super(); + bootLibrary = _bootLibrary; + compiler = _compiler; + extra = _extra; + autoBoot = _autoBoot; + filterLibrary = _filterLibrary; + } + public boolean bootLibrary() { + return this.bootLibrary; + } + public boolean compiler() { + return this.compiler; + } + public boolean extra() { + return this.extra; + } + public boolean autoBoot() { + return this.autoBoot; + } + public boolean filterLibrary() { + return this.filterLibrary; + } + public ClasspathOptions withBootLibrary(boolean bootLibrary) { + return new ClasspathOptions(bootLibrary, compiler, extra, autoBoot, filterLibrary); + } + public ClasspathOptions withCompiler(boolean compiler) { + return new ClasspathOptions(bootLibrary, compiler, extra, autoBoot, filterLibrary); + } + public ClasspathOptions withExtra(boolean extra) { + return new ClasspathOptions(bootLibrary, compiler, extra, autoBoot, filterLibrary); + } + public ClasspathOptions withAutoBoot(boolean autoBoot) { + return new ClasspathOptions(bootLibrary, compiler, extra, autoBoot, filterLibrary); + } + public ClasspathOptions withFilterLibrary(boolean filterLibrary) { + return new ClasspathOptions(bootLibrary, compiler, extra, autoBoot, filterLibrary); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof ClasspathOptions)) { + return false; + } else { + ClasspathOptions o = (ClasspathOptions)obj; + return (bootLibrary() == o.bootLibrary()) && (compiler() == o.compiler()) && (extra() == o.extra()) && (autoBoot() == o.autoBoot()) && (filterLibrary() == o.filterLibrary()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (37 * (37 * (37 * (17 + "xsbti.compile.ClasspathOptions".hashCode()) + (new Boolean(bootLibrary())).hashCode()) + (new Boolean(compiler())).hashCode()) + (new Boolean(extra())).hashCode()) + (new Boolean(autoBoot())).hashCode()) + (new Boolean(filterLibrary())).hashCode()); + } + public String toString() { + return "ClasspathOptions(" + "bootLibrary: " + bootLibrary() + ", " + "compiler: " + compiler() + ", " + "extra: " + extra() + ", " + "autoBoot: " + autoBoot() + ", " + "filterLibrary: " + filterLibrary() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/compile/CompileOptions.java b/internal/compiler-interface/src/main/contraband-java/xsbti/compile/CompileOptions.java new file mode 100644 index 0000000000..76476e1589 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/compile/CompileOptions.java @@ -0,0 +1,127 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.compile; +/** Compilation options */ +public final class CompileOptions implements java.io.Serializable { + + public static CompileOptions create() { + return new CompileOptions(); + } + public static CompileOptions of() { + return new CompileOptions(); + } + public static CompileOptions create(java.io.File[] _classpath, java.io.File[] _sources, java.io.File _classesDirectory, String[] _scalacOptions, String[] _javacOptions, int _maxErrors, java.util.function.Function _sourcePositionMapper, xsbti.compile.CompileOrder _order) { + return new CompileOptions(_classpath, _sources, _classesDirectory, _scalacOptions, _javacOptions, _maxErrors, _sourcePositionMapper, _order); + } + public static CompileOptions of(java.io.File[] _classpath, java.io.File[] _sources, java.io.File _classesDirectory, String[] _scalacOptions, String[] _javacOptions, int _maxErrors, java.util.function.Function _sourcePositionMapper, xsbti.compile.CompileOrder _order) { + return new CompileOptions(_classpath, _sources, _classesDirectory, _scalacOptions, _javacOptions, _maxErrors, _sourcePositionMapper, _order); + } + /** + * The classpath to use for compilation. + * This will be modified according to the ClasspathOptions used to configure the ScalaCompiler. + */ + private java.io.File[] classpath; + /** + * All sources that should be recompiled. + * This should include Scala and Java sources, which are identified by their extension. + */ + private java.io.File[] sources; + private java.io.File classesDirectory; + /** The options to pass to the Scala compiler other than the sources and classpath to use. */ + private String[] scalacOptions; + /** The options to pass to the Java compiler other than the sources and classpath to use. */ + private String[] javacOptions; + private int maxErrors; + private java.util.function.Function sourcePositionMapper; + /** Controls the order in which Java and Scala sources are compiled. */ + private xsbti.compile.CompileOrder order; + protected CompileOptions() { + super(); + classpath = new java.io.File[0]; + sources = new java.io.File[0]; + classesDirectory = new java.io.File("classes"); + scalacOptions = new String[0]; + javacOptions = new String[0]; + maxErrors = 100; + sourcePositionMapper = new java.util.function.Function() { public xsbti.Position apply(xsbti.Position a) { return a; } }; + order = xsbti.compile.CompileOrder.Mixed; + } + protected CompileOptions(java.io.File[] _classpath, java.io.File[] _sources, java.io.File _classesDirectory, String[] _scalacOptions, String[] _javacOptions, int _maxErrors, java.util.function.Function _sourcePositionMapper, xsbti.compile.CompileOrder _order) { + super(); + classpath = _classpath; + sources = _sources; + classesDirectory = _classesDirectory; + scalacOptions = _scalacOptions; + javacOptions = _javacOptions; + maxErrors = _maxErrors; + sourcePositionMapper = _sourcePositionMapper; + order = _order; + } + public java.io.File[] classpath() { + return this.classpath; + } + public java.io.File[] sources() { + return this.sources; + } + public java.io.File classesDirectory() { + return this.classesDirectory; + } + public String[] scalacOptions() { + return this.scalacOptions; + } + public String[] javacOptions() { + return this.javacOptions; + } + public int maxErrors() { + return this.maxErrors; + } + public java.util.function.Function sourcePositionMapper() { + return this.sourcePositionMapper; + } + public xsbti.compile.CompileOrder order() { + return this.order; + } + public CompileOptions withClasspath(java.io.File[] classpath) { + return new CompileOptions(classpath, sources, classesDirectory, scalacOptions, javacOptions, maxErrors, sourcePositionMapper, order); + } + public CompileOptions withSources(java.io.File[] sources) { + return new CompileOptions(classpath, sources, classesDirectory, scalacOptions, javacOptions, maxErrors, sourcePositionMapper, order); + } + public CompileOptions withClassesDirectory(java.io.File classesDirectory) { + return new CompileOptions(classpath, sources, classesDirectory, scalacOptions, javacOptions, maxErrors, sourcePositionMapper, order); + } + public CompileOptions withScalacOptions(String[] scalacOptions) { + return new CompileOptions(classpath, sources, classesDirectory, scalacOptions, javacOptions, maxErrors, sourcePositionMapper, order); + } + public CompileOptions withJavacOptions(String[] javacOptions) { + return new CompileOptions(classpath, sources, classesDirectory, scalacOptions, javacOptions, maxErrors, sourcePositionMapper, order); + } + public CompileOptions withMaxErrors(int maxErrors) { + return new CompileOptions(classpath, sources, classesDirectory, scalacOptions, javacOptions, maxErrors, sourcePositionMapper, order); + } + public CompileOptions withSourcePositionMapper(java.util.function.Function sourcePositionMapper) { + return new CompileOptions(classpath, sources, classesDirectory, scalacOptions, javacOptions, maxErrors, sourcePositionMapper, order); + } + public CompileOptions withOrder(xsbti.compile.CompileOrder order) { + return new CompileOptions(classpath, sources, classesDirectory, scalacOptions, javacOptions, maxErrors, sourcePositionMapper, order); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof CompileOptions)) { + return false; + } else { + CompileOptions o = (CompileOptions)obj; + return java.util.Arrays.deepEquals(classpath(), o.classpath()) && java.util.Arrays.deepEquals(sources(), o.sources()) && classesDirectory().equals(o.classesDirectory()) && java.util.Arrays.deepEquals(scalacOptions(), o.scalacOptions()) && java.util.Arrays.deepEquals(javacOptions(), o.javacOptions()) && (maxErrors() == o.maxErrors()) && sourcePositionMapper().equals(o.sourcePositionMapper()) && order().equals(o.order()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "xsbti.compile.CompileOptions".hashCode()) + classpath().hashCode()) + sources().hashCode()) + classesDirectory().hashCode()) + scalacOptions().hashCode()) + javacOptions().hashCode()) + (new Integer(maxErrors())).hashCode()) + sourcePositionMapper().hashCode()) + order().hashCode()); + } + public String toString() { + return "CompileOptions(" + "classpath: " + classpath() + ", " + "sources: " + sources() + ", " + "classesDirectory: " + classesDirectory() + ", " + "scalacOptions: " + scalacOptions() + ", " + "javacOptions: " + javacOptions() + ", " + "maxErrors: " + maxErrors() + ", " + "sourcePositionMapper: " + sourcePositionMapper() + ", " + "order: " + order() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/compile/CompileResult.java b/internal/compiler-interface/src/main/contraband-java/xsbti/compile/CompileResult.java new file mode 100644 index 0000000000..fb48739b8e --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/compile/CompileResult.java @@ -0,0 +1,60 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.compile; +/** The result of running the incremental compilation. */ +public final class CompileResult implements java.io.Serializable { + + public static CompileResult create(xsbti.compile.CompileAnalysis _analysis, xsbti.compile.MiniSetup _setup, boolean _hasModified) { + return new CompileResult(_analysis, _setup, _hasModified); + } + public static CompileResult of(xsbti.compile.CompileAnalysis _analysis, xsbti.compile.MiniSetup _setup, boolean _hasModified) { + return new CompileResult(_analysis, _setup, _hasModified); + } + + private xsbti.compile.CompileAnalysis analysis; + private xsbti.compile.MiniSetup setup; + private boolean hasModified; + protected CompileResult(xsbti.compile.CompileAnalysis _analysis, xsbti.compile.MiniSetup _setup, boolean _hasModified) { + super(); + analysis = _analysis; + setup = _setup; + hasModified = _hasModified; + } + public xsbti.compile.CompileAnalysis analysis() { + return this.analysis; + } + public xsbti.compile.MiniSetup setup() { + return this.setup; + } + public boolean hasModified() { + return this.hasModified; + } + public CompileResult withAnalysis(xsbti.compile.CompileAnalysis analysis) { + return new CompileResult(analysis, setup, hasModified); + } + public CompileResult withSetup(xsbti.compile.MiniSetup setup) { + return new CompileResult(analysis, setup, hasModified); + } + public CompileResult withHasModified(boolean hasModified) { + return new CompileResult(analysis, setup, hasModified); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof CompileResult)) { + return false; + } else { + CompileResult o = (CompileResult)obj; + return analysis().equals(o.analysis()) && setup().equals(o.setup()) && (hasModified() == o.hasModified()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (37 * (17 + "xsbti.compile.CompileResult".hashCode()) + analysis().hashCode()) + setup().hashCode()) + (new Boolean(hasModified())).hashCode()); + } + public String toString() { + return "CompileResult(" + "analysis: " + analysis() + ", " + "setup: " + setup() + ", " + "hasModified: " + hasModified() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/compile/Compilers.java b/internal/compiler-interface/src/main/contraband-java/xsbti/compile/Compilers.java new file mode 100644 index 0000000000..fe4df47920 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/compile/Compilers.java @@ -0,0 +1,56 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.compile; +/** The instances of Scalac/Javac used to compile the current project. */ +public final class Compilers implements java.io.Serializable { + + public static Compilers create(xsbti.compile.ScalaCompiler _scalac, xsbti.compile.JavaTools _javaTools) { + return new Compilers(_scalac, _javaTools); + } + public static Compilers of(xsbti.compile.ScalaCompiler _scalac, xsbti.compile.JavaTools _javaTools) { + return new Compilers(_scalac, _javaTools); + } + /** + * A `ScalaCompiler`. + * It should be cached by the client if desired. + */ + private xsbti.compile.ScalaCompiler scalac; + /** Tool chain of Java. */ + private xsbti.compile.JavaTools javaTools; + protected Compilers(xsbti.compile.ScalaCompiler _scalac, xsbti.compile.JavaTools _javaTools) { + super(); + scalac = _scalac; + javaTools = _javaTools; + } + public xsbti.compile.ScalaCompiler scalac() { + return this.scalac; + } + public xsbti.compile.JavaTools javaTools() { + return this.javaTools; + } + public Compilers withScalac(xsbti.compile.ScalaCompiler scalac) { + return new Compilers(scalac, javaTools); + } + public Compilers withJavaTools(xsbti.compile.JavaTools javaTools) { + return new Compilers(scalac, javaTools); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof Compilers)) { + return false; + } else { + Compilers o = (Compilers)obj; + return scalac().equals(o.scalac()) && javaTools().equals(o.javaTools()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (17 + "xsbti.compile.Compilers".hashCode()) + scalac().hashCode()) + javaTools().hashCode()); + } + public String toString() { + return "Compilers(" + "scalac: " + scalac() + ", " + "javaTools: " + javaTools() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/compile/DeleteImmediatelyManagerType.java b/internal/compiler-interface/src/main/contraband-java/xsbti/compile/DeleteImmediatelyManagerType.java new file mode 100644 index 0000000000..f5660052e5 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/compile/DeleteImmediatelyManagerType.java @@ -0,0 +1,42 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.compile; +/** + * Constructs a minimal ClassfileManager that immediately deletes class files when requested. + * This is the default classfile manager if no type is provided in incremental options. + */ +public final class DeleteImmediatelyManagerType extends xsbti.compile.ClassFileManagerType { + + public static DeleteImmediatelyManagerType create() { + return new DeleteImmediatelyManagerType(); + } + public static DeleteImmediatelyManagerType of() { + return new DeleteImmediatelyManagerType(); + } + + protected DeleteImmediatelyManagerType() { + super(); + + } + + + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof DeleteImmediatelyManagerType)) { + return false; + } else { + DeleteImmediatelyManagerType o = (DeleteImmediatelyManagerType)obj; + return true; + } + } + public int hashCode() { + return 37 * (17 + "xsbti.compile.DeleteImmediatelyManagerType".hashCode()); + } + public String toString() { + return "DeleteImmediatelyManagerType(" + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/compile/FileHash.java b/internal/compiler-interface/src/main/contraband-java/xsbti/compile/FileHash.java new file mode 100644 index 0000000000..c54e25663f --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/compile/FileHash.java @@ -0,0 +1,51 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.compile; +public final class FileHash implements java.io.Serializable { + + public static FileHash create(java.io.File _file, int _hash) { + return new FileHash(_file, _hash); + } + public static FileHash of(java.io.File _file, int _hash) { + return new FileHash(_file, _hash); + } + + private java.io.File file; + private int hash; + protected FileHash(java.io.File _file, int _hash) { + super(); + file = _file; + hash = _hash; + } + public java.io.File file() { + return this.file; + } + public int hash() { + return this.hash; + } + public FileHash withFile(java.io.File file) { + return new FileHash(file, hash); + } + public FileHash withHash(int hash) { + return new FileHash(file, hash); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof FileHash)) { + return false; + } else { + FileHash o = (FileHash)obj; + return file().equals(o.file()) && (hash() == o.hash()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (17 + "xsbti.compile.FileHash".hashCode()) + file().hashCode()) + (new Integer(hash())).hashCode()); + } + public String toString() { + return "FileHash(" + "file: " + file() + ", " + "hash: " + hash() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/compile/IncOptions.java b/internal/compiler-interface/src/main/contraband-java/xsbti/compile/IncOptions.java new file mode 100644 index 0000000000..6c4532b3fa --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/compile/IncOptions.java @@ -0,0 +1,277 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.compile; +/** + * Represents all configuration options for the incremental compiler itself and + * not the underlying Java/Scala compiler. + */ +public final class IncOptions implements java.io.Serializable { + public static int defaultTransitiveStep() { + return 3; + } + public static double defaultRecompileAllFraction() { + return 0.5; + } + public static boolean defaultRelationsDebug() { + return false; + } + public static boolean defaultApiDebug() { + return false; + } + public static int defaultApiDiffContextSize() { + return 5; + } + public static java.util.Optional defaultApiDumpDirectory() { + return java.util.Optional.empty(); + } + public static java.util.Optional defaultClassFileManagerType() { + return java.util.Optional.empty(); + } + public static java.util.Optional defaultRecompileOnMacroDef() { + return java.util.Optional.empty(); + } + public static boolean defaultUseOptimizedSealed() { + return false; + } + public static boolean defaultRecompileOnMacroDefImpl() { + return true; + } + public static boolean getRecompileOnMacroDef(IncOptions options) { + if (options.recompileOnMacroDef().isPresent()) { + return options.recompileOnMacroDef().get(); + } else { + return defaultRecompileOnMacroDefImpl(); + } + } + public static boolean defaultUseCustomizedFileManager() { + return false; + } + public static boolean defaultStoreApis() { + return true; + } + public static boolean defaultEnabled() { + return true; + } + public static java.util.Map defaultExtra() { + return new java.util.HashMap(); + } + public static ExternalHooks defaultExternal() { + return new DefaultExternalHooks(java.util.Optional.empty(), java.util.Optional.empty()); + } + public static boolean defaultLogRecompileOnMacro() { + return true; + } + public static IncOptions create() { + return new IncOptions(); + } + public static IncOptions of() { + return new IncOptions(); + } + public static IncOptions create(int _transitiveStep, double _recompileAllFraction, boolean _relationsDebug, boolean _apiDebug, int _apiDiffContextSize, java.util.Optional _apiDumpDirectory, java.util.Optional _classfileManagerType, boolean _useCustomizedFileManager, java.util.Optional _recompileOnMacroDef, boolean _useOptimizedSealed, boolean _storeApis, boolean _enabled, java.util.Map _extra, boolean _logRecompileOnMacro, xsbti.compile.ExternalHooks _externalHooks) { + return new IncOptions(_transitiveStep, _recompileAllFraction, _relationsDebug, _apiDebug, _apiDiffContextSize, _apiDumpDirectory, _classfileManagerType, _useCustomizedFileManager, _recompileOnMacroDef, _useOptimizedSealed, _storeApis, _enabled, _extra, _logRecompileOnMacro, _externalHooks); + } + public static IncOptions of(int _transitiveStep, double _recompileAllFraction, boolean _relationsDebug, boolean _apiDebug, int _apiDiffContextSize, java.util.Optional _apiDumpDirectory, java.util.Optional _classfileManagerType, boolean _useCustomizedFileManager, java.util.Optional _recompileOnMacroDef, boolean _useOptimizedSealed, boolean _storeApis, boolean _enabled, java.util.Map _extra, boolean _logRecompileOnMacro, xsbti.compile.ExternalHooks _externalHooks) { + return new IncOptions(_transitiveStep, _recompileAllFraction, _relationsDebug, _apiDebug, _apiDiffContextSize, _apiDumpDirectory, _classfileManagerType, _useCustomizedFileManager, _recompileOnMacroDef, _useOptimizedSealed, _storeApis, _enabled, _extra, _logRecompileOnMacro, _externalHooks); + } + /** After which step include whole transitive closure of invalidated source files. */ + private int transitiveStep; + /** + * What's the fraction of invalidated source files when we switch to recompiling + * all files and giving up incremental compilation altogether. That's useful in + * cases when probability that we end up recompiling most of source files but + * in multiple steps is high. Multi-step incremental recompilation is slower + * than recompiling everything in one step. + */ + private double recompileAllFraction; + /** Print very detailed information about relations, such as dependencies between source files. */ + private boolean relationsDebug; + /** Enable tools for debugging API changes. */ + private boolean apiDebug; + /** + * Controls context size (in lines) displayed when diffs are produced for textual API + * representation. + * + * This option is used only when `apiDebug == true`. + */ + private int apiDiffContextSize; + /** + * The directory where we dump textual representation of APIs. This method might be called + * only if apiDebug returns true. This is unused option at the moment as the needed functionality + * is not implemented yet. + */ + private java.util.Optional apiDumpDirectory; + /** ClassfileManager that will handle class file deletion and addition during a single incremental compilation run. */ + private java.util.Optional classfileManagerType; + /** + * Option to turn on customized file manager that tracks generated class files for transactional rollbacks. + * Using customized file manager may conflict with some libraries, this option allows user to decide + * whether to use. + */ + private boolean useCustomizedFileManager; + /** + * Determines whether incremental compiler should recompile all dependencies of a file + * that contains a macro definition. + */ + private java.util.Optional recompileOnMacroDef; + /** + * Determines whether optimized approach for invalidating sealed classes/trait is used. + * Turning this on may cause undercompilation in case of macros that are based sealed + * trait/class children enumeration. + */ + private boolean useOptimizedSealed; + /** Determines whether incremental compiler stores apis alongside analysis. */ + private boolean storeApis; + /** Determines whether incremental compilation is enabled. */ + private boolean enabled; + /** Extra options */ + private java.util.Map extra; + /** Determines whether to log information on file recompiled due to a transitive macro change */ + private boolean logRecompileOnMacro; + /** External hooks that allows clients e.g. IDEs to interacts with compilation internals */ + private xsbti.compile.ExternalHooks externalHooks; + protected IncOptions() { + super(); + transitiveStep = xsbti.compile.IncOptions.defaultTransitiveStep(); + recompileAllFraction = xsbti.compile.IncOptions.defaultRecompileAllFraction(); + relationsDebug = xsbti.compile.IncOptions.defaultRelationsDebug(); + apiDebug = xsbti.compile.IncOptions.defaultApiDebug(); + apiDiffContextSize = xsbti.compile.IncOptions.defaultApiDiffContextSize(); + apiDumpDirectory = xsbti.compile.IncOptions.defaultApiDumpDirectory(); + classfileManagerType = xsbti.compile.IncOptions.defaultClassFileManagerType(); + useCustomizedFileManager = xsbti.compile.IncOptions.defaultUseOptimizedSealed(); + recompileOnMacroDef = xsbti.compile.IncOptions.defaultRecompileOnMacroDef(); + useOptimizedSealed = xsbti.compile.IncOptions.defaultUseOptimizedSealed(); + storeApis = xsbti.compile.IncOptions.defaultStoreApis(); + enabled = xsbti.compile.IncOptions.defaultEnabled(); + extra = xsbti.compile.IncOptions.defaultExtra(); + logRecompileOnMacro = xsbti.compile.IncOptions.defaultLogRecompileOnMacro(); + externalHooks = xsbti.compile.IncOptions.defaultExternal(); + } + protected IncOptions(int _transitiveStep, double _recompileAllFraction, boolean _relationsDebug, boolean _apiDebug, int _apiDiffContextSize, java.util.Optional _apiDumpDirectory, java.util.Optional _classfileManagerType, boolean _useCustomizedFileManager, java.util.Optional _recompileOnMacroDef, boolean _useOptimizedSealed, boolean _storeApis, boolean _enabled, java.util.Map _extra, boolean _logRecompileOnMacro, xsbti.compile.ExternalHooks _externalHooks) { + super(); + transitiveStep = _transitiveStep; + recompileAllFraction = _recompileAllFraction; + relationsDebug = _relationsDebug; + apiDebug = _apiDebug; + apiDiffContextSize = _apiDiffContextSize; + apiDumpDirectory = _apiDumpDirectory; + classfileManagerType = _classfileManagerType; + useCustomizedFileManager = _useCustomizedFileManager; + recompileOnMacroDef = _recompileOnMacroDef; + useOptimizedSealed = _useOptimizedSealed; + storeApis = _storeApis; + enabled = _enabled; + extra = _extra; + logRecompileOnMacro = _logRecompileOnMacro; + externalHooks = _externalHooks; + } + public int transitiveStep() { + return this.transitiveStep; + } + public double recompileAllFraction() { + return this.recompileAllFraction; + } + public boolean relationsDebug() { + return this.relationsDebug; + } + public boolean apiDebug() { + return this.apiDebug; + } + public int apiDiffContextSize() { + return this.apiDiffContextSize; + } + public java.util.Optional apiDumpDirectory() { + return this.apiDumpDirectory; + } + public java.util.Optional classfileManagerType() { + return this.classfileManagerType; + } + public boolean useCustomizedFileManager() { + return this.useCustomizedFileManager; + } + public java.util.Optional recompileOnMacroDef() { + return this.recompileOnMacroDef; + } + public boolean useOptimizedSealed() { + return this.useOptimizedSealed; + } + public boolean storeApis() { + return this.storeApis; + } + public boolean enabled() { + return this.enabled; + } + public java.util.Map extra() { + return this.extra; + } + public boolean logRecompileOnMacro() { + return this.logRecompileOnMacro; + } + public xsbti.compile.ExternalHooks externalHooks() { + return this.externalHooks; + } + public IncOptions withTransitiveStep(int transitiveStep) { + return new IncOptions(transitiveStep, recompileAllFraction, relationsDebug, apiDebug, apiDiffContextSize, apiDumpDirectory, classfileManagerType, useCustomizedFileManager, recompileOnMacroDef, useOptimizedSealed, storeApis, enabled, extra, logRecompileOnMacro, externalHooks); + } + public IncOptions withRecompileAllFraction(double recompileAllFraction) { + return new IncOptions(transitiveStep, recompileAllFraction, relationsDebug, apiDebug, apiDiffContextSize, apiDumpDirectory, classfileManagerType, useCustomizedFileManager, recompileOnMacroDef, useOptimizedSealed, storeApis, enabled, extra, logRecompileOnMacro, externalHooks); + } + public IncOptions withRelationsDebug(boolean relationsDebug) { + return new IncOptions(transitiveStep, recompileAllFraction, relationsDebug, apiDebug, apiDiffContextSize, apiDumpDirectory, classfileManagerType, useCustomizedFileManager, recompileOnMacroDef, useOptimizedSealed, storeApis, enabled, extra, logRecompileOnMacro, externalHooks); + } + public IncOptions withApiDebug(boolean apiDebug) { + return new IncOptions(transitiveStep, recompileAllFraction, relationsDebug, apiDebug, apiDiffContextSize, apiDumpDirectory, classfileManagerType, useCustomizedFileManager, recompileOnMacroDef, useOptimizedSealed, storeApis, enabled, extra, logRecompileOnMacro, externalHooks); + } + public IncOptions withApiDiffContextSize(int apiDiffContextSize) { + return new IncOptions(transitiveStep, recompileAllFraction, relationsDebug, apiDebug, apiDiffContextSize, apiDumpDirectory, classfileManagerType, useCustomizedFileManager, recompileOnMacroDef, useOptimizedSealed, storeApis, enabled, extra, logRecompileOnMacro, externalHooks); + } + public IncOptions withApiDumpDirectory(java.util.Optional apiDumpDirectory) { + return new IncOptions(transitiveStep, recompileAllFraction, relationsDebug, apiDebug, apiDiffContextSize, apiDumpDirectory, classfileManagerType, useCustomizedFileManager, recompileOnMacroDef, useOptimizedSealed, storeApis, enabled, extra, logRecompileOnMacro, externalHooks); + } + public IncOptions withClassfileManagerType(java.util.Optional classfileManagerType) { + return new IncOptions(transitiveStep, recompileAllFraction, relationsDebug, apiDebug, apiDiffContextSize, apiDumpDirectory, classfileManagerType, useCustomizedFileManager, recompileOnMacroDef, useOptimizedSealed, storeApis, enabled, extra, logRecompileOnMacro, externalHooks); + } + public IncOptions withUseCustomizedFileManager(boolean useCustomizedFileManager) { + return new IncOptions(transitiveStep, recompileAllFraction, relationsDebug, apiDebug, apiDiffContextSize, apiDumpDirectory, classfileManagerType, useCustomizedFileManager, recompileOnMacroDef, useOptimizedSealed, storeApis, enabled, extra, logRecompileOnMacro, externalHooks); + } + public IncOptions withRecompileOnMacroDef(java.util.Optional recompileOnMacroDef) { + return new IncOptions(transitiveStep, recompileAllFraction, relationsDebug, apiDebug, apiDiffContextSize, apiDumpDirectory, classfileManagerType, useCustomizedFileManager, recompileOnMacroDef, useOptimizedSealed, storeApis, enabled, extra, logRecompileOnMacro, externalHooks); + } + public IncOptions withUseOptimizedSealed(boolean useOptimizedSealed) { + return new IncOptions(transitiveStep, recompileAllFraction, relationsDebug, apiDebug, apiDiffContextSize, apiDumpDirectory, classfileManagerType, useCustomizedFileManager, recompileOnMacroDef, useOptimizedSealed, storeApis, enabled, extra, logRecompileOnMacro, externalHooks); + } + public IncOptions withStoreApis(boolean storeApis) { + return new IncOptions(transitiveStep, recompileAllFraction, relationsDebug, apiDebug, apiDiffContextSize, apiDumpDirectory, classfileManagerType, useCustomizedFileManager, recompileOnMacroDef, useOptimizedSealed, storeApis, enabled, extra, logRecompileOnMacro, externalHooks); + } + public IncOptions withEnabled(boolean enabled) { + return new IncOptions(transitiveStep, recompileAllFraction, relationsDebug, apiDebug, apiDiffContextSize, apiDumpDirectory, classfileManagerType, useCustomizedFileManager, recompileOnMacroDef, useOptimizedSealed, storeApis, enabled, extra, logRecompileOnMacro, externalHooks); + } + public IncOptions withExtra(java.util.Map extra) { + return new IncOptions(transitiveStep, recompileAllFraction, relationsDebug, apiDebug, apiDiffContextSize, apiDumpDirectory, classfileManagerType, useCustomizedFileManager, recompileOnMacroDef, useOptimizedSealed, storeApis, enabled, extra, logRecompileOnMacro, externalHooks); + } + public IncOptions withLogRecompileOnMacro(boolean logRecompileOnMacro) { + return new IncOptions(transitiveStep, recompileAllFraction, relationsDebug, apiDebug, apiDiffContextSize, apiDumpDirectory, classfileManagerType, useCustomizedFileManager, recompileOnMacroDef, useOptimizedSealed, storeApis, enabled, extra, logRecompileOnMacro, externalHooks); + } + public IncOptions withExternalHooks(xsbti.compile.ExternalHooks externalHooks) { + return new IncOptions(transitiveStep, recompileAllFraction, relationsDebug, apiDebug, apiDiffContextSize, apiDumpDirectory, classfileManagerType, useCustomizedFileManager, recompileOnMacroDef, useOptimizedSealed, storeApis, enabled, extra, logRecompileOnMacro, externalHooks); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof IncOptions)) { + return false; + } else { + IncOptions o = (IncOptions)obj; + return (transitiveStep() == o.transitiveStep()) && (recompileAllFraction() == o.recompileAllFraction()) && (relationsDebug() == o.relationsDebug()) && (apiDebug() == o.apiDebug()) && (apiDiffContextSize() == o.apiDiffContextSize()) && apiDumpDirectory().equals(o.apiDumpDirectory()) && classfileManagerType().equals(o.classfileManagerType()) && (useCustomizedFileManager() == o.useCustomizedFileManager()) && recompileOnMacroDef().equals(o.recompileOnMacroDef()) && (useOptimizedSealed() == o.useOptimizedSealed()) && (storeApis() == o.storeApis()) && (enabled() == o.enabled()) && extra().equals(o.extra()) && (logRecompileOnMacro() == o.logRecompileOnMacro()) && externalHooks().equals(o.externalHooks()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "xsbti.compile.IncOptions".hashCode()) + (new Integer(transitiveStep())).hashCode()) + (new Double(recompileAllFraction())).hashCode()) + (new Boolean(relationsDebug())).hashCode()) + (new Boolean(apiDebug())).hashCode()) + (new Integer(apiDiffContextSize())).hashCode()) + apiDumpDirectory().hashCode()) + classfileManagerType().hashCode()) + (new Boolean(useCustomizedFileManager())).hashCode()) + recompileOnMacroDef().hashCode()) + (new Boolean(useOptimizedSealed())).hashCode()) + (new Boolean(storeApis())).hashCode()) + (new Boolean(enabled())).hashCode()) + extra().hashCode()) + (new Boolean(logRecompileOnMacro())).hashCode()) + externalHooks().hashCode()); + } + public String toString() { + return "IncOptions(" + "transitiveStep: " + transitiveStep() + ", " + "recompileAllFraction: " + recompileAllFraction() + ", " + "relationsDebug: " + relationsDebug() + ", " + "apiDebug: " + apiDebug() + ", " + "apiDiffContextSize: " + apiDiffContextSize() + ", " + "apiDumpDirectory: " + apiDumpDirectory() + ", " + "classfileManagerType: " + classfileManagerType() + ", " + "useCustomizedFileManager: " + useCustomizedFileManager() + ", " + "recompileOnMacroDef: " + recompileOnMacroDef() + ", " + "useOptimizedSealed: " + useOptimizedSealed() + ", " + "storeApis: " + storeApis() + ", " + "enabled: " + enabled() + ", " + "extra: " + extra() + ", " + "logRecompileOnMacro: " + logRecompileOnMacro() + ", " + "externalHooks: " + externalHooks() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/compile/IncToolOptions.java b/internal/compiler-interface/src/main/contraband-java/xsbti/compile/IncToolOptions.java new file mode 100644 index 0000000000..7ad476bcd7 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/compile/IncToolOptions.java @@ -0,0 +1,60 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.compile; +/** + * Define the component that manages the generated class files and defines the + * configuration options for an incremental compiler. This component is used by + * any Java compiler that implements {@link xsbti.compile.JavaTools} and they + * should return empty values by default because the incremental tool options + * are not enabled for Java tools, they are only enabled for Scala's incremental + * compiler. + */ +public final class IncToolOptions implements java.io.Serializable { + + public static IncToolOptions create(java.util.Optional _classFileManager, boolean _useCustomizedFileManager) { + return new IncToolOptions(_classFileManager, _useCustomizedFileManager); + } + public static IncToolOptions of(java.util.Optional _classFileManager, boolean _useCustomizedFileManager) { + return new IncToolOptions(_classFileManager, _useCustomizedFileManager); + } + /** Define a component that manages the generated class files in every compilation cycle. */ + private java.util.Optional classFileManager; + /** Flag that enables use of a customized {@link xsbti.compile.ClassFileManager}. */ + private boolean useCustomizedFileManager; + protected IncToolOptions(java.util.Optional _classFileManager, boolean _useCustomizedFileManager) { + super(); + classFileManager = _classFileManager; + useCustomizedFileManager = _useCustomizedFileManager; + } + public java.util.Optional classFileManager() { + return this.classFileManager; + } + public boolean useCustomizedFileManager() { + return this.useCustomizedFileManager; + } + public IncToolOptions withClassFileManager(java.util.Optional classFileManager) { + return new IncToolOptions(classFileManager, useCustomizedFileManager); + } + public IncToolOptions withUseCustomizedFileManager(boolean useCustomizedFileManager) { + return new IncToolOptions(classFileManager, useCustomizedFileManager); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof IncToolOptions)) { + return false; + } else { + IncToolOptions o = (IncToolOptions)obj; + return classFileManager().equals(o.classFileManager()) && (useCustomizedFileManager() == o.useCustomizedFileManager()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (17 + "xsbti.compile.IncToolOptions".hashCode()) + classFileManager().hashCode()) + (new Boolean(useCustomizedFileManager())).hashCode()); + } + public String toString() { + return "IncToolOptions(" + "classFileManager: " + classFileManager() + ", " + "useCustomizedFileManager: " + useCustomizedFileManager() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/compile/Inputs.java b/internal/compiler-interface/src/main/contraband-java/xsbti/compile/Inputs.java new file mode 100644 index 0000000000..e3619d4c44 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/compile/Inputs.java @@ -0,0 +1,71 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.compile; +/** Configures a single compilation of a single set of sources. */ +public final class Inputs implements java.io.Serializable { + + public static Inputs create(xsbti.compile.Compilers _compilers, xsbti.compile.CompileOptions _options, xsbti.compile.Setup _setup, xsbti.compile.PreviousResult _previousResult) { + return new Inputs(_compilers, _options, _setup, _previousResult); + } + public static Inputs of(xsbti.compile.Compilers _compilers, xsbti.compile.CompileOptions _options, xsbti.compile.Setup _setup, xsbti.compile.PreviousResult _previousResult) { + return new Inputs(_compilers, _options, _setup, _previousResult); + } + /** Return the Scala and Java compilers to use for compilation. */ + private xsbti.compile.Compilers compilers; + /** Return the compilation options, such as the sources and classpath to use. */ + private xsbti.compile.CompileOptions options; + /** Represent the configuration of incremental compilation. */ + private xsbti.compile.Setup setup; + /** Represent tha latest result of incremental compilation. */ + private xsbti.compile.PreviousResult previousResult; + protected Inputs(xsbti.compile.Compilers _compilers, xsbti.compile.CompileOptions _options, xsbti.compile.Setup _setup, xsbti.compile.PreviousResult _previousResult) { + super(); + compilers = _compilers; + options = _options; + setup = _setup; + previousResult = _previousResult; + } + public xsbti.compile.Compilers compilers() { + return this.compilers; + } + public xsbti.compile.CompileOptions options() { + return this.options; + } + public xsbti.compile.Setup setup() { + return this.setup; + } + public xsbti.compile.PreviousResult previousResult() { + return this.previousResult; + } + public Inputs withCompilers(xsbti.compile.Compilers compilers) { + return new Inputs(compilers, options, setup, previousResult); + } + public Inputs withOptions(xsbti.compile.CompileOptions options) { + return new Inputs(compilers, options, setup, previousResult); + } + public Inputs withSetup(xsbti.compile.Setup setup) { + return new Inputs(compilers, options, setup, previousResult); + } + public Inputs withPreviousResult(xsbti.compile.PreviousResult previousResult) { + return new Inputs(compilers, options, setup, previousResult); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof Inputs)) { + return false; + } else { + Inputs o = (Inputs)obj; + return compilers().equals(o.compilers()) && options().equals(o.options()) && setup().equals(o.setup()) && previousResult().equals(o.previousResult()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (37 * (37 * (17 + "xsbti.compile.Inputs".hashCode()) + compilers().hashCode()) + options().hashCode()) + setup().hashCode()) + previousResult().hashCode()); + } + public String toString() { + return "Inputs(" + "compilers: " + compilers() + ", " + "options: " + options() + ", " + "setup: " + setup() + ", " + "previousResult: " + previousResult() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/compile/MiniOptions.java b/internal/compiler-interface/src/main/contraband-java/xsbti/compile/MiniOptions.java new file mode 100644 index 0000000000..cde360e7d3 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/compile/MiniOptions.java @@ -0,0 +1,65 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.compile; +/** Compilation options. This is used as part of CompileSetup. */ +public final class MiniOptions implements java.io.Serializable { + + public static MiniOptions create(FileHash[] _classpathHash, String[] _scalacOptions, String[] _javacOptions) { + return new MiniOptions(_classpathHash, _scalacOptions, _javacOptions); + } + public static MiniOptions of(FileHash[] _classpathHash, String[] _scalacOptions, String[] _javacOptions) { + return new MiniOptions(_classpathHash, _scalacOptions, _javacOptions); + } + /** + * The classpath to use for compilation. + * This will be modified according to the ClasspathOptions used to configure the ScalaCompiler. + */ + private FileHash[] classpathHash; + /** The options to pass to the Scala compiler other than the sources and classpath to use. */ + private String[] scalacOptions; + /** The options to pass to the Java compiler other than the sources and classpath to use. */ + private String[] javacOptions; + protected MiniOptions(FileHash[] _classpathHash, String[] _scalacOptions, String[] _javacOptions) { + super(); + classpathHash = _classpathHash; + scalacOptions = _scalacOptions; + javacOptions = _javacOptions; + } + public FileHash[] classpathHash() { + return this.classpathHash; + } + public String[] scalacOptions() { + return this.scalacOptions; + } + public String[] javacOptions() { + return this.javacOptions; + } + public MiniOptions withClasspathHash(FileHash[] classpathHash) { + return new MiniOptions(classpathHash, scalacOptions, javacOptions); + } + public MiniOptions withScalacOptions(String[] scalacOptions) { + return new MiniOptions(classpathHash, scalacOptions, javacOptions); + } + public MiniOptions withJavacOptions(String[] javacOptions) { + return new MiniOptions(classpathHash, scalacOptions, javacOptions); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof MiniOptions)) { + return false; + } else { + MiniOptions o = (MiniOptions)obj; + return java.util.Arrays.deepEquals(classpathHash(), o.classpathHash()) && java.util.Arrays.deepEquals(scalacOptions(), o.scalacOptions()) && java.util.Arrays.deepEquals(javacOptions(), o.javacOptions()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (37 * (17 + "xsbti.compile.MiniOptions".hashCode()) + classpathHash().hashCode()) + scalacOptions().hashCode()) + javacOptions().hashCode()); + } + public String toString() { + return "MiniOptions(" + "classpathHash: " + classpathHash() + ", " + "scalacOptions: " + scalacOptions() + ", " + "javacOptions: " + javacOptions() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/compile/MiniSetup.java b/internal/compiler-interface/src/main/contraband-java/xsbti/compile/MiniSetup.java new file mode 100644 index 0000000000..0d6e04ab1f --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/compile/MiniSetup.java @@ -0,0 +1,84 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.compile; +/** This is used as part of CompileResult. */ +public final class MiniSetup implements java.io.Serializable { + + public static MiniSetup create(xsbti.compile.Output _output, xsbti.compile.MiniOptions _options, String _compilerVersion, xsbti.compile.CompileOrder _order, boolean _storeApis, xsbti.T2[] _extra) { + return new MiniSetup(_output, _options, _compilerVersion, _order, _storeApis, _extra); + } + public static MiniSetup of(xsbti.compile.Output _output, xsbti.compile.MiniOptions _options, String _compilerVersion, xsbti.compile.CompileOrder _order, boolean _storeApis, xsbti.T2[] _extra) { + return new MiniSetup(_output, _options, _compilerVersion, _order, _storeApis, _extra); + } + + private xsbti.compile.Output output; + private xsbti.compile.MiniOptions options; + private String compilerVersion; + private xsbti.compile.CompileOrder order; + private boolean storeApis; + private xsbti.T2[] extra; + protected MiniSetup(xsbti.compile.Output _output, xsbti.compile.MiniOptions _options, String _compilerVersion, xsbti.compile.CompileOrder _order, boolean _storeApis, xsbti.T2[] _extra) { + super(); + output = _output; + options = _options; + compilerVersion = _compilerVersion; + order = _order; + storeApis = _storeApis; + extra = _extra; + } + public xsbti.compile.Output output() { + return this.output; + } + public xsbti.compile.MiniOptions options() { + return this.options; + } + public String compilerVersion() { + return this.compilerVersion; + } + public xsbti.compile.CompileOrder order() { + return this.order; + } + public boolean storeApis() { + return this.storeApis; + } + public xsbti.T2[] extra() { + return this.extra; + } + public MiniSetup withOutput(xsbti.compile.Output output) { + return new MiniSetup(output, options, compilerVersion, order, storeApis, extra); + } + public MiniSetup withOptions(xsbti.compile.MiniOptions options) { + return new MiniSetup(output, options, compilerVersion, order, storeApis, extra); + } + public MiniSetup withCompilerVersion(String compilerVersion) { + return new MiniSetup(output, options, compilerVersion, order, storeApis, extra); + } + public MiniSetup withOrder(xsbti.compile.CompileOrder order) { + return new MiniSetup(output, options, compilerVersion, order, storeApis, extra); + } + public MiniSetup withStoreApis(boolean storeApis) { + return new MiniSetup(output, options, compilerVersion, order, storeApis, extra); + } + public MiniSetup withExtra(xsbti.T2[] extra) { + return new MiniSetup(output, options, compilerVersion, order, storeApis, extra); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof MiniSetup)) { + return false; + } else { + MiniSetup o = (MiniSetup)obj; + return output().equals(o.output()) && options().equals(o.options()) && compilerVersion().equals(o.compilerVersion()) && order().equals(o.order()) && (storeApis() == o.storeApis()) && java.util.Arrays.deepEquals(extra(), o.extra()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "xsbti.compile.MiniSetup".hashCode()) + output().hashCode()) + options().hashCode()) + compilerVersion().hashCode()) + order().hashCode()) + (new Boolean(storeApis())).hashCode()) + extra().hashCode()); + } + public String toString() { + return "MiniSetup(" + "output: " + output() + ", " + "options: " + options() + ", " + "compilerVersion: " + compilerVersion() + ", " + "order: " + order() + ", " + "storeApis: " + storeApis() + ", " + "extra: " + extra() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/compile/PreviousResult.java b/internal/compiler-interface/src/main/contraband-java/xsbti/compile/PreviousResult.java new file mode 100644 index 0000000000..afbff7ffb7 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/compile/PreviousResult.java @@ -0,0 +1,52 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.compile; +/** The previous source dependency analysis result from compilation. */ +public final class PreviousResult implements java.io.Serializable { + + public static PreviousResult create(java.util.Optional _analysis, java.util.Optional _setup) { + return new PreviousResult(_analysis, _setup); + } + public static PreviousResult of(java.util.Optional _analysis, java.util.Optional _setup) { + return new PreviousResult(_analysis, _setup); + } + + private java.util.Optional analysis; + private java.util.Optional setup; + protected PreviousResult(java.util.Optional _analysis, java.util.Optional _setup) { + super(); + analysis = _analysis; + setup = _setup; + } + public java.util.Optional analysis() { + return this.analysis; + } + public java.util.Optional setup() { + return this.setup; + } + public PreviousResult withAnalysis(java.util.Optional analysis) { + return new PreviousResult(analysis, setup); + } + public PreviousResult withSetup(java.util.Optional setup) { + return new PreviousResult(analysis, setup); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof PreviousResult)) { + return false; + } else { + PreviousResult o = (PreviousResult)obj; + return analysis().equals(o.analysis()) && setup().equals(o.setup()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (17 + "xsbti.compile.PreviousResult".hashCode()) + analysis().hashCode()) + setup().hashCode()); + } + public String toString() { + return "PreviousResult(" + "analysis: " + analysis() + ", " + "setup: " + setup() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/compile/Setup.java b/internal/compiler-interface/src/main/contraband-java/xsbti/compile/Setup.java new file mode 100644 index 0000000000..d623718b65 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/compile/Setup.java @@ -0,0 +1,108 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.compile; +/** Configures incremental recompilation. */ +public final class Setup implements java.io.Serializable { + + public static Setup create(xsbti.compile.PerClasspathEntryLookup _perClasspathEntryLookup, boolean _skip, java.io.File _cacheFile, xsbti.compile.GlobalsCache _cache, xsbti.compile.IncOptions _incrementalCompilerOptions, xsbti.Reporter _reporter, java.util.Optional _progress, xsbti.T2[] _extra) { + return new Setup(_perClasspathEntryLookup, _skip, _cacheFile, _cache, _incrementalCompilerOptions, _reporter, _progress, _extra); + } + public static Setup of(xsbti.compile.PerClasspathEntryLookup _perClasspathEntryLookup, boolean _skip, java.io.File _cacheFile, xsbti.compile.GlobalsCache _cache, xsbti.compile.IncOptions _incrementalCompilerOptions, xsbti.Reporter _reporter, java.util.Optional _progress, xsbti.T2[] _extra) { + return new Setup(_perClasspathEntryLookup, _skip, _cacheFile, _cache, _incrementalCompilerOptions, _reporter, _progress, _extra); + } + /** Provides a lookup of data structures and operations associated with a single classpath entry. */ + private xsbti.compile.PerClasspathEntryLookup perClasspathEntryLookup; + /** If true, no sources are actually compiled and the Analysis from the previous compilation is returned. */ + private boolean skip; + /** + * The file used to cache information across compilations. + * This file can be removed to force a full recompilation. + * The file should be unique and not shared between compilations. + */ + private java.io.File cacheFile; + private xsbti.compile.GlobalsCache cache; + private xsbti.compile.IncOptions incrementalCompilerOptions; + /** The reporter that should be used to report scala compilation to. */ + private xsbti.Reporter reporter; + /** Optionally provide progress indication. */ + private java.util.Optional progress; + private xsbti.T2[] extra; + protected Setup(xsbti.compile.PerClasspathEntryLookup _perClasspathEntryLookup, boolean _skip, java.io.File _cacheFile, xsbti.compile.GlobalsCache _cache, xsbti.compile.IncOptions _incrementalCompilerOptions, xsbti.Reporter _reporter, java.util.Optional _progress, xsbti.T2[] _extra) { + super(); + perClasspathEntryLookup = _perClasspathEntryLookup; + skip = _skip; + cacheFile = _cacheFile; + cache = _cache; + incrementalCompilerOptions = _incrementalCompilerOptions; + reporter = _reporter; + progress = _progress; + extra = _extra; + } + public xsbti.compile.PerClasspathEntryLookup perClasspathEntryLookup() { + return this.perClasspathEntryLookup; + } + public boolean skip() { + return this.skip; + } + public java.io.File cacheFile() { + return this.cacheFile; + } + public xsbti.compile.GlobalsCache cache() { + return this.cache; + } + public xsbti.compile.IncOptions incrementalCompilerOptions() { + return this.incrementalCompilerOptions; + } + public xsbti.Reporter reporter() { + return this.reporter; + } + public java.util.Optional progress() { + return this.progress; + } + public xsbti.T2[] extra() { + return this.extra; + } + public Setup withPerClasspathEntryLookup(xsbti.compile.PerClasspathEntryLookup perClasspathEntryLookup) { + return new Setup(perClasspathEntryLookup, skip, cacheFile, cache, incrementalCompilerOptions, reporter, progress, extra); + } + public Setup withSkip(boolean skip) { + return new Setup(perClasspathEntryLookup, skip, cacheFile, cache, incrementalCompilerOptions, reporter, progress, extra); + } + public Setup withCacheFile(java.io.File cacheFile) { + return new Setup(perClasspathEntryLookup, skip, cacheFile, cache, incrementalCompilerOptions, reporter, progress, extra); + } + public Setup withCache(xsbti.compile.GlobalsCache cache) { + return new Setup(perClasspathEntryLookup, skip, cacheFile, cache, incrementalCompilerOptions, reporter, progress, extra); + } + public Setup withIncrementalCompilerOptions(xsbti.compile.IncOptions incrementalCompilerOptions) { + return new Setup(perClasspathEntryLookup, skip, cacheFile, cache, incrementalCompilerOptions, reporter, progress, extra); + } + public Setup withReporter(xsbti.Reporter reporter) { + return new Setup(perClasspathEntryLookup, skip, cacheFile, cache, incrementalCompilerOptions, reporter, progress, extra); + } + public Setup withProgress(java.util.Optional progress) { + return new Setup(perClasspathEntryLookup, skip, cacheFile, cache, incrementalCompilerOptions, reporter, progress, extra); + } + public Setup withExtra(xsbti.T2[] extra) { + return new Setup(perClasspathEntryLookup, skip, cacheFile, cache, incrementalCompilerOptions, reporter, progress, extra); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof Setup)) { + return false; + } else { + Setup o = (Setup)obj; + return perClasspathEntryLookup().equals(o.perClasspathEntryLookup()) && (skip() == o.skip()) && cacheFile().equals(o.cacheFile()) && cache().equals(o.cache()) && incrementalCompilerOptions().equals(o.incrementalCompilerOptions()) && reporter().equals(o.reporter()) && progress().equals(o.progress()) && java.util.Arrays.deepEquals(extra(), o.extra()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "xsbti.compile.Setup".hashCode()) + perClasspathEntryLookup().hashCode()) + (new Boolean(skip())).hashCode()) + cacheFile().hashCode()) + cache().hashCode()) + incrementalCompilerOptions().hashCode()) + reporter().hashCode()) + progress().hashCode()) + extra().hashCode()); + } + public String toString() { + return "Setup(" + "perClasspathEntryLookup: " + perClasspathEntryLookup() + ", " + "skip: " + skip() + ", " + "cacheFile: " + cacheFile() + ", " + "cache: " + cache() + ", " + "incrementalCompilerOptions: " + incrementalCompilerOptions() + ", " + "reporter: " + reporter() + ", " + "progress: " + progress() + ", " + "extra: " + extra() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband-java/xsbti/compile/TransactionalManagerType.java b/internal/compiler-interface/src/main/contraband-java/xsbti/compile/TransactionalManagerType.java new file mode 100644 index 0000000000..c630322ee9 --- /dev/null +++ b/internal/compiler-interface/src/main/contraband-java/xsbti/compile/TransactionalManagerType.java @@ -0,0 +1,56 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti.compile; +/** + * Constructs a transactional ClassFileManager implementation that restores class + * files to the way they were before compilation if there is an error. Otherwise, it + * keeps the successfully generated class files from the new compilation. + */ +public final class TransactionalManagerType extends xsbti.compile.ClassFileManagerType { + + public static TransactionalManagerType create(java.io.File _backupDirectory, xsbti.Logger _logger) { + return new TransactionalManagerType(_backupDirectory, _logger); + } + public static TransactionalManagerType of(java.io.File _backupDirectory, xsbti.Logger _logger) { + return new TransactionalManagerType(_backupDirectory, _logger); + } + + private java.io.File backupDirectory; + private xsbti.Logger logger; + protected TransactionalManagerType(java.io.File _backupDirectory, xsbti.Logger _logger) { + super(); + backupDirectory = _backupDirectory; + logger = _logger; + } + public java.io.File backupDirectory() { + return this.backupDirectory; + } + public xsbti.Logger logger() { + return this.logger; + } + public TransactionalManagerType withBackupDirectory(java.io.File backupDirectory) { + return new TransactionalManagerType(backupDirectory, logger); + } + public TransactionalManagerType withLogger(xsbti.Logger logger) { + return new TransactionalManagerType(backupDirectory, logger); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof TransactionalManagerType)) { + return false; + } else { + TransactionalManagerType o = (TransactionalManagerType)obj; + return backupDirectory().equals(o.backupDirectory()) && logger().equals(o.logger()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (17 + "xsbti.compile.TransactionalManagerType".hashCode()) + backupDirectory().hashCode()) + logger().hashCode()); + } + public String toString() { + return "TransactionalManagerType(" + "backupDirectory: " + backupDirectory() + ", " + "logger: " + logger() + ")"; + } +} diff --git a/internal/compiler-interface/src/main/contraband/incremental.json b/internal/compiler-interface/src/main/contraband/incremental.json index b1d249e723..e2b52df255 100644 --- a/internal/compiler-interface/src/main/contraband/incremental.json +++ b/internal/compiler-interface/src/main/contraband/incremental.json @@ -46,108 +46,195 @@ { "name": "transitiveStep", "type": "int", - "doc": "After which step include whole transitive closure of invalidated source files." + "default": "xsbti.compile.IncOptions.defaultTransitiveStep()", + "doc": "After which step include whole transitive closure of invalidated source files.", + "since": "0.1.0" }, { "name": "recompileAllFraction", "type": "double", + "default": "xsbti.compile.IncOptions.defaultRecompileAllFraction()", "doc": [ "What's the fraction of invalidated source files when we switch to recompiling", "all files and giving up incremental compilation altogether. That's useful in", "cases when probability that we end up recompiling most of source files but", "in multiple steps is high. Multi-step incremental recompilation is slower", "than recompiling everything in one step." - ] + ], + "since": "0.1.0" }, { "name": "relationsDebug", "type": "boolean", - "doc": "Print very detailed information about relations, such as dependencies between source files." + "default": "xsbti.compile.IncOptions.defaultRelationsDebug()", + "doc": "Print very detailed information about relations, such as dependencies between source files.", + "since": "0.1.0" }, { "name": "apiDebug", "type": "boolean", - "doc": "Enable tools for debugging API changes." + "default": "xsbti.compile.IncOptions.defaultApiDebug()", + "doc": "Enable tools for debugging API changes.", + "since": "0.1.0" }, { "name": "apiDiffContextSize", "type": "int", + "default": "xsbti.compile.IncOptions.defaultApiDiffContextSize()", "doc": [ "Controls context size (in lines) displayed when diffs are produced for textual API", "representation.", "", "This option is used only when `apiDebug == true`." - ] + ], + "since": "0.1.0" }, { "name": "apiDumpDirectory", "type": "java.util.Optional", + "default": "xsbti.compile.IncOptions.defaultApiDumpDirectory()", "doc": [ "The directory where we dump textual representation of APIs. This method might be called", "only if apiDebug returns true. This is unused option at the moment as the needed functionality", "is not implemented yet." - ] + ], + "since": "0.1.0" }, { "name": "classfileManagerType", "type": "java.util.Optional", - "doc": "ClassfileManager that will handle class file deletion and addition during a single incremental compilation run." + "default": "xsbti.compile.IncOptions.defaultClassFileManagerType()", + "doc": "ClassfileManager that will handle class file deletion and addition during a single incremental compilation run.", + "since": "0.1.0" }, { "name": "useCustomizedFileManager", "type": "boolean", + "default": "xsbti.compile.IncOptions.defaultUseOptimizedSealed()", "doc": [ "Option to turn on customized file manager that tracks generated class files for transactional rollbacks.", "Using customized file manager may conflict with some libraries, this option allows user to decide", "whether to use." - ] + ], + "since": "0.1.0" }, { "name": "recompileOnMacroDef", "type": "java.util.Optional", + "default": "xsbti.compile.IncOptions.defaultRecompileOnMacroDef()", "doc": [ "Determines whether incremental compiler should recompile all dependencies of a file", "that contains a macro definition." - ] + ], + "since": "0.1.0" }, { "name": "useOptimizedSealed", "type": "boolean", + "default": "xsbti.compile.IncOptions.defaultUseOptimizedSealed()", "doc": [ "Determines whether optimized approach for invalidating sealed classes/trait is used.", "Turning this on may cause undercompilation in case of macros that are based sealed", "trait/class children enumeration." - ] + ], + "since": "0.1.0" }, { "name": "storeApis", "type": "boolean", + "default": "xsbti.compile.IncOptions.defaultStoreApis()", "doc": [ "Determines whether incremental compiler stores apis alongside analysis." - ] + ], + "since": "0.1.0" }, { "name": "enabled", "type": "boolean", + "default": "xsbti.compile.IncOptions.defaultEnabled()", "doc": [ "Determines whether incremental compilation is enabled." - ] + ], + "since": "0.1.0" }, { "name": "extra", "type": "java.util.Map", - "doc": "Extra options" + "default": "xsbti.compile.IncOptions.defaultExtra()", + "doc": "Extra options", + "since": "0.1.0" }, { "name": "logRecompileOnMacro", "type": "boolean", - "doc": "Determines whether to log information on file recompiled due to a transitive macro change" + "default": "xsbti.compile.IncOptions.defaultLogRecompileOnMacro()", + "doc": "Determines whether to log information on file recompiled due to a transitive macro change", + "since": "0.1.0" }, { "name": "externalHooks", "type": "xsbti.compile.ExternalHooks", - "doc": "External hooks that allows clients e.g. IDEs to interacts with compilation internals" + "default": "xsbti.compile.IncOptions.defaultExternal()", + "doc": "External hooks that allows clients e.g. IDEs to interacts with compilation internals", + "since": "0.1.0" } + ], + "extra": [ + "public static int defaultTransitiveStep() {", + " return 3;", + "}", + "public static double defaultRecompileAllFraction() {", + " return 0.5;", + "}", + "public static boolean defaultRelationsDebug() {", + " return false;", + "}", + "public static boolean defaultApiDebug() {", + " return false;", + "}", + "public static int defaultApiDiffContextSize() {", + " return 5;", + "}", + "public static java.util.Optional defaultApiDumpDirectory() {", + " return java.util.Optional.empty();", + "}", + "public static java.util.Optional defaultClassFileManagerType() {", + " return java.util.Optional.empty();", + "}", + "public static java.util.Optional defaultRecompileOnMacroDef() {", + " return java.util.Optional.empty();", + "}", + "public static boolean defaultUseOptimizedSealed() {", + " return false;", + "}", + "public static boolean defaultRecompileOnMacroDefImpl() {", + " return true;", + "}", + "public static boolean getRecompileOnMacroDef(IncOptions options) {", + " if (options.recompileOnMacroDef().isPresent()) {", + " return options.recompileOnMacroDef().get();", + " } else {", + " return defaultRecompileOnMacroDefImpl();", + " }", + "}", + "public static boolean defaultUseCustomizedFileManager() {", + " return false;", + "}", + "public static boolean defaultStoreApis() {", + " return true;", + "}", + "public static boolean defaultEnabled() {", + " return true;", + "}", + "public static java.util.Map defaultExtra() {", + " return new java.util.HashMap();", + "}", + "public static ExternalHooks defaultExternal() {", + " return new DefaultExternalHooks(java.util.Optional.empty(), java.util.Optional.empty());", + "}", + "public static boolean defaultLogRecompileOnMacro() {", + " return true;", + "}" ] }, { @@ -160,39 +247,61 @@ { "name": "classpath", "type": "java.io.File*", + "default": "new java.io.File[0]", "doc": [ "The classpath to use for compilation.", "This will be modified according to the ClasspathOptions used to configure the ScalaCompiler." - ] + ], + "since": "0.1.0" }, { "name": "sources", "type": "java.io.File*", + "default": "new java.io.File[0]", "doc": [ "All sources that should be recompiled.", "This should include Scala and Java sources, which are identified by their extension." - ] + ], + "since": "0.1.0" + }, + { + "name": "classesDirectory", + "type": "java.io.File", + "default": "new java.io.File(\"classes\")", + "since": "0.1.0" }, - { "name": "classesDirectory", "type": "java.io.File" }, { "name": "scalacOptions", "type": "String*", - "doc": "The options to pass to the Scala compiler other than the sources and classpath to use." + "default": "new String[0]", + "doc": "The options to pass to the Scala compiler other than the sources and classpath to use.", + "since": "0.1.0" }, { "name": "javacOptions", "type": "String*", - "doc": "The options to pass to the Java compiler other than the sources and classpath to use." + "default": "new String[0]", + "doc": "The options to pass to the Java compiler other than the sources and classpath to use.", + "since": "0.1.0" + }, + { + "name": "maxErrors", + "type": "int", + "default": "100", + "since": "0.1.0" }, - { "name": "maxErrors", "type": "int" }, { "name": "sourcePositionMapper", - "type": "xsbti.F1" + "type": "java.util.function.Function", + "default": "new java.util.function.Function() { public xsbti.Position apply(xsbti.Position a) { return a; } }", + "since": "0.1.0" }, { "name": "order", "type": "xsbti.compile.CompileOrder", - "doc": "Controls the order in which Java and Scala sources are compiled." + "default": "xsbti.compile.CompileOrder.Mixed", + "doc": "Controls the order in which Java and Scala sources are compiled.", + "since": "0.1.0" } ] }, diff --git a/internal/compiler-interface/src/main/java/xsbti/api/SafeLazy.java b/internal/compiler-interface/src/main/java/xsbti/api/SafeLazy.java index 7e75f5f3c0..a01fb3f09f 100644 --- a/internal/compiler-interface/src/main/java/xsbti/api/SafeLazy.java +++ b/internal/compiler-interface/src/main/java/xsbti/api/SafeLazy.java @@ -7,13 +7,15 @@ package xsbti.api; +import java.util.function.Supplier; + /** * Implement a Scala `lazy val` in Java for the facing sbt interface. * * It holds a reference to a thunk that is lazily evaluated and then * its reference is clear to avoid memory leaks in memory-intensive code. - * It needs to be defined in [[xsbti]] or a subpackage, see - * [[xsbti.api.Lazy]] or [[xsbti.F0]] for similar definitions. + * It needs to be defined in [[xsbti]] or a subpackage, see [[xsbti.api.Lazy]] + * for similar definitions. */ public final class SafeLazy { @@ -21,26 +23,27 @@ public final class SafeLazy { * cannot hold any reference to Scala code nor the Scala library. */ /** Return a sbt [[xsbti.api.Lazy]] from a given Scala parameterless function. */ - public static xsbti.api.Lazy apply(xsbti.F0 sbtThunk) { + public static xsbti.api.Lazy apply(Supplier sbtThunk) { return new Impl(sbtThunk); } /** Return a sbt [[xsbti.api.Lazy]] from a strict value. */ public static xsbti.api.Lazy strict(T value) { // Convert strict parameter to sbt function returning it - return apply(new xsbti.F0() { - public T apply() { + return apply(new Supplier() { + @Override + public T get() { return value; } }); } private static final class Impl extends xsbti.api.AbstractLazy { - private xsbti.F0 thunk; + private Supplier thunk; private T result; private boolean flag = false; - Impl(xsbti.F0 thunk) { + Impl(Supplier thunk) { this.thunk = thunk; } @@ -52,7 +55,7 @@ private static final class Impl extends xsbti.api.AbstractLazy { public T get() { if (flag) return result; else { - result = thunk.apply(); + result = thunk.get(); flag = true; // Clear reference so that thunk is GC'ed thunk = null; diff --git a/internal/compiler-interface/src/main/java/xsbti/compile/DefaultExternalHooks.java b/internal/compiler-interface/src/main/java/xsbti/compile/DefaultExternalHooks.java new file mode 100644 index 0000000000..df57af858f --- /dev/null +++ b/internal/compiler-interface/src/main/java/xsbti/compile/DefaultExternalHooks.java @@ -0,0 +1,48 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + +package xsbti.compile; + +import java.io.File; +import java.util.Optional; +import java.util.Set; + +public class DefaultExternalHooks implements ExternalHooks { + private Optional lookup = Optional.empty(); + private Optional classFileManager = Optional.empty(); + + public DefaultExternalHooks(Optional lookup, Optional classFileManager) { + this.lookup = lookup; + this.classFileManager = classFileManager; + } + + @Override + public Optional getExternalLookup() { + return lookup; + } + + @Override + public Optional getExternalClassFileManager() { + return classFileManager; + } + + @Override + public ExternalHooks withExternalClassFileManager(ClassFileManager externalClassFileManager) { + Optional currentManager = this.getExternalClassFileManager(); + Optional mixedManager = currentManager; + if (currentManager.isPresent()) { + Optional external = Optional.of(externalClassFileManager); + mixedManager = Optional.of(WrappedClassFileManager.of(currentManager.get(), external)); + } + return new DefaultExternalHooks(this.getExternalLookup(), mixedManager); + } + + @Override + public ExternalHooks withExternalLookup(Lookup externalLookup) { + return new DefaultExternalHooks(Optional.of(externalLookup), this.getExternalClassFileManager()); + } +} diff --git a/internal/compiler-interface/src/main/java/xsbti/compile/WrappedClassFileManager.java b/internal/compiler-interface/src/main/java/xsbti/compile/WrappedClassFileManager.java new file mode 100644 index 0000000000..8c12c55f8c --- /dev/null +++ b/internal/compiler-interface/src/main/java/xsbti/compile/WrappedClassFileManager.java @@ -0,0 +1,63 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + +package xsbti.compile; + +import java.io.File; +import java.util.Optional; + +/** + * Defines a classfile manager that composes the operation of two classfile manager, + * one being the internal classfile manager (the one used by the compiler) and the + * other one being the external classfile manager (a customizable, build tool-defined + * class file manager to control which class files should be notified/removed/generated + * aside from the ones covered by the internal classfile manager). + * + * @param internal Compiler classfile manager. + * @param external Build tool (or external) classfile manager the complements the internal one. + */ +public class WrappedClassFileManager implements ClassFileManager { + private ClassFileManager internal; + private Optional external; + + public static WrappedClassFileManager of(ClassFileManager internal, Optional external) { + return new WrappedClassFileManager(internal, external); + } + + protected WrappedClassFileManager(ClassFileManager internal, + Optional external) { + this.internal = internal; + this.external = external; + } + + @Override + public void delete(File[] classes) { + // Avoid Java 8 syntax to accommodate Scala 2.10 + if (external.isPresent()) { + external.get().delete(classes); + } + internal.delete(classes); + } + + @Override + public void complete(boolean success) { + // Avoid Java 8 syntax to accommodate Scala 2.10 + if (external.isPresent()) { + external.get().complete(success); + } + internal.complete(success); + } + + @Override + public void generated(File[] classes) { + // Avoid Java 8 syntax to accommodate Scala 2.10 + if (external.isPresent()) { + external.get().generated(classes); + } + internal.generated(classes); + } +} diff --git a/internal/zinc-apiinfo/src/main/scala/sbt/internal/inc/ClassToAPI.scala b/internal/zinc-apiinfo/src/main/scala/sbt/internal/inc/ClassToAPI.scala index 58bbbb2544..59494a9827 100644 --- a/internal/zinc-apiinfo/src/main/scala/sbt/internal/inc/ClassToAPI.scala +++ b/internal/zinc-apiinfo/src/main/scala/sbt/internal/inc/ClassToAPI.scala @@ -90,31 +90,31 @@ object ClassToAPI { val name = classCanonicalName(c) val tpe = if (Modifier.isInterface(c.getModifiers)) Trait else ClassDef lazy val (static, instance) = structure(c, enclPkg, cmap) - val cls = new api.ClassLike(name, + val cls = api.ClassLike.of(name, + acc, + mods, + annots, + tpe, + lzyS(Empty), + lzy(instance, cmap), + emptyStringArray, + children.toArray, + topLevel, + typeParameters(typeParameterTypes(c))) + val clsDef = + api.ClassLikeDef.of(name, acc, mods, annots, typeParameters(typeParameterTypes(c)), tpe) + val stat = api.ClassLike.of(name, acc, mods, annots, - tpe, + Module, lzyS(Empty), - lzy(instance, cmap), + lzy(static, cmap), emptyStringArray, - children.toArray, + emptyTypeArray, topLevel, - typeParameters(typeParameterTypes(c))) - val clsDef = - new api.ClassLikeDef(name, acc, mods, annots, typeParameters(typeParameterTypes(c)), tpe) - val stat = new api.ClassLike(name, - acc, - mods, - annots, - Module, - lzyS(Empty), - lzy(static, cmap), - emptyStringArray, - emptyTypeArray, - topLevel, - emptyTypeParameterArray) - val statDef = new api.ClassLikeDef(name, acc, mods, annots, emptyTypeParameterArray, Module) + emptyTypeParameterArray) + val statDef = api.ClassLikeDef.of(name, acc, mods, annots, emptyTypeParameterArray, Module) val defs = cls :: stat :: Nil val defsEmptyMembers = clsDef :: statDef :: Nil cmap.memo(name) = defsEmptyMembers @@ -154,10 +154,10 @@ object ClassToAPI { cmap.inherited ++= parentJavaTypes.collect { case parent: Class[_] => c -> parent } val parentTypes = types(parentJavaTypes) val instanceStructure = - new api.Structure(lzyS(parentTypes), lzyS(all.declared.toArray), lzyS(all.inherited.toArray)) - val staticStructure = new api.Structure(lzyEmptyTpeArray, - lzyS(all.staticDeclared.toArray), - lzyS(all.staticInherited.toArray)) + api.Structure.of(lzyS(parentTypes), lzyS(all.declared.toArray), lzyS(all.inherited.toArray)) + val staticStructure = api.Structure.of(lzyEmptyTpeArray, + lzyS(all.staticDeclared.toArray), + lzyS(all.staticInherited.toArray)) (staticStructure, instanceStructure) } @@ -207,7 +207,7 @@ object ClassToAPI { def parents(c: Class[_]): Seq[api.Type] = types(allSuperTypes(c)) def types(ts: Seq[Type]): Array[api.Type] = (ts filter (_ ne null) map reference).toArray def upperBounds(ts: Array[Type]): api.Type = - new api.Structure(lzy(types(ts)), lzyEmptyDefArray, lzyEmptyDefArray) + api.Structure.of(lzy(types(ts)), lzyEmptyDefArray, lzyEmptyDefArray) @deprecated("Use fieldToDef[4] instead", "0.13.9") def fieldToDef(enclPkg: Option[String])(f: Field): api.FieldLike = { @@ -238,9 +238,9 @@ object ClassToAPI { } val tpe = specificTpe.getOrElse(fieldTpe) if (mods.isFinal) { - new api.Val(name, accs, mods, annots, tpe) + api.Val.of(name, accs, mods, annots, tpe) } else { - new api.Var(name, accs, mods, annots, tpe) + api.Var.of(name, accs, mods, annots, tpe) } } @@ -255,7 +255,7 @@ object ClassToAPI { * banned characters. */ private def singletonForConstantField(c: Class[_], field: Field, constantValue: AnyRef) = - new api.Singleton( + api.Singleton.of( pathFromStrings( c.getName .split("\\.") @@ -309,27 +309,27 @@ object ClassToAPI { val pa = (paramAnnots, paramTypes, isVarArg).zipped map { case (a, p, v) => parameter(a, p, v) } - val params = new api.ParameterList(pa, false) + val params = api.ParameterList.of(pa, false) val ret = retType match { case Some(rt) => reference(rt); case None => Empty } - new api.Def(name, - access(mods, enclPkg), - modifiers(mods), - annotations(annots) ++ exceptionAnnotations(exceptions), - typeParameters(tps), - Array(params), - ret) + api.Def.of(name, + access(mods, enclPkg), + modifiers(mods), + annotations(annots) ++ exceptionAnnotations(exceptions), + typeParameters(tps), + Array(params), + ret) } def exceptionAnnotations(exceptions: Array[Type]): Array[api.Annotation] = if (exceptions.length == 0) emptyAnnotationArray else arrayMap(exceptions)(t => - new api.Annotation(Throws, Array(new api.AnnotationArgument("value", t.toString)))) + api.Annotation.of(Throws, Array(api.AnnotationArgument.of("value", t.toString)))) def parameter(annots: Array[Annotation], parameter: Type, varArgs: Boolean): api.MethodParameter = - new api.MethodParameter( + api.MethodParameter.of( "", annotated(reference(parameter), annots), false, @@ -337,7 +337,7 @@ object ClassToAPI { def annotated(t: api.Type, annots: Array[Annotation]): api.Type = ( if (annots.length == 0) t - else new api.Annotated(t, annotations(annots)) + else api.Annotated.of(t, annotations(annots)) ) case class Defs(declared: Seq[api.ClassDefinition], @@ -382,12 +382,12 @@ object ClassToAPI { else arrayMap(tps)(typeParameter) def typeParameter[T <: GenericDeclaration](tp: TypeVariable[T]): api.TypeParameter = - new api.TypeParameter(typeVariable(tp), - emptyAnnotationArray, - emptyTypeParameterArray, - api.Variance.Invariant, - NothingRef, - upperBounds(tp.getBounds)) + api.TypeParameter.of(typeVariable(tp), + emptyAnnotationArray, + emptyTypeParameterArray, + api.Variance.Invariant, + NothingRef, + upperBounds(tp.getBounds)) // needs to be stable across compilations def typeVariable[T <: GenericDeclaration](tv: TypeVariable[T]): String = @@ -418,7 +418,7 @@ object ClassToAPI { def annotations(a: Array[Annotation]): Array[api.Annotation] = if (a.length == 0) emptyAnnotationArray else arrayMap(a)(annotation) def annotation(a: Annotation): api.Annotation = - new api.Annotation(reference(a.annotationType), Array(javaAnnotation(a.toString))) + api.Annotation.of(reference(a.annotationType), Array(javaAnnotation(a.toString))) /** * This method mimics Scala compiler's behavior of `Symbol.children` method when Symbol corresponds to @@ -437,9 +437,9 @@ object ClassToAPI { // full information not available from reflection def javaAnnotation(s: String): api.AnnotationArgument = - new api.AnnotationArgument("toString", s) + api.AnnotationArgument.of("toString", s) - def array(tpe: api.Type): api.Type = new api.Parameterized(ArrayRef, Array(tpe)) + def array(tpe: api.Type): api.Type = api.Parameterized.of(ArrayRef, Array(tpe)) def reference(c: Class[_]): api.Type = if (c.isArray) array(reference(c.getComponentType)) else if (c.isPrimitive) primitive(c.getName) @@ -450,21 +450,21 @@ object ClassToAPI { val (pkg, cls) = packageAndName(s) pkg match { // translate all primitives? - case None => new api.Projection(Empty, cls) + case None => api.Projection.of(Empty, cls) case Some(p) => - new api.Projection(new api.Singleton(pathFromString(p)), cls) + api.Projection.of(api.Singleton.of(pathFromString(p)), cls) } } def referenceP(t: ParameterizedType): api.Parameterized = { val targs = t.getActualTypeArguments val args = if (targs.isEmpty) emptyTypeArray else arrayMap(targs)(t => reference(t): api.Type) val base = reference(t.getRawType) - new api.Parameterized(base, args) + api.Parameterized.of(base, args) } def reference(t: Type): api.Type = t match { case _: WildcardType => reference("_") - case tv: TypeVariable[_] => new api.ParameterRef(typeVariable(tv)) + case tv: TypeVariable[_] => api.ParameterRef.of(typeVariable(tv)) case pt: ParameterizedType => referenceP(pt) case gat: GenericArrayType => array(reference(gat.getGenericComponentType)) case c: Class[_] => reference(c) @@ -473,7 +473,7 @@ object ClassToAPI { def pathFromString(s: String): api.Path = pathFromStrings(s.split("\\.")) def pathFromStrings(ss: Seq[String]): api.Path = - new api.Path((ss.map(new api.Id(_)) :+ ThisRef).toArray) + api.Path.of((ss.map(api.Id.of(_)) :+ ThisRef).toArray) def packageName(c: Class[_]) = packageAndName(c)._1 def packageAndName(c: Class[_]): (Option[String], String) = packageAndName(c.getName) @@ -485,15 +485,15 @@ object ClassToAPI { (None, name) } - val Empty = new api.EmptyType - val ThisRef = new api.This + val Empty = api.EmptyType.of() + val ThisRef = api.This.of() - val Public = new api.Public - val Unqualified = new api.Unqualified - val Private = new api.Private(Unqualified) - val Protected = new api.Protected(Unqualified) + val Public = api.Public.of() + val Unqualified = api.Unqualified.of() + val Private = api.Private.of(Unqualified) + val Protected = api.Protected.of(Unqualified) def packagePrivate(pkg: Option[String]): api.Access = - new api.Private(new api.IdQualifier(pkg getOrElse "")) + api.Private.of(api.IdQualifier.of(pkg getOrElse "")) val ArrayRef = reference("scala.Array") val Throws = reference("scala.throws") diff --git a/internal/zinc-apiinfo/src/main/scala/xsbt/api/APIUtil.scala b/internal/zinc-apiinfo/src/main/scala/xsbt/api/APIUtil.scala index ba72cb8931..6b3774f3e2 100644 --- a/internal/zinc-apiinfo/src/main/scala/xsbt/api/APIUtil.scala +++ b/internal/zinc-apiinfo/src/main/scala/xsbt/api/APIUtil.scala @@ -58,7 +58,7 @@ object APIUtil { def minimizeClass(c: ClassLike): ClassLike = { val savedAnnotations = Discovery.defAnnotations(c.structure, (_: Any) => true).toArray[String] val struct = minimizeStructure(c.structure, c.definitionType == DefinitionType.Module) - new ClassLike( + ClassLike.of( c.name, c.access, c.modifiers, @@ -74,9 +74,9 @@ object APIUtil { } def minimizeStructure(s: Structure, isModule: Boolean): Structure = - new Structure(lzy(s.parents), - filterDefinitions(s.declared, isModule), - filterDefinitions(s.inherited, isModule)) + Structure.of(lzy(s.parents), + filterDefinitions(s.declared, isModule), + filterDefinitions(s.inherited, isModule)) def filterDefinitions(ds: Array[ClassDefinition], isModule: Boolean): Lazy[Array[ClassDefinition]] = lzy(if (isModule) ds filter Discovery.isMainMethod else Array()) @@ -91,21 +91,21 @@ object APIUtil { } private val emptyModifiers = new Modifiers(false, false, false, false, false, false, false, false) - private val emptyStructure = new Structure(lzy(Array.empty), lzy(Array.empty), lzy(Array.empty)) + private val emptyStructure = Structure.of(lzy(Array.empty), lzy(Array.empty), lzy(Array.empty)) def emptyClassLike(name: String, definitionType: DefinitionType): ClassLike = - new xsbti.api.ClassLike(name, - new Public, - emptyModifiers, - Array.empty, - definitionType, - lzy(emptyType), - lzy(emptyStructure), - Array.empty, - Array.empty, - true, - Array.empty) + xsbti.api.ClassLike.of(name, + Public.of(), + emptyModifiers, + Array.empty, + definitionType, + lzy(emptyType), + lzy(emptyStructure), + Array.empty, + Array.empty, + true, + Array.empty) private[this] def lzy[T <: AnyRef](t: T): Lazy[T] = SafeLazyProxy.strict(t) - private[this] val emptyType = new EmptyType + private[this] val emptyType = EmptyType.of() } diff --git a/internal/zinc-apiinfo/src/main/scala/xsbt/api/NameHashing.scala b/internal/zinc-apiinfo/src/main/scala/xsbt/api/NameHashing.scala index 4d7e3a82a1..835ade47dd 100644 --- a/internal/zinc-apiinfo/src/main/scala/xsbt/api/NameHashing.scala +++ b/internal/zinc-apiinfo/src/main/scala/xsbt/api/NameHashing.scala @@ -58,7 +58,7 @@ class NameHashing(optimizedSealed: Boolean) { val hashes = groupedBySimpleName.mapValues(hashLocatedDefinitions(_, location, includeSealedChildren)) hashes.toIterable - .map({ case (name: String, hash: Int) => new NameHash(name, useScope, hash) })( + .map({ case (name: String, hash: Int) => NameHash.of(name, useScope, hash) })( collection.breakOut) } @@ -129,7 +129,7 @@ object NameHashing { m(key) = Set(existingHash, nh.hash).hashCode() } } - m.map { case ((name, scope), hash) => new NameHash(name, scope, hash) }(collection.breakOut) + m.map { case ((name, scope), hash) => NameHash.of(name, scope, hash) }(collection.breakOut) } private case class LocatedDefinition(location: Location, definition: Definition) diff --git a/internal/zinc-apiinfo/src/main/scala/xsbt/api/SafeLazyProxy.scala b/internal/zinc-apiinfo/src/main/scala/xsbt/api/SafeLazyProxy.scala index 0508f70a87..fd835e9130 100644 --- a/internal/zinc-apiinfo/src/main/scala/xsbt/api/SafeLazyProxy.scala +++ b/internal/zinc-apiinfo/src/main/scala/xsbt/api/SafeLazyProxy.scala @@ -7,6 +7,8 @@ package xsbti.api +import java.util.function.Supplier + /** * Proxy `SafeLazy` functionality from the Java implementation * implementation in [[xsbt.api.SafeLazy]] to Scala helpers. @@ -21,7 +23,7 @@ object SafeLazyProxy { * Return a lazy implementation of a Scala by-name parameter. */ def apply[T](s: => T): Lazy[T] = { - val sbtThunk = new xsbti.F0[T] { def apply() = s } + val sbtThunk = new Supplier[T] { override def get() = s } SafeLazy.apply(sbtThunk) } @@ -29,7 +31,7 @@ object SafeLazyProxy { * Return a lazy implementation of a strict value. */ def strict[T](s: T): Lazy[T] = { - val sbtThunk = new xsbti.F0[T] { def apply() = s } + val sbtThunk = new Supplier[T] { override def get() = s } SafeLazy.apply(sbtThunk) } } diff --git a/internal/zinc-apiinfo/src/test/scala/xsbt/api/NameHashingSpecification.scala b/internal/zinc-apiinfo/src/test/scala/xsbt/api/NameHashingSpecification.scala index b4045454e6..1f52a743ba 100644 --- a/internal/zinc-apiinfo/src/test/scala/xsbt/api/NameHashingSpecification.scala +++ b/internal/zinc-apiinfo/src/test/scala/xsbt/api/NameHashingSpecification.scala @@ -23,12 +23,12 @@ class NameHashingSpecification extends UnitSpec { "NameHashing" should "generate correct hashes for sealed classes" in { val def1 = - new Def("foo", publicAccess, defaultModifiers, Array.empty, Array.empty, Array.empty, strTpe) + Def.of("foo", publicAccess, defaultModifiers, Array.empty, Array.empty, Array.empty, strTpe) val def2 = - new Def("bar", publicAccess, defaultModifiers, Array.empty, Array.empty, Array.empty, intTpe) + Def.of("bar", publicAccess, defaultModifiers, Array.empty, Array.empty, Array.empty, intTpe) - val Ala = new Projection(emptyType, "Ala") - val Ola = new Projection(emptyType, "Ola") + val Ala = Projection.of(emptyType, "Ala") + val Ola = Projection.of(emptyType, "Ola") def createClass(types: Type*) = simpleClass("Bar", def1, def2) @@ -82,9 +82,9 @@ class NameHashingSpecification extends UnitSpec { "NameHashing" should "generate hashes that are insensitive to the definition order when adding a new member" in { val nameHashing = new NameHashing(false) val def1 = - new Def("foo", publicAccess, defaultModifiers, Array.empty, Array.empty, Array.empty, strTpe) + Def.of("foo", publicAccess, defaultModifiers, Array.empty, Array.empty, Array.empty, strTpe) val def2 = - new Def("bar", publicAccess, defaultModifiers, Array.empty, Array.empty, Array.empty, intTpe) + Def.of("bar", publicAccess, defaultModifiers, Array.empty, Array.empty, Array.empty, intTpe) val classBar1 = simpleClass("Bar", def1) val classBar2 = simpleClass("Bar", def1, def2) val nameHashes1 = nameHashing.nameHashes(classBar1) @@ -102,9 +102,9 @@ class NameHashingSpecification extends UnitSpec { it should "generate hashes that are insensitive to the definition order" in { val nameHashing = new NameHashing(false) val def1 = - new Def("bar", publicAccess, defaultModifiers, Array.empty, Array.empty, Array.empty, intTpe) + Def.of("bar", publicAccess, defaultModifiers, Array.empty, Array.empty, Array.empty, intTpe) val def2 = - new Def("bar", publicAccess, defaultModifiers, Array.empty, Array.empty, Array.empty, strTpe) + Def.of("bar", publicAccess, defaultModifiers, Array.empty, Array.empty, Array.empty, strTpe) val classA = simpleClass("Foo", def1, def2) val classB = simpleClass("Foo", def2, def1) val nameHashes1 = nameHashing.nameHashes(classA) @@ -135,7 +135,7 @@ class NameHashingSpecification extends UnitSpec { it should "generate hashes that are sensitive to the definition location" in { val nameHashing = new NameHashing(false) val deff = - new Def("bar", publicAccess, defaultModifiers, Array.empty, Array.empty, Array.empty, intTpe) + Def.of("bar", publicAccess, defaultModifiers, Array.empty, Array.empty, Array.empty, intTpe) val classFoo = simpleClassLike(name = "Foo", dt = DefinitionType.ClassDef, structure = simpleStructure(deff)) @@ -166,17 +166,17 @@ class NameHashingSpecification extends UnitSpec { it should "generate hashes that account for definitions in parent class" in { val parentA = simpleClass("Parent") val barMethod = - new Def("bar", publicAccess, defaultModifiers, Array.empty, Array.empty, Array.empty, intTpe) + Def.of("bar", publicAccess, defaultModifiers, Array.empty, Array.empty, Array.empty, intTpe) val parentB = simpleClass("Parent", barMethod) val childA = { val structure = - new Structure(lzy(Array[Type](parentA.structure)), emptyMembers, emptyMembers) + Structure.of(lzy(Array[Type](parentA.structure)), emptyMembers, emptyMembers) simpleClassLike("Child", structure) } val childB = { - val structure = new Structure(lzy(Array[Type](parentB.structure)), - emptyMembers, - lzy(Array[ClassDefinition](barMethod))) + val structure = Structure.of(lzy(Array[Type](parentB.structure)), + emptyMembers, + lzy(Array[ClassDefinition](barMethod))) simpleClassLike("Child", structure) } val parentANameHashes = nameHashesForClass(parentA) @@ -210,38 +210,38 @@ class NameHashingSpecification extends UnitSpec { /** def foo: { bar: Int } */ val fooMethod1 = { - val barMethod1 = new Def("bar", - publicAccess, - defaultModifiers, - Array.empty, - Array.empty, - Array.empty, - intTpe) - new Def("foo", - publicAccess, - defaultModifiers, - Array.empty, - Array.empty, - Array.empty, - simpleStructure(barMethod1)) + val barMethod1 = Def.of("bar", + publicAccess, + defaultModifiers, + Array.empty, + Array.empty, + Array.empty, + intTpe) + Def.of("foo", + publicAccess, + defaultModifiers, + Array.empty, + Array.empty, + Array.empty, + simpleStructure(barMethod1)) } /** def foo: { bar: String } */ val fooMethod2 = { - val barMethod2 = new Def("bar", - publicAccess, - defaultModifiers, - Array.empty, - Array.empty, - Array.empty, - strTpe) - new Def("foo", - publicAccess, - defaultModifiers, - Array.empty, - Array.empty, - Array.empty, - simpleStructure(barMethod2)) + val barMethod2 = Def.of("bar", + publicAccess, + defaultModifiers, + Array.empty, + Array.empty, + Array.empty, + strTpe) + Def.of("foo", + publicAccess, + defaultModifiers, + Array.empty, + Array.empty, + Array.empty, + simpleStructure(barMethod2)) } val aClass1 = simpleClass("A", fooMethod1) val aClass2 = simpleClass("A", fooMethod2) @@ -265,9 +265,9 @@ class NameHashingSpecification extends UnitSpec { it should "merge name hashes" in { val nameHashing = new NameHashing(false) val def1 = - new Def("foo", publicAccess, defaultModifiers, Array.empty, Array.empty, Array.empty, strTpe) + Def.of("foo", publicAccess, defaultModifiers, Array.empty, Array.empty, Array.empty, strTpe) val def2 = - new Def("bar", publicAccess, defaultModifiers, Array.empty, Array.empty, Array.empty, intTpe) + Def.of("bar", publicAccess, defaultModifiers, Array.empty, Array.empty, Array.empty, intTpe) val classBar = simpleClass("Bar", def1) val objectBar = simpleObject("Bar", def2) val nameHashes1 = nameHashing.nameHashes(classBar) @@ -289,7 +289,7 @@ class NameHashingSpecification extends UnitSpec { it should "calcualte name hashes for private top level class" in { /* class Foo { def foo: String } */ val fooDef = - new Def("foo", publicAccess, defaultModifiers, Array.empty, Array.empty, Array.empty, strTpe) + Def.of("foo", publicAccess, defaultModifiers, Array.empty, Array.empty, Array.empty, strTpe) val classFoo = simpleClassLike("Foo", simpleStructure(fooDef), access = privateAccess, topLevel = true) val nameHashes = nameHashesForClass(classFoo) @@ -328,7 +328,7 @@ class NameHashingSpecification extends UnitSpec { private def lzy[T](x: T): Lazy[T] = new Lazy[T] { def get: T = x } private def simpleStructure(defs: ClassDefinition*) = - new Structure(lzy(Array.empty[Type]), lzy(defs.toArray), emptyMembers) + Structure.of(lzy(Array.empty[Type]), lzy(defs.toArray), emptyMembers) private def simpleClass(name: String, defs: ClassDefinition*): ClassLike = { val structure = simpleStructure(defs: _*) @@ -345,24 +345,24 @@ class NameHashingSpecification extends UnitSpec { dt: DefinitionType = DefinitionType.ClassDef, topLevel: Boolean = true, access: Access = publicAccess): ClassLike = { - new ClassLike(name, - access, - defaultModifiers, - Array.empty, - dt, - lzy(emptyType), - lzy(structure), - Array.empty, - Array.empty, - topLevel, - Array.empty) + ClassLike.of(name, + access, + defaultModifiers, + Array.empty, + dt, + lzy(emptyType), + lzy(structure), + Array.empty, + Array.empty, + topLevel, + Array.empty) } - private val emptyType = new EmptyType - private val intTpe = new Projection(emptyType, "Int") - private val strTpe = new Projection(emptyType, "String") - private val publicAccess = new Public - private val privateAccess = new Private(new Unqualified) + private val emptyType = EmptyType.of() + private val intTpe = Projection.of(emptyType, "Int") + private val strTpe = Projection.of(emptyType, "String") + private val publicAccess = Public.of() + private val privateAccess = Private.of(Unqualified.of()) private val defaultModifiers = new Modifiers(false, false, false, false, false, false, false, false) private val emptyMembers = lzy(Array.empty[ClassDefinition]) diff --git a/internal/zinc-compile-core/src/main/contraband-java/xsbti/ReporterConfig.java b/internal/zinc-compile-core/src/main/contraband-java/xsbti/ReporterConfig.java new file mode 100644 index 0000000000..f68f0437f4 --- /dev/null +++ b/internal/zinc-compile-core/src/main/contraband-java/xsbti/ReporterConfig.java @@ -0,0 +1,91 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package xsbti; +public final class ReporterConfig implements java.io.Serializable { + + public static ReporterConfig create(String _loggerName, int _maximumErrors, boolean _useColor, java.util.function.Function[] _msgFilters, java.util.function.Function[] _fileFilters, java.util.logging.Level _logLevel, java.util.function.Function _positionMapper) { + return new ReporterConfig(_loggerName, _maximumErrors, _useColor, _msgFilters, _fileFilters, _logLevel, _positionMapper); + } + public static ReporterConfig of(String _loggerName, int _maximumErrors, boolean _useColor, java.util.function.Function[] _msgFilters, java.util.function.Function[] _fileFilters, java.util.logging.Level _logLevel, java.util.function.Function _positionMapper) { + return new ReporterConfig(_loggerName, _maximumErrors, _useColor, _msgFilters, _fileFilters, _logLevel, _positionMapper); + } + + private String loggerName; + private int maximumErrors; + private boolean useColor; + private java.util.function.Function[] msgFilters; + private java.util.function.Function[] fileFilters; + private java.util.logging.Level logLevel; + private java.util.function.Function positionMapper; + protected ReporterConfig(String _loggerName, int _maximumErrors, boolean _useColor, java.util.function.Function[] _msgFilters, java.util.function.Function[] _fileFilters, java.util.logging.Level _logLevel, java.util.function.Function _positionMapper) { + super(); + loggerName = _loggerName; + maximumErrors = _maximumErrors; + useColor = _useColor; + msgFilters = _msgFilters; + fileFilters = _fileFilters; + logLevel = _logLevel; + positionMapper = _positionMapper; + } + public String loggerName() { + return this.loggerName; + } + public int maximumErrors() { + return this.maximumErrors; + } + public boolean useColor() { + return this.useColor; + } + public java.util.function.Function[] msgFilters() { + return this.msgFilters; + } + public java.util.function.Function[] fileFilters() { + return this.fileFilters; + } + public java.util.logging.Level logLevel() { + return this.logLevel; + } + public java.util.function.Function positionMapper() { + return this.positionMapper; + } + public ReporterConfig withLoggerName(String loggerName) { + return new ReporterConfig(loggerName, maximumErrors, useColor, msgFilters, fileFilters, logLevel, positionMapper); + } + public ReporterConfig withMaximumErrors(int maximumErrors) { + return new ReporterConfig(loggerName, maximumErrors, useColor, msgFilters, fileFilters, logLevel, positionMapper); + } + public ReporterConfig withUseColor(boolean useColor) { + return new ReporterConfig(loggerName, maximumErrors, useColor, msgFilters, fileFilters, logLevel, positionMapper); + } + public ReporterConfig withMsgFilters(java.util.function.Function[] msgFilters) { + return new ReporterConfig(loggerName, maximumErrors, useColor, msgFilters, fileFilters, logLevel, positionMapper); + } + public ReporterConfig withFileFilters(java.util.function.Function[] fileFilters) { + return new ReporterConfig(loggerName, maximumErrors, useColor, msgFilters, fileFilters, logLevel, positionMapper); + } + public ReporterConfig withLogLevel(java.util.logging.Level logLevel) { + return new ReporterConfig(loggerName, maximumErrors, useColor, msgFilters, fileFilters, logLevel, positionMapper); + } + public ReporterConfig withPositionMapper(java.util.function.Function positionMapper) { + return new ReporterConfig(loggerName, maximumErrors, useColor, msgFilters, fileFilters, logLevel, positionMapper); + } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof ReporterConfig)) { + return false; + } else { + ReporterConfig o = (ReporterConfig)obj; + return loggerName().equals(o.loggerName()) && (maximumErrors() == o.maximumErrors()) && (useColor() == o.useColor()) && java.util.Arrays.deepEquals(msgFilters(), o.msgFilters()) && java.util.Arrays.deepEquals(fileFilters(), o.fileFilters()) && logLevel().equals(o.logLevel()) && positionMapper().equals(o.positionMapper()); + } + } + public int hashCode() { + return 37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "xsbti.ReporterConfig".hashCode()) + loggerName().hashCode()) + (new Integer(maximumErrors())).hashCode()) + (new Boolean(useColor())).hashCode()) + msgFilters().hashCode()) + fileFilters().hashCode()) + logLevel().hashCode()) + positionMapper().hashCode()); + } + public String toString() { + return "ReporterConfig(" + "loggerName: " + loggerName() + ", " + "maximumErrors: " + maximumErrors() + ", " + "useColor: " + useColor() + ", " + "msgFilters: " + msgFilters() + ", " + "fileFilters: " + fileFilters() + ", " + "logLevel: " + logLevel() + ", " + "positionMapper: " + positionMapper() + ")"; + } +} diff --git a/internal/zinc-compile-core/src/main/scala/sbt/internal/inc/CompilerCache.scala b/internal/zinc-compile-core/src/main/scala/sbt/internal/inc/CompilerCache.scala index a339522f58..c54834be2f 100644 --- a/internal/zinc-compile-core/src/main/scala/sbt/internal/inc/CompilerCache.scala +++ b/internal/zinc-compile-core/src/main/scala/sbt/internal/inc/CompilerCache.scala @@ -13,7 +13,7 @@ import java.util import xsbti.{ Reporter, Logger => xLogger } import xsbti.compile.{ CachedCompiler, CachedCompilerProvider, GlobalsCache, Output } -import sbt.util.Logger.f0 +import sbt.util.InterfaceUtil.{ toSupplier => f0 } /** * Manage a number of maxInstance of cached Scala compilers. diff --git a/internal/zinc-compile-core/src/main/scala/sbt/internal/inc/LoggedReporter.scala b/internal/zinc-compile-core/src/main/scala/sbt/internal/inc/LoggedReporter.scala index 1034d4be7e..4bca388381 100644 --- a/internal/zinc-compile-core/src/main/scala/sbt/internal/inc/LoggedReporter.scala +++ b/internal/zinc-compile-core/src/main/scala/sbt/internal/inc/LoggedReporter.scala @@ -100,7 +100,7 @@ class LoggedReporter( logger: Logger, sourcePositionMapper: Position => Position = identity[Position] ) extends Reporter { - import sbt.util.InterfaceUtil.f0 + import sbt.util.InterfaceUtil.{ toSupplier => f0 } val positions = new mutable.HashMap[PositionKey, Severity] val count = new EnumMap[Severity, Int](classOf[Severity]) protected val allProblems = new mutable.ListBuffer[Problem] diff --git a/internal/zinc-compile-core/src/main/scala/sbt/internal/inc/ReporterManager.scala b/internal/zinc-compile-core/src/main/scala/sbt/internal/inc/ReporterManager.scala index 52bb15f1c0..b901369f1c 100644 --- a/internal/zinc-compile-core/src/main/scala/sbt/internal/inc/ReporterManager.scala +++ b/internal/zinc-compile-core/src/main/scala/sbt/internal/inc/ReporterManager.scala @@ -47,7 +47,7 @@ object ReporterManager { } } - private val UseColor = ConsoleAppender.formatEnabled + private val UseColor = ConsoleAppender.formatEnabledInEnv private val NoPositionMapper = java.util.function.Function.identity[Position]() import java.util.function.{ Function => JavaFunction } @@ -57,7 +57,7 @@ object ReporterManager { /** Returns sane defaults with a long tradition in sbt. */ def getDefaultReporterConfig: ReporterConfig = - new ReporterConfig(DefaultName, 100, UseColor, Array(), Array(), Level.INFO, NoPositionMapper) + ReporterConfig.of(DefaultName, 100, UseColor, Array(), Array(), Level.INFO, NoPositionMapper) def getReporter(logger: xsbti.Logger, config: ReporterConfig): Reporter = { val maxErrors = config.maximumErrors() diff --git a/internal/zinc-core/src/main/java/xsbti/compile/IncOptionsUtil.java b/internal/zinc-core/src/main/java/xsbti/compile/IncOptionsUtil.java index d3773c0be2..4add448174 100644 --- a/internal/zinc-core/src/main/java/xsbti/compile/IncOptionsUtil.java +++ b/internal/zinc-core/src/main/java/xsbti/compile/IncOptionsUtil.java @@ -7,14 +7,13 @@ package xsbti.compile; -import sbt.internal.inc.ClassFileManager.WrappedClassFileManager; -import xsbti.F0; import xsbti.Logger; import java.io.File; import java.util.HashMap; import java.util.Map; import java.util.Optional; +import java.util.function.Supplier; /** * Define a helper class to instantiate {@link IncOptions}. @@ -41,130 +40,11 @@ public class IncOptionsUtil { public static final String DELETE_IMMEDIATELY_MANAGER_TYPE = "deleteImmediatelyManagerType"; private static final String XSBTI_NOTHING = "NOTHING"; - public static int defaultTransitiveStep() { - return 3; - } - - public static double defaultRecompileAllFraction() { - return 0.5; - } - - public static boolean defaultRelationsDebug() { - return false; - } - - public static boolean defaultApiDebug() { - return false; - } - - public static int defaultApiDiffContextSize() { - return 5; - } - - public static Optional defaultApiDumpDirectory() { - return Optional.empty(); - } - - public static Optional defaultClassFileManagerType() { - return Optional.empty(); - } - - public static Optional defaultRecompileOnMacroDef() { - return Optional.empty(); - } - - public static boolean defaultUseOptimizedSealed() { - return false; - } - - public static boolean defaultRecompileOnMacroDefImpl() { - return true; - } - - public static boolean getRecompileOnMacroDef(IncOptions options) { - if (options.recompileOnMacroDef().isPresent()) { - return options.recompileOnMacroDef().get(); - } else { - return defaultRecompileOnMacroDefImpl(); - } - } - - public static boolean defaultUseCustomizedFileManager() { - return false; - } - - public static boolean defaultStoreApis() { - return true; - } - - public static boolean defaultEnabled() { - return true; - } - - public static Map defaultExtra() { - return new HashMap(); - } - - private static class ConcreteExternalHooks implements ExternalHooks { - private Optional lookup = Optional.empty(); - private Optional classFileManager = Optional.empty(); - - private ConcreteExternalHooks(Optional lookup, Optional classFileManager) { - this.lookup = lookup; - this.classFileManager = classFileManager; - } - - @Override - public Optional getExternalLookup() { - return lookup; - } - - @Override - public Optional getExternalClassFileManager() { - return classFileManager; - } - - @Override - public ExternalHooks withExternalClassFileManager(ClassFileManager externalClassFileManager) { - Optional currentManager = this.getExternalClassFileManager(); - Optional mixedManager = currentManager; - if (currentManager.isPresent()) { - Optional external = Optional.of(externalClassFileManager); - mixedManager = Optional.of(new WrappedClassFileManager(currentManager.get(), external)); - } - return new ConcreteExternalHooks(this.getExternalLookup(), mixedManager); - } - - @Override - public ExternalHooks withExternalLookup(Lookup externalLookup) { - return new ConcreteExternalHooks(Optional.of(externalLookup), this.getExternalClassFileManager()); - } - } - - public static ExternalHooks defaultExternal() { - return new ConcreteExternalHooks(Optional.empty(), Optional.empty()); - } - - public static boolean defaultLogRecompileOnMacro() { - return true; - } - - public static IncOptions defaultIncOptions() { - IncOptions retval = new IncOptions( - defaultTransitiveStep(), defaultRecompileAllFraction(), - defaultRelationsDebug(), defaultApiDebug(), defaultApiDiffContextSize(), - defaultApiDumpDirectory(), defaultClassFileManagerType(), - defaultUseCustomizedFileManager(), defaultRecompileOnMacroDef(), - defaultUseOptimizedSealed(), defaultStoreApis(), defaultEnabled(), - defaultExtra(), defaultLogRecompileOnMacro(), defaultExternal()); - return retval; - } - // Small utility function for logging - private static F0 f0(String message) { - return new F0() { + private static Supplier f0(String message) { + return new Supplier() { @Override - public String apply() { + public String get() { return message; } }; @@ -178,7 +58,7 @@ public String apply() { * @return An instance of {@link IncOptions}. */ public static IncOptions fromStringMap(Map values, Logger logger) { - IncOptions base = defaultIncOptions(); + IncOptions base = IncOptions.of(); logger.debug(f0("Reading incremental options from map")); if (values.containsKey(TRANSITIVE_STEP_KEY)) { diff --git a/internal/zinc-core/src/main/scala/sbt/internal/inc/APIs.scala b/internal/zinc-core/src/main/scala/sbt/internal/inc/APIs.scala index 289d61dd4c..3adba18443 100644 --- a/internal/zinc-core/src/main/scala/sbt/internal/inc/APIs.scala +++ b/internal/zinc-core/src/main/scala/sbt/internal/inc/APIs.scala @@ -51,13 +51,13 @@ object APIs { val emptyAPI = APIUtil.emptyClassLike(emptyName, DefinitionType.ClassDef) val emptyAPIHash = -1 val noCompilationStamp = -1L - val emptyCompanions = new xsbti.api.Companions(emptyAPI, emptyAPI) - val emptyAnalyzedClass = new xsbti.api.AnalyzedClass(noCompilationStamp, - emptyName, - SafeLazyProxy(emptyCompanions), - emptyAPIHash, - Array.empty[NameHash], - false) + val emptyCompanions = xsbti.api.Companions.of(emptyAPI, emptyAPI) + val emptyAnalyzedClass = xsbti.api.AnalyzedClass.of(noCompilationStamp, + emptyName, + SafeLazyProxy(emptyCompanions), + emptyAPIHash, + Array.empty[NameHash], + false) def getAPI[T](map: Map[T, AnalyzedClass], className: T): AnalyzedClass = map.getOrElse(className, emptyAnalyzedClass) } diff --git a/internal/zinc-core/src/main/scala/sbt/internal/inc/ClassFileManager.scala b/internal/zinc-core/src/main/scala/sbt/internal/inc/ClassFileManager.scala index 77e133aaa7..62de7c2c6a 100644 --- a/internal/zinc-core/src/main/scala/sbt/internal/inc/ClassFileManager.scala +++ b/internal/zinc-core/src/main/scala/sbt/internal/inc/ClassFileManager.scala @@ -23,38 +23,6 @@ import xsbti.compile.{ } object ClassFileManager { - - /** - * Defines a classfile manager that composes the operation of two classfile manager, - * one being the internal classfile manager (the one used by the compiler) and the - * other one being the external classfile manager (a customizable, build tool-defined - * class file manager to control which class files should be notified/removed/generated - * aside from the ones covered by the internal classfile manager). - * - * @param internal Compiler classfile manager. - * @param external Build tool (or external) classfile manager the complements the internal one. - */ - case class WrappedClassFileManager(internal: ClassFileManager, - external: Optional[ClassFileManager]) - extends ClassFileManager { - - import JavaInterfaceUtil.EnrichOptional - override def delete(classes: Array[File]): Unit = { - external.toOption.foreach(_.delete(classes)) - internal.delete(classes) - } - - override def complete(success: Boolean): Unit = { - external.toOption.foreach(_.complete(success)) - internal.complete(success) - } - - override def generated(classes: Array[File]): Unit = { - external.toOption.foreach(_.generated(classes)) - internal.generated(classes) - } - } - def getDefaultClassFileManager( classFileManagerType: Optional[ClassFileManagerType]): ClassFileManager = { if (classFileManagerType.isPresent) { @@ -71,7 +39,7 @@ object ClassFileManager { val internal = getDefaultClassFileManager(options.classfileManagerType) val external = Option(options.externalHooks()) .flatMap(ext => ext.getExternalClassFileManager.toOption) - WrappedClassFileManager(internal, external.toOptional) + xsbti.compile.WrappedClassFileManager.of(internal, external.toOptional) } private final class DeleteClassFileManager extends ClassFileManager { diff --git a/internal/zinc-core/src/main/scala/sbt/internal/inc/Compilations.scala b/internal/zinc-core/src/main/scala/sbt/internal/inc/Compilations.scala index 9c62de6534..e7d3cb7da0 100644 --- a/internal/zinc-core/src/main/scala/sbt/internal/inc/Compilations.scala +++ b/internal/zinc-core/src/main/scala/sbt/internal/inc/Compilations.scala @@ -25,9 +25,9 @@ trait Compilations extends ReadCompilations { object Compilations { val empty: Compilations = new MCompilations(Seq.empty) - def make(s: Seq[Compilation]): Compilations = new MCompilations(s) + def of(s: Seq[Compilation]): Compilations = new MCompilations(s) def merge(s: Traversable[Compilations]): Compilations = - make((s flatMap { _.allCompilations }).toSeq.distinct) + of((s flatMap { _.allCompilations }).toSeq.distinct) } private final class MCompilations(val allCompilations: Seq[Compilation]) extends Compilations { diff --git a/internal/zinc-core/src/main/scala/sbt/internal/inc/Compile.scala b/internal/zinc-core/src/main/scala/sbt/internal/inc/Compile.scala index 415ecfafc2..b6c2c402a6 100644 --- a/internal/zinc-core/src/main/scala/sbt/internal/inc/Compile.scala +++ b/internal/zinc-core/src/main/scala/sbt/internal/inc/Compile.scala @@ -193,7 +193,7 @@ private final class AnalysisCallback( if (onClassName != sourceClassName) add(intSrcDeps, sourceClassName, - new InternalDependency(sourceClassName, onClassName, context)) + InternalDependency.of(sourceClassName, onClassName, context)) } private[this] def externalBinaryDependency(binary: File, @@ -209,7 +209,7 @@ private final class AnalysisCallback( targetClass: AnalyzedClass, context: DependencyContext): Unit = { val dependency = - new ExternalDependency(sourceClassName, targetBinaryClassName, targetClass, context) + ExternalDependency.of(sourceClassName, targetBinaryClassName, targetClass, context) add(extSrcDeps, sourceClassName, dependency) } @@ -315,7 +315,7 @@ private final class AnalysisCallback( lazy val emptyObject = emptyHash -> APIUtil.emptyClassLike(className, DefinitionType.Module) val (classApiHash, classApi) = classApis.getOrElse(className, emptyClass) val (objectApiHash, objectApi) = objectApis.getOrElse(className, emptyObject) - val companions = new Companions(classApi, objectApi) + val companions = Companions.of(classApi, objectApi) val apiHash = (classApiHash, objectApiHash).hashCode (companions, apiHash) } @@ -337,12 +337,12 @@ private final class AnalysisCallback( val (companions, apiHash) = companionsWithHash(name) val nameHashes = nameHashesForCompanions(name) val safeCompanions = SafeLazyProxy(companions) - val ac = new AnalyzedClass(compilation.getStartTime(), - name, - safeCompanions, - apiHash, - nameHashes, - hasMacro) + val ac = AnalyzedClass.of(compilation.getStartTime(), + name, + safeCompanions, + apiHash, + nameHashes, + hasMacro) ac } diff --git a/internal/zinc-core/src/main/scala/sbt/internal/inc/IncrementalCommon.scala b/internal/zinc-core/src/main/scala/sbt/internal/inc/IncrementalCommon.scala index 42a9127268..979ae826f6 100644 --- a/internal/zinc-core/src/main/scala/sbt/internal/inc/IncrementalCommon.scala +++ b/internal/zinc-core/src/main/scala/sbt/internal/inc/IncrementalCommon.scala @@ -201,7 +201,7 @@ private[inc] abstract class IncrementalCommon(val log: sbt.util.Logger, options: if (shortcutSameClass(a, b)) { None } else { - if (hasMacro && IncOptionsUtil.getRecompileOnMacroDef(options)) { + if (hasMacro && IncOptions.getRecompileOnMacroDef(options)) { Some(APIChangeDueToMacroDefinition(className)) } else sameAPI(className, a, b) } diff --git a/internal/zinc-core/src/main/scala/sbt/internal/inc/JavaInterfaceUtil.scala b/internal/zinc-core/src/main/scala/sbt/internal/inc/JavaInterfaceUtil.scala index 44307f5d1f..c7ad6c0539 100644 --- a/internal/zinc-core/src/main/scala/sbt/internal/inc/JavaInterfaceUtil.scala +++ b/internal/zinc-core/src/main/scala/sbt/internal/inc/JavaInterfaceUtil.scala @@ -8,6 +8,7 @@ package sbt.internal.inc import java.util.Optional +import sbt.util.InterfaceUtil import xsbti.T2 @@ -17,13 +18,10 @@ object JavaInterfaceUtil { } private[sbt] implicit class EnrichOptional[T](optional: Optional[T]) { - def toOption: Option[T] = if (!optional.isPresent) None else Some(optional.get()) + def toOption: Option[T] = InterfaceUtil.toOption(optional) } private[sbt] implicit class EnrichOption[T](option: Option[T]) { - def toOptional: Optional[T] = option match { - case Some(value) => Optional.of(value) - case None => Optional.empty[T] - } + def toOptional: Optional[T] = InterfaceUtil.toOptional(option) } } diff --git a/internal/zinc-core/src/main/scala/sbt/internal/inc/SourceInfo.scala b/internal/zinc-core/src/main/scala/sbt/internal/inc/SourceInfo.scala index 7b829960f4..4f5e52345a 100644 --- a/internal/zinc-core/src/main/scala/sbt/internal/inc/SourceInfo.scala +++ b/internal/zinc-core/src/main/scala/sbt/internal/inc/SourceInfo.scala @@ -23,8 +23,8 @@ trait SourceInfos extends ReadSourceInfos { } object SourceInfos { - def empty: SourceInfos = make(Map.empty) - def make(m: Map[File, SourceInfo]): SourceInfos = new MSourceInfos(m) + def empty: SourceInfos = of(Map.empty) + def of(m: Map[File, SourceInfo]): SourceInfos = new MSourceInfos(m) val emptyInfo: SourceInfo = makeInfo(Nil, Nil, Nil) def makeInfo(reported: Seq[Problem], diff --git a/internal/zinc-ivy-integration/src/main/java/xsbti/compile/ZincBridgeProvider.java b/internal/zinc-ivy-integration/src/main/java/xsbti/compile/ZincBridgeProvider.java index 1560a0e443..0a1e8e77e3 100644 --- a/internal/zinc-ivy-integration/src/main/java/xsbti/compile/ZincBridgeProvider.java +++ b/internal/zinc-ivy-integration/src/main/java/xsbti/compile/ZincBridgeProvider.java @@ -9,9 +9,8 @@ import sbt.internal.inc.ZincComponentCompiler; import sbt.internal.inc.ZincComponentManager; -import sbt.internal.librarymanagement.IvyConfiguration; +import sbt.librarymanagement.DependencyResolution; import sbt.librarymanagement.Resolver; -import sbt.librarymanagement.ResolversSyntax; import scala.None$; import xsbti.ComponentProvider; import xsbti.GlobalLock; @@ -24,7 +23,7 @@ public interface ZincBridgeProvider { * Returns an ivy resolver to resolve dependencies locally in the default `.ivy2/local`. *

* For those users interested in using Internet resolvers like Maven Central, you can - * instantiate them via {@link ResolversSyntax#DefaultMavenRepository()} et al. + * instantiate them via {@link Resolver#mavenCentral()} et al. * * @return A local ivy resolver. */ @@ -32,26 +31,6 @@ public static Resolver getLocalResolver() { return ZincComponentCompiler.LocalResolver(); } - /** - * Get the default ivy configuration to retrieve compiler components. - *

- * This method is useful to invoke {@link ZincBridgeProvider#getProvider(File, GlobalLock, ComponentProvider, IvyConfiguration, Logger)}. - *

- * In order to know which arguments to pass, reading the - * ivy main concepts - * may be useful. - * - * @param baseDirectory The base directory for ivy. - * @param ivyHome The home for ivy. - * @param resolvers The resolvers to be used (usually local and Maven). - * See {@link ZincBridgeProvider#getProvider(File, GlobalLock, ComponentProvider, IvyConfiguration, Logger)} - * and {@link ResolversSyntax}. - * @return A default ivy configuration ready for fetching Zinc compiler components. - */ - public static IvyConfiguration getDefaultConfiguration(File baseDirectory, File ivyHome, Resolver[] resolvers, Logger logger) { - return ZincComponentCompiler.getDefaultConfiguration(baseDirectory, ivyHome, resolvers, logger); - } - /** * Returns a global lock that does nothing but calling the callable to synchronize * across threads. The lock file is used to resolve and download dependencies via ivy. @@ -86,16 +65,16 @@ public static ComponentProvider getDefaultComponentProvider(File componentsRoot) * @param lock The lock file used internally by Ivy to synchronize the dependency resolution. * @param componentProvider A provider capable of retrieving existing components or installing * new ones. The component provider manages compiled bridge sources. - * @param ivyConfiguration The ivy configuration used internally by the provider. + * @param dependencyResolution The library management module to use to retrieve the bridge. * @param logger The logger. * @return A compiler bridge provider capable of fetching scala jars and the compiler bridge. */ public static CompilerBridgeProvider getProvider(File scalaJarsTarget, GlobalLock lock, ComponentProvider componentProvider, - IvyConfiguration ivyConfiguration, + DependencyResolution dependencyResolution, Logger logger) { ZincComponentManager manager = new ZincComponentManager(lock, componentProvider, None$.empty(), logger); - return ZincComponentCompiler.interfaceProvider(manager, ivyConfiguration, scalaJarsTarget); + return ZincComponentCompiler.interfaceProvider(manager, dependencyResolution, scalaJarsTarget); } } diff --git a/internal/zinc-ivy-integration/src/main/scala/sbt/internal/inc/ZincComponentCompiler.scala b/internal/zinc-ivy-integration/src/main/scala/sbt/internal/inc/ZincComponentCompiler.scala index ebf9c84e69..9a09775818 100644 --- a/internal/zinc-ivy-integration/src/main/scala/sbt/internal/inc/ZincComponentCompiler.scala +++ b/internal/zinc-ivy-integration/src/main/scala/sbt/internal/inc/ZincComponentCompiler.scala @@ -58,7 +58,7 @@ private[sbt] object ZincComponentCompiler { private class ZincCompilerBridgeProvider( userProvidedBridgeSources: Option[ModuleID], manager: ZincComponentManager, - ivyConfiguration: IvyConfiguration, + dependencyResolution: DependencyResolution, scalaJarsTarget: File ) extends CompilerBridgeProvider { @@ -71,10 +71,12 @@ private[sbt] object ZincComponentCompiler { def compiledBridge(bridgeSources: ModuleID, scalaInstance: xsbti.compile.ScalaInstance, logger: xsbti.Logger): File = { + import InterfaceUtil.{ toSupplier => f0 } val autoClasspath = ClasspathOptionsUtil.auto val raw = new RawCompiler(scalaInstance, autoClasspath, logger) - val zinc = new ZincComponentCompiler(raw, manager, ivyConfiguration, bridgeSources, logger) - logger.debug(InterfaceUtil.f0(s"Getting $bridgeSources for Scala ${scalaInstance.version}")) + val zinc = + new ZincComponentCompiler(raw, manager, dependencyResolution, bridgeSources, logger) + logger.debug(f0(s"Getting $bridgeSources for Scala ${scalaInstance.version}")) zinc.compiledBridgeJar } @@ -99,9 +101,17 @@ private[sbt] object ZincComponentCompiler { val scalaCompiler = ModuleID(ScalaOrganization, ScalaCompilerID, scalaVersion) val dependencies = Vector(scalaLibrary, scalaCompiler).map(_.withConfigurations(CompileConf)) val wrapper = dummyModule.withConfigurations(CompileConf) - val ivySbt: IvySbt = new IvySbt(ivyConfiguration) - val ivyModule = ZincIvyActions.getModule(ivySbt, wrapper, dependencies) - ZincIvyActions.update(ivyModule, scalaJarsTarget, noSource = true, fullLogger) match { + val moduleDescriptorConfiguration = + ModuleDescriptorConfiguration(wrapper, ModuleInfo(wrapper.name)) + .withDependencies(dependencies) + .withConfigurations(ZincLMHelper.DefaultConfigurations) + + val moduleDescriptor = dependencyResolution.moduleDescriptor(moduleDescriptorConfiguration) + ZincLMHelper.update(dependencyResolution, + moduleDescriptor, + scalaJarsTarget, + noSource = true, + fullLogger) match { case Left(uw) => val unresolvedLines = unresolvedWarningLines.showLines(uw).mkString("\n") val unretrievedMessage = s"The Scala compiler and library could not be retrieved." @@ -137,17 +147,17 @@ private[sbt] object ZincComponentCompiler { // Used by ZincUtil. def interfaceProvider(compilerBridgeSource: ModuleID, manager: ZincComponentManager, - ivyConfiguration: IvyConfiguration, + dependencyResolution: DependencyResolution, scalaJarsTarget: File): CompilerBridgeProvider = new ZincCompilerBridgeProvider(Some(compilerBridgeSource), manager, - ivyConfiguration, + dependencyResolution, scalaJarsTarget) def interfaceProvider(manager: ZincComponentManager, - ivyConfiguration: IvyConfiguration, + dependencyResolution: DependencyResolution, scalaJarsTarget: File): CompilerBridgeProvider = - new ZincCompilerBridgeProvider(None, manager, ivyConfiguration, scalaJarsTarget) + new ZincCompilerBridgeProvider(None, manager, dependencyResolution, scalaJarsTarget) private final val LocalIvy = s"$${user.home}/.ivy2/local/${Resolver.localBasePattern}" final val LocalResolver: Resolver = { @@ -182,43 +192,22 @@ private[sbt] object ZincComponentCompiler { new DefaultComponentProvider(targetDir) } - def getDefaultConfiguration(baseDirectory: File, - ivyHome: File, - resolvers0: Array[Resolver], - log: xsbti.Logger): IvyConfiguration = { - import sbt.io.syntax._ - val resolvers = resolvers0.toVector - val chainResolver = ChainedResolver("zinc-chain", resolvers) - new InlineIvyConfiguration( - paths = IvyPaths(baseDirectory, Some(ivyHome)), - resolvers = resolvers, - otherResolvers = Vector.empty, - moduleConfigurations = Vector(ModuleConfiguration("*", chainResolver)), - lock = None, - checksums = Vector.empty, - managedChecksums = false, - resolutionCacheDir = Some(ivyHome / "resolution-cache"), - updateOptions = UpdateOptions(), - log = log - ) - } } /** * Component compiler which is able to to retrieve the compiler bridge sources - * `sourceModule` using Ivy. + * `sourceModule` using a `DependencyResolution` instance. * The compiled classes are cached using the provided component manager according * to the actualVersion field of the RawCompiler. */ private[inc] class ZincComponentCompiler( compiler: RawCompiler, manager: ZincComponentManager, - ivyConfiguration: IvyConfiguration, + dependencyResolution: DependencyResolution, bridgeSources: ModuleID, log: Logger ) { import sbt.internal.util.{ BufferedLogger, FullLogger } - private final val ivySbt: IvySbt = new IvySbt(ivyConfiguration) private final val buffered = new BufferedLogger(FullLogger(log)) def compiledBridgeJar: File = { @@ -247,19 +236,6 @@ private[inc] class ZincComponentCompiler( s"$id$binSeparator${scalaVersion}__$javaClassVersion" } - /** - * Returns an ivy module that will wrap and download a given `moduleID`. - * - * @param moduleID The `moduleID` that needs to be wrapped in a dummy module to be downloaded. - */ - private[inc] def wrapDependencyInModule(moduleID: ModuleID): IvySbt#Module = { - import ZincComponentCompiler.{ sbtOrgTemp, modulePrefixTemp } - val sha1 = Hash.toHex(Hash(moduleID.name)) - val dummyID = ModuleID(sbtOrgTemp, s"$modulePrefixTemp$sha1", moduleID.revision) - .withConfigurations(moduleID.configurations) - ZincIvyActions.getModule(ivySbt, dummyID, Vector(moduleID)) - } - /** * Resolves the compiler bridge sources, compiles them and installs the sbt component * in the local filesystem to make sure that it's reused the next time is required. @@ -268,12 +244,17 @@ private[inc] class ZincComponentCompiler( */ private def compileAndInstall(compilerBridgeId: String): Unit = { import UnresolvedWarning.unresolvedWarningLines - val ivyModuleForBridge = wrapDependencyInModule(bridgeSources) + val moduleForBridge = + dependencyResolution.wrapDependencyInModule(bridgeSources) IO.withTemporaryDirectory { binaryDirectory => val target = new File(binaryDirectory, s"$compilerBridgeId.jar") buffered bufferQuietly { IO.withTemporaryDirectory { retrieveDirectory => - ZincIvyActions.update(ivyModuleForBridge, retrieveDirectory, false, buffered) match { + ZincLMHelper.update(dependencyResolution, + moduleForBridge, + retrieveDirectory, + false, + buffered) match { case Left(uw) => val mod = bridgeSources.toString val unresolvedLines = unresolvedWarningLines.showLines(uw).mkString("\n") @@ -294,70 +275,23 @@ private[inc] class ZincComponentCompiler( } -object ZincIvyActions { - type IvyModule = IvySbt#Module - - /** Define the default configurations for a Zinc module wrapper. */ - private final val DefaultConfigurations: Vector[Configuration] = - Vector(Configurations.Component, Configurations.Compile) - - /** - * Create a module from its dummy wrapper and its dependencies. - * - * @param wrapper The ModuleID wrapper that will download the dependencies. - * @param deps The dependencies to be downloaded. - * @return A fully-fledged ivy module to be used for [[IvyActions]]. - */ - private[inc] def getModule(ivySbt: IvySbt, - wrapper: ModuleID, - deps: Vector[ModuleID]): IvyModule = { - val moduleInfo = ModuleInfo(wrapper.name) - val componentIvySettings = InlineConfiguration( - validate = false, - ivyScala = None, - module = wrapper, - moduleInfo = moduleInfo, - dependencies = deps - ).withConfigurations(DefaultConfigurations) - new ivySbt.Module(componentIvySettings) - } - - // The implementation of this method is linked to `wrapDependencyInModule` - private def prettyPrintDependency(module: IvyModule): String = { - module.moduleSettings match { - case ic: InlineConfiguration => - // Pretty print the module as `ModuleIDExtra.toStringImpl` does. - ic.dependencies.map(m => s"${m.organization}:${m.name}:${m.revision}").mkString(", ") - case _ => sys.error("Fatal: configuration to download was not inline.") - } - } +private object ZincLMHelper { private final val warningConf = UnresolvedWarningConfiguration() private final val defaultRetrievePattern = Resolver.defaultRetrievePattern - private def defaultUpdateConfiguration(targetDir: File, noSource: Boolean): UpdateConfiguration = { - val retrieve = RetrieveConfiguration(targetDir, defaultRetrievePattern, false, None) - val logLevel = UpdateLogging.DownloadOnly - val defaultExcluded = Set("doc") - val finalExcluded = if (noSource) defaultExcluded + "src" else defaultExcluded - val artifactFilter = ArtifactTypeFilter.forbid(finalExcluded) - UpdateConfiguration(retrieve = Some(retrieve), - missingOk = false, - logging = logLevel, - artifactFilter = artifactFilter, - offline = false, - frozen = false) - } + private[inc] final val DefaultConfigurations: Vector[Configuration] = + Vector(Configurations.Component, Configurations.Compile) - private[inc] def update(module: IvyModule, + private[inc] def update(dependencyResolution: DependencyResolution, + module: ModuleDescriptor, retrieveDirectory: File, noSource: Boolean = false, logger: Logger): Either[UnresolvedWarning, Vector[File]] = { - import IvyActions.updateEither val updateConfiguration = defaultUpdateConfiguration(retrieveDirectory, noSource) val dependencies = prettyPrintDependency(module) logger.info(s"Attempting to fetch $dependencies.") val clockForCache = LogicalClock.unknown - updateEither(module, updateConfiguration, warningConf, clockForCache, None, logger) match { + dependencyResolution.update(module, updateConfiguration, warningConf, logger) match { case Left(unresolvedWarning) => logger.debug(s"Couldn't retrieve module(s) ${prettyPrintDependency(module)}.") Left(unresolvedWarning) @@ -369,4 +303,28 @@ object ZincIvyActions { Right(allFiles) } } + + private def defaultUpdateConfiguration(targetDir: File, noSource: Boolean): UpdateConfiguration = { + val retrieve = RetrieveConfiguration() + .withRetrieveDirectory(targetDir) + .withOutputPattern(defaultRetrievePattern) + val logLevel = UpdateLogging.DownloadOnly + val defaultExcluded = Set("doc") + val finalExcluded = if (noSource) defaultExcluded + "src" else defaultExcluded + val artifactFilter = ArtifactTypeFilter.forbid(finalExcluded) + UpdateConfiguration() + .withRetrieveManaged(retrieve) + .withLogging(logLevel) + .withArtifactFilter(artifactFilter) + } + + private def prettyPrintDependency(module: ModuleDescriptor): String = { + module.directDependencies + .map { m => + // Pretty print the module as `ModuleIDExtra.toStringImpl` does. + s"${m.organization}:${m.name}:${m.revision}" + } + .mkString(", ") + } + } diff --git a/internal/zinc-ivy-integration/src/test/scala/sbt/internal/inc/BridgeProviderSpecification.scala b/internal/zinc-ivy-integration/src/test/scala/sbt/internal/inc/BridgeProviderSpecification.scala index 6eebed1cf8..abd2485a4c 100644 --- a/internal/zinc-ivy-integration/src/test/scala/sbt/internal/inc/BridgeProviderSpecification.scala +++ b/internal/zinc-ivy-integration/src/test/scala/sbt/internal/inc/BridgeProviderSpecification.scala @@ -1,20 +1,13 @@ package sbt.internal.inc import java.io.File -import java.util.concurrent.Callable import sbt.io.IO import sbt.io.syntax._ -import sbt.librarymanagement.{ - DefaultMavenRepository, - FileRepository, - Patterns, - Resolver, - UpdateOptions -} +import sbt.librarymanagement._ +import sbt.librarymanagement.ivy._ import sbt.util.Logger import xsbti.compile.CompilerBridgeProvider -import xsbti.{ ComponentProvider, GlobalLock } /** * Base class for test suites that must be able to fetch and compile the compiler bridge. @@ -26,9 +19,9 @@ abstract class BridgeProviderSpecification extends UnitSpec { def currentTarget: File = currentBase / "target" / "ivyhome" def currentManaged: File = currentBase / "target" / "lib_managed" - val resolvers = Array(ZincComponentCompiler.LocalResolver, DefaultMavenRepository) + val resolvers = Array(ZincComponentCompiler.LocalResolver, Resolver.mavenCentral) private val ivyConfiguration = - ZincComponentCompiler.getDefaultConfiguration(currentBase, currentTarget, resolvers, log) + getDefaultConfiguration(currentBase, currentTarget, resolvers, log) def secondaryCacheDirectory: File = { val target = file("target").getAbsoluteFile @@ -40,7 +33,8 @@ abstract class BridgeProviderSpecification extends UnitSpec { val secondaryCache = Some(secondaryCacheDirectory) val componentProvider = ZincComponentCompiler.getDefaultComponentProvider(targetDir) val manager = new ZincComponentManager(lock, componentProvider, secondaryCache, log) - ZincComponentCompiler.interfaceProvider(manager, ivyConfiguration, currentManaged) + val dependencyResolution = IvyDependencyResolution(ivyConfiguration) + ZincComponentCompiler.interfaceProvider(manager, dependencyResolution, currentManaged) } def getCompilerBridge(targetDir: File, log: Logger, scalaVersion: String): File = { @@ -58,4 +52,22 @@ abstract class BridgeProviderSpecification extends UnitSpec { val provider = getZincProvider(targetDir, logger) provider.fetchScalaInstance(scalaVersion, logger) } + + private def getDefaultConfiguration(baseDirectory: File, + ivyHome: File, + resolvers0: Array[Resolver], + log: xsbti.Logger): InlineIvyConfiguration = { + import sbt.io.syntax._ + val resolvers = resolvers0.toVector + val chainResolver = ChainedResolver("zinc-chain", resolvers) + InlineIvyConfiguration() + .withPaths(IvyPaths(baseDirectory, Some(ivyHome))) + .withResolvers(resolvers) + .withModuleConfigurations(Vector(ModuleConfiguration("*", chainResolver))) + .withLock(None) + .withChecksums(Vector.empty) + .withResolutionCacheDir(ivyHome / "resolution-cache") + .withUpdateOptions(UpdateOptions()) + .withLog(log) + } } diff --git a/internal/zinc-persist/src/main/scala/sbt/internal/inc/binary/converters/ProtobufDefaults.scala b/internal/zinc-persist/src/main/scala/sbt/internal/inc/binary/converters/ProtobufDefaults.scala index 53c488ddad..c9d63cc4c8 100644 --- a/internal/zinc-persist/src/main/scala/sbt/internal/inc/binary/converters/ProtobufDefaults.scala +++ b/internal/zinc-persist/src/main/scala/sbt/internal/inc/binary/converters/ProtobufDefaults.scala @@ -15,11 +15,11 @@ object ProtobufDefaults { final val MissingString: String = "" object ReadersConstants { - final val This: This = new This() - final val Public: Public = new Public() - final val EmptyType: EmptyType = new EmptyType() - final val Unqualified: Unqualified = new Unqualified() - final val ThisQualifier: ThisQualifier = new ThisQualifier() + final val This: This = xsbti.api.This.of() + final val Public: Public = xsbti.api.Public.of() + final val EmptyType: EmptyType = xsbti.api.EmptyType.of() + final val Unqualified: Unqualified = xsbti.api.Unqualified.of() + final val ThisQualifier: ThisQualifier = xsbti.api.ThisQualifier.of() } object WritersConstants { diff --git a/internal/zinc-persist/src/main/scala/sbt/internal/inc/binary/converters/ProtobufReaders.scala b/internal/zinc-persist/src/main/scala/sbt/internal/inc/binary/converters/ProtobufReaders.scala index 15cb3bee11..014cc6e069 100644 --- a/internal/zinc-persist/src/main/scala/sbt/internal/inc/binary/converters/ProtobufReaders.scala +++ b/internal/zinc-persist/src/main/scala/sbt/internal/inc/binary/converters/ProtobufReaders.scala @@ -111,7 +111,7 @@ final class ProtobufReaders(mapper: ReadMapper) { def fromCompilations(compilations0: schema.Compilations): Compilations = { val compilations = compilations0.compilations.map(fromCompilation).toList val castedCompilations = compilations.map { case c: sbt.internal.inc.Compilation => c } - Compilations.make(castedCompilations) + Compilations.of(castedCompilations) } def fromPosition(position: schema.Position): Position = { @@ -166,21 +166,21 @@ final class ProtobufReaders(mapper: ReadMapper) { val sourceInfo = fromSourceInfo(value) file -> sourceInfo } - SourceInfos.make(sourceInfos.toMap) + SourceInfos.of(sourceInfos.toMap) } def fromClasspathFileHash(fileHash: schema.FileHash): FileHash = { val hash = fileHash.hash val classpathEntry = fromPathString(fileHash.path) val newClasspathEntry = mapper.mapClasspathEntry(classpathEntry) - new FileHash(newClasspathEntry, hash) + FileHash.of(newClasspathEntry, hash) } def fromMiniOptions(miniOptions: schema.MiniOptions): MiniOptions = { val classpathHash = miniOptions.classpathHash.map(fromClasspathFileHash).toArray val javacOptions = miniOptions.javacOptions.map(mapper.mapJavacOption).toArray val scalacOptions = miniOptions.scalacOptions.map(mapper.mapScalacOption).toArray - new MiniOptions(classpathHash, scalacOptions, javacOptions) + MiniOptions.of(classpathHash, scalacOptions, javacOptions) } def fromCompileOrder(compileOrder: schema.CompileOrder): CompileOrder = { @@ -220,7 +220,7 @@ final class ProtobufReaders(mapper: ReadMapper) { val compileOrder = fromCompileOrder(miniSetup.compileOrder) val storeApis = miniSetup.storeApis val extra = miniSetup.extra.map(fromStringTuple).toArray - new MiniSetup(output, miniOptions, compilerVersion, compileOrder, storeApis, extra) + MiniSetup.of(output, miniOptions, compilerVersion, compileOrder, storeApis, extra) } implicit class EfficientTraverse[T](seq: Seq[T]) { @@ -240,26 +240,27 @@ final class ProtobufReaders(mapper: ReadMapper) { import SchemaPath.{ Component => SchemaComponent } import Classes.{ Component, PathComponent } pathComponent.component match { - case SchemaComponent.Id(c) => new Id(c.id) - case SchemaComponent.Super(c) => new Super(c.qualifier.read(fromPath, ExpectedPathInSuper)) - case SchemaComponent.This(_) => ReadersConstants.This - case SchemaComponent.Empty => ReadersFeedback.expected(Component, PathComponent).!! + case SchemaComponent.Id(c) => Id.of(c.id) + case SchemaComponent.Super(c) => + Super.of(c.qualifier.read(fromPath, ExpectedPathInSuper)) + case SchemaComponent.This(_) => ReadersConstants.This + case SchemaComponent.Empty => ReadersFeedback.expected(Component, PathComponent).!! } } val components = path.components.toZincArray(fromPathComponent) - new Path(components) + Path.of(components) } def fromAnnotation(annotation: schema.Annotation): Annotation = { def fromAnnotationArgument(argument: schema.AnnotationArgument): AnnotationArgument = { val name = argument.name val value = argument.value - new AnnotationArgument(name, value) + AnnotationArgument.of(name, value) } val arguments = annotation.arguments.toZincArray(fromAnnotationArgument) val base = annotation.base.read(fromType, ReadersFeedback.expectedBaseIn(Classes.Annotation)) - new Annotation(base, arguments) + Annotation.of(base, arguments) } def fromStructure(tpe: schema.Type.Structure): Structure = { @@ -267,54 +268,54 @@ final class ProtobufReaders(mapper: ReadMapper) { val parents = `lazy`(tpe.parents.toZincArray(fromType)) val declared = `lazy`(tpe.declared.toZincArray(fromClassDefinition)) val inherited = `lazy`(tpe.inherited.toZincArray(fromClassDefinition)) - new Structure(parents, declared, inherited) + Structure.of(parents, declared, inherited) } def fromType(`type`: schema.Type): Type = { import ReadersFeedback.expectedBaseIn def fromParameterRef(tpe: schema.Type.ParameterRef): ParameterRef = { - new ParameterRef(tpe.id) + ParameterRef.of(tpe.id) } def fromParameterized(tpe: schema.Type.Parameterized): Parameterized = { val baseType = tpe.baseType.read(fromType, expectedBaseIn(Classes.Parameterized)) val typeArguments = tpe.typeArguments.toZincArray(fromType) - new Parameterized(baseType, typeArguments) + Parameterized.of(baseType, typeArguments) } def fromPolymorphic(tpe: schema.Type.Polymorphic): Polymorphic = { val baseType = tpe.baseType.read(fromType, expectedBaseIn(Classes.Polymorphic)) val typeParameters = tpe.typeParameters.toZincArray(fromTypeParameter) - new Polymorphic(baseType, typeParameters) + Polymorphic.of(baseType, typeParameters) } def fromConstant(tpe: schema.Type.Constant): Constant = { val baseType = tpe.baseType.read(fromType, expectedBaseIn(Classes.Constant)) val value = tpe.value - new Constant(baseType, value) + Constant.of(baseType, value) } def fromExistential(tpe: schema.Type.Existential): Existential = { val baseType = tpe.baseType.read(fromType, expectedBaseIn(Classes.Existential)) val clause = tpe.clause.toZincArray(fromTypeParameter) - new Existential(baseType, clause) + Existential.of(baseType, clause) } def fromSingleton(tpe: schema.Type.Singleton): Singleton = { val path = tpe.path.read(fromPath, ReadersFeedback.ExpectedPathInSingleton) - new Singleton(path) + Singleton.of(path) } def fromProjection(tpe: schema.Type.Projection): Projection = { val id = tpe.id val prefix = tpe.prefix.read(fromType, ReadersFeedback.ExpectedPrefixInProjection) - new Projection(prefix, id) + Projection.of(prefix, id) } def fromAnnotated(tpe: schema.Type.Annotated): Annotated = { val baseType = tpe.baseType.read(fromType, expectedBaseIn(Classes.Annotated)) val annotations = tpe.annotations.toZincArray(fromAnnotation) - new Annotated(baseType, annotations) + Annotated.of(baseType, annotations) } `type`.value match { @@ -339,7 +340,7 @@ final class ProtobufReaders(mapper: ReadMapper) { def fromQualifier(qualifier: schema.Qualifier): Qualifier = { import schema.Qualifier.{ Type => QualifierType } qualifier.`type` match { - case QualifierType.IdQualifier(q) => new IdQualifier(q.value) + case QualifierType.IdQualifier(q) => IdQualifier.of(q.value) case QualifierType.ThisQualifier(_) => ReadersConstants.ThisQualifier case QualifierType.Unqualified(_) => ReadersConstants.Unqualified case QualifierType.Empty => ReadersFeedback.ExpectedNonEmptyQualifier.!! @@ -351,8 +352,8 @@ final class ProtobufReaders(mapper: ReadMapper) { access.`type` match { case schema.Access.Type.Public(_) => ReadersConstants.Public - case schema.Access.Type.Protected(a) => new Protected(readQualifier(a.qualifier)) - case schema.Access.Type.Private(a) => new Private(readQualifier(a.qualifier)) + case schema.Access.Type.Protected(a) => Protected.of(readQualifier(a.qualifier)) + case schema.Access.Type.Private(a) => Private.of(readQualifier(a.qualifier)) case schema.Access.Type.Empty => ReadersFeedback.ExpectedValidAccessType.!! } } @@ -395,48 +396,48 @@ final class ProtobufReaders(mapper: ReadMapper) { val hasDefault = methodParameter.hasDefault val `type` = methodParameter.`type`.read(fromType, expectedTypeIn(Classes.MethodParameter)) val modifier = fromParameterModifier(methodParameter.modifier) - new MethodParameter(name, `type`, hasDefault, modifier) + MethodParameter.of(name, `type`, hasDefault, modifier) } val isImplicit = parameterList.isImplicit val parameters = parameterList.parameters.toZincArray(fromMethodParameter) - new ParameterList(parameters, isImplicit) + ParameterList.of(parameters, isImplicit) } def fromClassLikeDef(defDef: schema.ClassDefinition.ClassLikeDef): ClassLikeDef = { val definitionType = fromDefinitionType(defDef.definitionType) val typeParameters = defDef.typeParameters.toZincArray(fromTypeParameter) - new ClassLikeDef(name, access, modifiers, annotations, typeParameters, definitionType) + ClassLikeDef.of(name, access, modifiers, annotations, typeParameters, definitionType) } def fromDefDef(defDef: schema.ClassDefinition.Def): Def = { val returnType = defDef.returnType.read(fromType, ExpectedReturnTypeInDef) val typeParameters = defDef.typeParameters.toZincArray(fromTypeParameter) val valueParameters = defDef.valueParameters.toZincArray(fromParameterList) - new Def(name, access, modifiers, annotations, typeParameters, valueParameters, returnType) + Def.of(name, access, modifiers, annotations, typeParameters, valueParameters, returnType) } def fromValDef(valDef: schema.ClassDefinition.Val): Val = { val `type` = valDef.`type`.read(fromType, expectedTypeIn(Classes.Val)) - new Val(name, access, modifiers, annotations, `type`) + Val.of(name, access, modifiers, annotations, `type`) } def fromVarDef(varDef: schema.ClassDefinition.Var): Var = { val `type` = varDef.`type`.read(fromType, expectedTypeIn(Classes.Var)) - new Var(name, access, modifiers, annotations, `type`) + Var.of(name, access, modifiers, annotations, `type`) } def fromTypeAlias(typeAlias: schema.ClassDefinition.TypeAlias): TypeAlias = { val `type` = typeAlias.`type`.read(fromType, expectedTypeIn(Classes.TypeAlias)) val typeParameters = typeAlias.typeParameters.toZincArray(fromTypeParameter) - new TypeAlias(name, access, modifiers, annotations, typeParameters, `type`) + TypeAlias.of(name, access, modifiers, annotations, typeParameters, `type`) } def fromTypeDeclaration(decl: schema.ClassDefinition.TypeDeclaration): TypeDeclaration = { val lowerBound = decl.lowerBound.read(fromType, ExpectedLowerBoundInTypeDeclaration) val upperBound = decl.upperBound.read(fromType, ExpectedUpperBoundInTypeDeclaration) val typeParams = decl.typeParameters.toZincArray(fromTypeParameter) - new TypeDeclaration(name, access, modifiers, annotations, typeParams, lowerBound, upperBound) + TypeDeclaration.of(name, access, modifiers, annotations, typeParams, lowerBound, upperBound) } import schema.ClassDefinition.{ Extra => DefType } @@ -468,7 +469,7 @@ final class ProtobufReaders(mapper: ReadMapper) { val variance = fromVariance(typeParameter.variance) val lowerBound = typeParameter.lowerBound.read(fromType, ExpectedLowerBoundInTypeParameter) val upperBound = typeParameter.upperBound.read(fromType, ExpectedUpperBoundInTypeParameter) - new TypeParameter(id, annotations, typeParameters, variance, lowerBound, upperBound) + TypeParameter.of(id, annotations, typeParameters, variance, lowerBound, upperBound) } def fromClassLike(classLike: schema.ClassLike): ClassLike = { @@ -487,7 +488,7 @@ final class ProtobufReaders(mapper: ReadMapper) { val childrenOfSealedClass = classLike.childrenOfSealedClass.toZincArray(fromType) val topLevel = classLike.topLevel val typeParameters = classLike.typeParameters.toZincArray(fromTypeParameter) - new ClassLike( + ClassLike.of( name, access, modifiers, @@ -516,14 +517,14 @@ final class ProtobufReaders(mapper: ReadMapper) { def expected(msg: String) = ReadersFeedback.expected(msg, Classes.Companions) val classApi = companions.classApi.read(fromClassLike, expected("class api")) val objectApi = companions.objectApi.read(fromClassLike, expected("object api")) - new Companions(classApi, objectApi) + Companions.of(classApi, objectApi) } def fromNameHash(nameHash: schema.NameHash): NameHash = { val name = nameHash.name val hash = nameHash.hash val scope = fromUseScope(nameHash.scope) - new NameHash(name, scope, hash) + NameHash.of(name, scope, hash) } import SafeLazyProxy.{ strict => mkLazy } @@ -534,7 +535,7 @@ final class ProtobufReaders(mapper: ReadMapper) { val apiHash = analyzedClass.apiHash val nameHashes = analyzedClass.nameHashes.toZincArray(fromNameHash) val hasMacro = analyzedClass.hasMacro - new AnalyzedClass(compilationTimestamp, name, api, apiHash, nameHashes, hasMacro) + AnalyzedClass.of(compilationTimestamp, name, api, apiHash, nameHashes, hasMacro) } private final val stringId = identity[String] _ diff --git a/internal/zinc-persist/src/main/scala/sbt/internal/inc/text/AnalyzedClassFormats.scala b/internal/zinc-persist/src/main/scala/sbt/internal/inc/text/AnalyzedClassFormats.scala index 3769cd4d09..b31b4cd2f9 100644 --- a/internal/zinc-persist/src/main/scala/sbt/internal/inc/text/AnalyzedClassFormats.scala +++ b/internal/zinc-persist/src/main/scala/sbt/internal/inc/text/AnalyzedClassFormats.scala @@ -26,12 +26,12 @@ object AnalyzedClassFormats { apiHash: Int, nameHashes: Array[NameHash], hasMacro: Boolean) => - new AnalyzedClass(compilationTimestamp, - name, - SafeLazyProxy(emptyCompanions), - apiHash, - nameHashes, - hasMacro) + AnalyzedClass.of(compilationTimestamp, + name, + SafeLazyProxy(emptyCompanions), + apiHash, + nameHashes, + hasMacro) } ) } diff --git a/internal/zinc-persist/src/main/scala/sbt/internal/inc/text/TextAnalysisFormat.scala b/internal/zinc-persist/src/main/scala/sbt/internal/inc/text/TextAnalysisFormat.scala index b392520b07..375baafa44 100644 --- a/internal/zinc-persist/src/main/scala/sbt/internal/inc/text/TextAnalysisFormat.scala +++ b/internal/zinc-persist/src/main/scala/sbt/internal/inc/text/TextAnalysisFormat.scala @@ -39,7 +39,7 @@ class TextAnalysisFormat(val mappers: ReadWriteMappers) private implicit val compilationF: Format[Compilation] = CompilationFormat private implicit val nameHashesFormat: Format[NameHash] = { def read(name: String, scopeName: String, hash: Int) = - new NameHash(name, UseScope.valueOf(scopeName), hash) + NameHash.of(name, UseScope.valueOf(scopeName), hash) asProduct3(read)(a => (a.name(), a.scope().name(), a.hash())) } private implicit val companionsFomrat: Format[Companions] = CompanionsFormat @@ -67,7 +67,7 @@ class TextAnalysisFormat(val mappers: ReadWriteMappers) case (a, b, c) => SourceInfos.makeInfo(a, b, c) }) private implicit def fileHashFormat: Format[FileHash] = - asProduct2((file: File, hash: Int) => new FileHash(file, hash))(h => (h.file, h.hash)) + asProduct2((file: File, hash: Int) => FileHash.of(file, hash))(h => (h.file, h.hash)) private implicit def seqFormat[T](implicit optionFormat: Format[T]): Format[Seq[T]] = viaSeq[Seq[T], T](x => x) private def t2[A1, A2](a1: A1, a2: A2): T2[A1, A2] = InterfaceUtil.t2(a1 -> a2) @@ -306,7 +306,7 @@ class TextAnalysisFormat(val mappers: ReadWriteMappers) sourceInfoToString, inlineVals = false) def read(in: BufferedReader): SourceInfos = - SourceInfos.make(readMap(in)(Headers.infos, sourcesMapper.read, stringToSourceInfo)) + SourceInfos.of(readMap(in)(Headers.infos, sourcesMapper.read, stringToSourceInfo)) } private[this] object CompilationsF { @@ -320,7 +320,7 @@ class TextAnalysisFormat(val mappers: ReadWriteMappers) def write(out: Writer, compilations: Compilations): Unit = writeSeq(out)(Headers.compilations, compilations.allCompilations, compilationToString) - def read(in: BufferedReader): Compilations = Compilations.make( + def read(in: BufferedReader): Compilations = Compilations.of( readSeq[Compilation](in)(Headers.compilations, stringToCompilation) ) } @@ -420,9 +420,9 @@ class TextAnalysisFormat(val mappers: ReadWriteMappers) case None => throw new ReadException("No output mode specified") } - val original = new MiniSetup( + val original = MiniSetup.of( output, - new MiniOptions(classpathHash.toArray, compileOptions.toArray, javacOptions.toArray), + MiniOptions.of(classpathHash.toArray, compileOptions.toArray, javacOptions.toArray), compilerVersion, xsbti.compile.CompileOrder.valueOf(compileOrder), skipApiStoring, diff --git a/internal/zinc-persist/src/test/scala/sbt/inc/AnalysisGenerators.scala b/internal/zinc-persist/src/test/scala/sbt/inc/AnalysisGenerators.scala index 36537c5a06..95184dd1ad 100644 --- a/internal/zinc-persist/src/test/scala/sbt/inc/AnalysisGenerators.scala +++ b/internal/zinc-persist/src/test/scala/sbt/inc/AnalysisGenerators.scala @@ -79,25 +79,25 @@ trait AnalysisGenerators { Stamps(zipTreeMap(prod, prodStamps), zipTreeMap(src, srcStamps), zipTreeMap(bin, binStamps)) } - private[this] val emptyStructure = new Structure(lzy(Array()), lzy(Array()), lzy(Array())) + private[this] val emptyStructure = Structure.of(lzy(Array()), lzy(Array()), lzy(Array())) // We need "proper" definitions with specific class names, as groupBy use these to pick a representative top-level class when splitting. private[this] def makeClassLike(name: String, definitionType: DefinitionType): ClassLike = - new ClassLike(name, - new Public(), - APIs.emptyModifiers, - Array(), - definitionType, - lzy(new EmptyType()), - lzy(emptyStructure), - Array(), - Array(), - true, - Array()) + ClassLike.of(name, + Public.of(), + APIs.emptyModifiers, + Array(), + definitionType, + lzy(EmptyType.of()), + lzy(emptyStructure), + Array(), + Array(), + true, + Array()) private[this] def makeCompanions(name: String): Companions = - new Companions(makeClassLike(name, DefinitionType.ClassDef), - makeClassLike(name, DefinitionType.Module)) + Companions.of(makeClassLike(name, DefinitionType.ClassDef), + makeClassLike(name, DefinitionType.Module)) private[this] def lzy[T <: AnyRef](x: T) = SafeLazyProxy.strict(x) @@ -107,7 +107,7 @@ trait AnalysisGenerators { scopes <- listOfN(defns.size, oneOf(Seq(UseScope.Default, UseScope.Implicit, UseScope.PatMatTarget))) (name, scope) <- names zip scopes - } yield new NameHash(name, scope, (name, scope).hashCode()) + } yield NameHash.of(name, scope, (name, scope).hashCode()) def genClass(name: String): Gen[AnalyzedClass] = for { @@ -116,12 +116,12 @@ trait AnalysisGenerators { hasMacro <- arbitrary[Boolean] nameHashes <- genNameHashes(Seq(name)) } yield - new AnalyzedClass(startTime, - name, - SafeLazyProxy(makeCompanions(name)), - apiHash, - nameHashes, - hasMacro) + AnalyzedClass.of(startTime, + name, + SafeLazyProxy(makeCompanions(name)), + apiHash, + nameHashes, + hasMacro) def genClasses(all_defns: Seq[String]): Gen[Seq[AnalyzedClass]] = Gen.sequence[List[AnalyzedClass], AnalyzedClass](all_defns.map(genClass)) diff --git a/internal/zinc-persist/src/test/scala/sbt/inc/binary/BinaryAnalysisFormatSpecification.scala b/internal/zinc-persist/src/test/scala/sbt/inc/binary/BinaryAnalysisFormatSpecification.scala index 21b5e8632c..e0f4766f27 100644 --- a/internal/zinc-persist/src/test/scala/sbt/inc/binary/BinaryAnalysisFormatSpecification.scala +++ b/internal/zinc-persist/src/test/scala/sbt/inc/binary/BinaryAnalysisFormatSpecification.scala @@ -34,7 +34,7 @@ object BinaryAnalysisFormatSpecification NonLocalProduct("A$", "A$", f("A$.class"), stamp) :: Nil val binDeps = (f("x.jar"), "x", stamp) :: Nil val memberDep = DependencyContext.DependencyByMemberRef - val extDeps = new ExternalDependency("A", "C", cClass, memberDep) :: Nil + val extDeps = ExternalDependency.of("A", "C", cClass, memberDep) :: Nil Analysis.empty.addSource(aScala, apis, stamp, infos, products, Nil, Nil, extDeps, binDeps) } @@ -57,11 +57,11 @@ trait BinaryAnalysisFormatSpecification { self: Properties => private final val ScalaVersion = "2.10.4" val commonSetup: MiniSetup = { val output = dummyOutput - val options = new MiniOptions(Array(), Array(), Array()) + val options = MiniOptions.of(Array(), Array(), Array()) val order = xsbti.compile.CompileOrder.Mixed val shouldStoreApis = storeApis val extra = Array(t2("key" -> "value")) - new MiniSetup(output, options, ScalaVersion, order, shouldStoreApis, extra) + MiniSetup.of(output, options, ScalaVersion, order, shouldStoreApis, extra) } private final val ReadFeedback = "The analysis file cannot be read." diff --git a/internal/zinc-persist/src/test/scala/sbt/inc/text/TextAnalysisFormatSpecification.scala b/internal/zinc-persist/src/test/scala/sbt/inc/text/TextAnalysisFormatSpecification.scala index 589051dc81..de5fe13911 100644 --- a/internal/zinc-persist/src/test/scala/sbt/inc/text/TextAnalysisFormatSpecification.scala +++ b/internal/zinc-persist/src/test/scala/sbt/inc/text/TextAnalysisFormatSpecification.scala @@ -44,12 +44,12 @@ trait BaseTextAnalysisFormatTest { self: Properties => def getOutputDirectory: java.io.File = new java.io.File(RootFilePath) } - val commonSetup = new MiniSetup(dummyOutput, - new MiniOptions(Array(), Array(), Array()), - "2.10.4", - xsbti.compile.CompileOrder.Mixed, - storeApis, - Array(t2(("key", "value")))) + val commonSetup = MiniSetup.of(dummyOutput, + MiniOptions.of(Array(), Array(), Array()), + "2.10.4", + xsbti.compile.CompileOrder.Mixed, + storeApis, + Array(t2(("key", "value")))) val companionStore = new CompanionsStore { def getUncaught(): (Map[String, Companions], Map[String, Companions]) = (Map(), Map()) def get(): Option[(Map[String, Companions], Map[String, Companions])] = Some(getUncaught()) @@ -90,10 +90,10 @@ trait BaseTextAnalysisFormatTest { self: Properties => val products = NonLocalProduct("A", "A", f("A.class"), absent) :: NonLocalProduct("A$", "A$", f("A$.class"), absent) :: Nil val binaryDeps = (f("x.jar"), "x", absent) :: Nil - val externalDeps = new ExternalDependency("A", - "C", - cClass, - DependencyContext.DependencyByMemberRef) :: Nil + val externalDeps = ExternalDependency.of("A", + "C", + cClass, + DependencyContext.DependencyByMemberRef) :: Nil analysis = analysis.addSource(aScala, Seq(aClass), absent, diff --git a/internal/zinc-scripted/src/main/contraband-scala/sbt/internal/inctest/Build.scala b/internal/zinc-scripted/src/main/contraband-scala/sbt/internal/inctest/Build.scala index 7513e854d1..769fccb15d 100644 --- a/internal/zinc-scripted/src/main/contraband-scala/sbt/internal/inctest/Build.scala +++ b/internal/zinc-scripted/src/main/contraband-scala/sbt/internal/inctest/Build.scala @@ -14,7 +14,7 @@ final class Build private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (17 + "Build".##) + projects.##) + 37 * (37 * (17 + "sbt.internal.inctest.Build".##) + projects.##) } override def toString: String = { "Build(" + projects + ")" diff --git a/internal/zinc-scripted/src/main/contraband-scala/sbt/internal/inctest/Project.scala b/internal/zinc-scripted/src/main/contraband-scala/sbt/internal/inctest/Project.scala index 2678426a73..c3cd1bd538 100644 --- a/internal/zinc-scripted/src/main/contraband-scala/sbt/internal/inctest/Project.scala +++ b/internal/zinc-scripted/src/main/contraband-scala/sbt/internal/inctest/Project.scala @@ -17,7 +17,7 @@ final class Project private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (37 * (37 * (17 + "Project".##) + name.##) + dependsOn.##) + in.##) + scalaVersion.##) + 37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.inctest.Project".##) + name.##) + dependsOn.##) + in.##) + scalaVersion.##) } override def toString: String = { "Project(" + name + ", " + dependsOn + ", " + in + ", " + scalaVersion + ")" diff --git a/internal/zinc-scripted/src/test/scala/sbt/internal/inc/IncHandler.scala b/internal/zinc-scripted/src/test/scala/sbt/internal/inc/IncHandler.scala index 2fdc522fe6..9f763922e6 100644 --- a/internal/zinc-scripted/src/test/scala/sbt/internal/inc/IncHandler.scala +++ b/internal/zinc-scripted/src/test/scala/sbt/internal/inc/IncHandler.scala @@ -221,7 +221,7 @@ case class ProjectStructure( val fileStore = AnalysisStore.cached(FileAnalysisStore.binary(cacheFile)) def prev = fileStore.get.toOption match { case Some(contents) => - new PreviousResult(Optional.of(contents.getAnalysis), Optional.of(contents.getMiniSetup)) + PreviousResult.of(Optional.of(contents.getAnalysis), Optional.of(contents.getMiniSetup)) case _ => compiler.emptyPreviousResult } def unmanagedJars: List[File] = (baseDirectory / "lib" ** "*.jar").get.toList @@ -343,8 +343,8 @@ case class ProjectStructure( val lookup = new PerClasspathEntryLookupImpl(lookupAnalysis, Locate.definesClass) val transactional: Optional[xsbti.compile.ClassFileManagerType] = Optional.of( - new xsbti.compile.TransactionalManagerType(targetDir / "classes.bak", - sbt.util.Logger.Null)) + xsbti.compile.TransactionalManagerType + .of(targetDir / "classes.bak", sbt.util.Logger.Null)) // We specify the class file manager explicitly even though it's noew possible // to specify it in the incremental option property file (this is the default for sbt) val incOptionsFile = baseDirectory / "incOptions.properties" @@ -456,7 +456,7 @@ case class ProjectStructure( Option(map.get("scalac.options")).map(_.toString.split(" +")).getOrElse(Array.empty) (IncOptionsUtil.fromStringMap(map, scriptedLog), scalacOptions) - } else (IncOptionsUtil.defaultIncOptions, Array.empty) + } else (IncOptions.of(), Array.empty) } def getProblems(): Seq[Problem] = diff --git a/internal/zinc-testing/src/main/scala/sbt/internal/inc/BaseIvySpecification.scala b/internal/zinc-testing/src/main/scala/sbt/internal/inc/BaseIvySpecification.scala index 4e2aee59c7..cffd7dd1af 100644 --- a/internal/zinc-testing/src/main/scala/sbt/internal/inc/BaseIvySpecification.scala +++ b/internal/zinc-testing/src/main/scala/sbt/internal/inc/BaseIvySpecification.scala @@ -16,9 +16,10 @@ import java.io.File import sbt.internal.librarymanagement._ import sbt.internal.librarymanagement.cross.CrossVersionUtil import sbt.librarymanagement._ +import sbt.librarymanagement.ivy._ import Configurations._ -import scalajson.ast.unsafe.JValue +import sjsonnew.shaded.scalajson.ast.unsafe.JValue trait BaseIvySpecification extends UnitSpec { def currentBase: File = new File(".") @@ -34,8 +35,8 @@ trait BaseIvySpecification extends UnitSpec { scalaFullVersion: Option[String], uo: UpdateOptions = UpdateOptions(), overrideScalaVersion: Boolean = true): IvySbt#Module = { - val ivyScala = scalaFullVersion map { fv => - IvyScala( + val scalaModuleInfo = scalaFullVersion map { fv => + ScalaModuleInfo( scalaFullVersion = fv, scalaBinaryVersion = CrossVersionUtil.binaryScalaVersion(fv), configurations = Vector.empty, @@ -45,57 +46,43 @@ trait BaseIvySpecification extends UnitSpec { ) } - val moduleSetting: ModuleSettings = InlineConfiguration( - validate = false, - ivyScala = ivyScala, - module = moduleId, - moduleInfo = ModuleInfo("foo"), - dependencies = deps - ).withConfigurations(configurations) + val moduleSetting: ModuleSettings = ModuleDescriptorConfiguration(moduleId, ModuleInfo("foo")) + .withDependencies(deps) + .withConfigurations(configurations) + .withScalaModuleInfo(scalaModuleInfo) val ivySbt = new IvySbt(mkIvyConfiguration(uo)) new ivySbt.Module(moduleSetting) } - def resolvers: Vector[Resolver] = Vector(DefaultMavenRepository) + def resolvers: Vector[Resolver] = Vector(Resolver.mavenCentral) def chainResolver = ChainedResolver("sbt-chain", resolvers) - def mkIvyConfiguration(uo: UpdateOptions): IvyConfiguration = - new InlineIvyConfiguration( - paths = IvyPaths(currentBase, Some(currentTarget)), - resolvers = resolvers, - otherResolvers = Vector.empty, - moduleConfigurations = Vector(ModuleConfiguration("*", chainResolver)), - lock = None, - checksums = Vector.empty, - managedChecksums = false, - resolutionCacheDir = Some(currentTarget / "resolution-cache"), - updateOptions = uo, - log = log - ) + def mkIvyConfiguration(uo: UpdateOptions): IvyConfiguration = { + val moduleConfs = Vector(ModuleConfiguration("*", chainResolver)) + val resCacheDir = currentTarget / "resolution-cache" + InlineIvyConfiguration() + .withPaths(IvyPaths(currentTarget, Some(currentTarget))) + .withResolvers(resolvers) + .withModuleConfigurations(moduleConfs) + .withChecksums(Vector.empty) + .withResolutionCacheDir(resCacheDir) + .withLog(log) + .withUpdateOptions(uo) + } def makeUpdateConfiguration: UpdateConfiguration = { val retrieveConfig = - RetrieveConfiguration(currentManaged, Resolver.defaultRetrievePattern, false, None) - UpdateConfiguration( - retrieve = Some(retrieveConfig), - missingOk = false, - logging = UpdateLogging.Full, - artifactFilter = ArtifactTypeFilter.forbid(Set("src", "doc")), - offline = false, - frozen = false - ) + RetrieveConfiguration(currentManaged, Resolver.defaultRetrievePattern, false, Vector.empty) + UpdateConfiguration() + .withRetrieveManaged(retrieveConfig) + .withLogging(UpdateLogging.Full) } def ivyUpdateEither(module: IvySbt#Module): Either[UnresolvedWarning, UpdateReport] = { // IO.delete(currentTarget) val config = makeUpdateConfiguration - IvyActions.updateEither(module, - config, - UnresolvedWarningConfiguration(), - LogicalClock.unknown, - Some(currentDependency), - log) + IvyActions.updateEither(module, config, UnresolvedWarningConfiguration(), log) } def cleanIvyCache(): Unit = IO.delete(currentTarget / "cache") @@ -112,14 +99,12 @@ trait BaseIvySpecification extends UnitSpec { def mkPublishConfiguration(resolver: Resolver, artifacts: Map[Artifact, File]): PublishConfiguration = { - new PublishConfiguration( - ivyFile = None, - resolverName = resolver.name, - artifacts = artifacts, - checksums = Vector.empty, - logging = UpdateLogging.Full, - overwrite = true - ) + PublishConfiguration() + .withResolverName(resolver.name) + .withArtifacts(artifacts.toVector) + .withChecksums(Vector.empty) + .withLogging(UpdateLogging.Full) + .withOverwrite(true) } def ivyPublish(module: IvySbt#Module, config: PublishConfiguration) = { diff --git a/internal/zinc-testing/src/main/scala/sjsonnew/support/scalajson/unsafe/FixedParser.scala b/internal/zinc-testing/src/main/scala/sjsonnew/support/scalajson/unsafe/FixedParser.scala index 037233c5e4..36de4e8871 100644 --- a/internal/zinc-testing/src/main/scala/sjsonnew/support/scalajson/unsafe/FixedParser.scala +++ b/internal/zinc-testing/src/main/scala/sjsonnew/support/scalajson/unsafe/FixedParser.scala @@ -8,7 +8,7 @@ package sjsonnew package support.scalajson.unsafe -import scalajson.ast.unsafe._ +import sjsonnew.shaded.scalajson.ast.unsafe._ import scala.collection.mutable import jawn.{ SupportParser, MutableFacade } diff --git a/project/Dependencies.scala b/project/Dependencies.scala index cf82253956..6d5f8e3e55 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -6,9 +6,9 @@ object Dependencies { val scala211 = "2.11.11" val scala212 = "2.12.2" - private val ioVersion = "1.0.0-M12" - private val utilVersion = "1.0.0-M26" - private val lmVersion = "1.0.0-X17" + private val ioVersion = "1.0.0-M13" + private val utilVersion = "1.0.0-M27" + private val lmVersion = "1.0.0-X18" private val sbtIO = "org.scala-sbt" %% "io" % ioVersion @@ -20,7 +20,8 @@ object Dependencies { private val utilInterface = "org.scala-sbt" % "util-interface" % utilVersion private val utilScripted = "org.scala-sbt" %% "util-scripted" % utilVersion - private val libraryManagement = "org.scala-sbt" %% "librarymanagement" % lmVersion + private val libraryManagementCore = "org.scala-sbt" %% "librarymanagement-core" % lmVersion + private val libraryManagementIvy = "org.scala-sbt" %% "librarymanagement-ivy" % lmVersion val launcherInterface = "org.scala-sbt" % "launcher-interface" % "1.0.0" @@ -48,7 +49,7 @@ object Dependencies { lazy val sbtIoPath = getSbtModulePath("sbtio.path", "sbt/io") lazy val sbtUtilPath = getSbtModulePath("sbtutil.path", "sbt/util") - lazy val sbtLmPath = getSbtModulePath("sbtlm.path", "sbt/lm") + lazy val sbtLmPath = getSbtModulePath("sbtlm.path", "sbt/librarymanagement") def addSbtIO(p: Project): Project = addSbtModule(p, sbtIoPath, "io", sbtIO) @@ -67,7 +68,9 @@ object Dependencies { def addSbtUtilTracking(p: Project): Project = addSbtModule(p, sbtUtilPath, "utilTracking", utilTracking) - def addSbtLm(p: Project): Project = addSbtModule(p, sbtLmPath, "lm", libraryManagement) + def addSbtLmCore(p: Project): Project = addSbtModule(p, sbtLmPath, "lmCore", libraryManagementCore) + def addSbtLmIvy(p: Project): Project = addSbtModule(p, sbtLmPath, "lmIvy", libraryManagementIvy) + def addSbtLmIvyTest(p: Project): Project = addSbtModule(p, sbtLmPath, "lmIvy", libraryManagementIvy, Some(Test)) val scalaLibrary = Def.setting { "org.scala-lang" % "scala-library" % scalaVersion.value } val scalaCompiler = Def.setting { "org.scala-lang" % "scala-compiler" % scalaVersion.value } diff --git a/project/plugins.sbt b/project/plugins.sbt index 954565882a..d21fa50209 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -4,7 +4,7 @@ addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0-M1") addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.3") // addSbtPlugin("de.heikoseeberger" % "sbt-header" % "1.7.0") addSbtPlugin("org.scala-sbt" % "sbt-houserules" % "0.3.3") -addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.3.0-M7") +addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.3.0-M9") resolvers += Resolver.bintrayIvyRepo("scalacenter", "sbt-releases") addSbtPlugin( diff --git a/zinc-compile/src/test/scala/sjsonnew/support/scalajson/unsafe/FixedParser.scala b/zinc-compile/src/test/scala/sjsonnew/support/scalajson/unsafe/FixedParser.scala index 0568bda16d..ec55b454ab 100644 --- a/zinc-compile/src/test/scala/sjsonnew/support/scalajson/unsafe/FixedParser.scala +++ b/zinc-compile/src/test/scala/sjsonnew/support/scalajson/unsafe/FixedParser.scala @@ -1,7 +1,7 @@ package sjsonnew package support.scalajson.unsafe -import scalajson.ast.unsafe._ +import sjsonnew.shaded.scalajson.ast.unsafe._ import scala.collection.mutable import jawn.{ SupportParser, MutableFacade } diff --git a/zinc/src/main/java/xsbti/compile/ZincCompilerUtil.java b/zinc/src/main/java/xsbti/compile/ZincCompilerUtil.java index 21ba7f4867..a42fc54862 100644 --- a/zinc/src/main/java/xsbti/compile/ZincCompilerUtil.java +++ b/zinc/src/main/java/xsbti/compile/ZincCompilerUtil.java @@ -7,10 +7,11 @@ package xsbti.compile; -import java.io.File; -import xsbti.F0; import xsbti.Logger; +import java.io.File; +import java.util.function.Supplier; + /** * Defines a util interface to get Scala compilers and the default implementation * of the Scala incremental compiler if only {@link IncrementalCompiler} is required. @@ -68,9 +69,9 @@ public static CompilerBridgeProvider constantBridgeProvider(ScalaInstance scalaI return new CompilerBridgeProvider() { @Override public File fetchCompiledBridge(ScalaInstance scalaInstance, Logger logger) { - logger.debug(new F0() { + logger.debug(new Supplier() { @Override - public String apply() { + public String get() { String bridgeName = compilerBridgeJar.getAbsolutePath(); return "Returning already retrieved and compiled bridge: " + bridgeName + "."; } @@ -80,9 +81,9 @@ public String apply() { @Override public ScalaInstance fetchScalaInstance(String scalaVersion, Logger logger) { - logger.debug(new F0() { + logger.debug(new Supplier() { @Override - public String apply() { + public String get() { String instance = scalaInstance.toString(); return "Returning default scala instance:\n\t" + instance; } diff --git a/zinc/src/main/scala/sbt/internal/inc/IncrementalCompilerImpl.scala b/zinc/src/main/scala/sbt/internal/inc/IncrementalCompilerImpl.scala index 2fc6d4b45e..e780f70cf2 100644 --- a/zinc/src/main/scala/sbt/internal/inc/IncrementalCompilerImpl.scala +++ b/zinc/src/main/scala/sbt/internal/inc/IncrementalCompilerImpl.scala @@ -11,6 +11,7 @@ package inc import java.io.File import java.util.Optional +import java.util.function.{ Function => JavaFunction } import sbt.internal.inc.JavaInterfaceUtil._ import sbt.util.InterfaceUtil @@ -177,7 +178,7 @@ class IncrementalCompilerImpl extends IncrementalCompiler { |${e.getMessage} |${ex.getStackTrace.mkString("\n")} """ - logger.error(InterfaceUtil.f0(msg.stripMargin)) + logger.error(InterfaceUtil.toSupplier(msg.stripMargin)) throw ex } } @@ -257,7 +258,7 @@ class IncrementalCompilerImpl extends IncrementalCompiler { incrementalOptions, extra ) - if (skip) new CompileResult(prev, config.currentSetup, false) + if (skip) CompileResult.of(prev, config.currentSetup, false) else { val (analysis, changed) = compileInternal( MixedAnalyzingCompiler(config)(logger), @@ -265,7 +266,7 @@ class IncrementalCompilerImpl extends IncrementalCompiler { MiniSetupUtil.equivPairs, logger ) - new CompileResult(analysis, config.currentSetup, changed) + CompileResult.of(analysis, config.currentSetup, changed) } } } @@ -321,7 +322,7 @@ class IncrementalCompilerImpl extends IncrementalCompiler { extra: Array[T2[String, String]] ): Setup = { val progress = optionProgress.toOptional - new Setup(lookup, skip, cacheFile, cache, incOptions, reporter, progress, extra) + Setup.of(lookup, skip, cacheFile, cache, incOptions, reporter, progress, extra) } def inputs( @@ -330,7 +331,7 @@ class IncrementalCompilerImpl extends IncrementalCompiler { setup: Setup, pr: PreviousResult ): Inputs = { - new Inputs(compilers, options, setup, pr) + Inputs.of(compilers, options, setup, pr) } def inputs( @@ -340,14 +341,14 @@ class IncrementalCompilerImpl extends IncrementalCompiler { scalacOptions: Array[String], javacOptions: Array[String], maxErrors: Int, - sourcePositionMappers: Array[F1[Position, Optional[Position]]], + sourcePositionMappers: Array[JavaFunction[Position, Optional[Position]]], order: CompileOrder, compilers: Compilers, setup: Setup, pr: PreviousResult ): Inputs = { val compileOptions = { - new CompileOptions( + CompileOptions.of( classpath, sources, classesDirectory, @@ -362,14 +363,14 @@ class IncrementalCompilerImpl extends IncrementalCompiler { } def previousResult(result: CompileResult): PreviousResult = { - new PreviousResult( + PreviousResult.of( Optional.of[CompileAnalysis](result.analysis), Optional.of[MiniSetup](result.setup) ) } def emptyPreviousResult: PreviousResult = { - new PreviousResult( + PreviousResult.of( Optional.empty[CompileAnalysis], Optional.empty[MiniSetup] ) @@ -390,9 +391,9 @@ class IncrementalCompilerImpl extends IncrementalCompiler { /* * Define helpers to convert from sbt Java interface to the Scala one * */ /* *********************************************************************** */ - private[sbt] def foldMappers[A](mappers: Array[F1[A, Optional[A]]]) = { - mappers.foldRight(InterfaceUtil.f1[A, A](identity)) { (mapper, mappers) => - InterfaceUtil.f1[A, A]({ p: A => + private[sbt] def foldMappers[A](mappers: Array[JavaFunction[A, Optional[A]]]) = { + mappers.foldRight(InterfaceUtil.toJavaFunction[A, A](identity)) { (mapper, mappers) => + InterfaceUtil.toJavaFunction[A, A]({ p: A => mapper(p).toOption.getOrElse(mappers(p)) }) } diff --git a/zinc/src/main/scala/sbt/internal/inc/LookupImpl.scala b/zinc/src/main/scala/sbt/internal/inc/LookupImpl.scala index a4370c3fa9..11efed82b9 100644 --- a/zinc/src/main/scala/sbt/internal/inc/LookupImpl.scala +++ b/zinc/src/main/scala/sbt/internal/inc/LookupImpl.scala @@ -9,7 +9,6 @@ package sbt.internal.inc import java.io.File -import sbt.util.Logger._ import xsbti.compile.{ Changes, CompileAnalysis, FileHash, MiniSetup } class LookupImpl(compileConfiguration: CompileConfiguration, previousSetup: Option[MiniSetup]) diff --git a/zinc/src/main/scala/sbt/internal/inc/MixedAnalyzingCompiler.scala b/zinc/src/main/scala/sbt/internal/inc/MixedAnalyzingCompiler.scala index fbbb5372b8..df0952f9c5 100644 --- a/zinc/src/main/scala/sbt/internal/inc/MixedAnalyzingCompiler.scala +++ b/zinc/src/main/scala/sbt/internal/inc/MixedAnalyzingCompiler.scala @@ -88,7 +88,7 @@ final class MixedAnalyzingCompiler( if (javaSrcs.nonEmpty) { timed("Java compilation + analysis", log) { val incToolOptions = - new IncToolOptions( + IncToolOptions.of( Optional.of(classfileManager), incOptions.useCustomizedFileManager() ) @@ -182,11 +182,11 @@ object MixedAnalyzingCompiler { extra: List[(String, String)] ): CompileConfiguration = { val classpathHash = classpath map { x => - new FileHash(x, Stamper.forHash(x).hashCode) + FileHash.of(x, Stamper.forHash(x).hashCode) } - val compileSetup = new MiniSetup( + val compileSetup = MiniSetup.of( output, - new MiniOptions( + MiniOptions.of( classpathHash.toArray, options.toArray, javacOptions.toArray @@ -322,10 +322,10 @@ object MixedAnalyzingCompiler { } /** - * Create a an analysis store cache at the desired location. - * - * Note: This method will be deprecated after Zinc 1.1. - */ + * Create a an analysis store cache at the desired location. + * + * Note: This method will be deprecated after Zinc 1.1. + */ def staticCachedStore(analysisFile: File, useTextAnalysis: Boolean): AnalysisStore = { import xsbti.compile.AnalysisStore val fileStore = diff --git a/zinc/src/main/scala/sbt/internal/inc/ZincUtil.scala b/zinc/src/main/scala/sbt/internal/inc/ZincUtil.scala index 9b54d773c5..3af3271e60 100644 --- a/zinc/src/main/scala/sbt/internal/inc/ZincUtil.scala +++ b/zinc/src/main/scala/sbt/internal/inc/ZincUtil.scala @@ -10,8 +10,7 @@ package sbt.internal.inc import java.io.File import java.net.URLClassLoader -import sbt.librarymanagement.ModuleID -import sbt.internal.librarymanagement.IvyConfiguration +import sbt.librarymanagement.{ DependencyResolution, ModuleID } import sbt.internal.inc.javac.JavaTools import sbt.internal.inc.classpath.ClassLoaderCache import xsbti.compile.{ JavaTools => XJavaTools, _ } @@ -89,7 +88,7 @@ object ZincUtil { globalLock: xsbti.GlobalLock, componentProvider: xsbti.ComponentProvider, secondaryCacheDir: Option[File], - ivyConfiguration: IvyConfiguration, + depencencyResolution: DependencyResolution, compilerBridgeSource: ModuleID, scalaJarsTarget: File, log: xsbti.Logger @@ -99,7 +98,7 @@ object ZincUtil { val bridgeProvider = ZincComponentCompiler.interfaceProvider(compilerBridgeSource, componentManager, - ivyConfiguration, + depencencyResolution, scalaJarsTarget) val emptyHandler = (_: Seq[String]) => () val loader = Some(new ClassLoaderCache(new URLClassLoader(Array()))) @@ -124,7 +123,7 @@ object ZincUtil { compilers(JavaTools.directOrFork(instance, classpathOptions, javaHome), scalac) def compilers(javaTools: XJavaTools, scalac: ScalaCompiler): Compilers = { - new Compilers(scalac, javaTools) + Compilers.of(scalac, javaTools) } def constantBridgeProvider(scalaInstance: xsbti.compile.ScalaInstance, diff --git a/zinc/src/main/scala/sbt/internal/inc/javac/AnalyzingJavaCompiler.scala b/zinc/src/main/scala/sbt/internal/inc/javac/AnalyzingJavaCompiler.scala index 39dadb912e..ef999e9030 100644 --- a/zinc/src/main/scala/sbt/internal/inc/javac/AnalyzingJavaCompiler.scala +++ b/zinc/src/main/scala/sbt/internal/inc/javac/AnalyzingJavaCompiler.scala @@ -18,6 +18,7 @@ import xsbti.compile._ import xsbti.{ AnalysisCallback, Reporter => XReporter, Logger => XLogger } import sbt.io.PathFinder +import sbt.util.InterfaceUtil import sbt.util.Logger /** @@ -97,7 +98,7 @@ final class AnalyzingJavaCompiler private[sbt] ( // Report warnings about source files that have no output directory chunks.get(None) foreach { srcs => val culpritPaths = srcs.map(_.getAbsolutePath).mkString(", ") - log.error(Logger.f0(s"No output directory mapped for: $culpritPaths")) + log.error(InterfaceUtil.toSupplier(s"No output directory mapped for: $culpritPaths")) } // Memoize the known class files in the Javac output directory diff --git a/zinc/src/test/scala/sbt/inc/BaseCompilerSpec.scala b/zinc/src/test/scala/sbt/inc/BaseCompilerSpec.scala index 80c94dbdfd..3d2a5889ac 100644 --- a/zinc/src/test/scala/sbt/inc/BaseCompilerSpec.scala +++ b/zinc/src/test/scala/sbt/inc/BaseCompilerSpec.scala @@ -99,7 +99,7 @@ class BaseCompilerSpec extends BridgeProviderSpecification { tempDir: File, sources: Array[File], classpath: Seq[File], - incOptions: IncOptions = IncOptionsUtil.defaultIncOptions() + incOptions: IncOptions = IncOptions.of() ) { val noLogger = Logger.Null val compiler = new IncrementalCompilerImpl @@ -153,8 +153,8 @@ class BaseCompilerSpec extends BridgeProviderSpecification { case Some(analysisContents) => val prevAnalysis = analysisContents.getAnalysis val prevSetup = analysisContents.getMiniSetup - new PreviousResult(Optional.of[CompileAnalysis](prevAnalysis), - Optional.of[MiniSetup](prevSetup)) + PreviousResult.of(Optional.of[CompileAnalysis](prevAnalysis), + Optional.of[MiniSetup](prevSetup)) case _ => compiler.emptyPreviousResult } diff --git a/zinc/src/test/scala/sbt/inc/MultiProjectIncrementalSpec.scala b/zinc/src/test/scala/sbt/inc/MultiProjectIncrementalSpec.scala index c1c5f11de6..0be56c2c21 100644 --- a/zinc/src/test/scala/sbt/inc/MultiProjectIncrementalSpec.scala +++ b/zinc/src/test/scala/sbt/inc/MultiProjectIncrementalSpec.scala @@ -65,10 +65,9 @@ class MultiProjectIncrementalSpec extends BridgeProviderSpecification { override def shouldDoIncrementalCompilation(changedClasses: Set[String], analysis: CompileAnalysis): Boolean = true } - val incOptions = IncOptionsUtil - .defaultIncOptions() + val incOptions = IncOptions + .of() .withApiDebug(true) - .withExternalHooks(IncOptionsUtil.defaultExternal()) val reporter = new ManagedLoggedReporter(maxErrors, log) val setup = compiler.setup(lookup, @@ -96,7 +95,7 @@ class MultiProjectIncrementalSpec extends BridgeProviderSpecification { fileStore.set(contents) val prev1 = fileStore.get.toOption match { case Some(contents) => - new PreviousResult(Optional.of(contents.getAnalysis), Optional.of(contents.getMiniSetup)) + PreviousResult.of(Optional.of(contents.getAnalysis), Optional.of(contents.getMiniSetup)) case _ => sys.error("previous is not found") } val sources1 = Array(dependerFile, depender2File) @@ -157,7 +156,7 @@ class MultiProjectIncrementalSpec extends BridgeProviderSpecification { val sources3 = Array(knownSampleGoodFile, dependerFile, depender2File) val prev = fileStore.get.toOption match { case Some(contents) => - new PreviousResult(Optional.of(contents.getAnalysis), Optional.of(contents.getMiniSetup)) + PreviousResult.of(Optional.of(contents.getAnalysis), Optional.of(contents.getMiniSetup)) case _ => sys.error("previous is not found") } val lookup3 = new PerClasspathEntryLookupImpl(