diff --git a/.scalafmt.conf b/.scalafmt.conf new file mode 100644 index 00000000000..b1d2c4db221 --- /dev/null +++ b/.scalafmt.conf @@ -0,0 +1,3 @@ +version = 3.2.1 +runner.dialect = scala213 +maxColumn = 100 diff --git a/src/python/pants/backend/java/dependency_inference/PantsJavaParserLauncher.java b/src/python/pants/backend/java/dependency_inference/PantsJavaParserLauncher.java index fc016b59207..ef895739113 100644 --- a/src/python/pants/backend/java/dependency_inference/PantsJavaParserLauncher.java +++ b/src/python/pants/backend/java/dependency_inference/PantsJavaParserLauncher.java @@ -2,7 +2,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; - import com.github.javaparser.StaticJavaParser; import com.github.javaparser.ast.CompilationUnit; import com.github.javaparser.ast.ImportDeclaration; @@ -24,122 +23,117 @@ import com.github.javaparser.ast.type.ClassOrInterfaceType; import com.github.javaparser.ast.type.Type; import com.github.javaparser.ast.type.WildcardType; - import java.io.File; -import java.util.AbstractCollection; import java.util.ArrayList; -import java.util.Collection; import java.util.HashSet; import java.util.List; import java.util.Optional; import java.util.function.Consumer; import java.util.stream.Collectors; -import java.util.stream.Stream; class Import { - Import(String name, boolean isStatic, boolean isAsterisk) { - this.name = name; - this.isStatic = isStatic; - this.isAsterisk = isAsterisk; - } - - public static Import fromImportDeclaration(ImportDeclaration imp) { - return new Import(imp.getName().toString(), imp.isStatic(), imp.isAsterisk()); - } - - public final String name; - public final boolean isStatic; - public final boolean isAsterisk; + Import(String name, boolean isStatic, boolean isAsterisk) { + this.name = name; + this.isStatic = isStatic; + this.isAsterisk = isAsterisk; + } + + public static Import fromImportDeclaration(ImportDeclaration imp) { + return new Import(imp.getName().toString(), imp.isStatic(), imp.isAsterisk()); + } + + public final String name; + public final boolean isStatic; + public final boolean isAsterisk; } class CompilationUnitAnalysis { - CompilationUnitAnalysis( - Optional declaredPackage, - ArrayList imports, - ArrayList topLevelTypes, - ArrayList consumedTypes, - ArrayList exportTypes - ) { - this.declaredPackage = declaredPackage; - this.imports = imports; - this.topLevelTypes = topLevelTypes; - this.consumedTypes = consumedTypes; - this.exportTypes = exportTypes; - } - - public final Optional declaredPackage; - public final ArrayList imports; - public final ArrayList topLevelTypes; - public final ArrayList consumedTypes; - public final ArrayList exportTypes; + CompilationUnitAnalysis( + Optional declaredPackage, + ArrayList imports, + ArrayList topLevelTypes, + ArrayList consumedTypes, + ArrayList exportTypes) { + this.declaredPackage = declaredPackage; + this.imports = imports; + this.topLevelTypes = topLevelTypes; + this.consumedTypes = consumedTypes; + this.exportTypes = exportTypes; + } + + public final Optional declaredPackage; + public final ArrayList imports; + public final ArrayList topLevelTypes; + public final ArrayList consumedTypes; + public final ArrayList exportTypes; } /** - * TODO: The dependencies of this class are defined in two places: - * 1. `3rdparty/jvm` via import inference. - * 2. `java_parser_artifact_requirements`. - * See https://github.com/pantsbuild/pants/issues/13754. + * TODO: The dependencies of this class are defined in two places: 1. `3rdparty/jvm` via import + * inference. 2. `java_parser_artifact_requirements`. See + * https://github.com/pantsbuild/pants/issues/13754. */ public class PantsJavaParserLauncher { - // Unwrap a `Type` and return the identifiers representing the "consumed" types. - private static List unwrapIdentifiersForType(Type type) { - if (type.isArrayType()) { - return unwrapIdentifiersForType(type.asArrayType().getComponentType()); - } else if (type.isWildcardType()) { - WildcardType wildcardType = type.asWildcardType(); - ArrayList result = new ArrayList<>(); - if (wildcardType.getExtendedType().isPresent()) { - result.addAll(unwrapIdentifiersForType(wildcardType.getExtendedType().get())); - } - if (wildcardType.getSuperType().isPresent()) { - result.addAll(unwrapIdentifiersForType(wildcardType.getSuperType().get())); - } - return result; - } else if (type.isClassOrInterfaceType()) { - ArrayList result = new ArrayList<>(); - ClassOrInterfaceType classType = type.asClassOrInterfaceType(); - Optional> typeArguments = classType.getTypeArguments(); - if (typeArguments.isPresent()) { - for (Type argumentType : typeArguments.get()) { - result.addAll(unwrapIdentifiersForType(argumentType)); - } - } - result.add(classType.getNameWithScope()); - return result; - } else if (type.isIntersectionType()) { - ArrayList result = new ArrayList<>(); - for (Type elementType : type.asIntersectionType().getElements()) { - result.addAll(unwrapIdentifiersForType(elementType)); - } - return result; + // Unwrap a `Type` and return the identifiers representing the "consumed" types. + private static List unwrapIdentifiersForType(Type type) { + if (type.isArrayType()) { + return unwrapIdentifiersForType(type.asArrayType().getComponentType()); + } else if (type.isWildcardType()) { + WildcardType wildcardType = type.asWildcardType(); + ArrayList result = new ArrayList<>(); + if (wildcardType.getExtendedType().isPresent()) { + result.addAll(unwrapIdentifiersForType(wildcardType.getExtendedType().get())); + } + if (wildcardType.getSuperType().isPresent()) { + result.addAll(unwrapIdentifiersForType(wildcardType.getSuperType().get())); + } + return result; + } else if (type.isClassOrInterfaceType()) { + ArrayList result = new ArrayList<>(); + ClassOrInterfaceType classType = type.asClassOrInterfaceType(); + Optional> typeArguments = classType.getTypeArguments(); + if (typeArguments.isPresent()) { + for (Type argumentType : typeArguments.get()) { + result.addAll(unwrapIdentifiersForType(argumentType)); } + } + result.add(classType.getNameWithScope()); + return result; + } else if (type.isIntersectionType()) { + ArrayList result = new ArrayList<>(); + for (Type elementType : type.asIntersectionType().getElements()) { + result.addAll(unwrapIdentifiersForType(elementType)); + } + return result; + } - // Not handled: - // - PrimitiveType - // - VarType (Java `var` keyword to be inferred by the compiler. + // Not handled: + // - PrimitiveType + // - VarType (Java `var` keyword to be inferred by the compiler. - return new ArrayList<>(); - } + return new ArrayList<>(); + } - public static void main(String[] args) throws Exception { - String analysisOutputPath = args[0]; - String sourceToAnalyze = args[1]; + public static void main(String[] args) throws Exception { + String analysisOutputPath = args[0]; + String sourceToAnalyze = args[1]; - CompilationUnit cu = StaticJavaParser.parse(new File(sourceToAnalyze)); + CompilationUnit cu = StaticJavaParser.parse(new File(sourceToAnalyze)); - // Get the source's declare package. - Optional declaredPackage = cu.getPackageDeclaration() - .map(PackageDeclaration::getName) - .map(Name::toString); + // Get the source's declare package. + Optional declaredPackage = + cu.getPackageDeclaration().map(PackageDeclaration::getName).map(Name::toString); - // Get the source's imports. - ArrayList imports = new ArrayList( + // Get the source's imports. + ArrayList imports = + new ArrayList( cu.getImports().stream() .map(Import::fromImportDeclaration) .collect(Collectors.toList())); - // Get the source's top level types - ArrayList topLevelTypes = new ArrayList( + // Get the source's top level types + ArrayList topLevelTypes = + new ArrayList( cu.getTypes().stream() .filter(TypeDeclaration::isTopLevelType) .map(TypeDeclaration::getFullyQualifiedName) @@ -149,78 +143,88 @@ public static void main(String[] args) throws Exception { .map(Optional::get) .collect(Collectors.toList())); - HashSet candidateConsumedTypes = new HashSet<>(); - HashSet candidateExportTypes = new HashSet<>(); - - Consumer consumed = (type) -> { candidateConsumedTypes.add(type); }; - Consumer export = (type) -> { candidateConsumedTypes.add(type); candidateExportTypes.add(type); }; - - HashSet consumedIdentifiers = new HashSet<>(); - HashSet exportIdentifiers = new HashSet<>(); - - cu.walk(new Consumer() { - @Override - public void accept(Node node) { - if (node instanceof NodeWithType) { - NodeWithType typedNode = (NodeWithType) node; - consumed.accept(typedNode.getType()); - } - if (node instanceof VariableDeclarator) { - VariableDeclarator varDecl = (VariableDeclarator) node; - consumed.accept(varDecl.getType()); - } - if (node instanceof MethodDeclaration) { - MethodDeclaration methodDecl = (MethodDeclaration) node; - export.accept(methodDecl.getType()); - for (Parameter param : methodDecl.getParameters()) { - export.accept(param.getType()); - } - methodDecl.getThrownExceptions().stream().forEach(consumed); - } - if (node instanceof ClassOrInterfaceDeclaration) { - ClassOrInterfaceDeclaration classOrIntfDecl = (ClassOrInterfaceDeclaration) node; - classOrIntfDecl.getExtendedTypes().stream().forEach(export); - classOrIntfDecl.getImplementedTypes().stream().forEach(export); - } - if (node instanceof AnnotationExpr) { - AnnotationExpr annoExpr = (AnnotationExpr) node; - consumedIdentifiers.add(annoExpr.getNameAsString()); - } - if (node instanceof MethodCallExpr) { - MethodCallExpr methodCallExpr = (MethodCallExpr) node; - Optional scopeExprOpt = methodCallExpr.getScope(); - if (scopeExprOpt.isPresent()) { - Expression scope = scopeExprOpt.get(); - if (scope instanceof NameExpr) { - NameExpr nameExpr = (NameExpr) scope; - consumedIdentifiers.add(nameExpr.getNameAsString()); - } - } - } - if (node instanceof FieldAccessExpr) { - FieldAccessExpr fieldAccessExpr = (FieldAccessExpr) node; - Expression scope = fieldAccessExpr.getScope(); - if (scope instanceof NameExpr) { - NameExpr nameExpr = (NameExpr) scope; - consumedIdentifiers.add(nameExpr.getNameAsString()); - } + HashSet candidateConsumedTypes = new HashSet<>(); + HashSet candidateExportTypes = new HashSet<>(); + + Consumer consumed = + (type) -> { + candidateConsumedTypes.add(type); + }; + Consumer export = + (type) -> { + candidateConsumedTypes.add(type); + candidateExportTypes.add(type); + }; + + HashSet consumedIdentifiers = new HashSet<>(); + HashSet exportIdentifiers = new HashSet<>(); + + cu.walk( + new Consumer() { + @Override + public void accept(Node node) { + if (node instanceof NodeWithType) { + NodeWithType typedNode = (NodeWithType) node; + consumed.accept(typedNode.getType()); + } + if (node instanceof VariableDeclarator) { + VariableDeclarator varDecl = (VariableDeclarator) node; + consumed.accept(varDecl.getType()); + } + if (node instanceof MethodDeclaration) { + MethodDeclaration methodDecl = (MethodDeclaration) node; + export.accept(methodDecl.getType()); + for (Parameter param : methodDecl.getParameters()) { + export.accept(param.getType()); + } + methodDecl.getThrownExceptions().stream().forEach(consumed); + } + if (node instanceof ClassOrInterfaceDeclaration) { + ClassOrInterfaceDeclaration classOrIntfDecl = (ClassOrInterfaceDeclaration) node; + classOrIntfDecl.getExtendedTypes().stream().forEach(export); + classOrIntfDecl.getImplementedTypes().stream().forEach(export); + } + if (node instanceof AnnotationExpr) { + AnnotationExpr annoExpr = (AnnotationExpr) node; + consumedIdentifiers.add(annoExpr.getNameAsString()); + } + if (node instanceof MethodCallExpr) { + MethodCallExpr methodCallExpr = (MethodCallExpr) node; + Optional scopeExprOpt = methodCallExpr.getScope(); + if (scopeExprOpt.isPresent()) { + Expression scope = scopeExprOpt.get(); + if (scope instanceof NameExpr) { + NameExpr nameExpr = (NameExpr) scope; + consumedIdentifiers.add(nameExpr.getNameAsString()); } + } } - }); - - for (Type type : candidateConsumedTypes) { - List identifiersForType = unwrapIdentifiersForType(type); - consumedIdentifiers.addAll(identifiersForType); - if (candidateExportTypes.contains(type)) { - exportIdentifiers.addAll(identifiersForType); + if (node instanceof FieldAccessExpr) { + FieldAccessExpr fieldAccessExpr = (FieldAccessExpr) node; + Expression scope = fieldAccessExpr.getScope(); + if (scope instanceof NameExpr) { + NameExpr nameExpr = (NameExpr) scope; + consumedIdentifiers.add(nameExpr.getNameAsString()); + } } - } + } + }); - ArrayList consumedTypes = new ArrayList<>(consumedIdentifiers); - ArrayList exportTypes = new ArrayList<>(exportIdentifiers); - CompilationUnitAnalysis analysis = new CompilationUnitAnalysis(declaredPackage, imports, topLevelTypes, consumedTypes, exportTypes); - ObjectMapper mapper = new ObjectMapper(); - mapper.registerModule(new Jdk8Module()); - mapper.writeValue(new File(analysisOutputPath), analysis); + for (Type type : candidateConsumedTypes) { + List identifiersForType = unwrapIdentifiersForType(type); + consumedIdentifiers.addAll(identifiersForType); + if (candidateExportTypes.contains(type)) { + exportIdentifiers.addAll(identifiersForType); + } } + + ArrayList consumedTypes = new ArrayList<>(consumedIdentifiers); + ArrayList exportTypes = new ArrayList<>(exportIdentifiers); + CompilationUnitAnalysis analysis = + new CompilationUnitAnalysis( + declaredPackage, imports, topLevelTypes, consumedTypes, exportTypes); + ObjectMapper mapper = new ObjectMapper(); + mapper.registerModule(new Jdk8Module()); + mapper.writeValue(new File(analysisOutputPath), analysis); + } } diff --git a/src/python/pants/backend/scala/dependency_inference/ScalaParser.scala b/src/python/pants/backend/scala/dependency_inference/ScalaParser.scala index f4b6a561a90..57d4669bb1b 100644 --- a/src/python/pants/backend/scala/dependency_inference/ScalaParser.scala +++ b/src/python/pants/backend/scala/dependency_inference/ScalaParser.scala @@ -1,9 +1,7 @@ -/** - * TODO: The dependencies of this class are defined in two places: - * 1. `3rdparty/jvm` via import inference. - * 2. `SCALA_PARSER_ARTIFACT_REQUIREMENTS`. - * See https://github.com/pantsbuild/pants/issues/13754. - */ +/** TODO: The dependencies of this class are defined in two places: + * 1. `3rdparty/jvm` via import inference. 2. `SCALA_PARSER_ARTIFACT_REQUIREMENTS`. See + * https://github.com/pantsbuild/pants/issues/13754. + */ package org.pantsbuild.backend.scala.dependency_inference import io.circe._ @@ -17,21 +15,21 @@ import scala.collection.mutable.{ArrayBuffer, HashMap, HashSet} import scala.reflect.NameTransformer case class AnImport( - // The partially qualified input name for the import, which must be in scope at - // the import site. - name: String, - // An optional single token alias for the import in this scope. - alias: Option[String], - // True if the import imports all symbols contained within the name. - isWildcard: Boolean, + // The partially qualified input name for the import, which must be in scope at + // the import site. + name: String, + // An optional single token alias for the import in this scope. + alias: Option[String], + // True if the import imports all symbols contained within the name. + isWildcard: Boolean ) case class Analysis( - providedSymbols: Vector[String], - providedSymbolsEncoded: Vector[String], - importsByScope: HashMap[String, ArrayBuffer[AnImport]], - consumedSymbolsByScope: HashMap[String, HashSet[String]], - scopes: Vector[String], + providedSymbols: Vector[String], + providedSymbolsEncoded: Vector[String], + importsByScope: HashMap[String, ArrayBuffer[AnImport]], + consumedSymbolsByScope: HashMap[String, HashSet[String]], + scopes: Vector[String] ) case class ProvidedSymbol(sawClass: Boolean, sawTrait: Boolean, sawObject: Boolean) @@ -48,13 +46,13 @@ class SourceAnalysisTraverser extends Traverser { // Extract a qualified name from a tree. def extractName(tree: Tree): String = { tree match { - case Term.Select(qual, name) => s"${extractName(qual)}.${extractName(name)}" - case Type.Select(qual, name) => s"${extractName(qual)}.${extractName(name)}" - case Term.Name(name) => name - case Type.Name(name) => name - case Pat.Var(node) => extractName(node) + case Term.Select(qual, name) => s"${extractName(qual)}.${extractName(name)}" + case Type.Select(qual, name) => s"${extractName(qual)}.${extractName(name)}" + case Term.Name(name) => name + case Type.Name(name) => name + case Pat.Var(node) => extractName(node) case Name.Indeterminate(name) => name - case _ => "" + case _ => "" } } @@ -65,36 +63,45 @@ class SourceAnalysisTraverser extends Traverser { val qualName = extractName(qual) Vector(s"${qualName}.${name}") } - case Type.Apply(tpe, args) => extractNamesFromTypeTree(tpe) ++ args.toVector.flatMap(extractNamesFromTypeTree(_)) - case Type.ApplyInfix(lhs, _op, rhs) => extractNamesFromTypeTree(lhs) ++ extractNamesFromTypeTree(rhs) + case Type.Apply(tpe, args) => + extractNamesFromTypeTree(tpe) ++ args.toVector.flatMap(extractNamesFromTypeTree(_)) + case Type.ApplyInfix(lhs, _op, rhs) => + extractNamesFromTypeTree(lhs) ++ extractNamesFromTypeTree(rhs) case Type.Function(params, res) => params.toVector.flatMap(extractNamesFromTypeTree(_)) ++ extractNamesFromTypeTree(res) case Type.PolyFunction(_tparams, tpe) => extractNamesFromTypeTree(tpe) case Type.ContextFunction(params, res) => params.toVector.flatMap(extractNamesFromTypeTree(_)) ++ extractNamesFromTypeTree(res) - case Type.Tuple(args) => args.toVector.flatMap(extractNamesFromTypeTree(_)) + case Type.Tuple(args) => args.toVector.flatMap(extractNamesFromTypeTree(_)) case Type.With(lhs, rhs) => extractNamesFromTypeTree(lhs) ++ extractNamesFromTypeTree(rhs) - case Type.And(lhs, rhs) => extractNamesFromTypeTree(lhs) ++ extractNamesFromTypeTree(rhs) - case Type.Or(lhs, rhs) => extractNamesFromTypeTree(lhs) ++ extractNamesFromTypeTree(rhs) + case Type.And(lhs, rhs) => extractNamesFromTypeTree(lhs) ++ extractNamesFromTypeTree(rhs) + case Type.Or(lhs, rhs) => extractNamesFromTypeTree(lhs) ++ extractNamesFromTypeTree(rhs) // TODO: Recurse into `_stats` to find additional types. // A `Type.Refine` represents syntax: A { def f: Int } - case Type.Refine(typeOpt, _stats) => typeOpt.toVector.flatMap(extractNamesFromTypeTree(_)) + case Type.Refine(typeOpt, _stats) => typeOpt.toVector.flatMap(extractNamesFromTypeTree(_)) case Type.Existential(tpe, _stats) => extractNamesFromTypeTree(tpe) - case Type.Annotate(tpe, _annots) => extractNamesFromTypeTree(tpe) - case Type.Lambda(_tparams, tpe) => extractNamesFromTypeTree(tpe) + case Type.Annotate(tpe, _annots) => extractNamesFromTypeTree(tpe) + case Type.Lambda(_tparams, tpe) => extractNamesFromTypeTree(tpe) case Type.Bounds(loOpt, hiOpt) => - loOpt.toVector.flatMap(extractNamesFromTypeTree(_)) ++ hiOpt.toVector.flatMap(extractNamesFromTypeTree(_)) - case Type.ByName(tpe) => extractNamesFromTypeTree(tpe) + loOpt.toVector.flatMap(extractNamesFromTypeTree(_)) ++ hiOpt.toVector.flatMap( + extractNamesFromTypeTree(_) + ) + case Type.ByName(tpe) => extractNamesFromTypeTree(tpe) case Type.Repeated(tpe) => extractNamesFromTypeTree(tpe) // TODO: Should we extract a type from _tpe? // `Type.Match` represents this Scala 3 syntax: type T = match { case A => B } case Type.Match(_tpe, cases) => cases.toVector.flatMap(extractNamesFromTypeTree(_)) case TypeCase(pat, body) => extractNamesFromTypeTree(pat) ++ extractNamesFromTypeTree(body) - case _ => Vector() + case _ => Vector() } } - def recordProvidedName(symbolName: String, sawClass: Boolean = false, sawTrait: Boolean = false, sawObject: Boolean = false): Unit = { + def recordProvidedName( + symbolName: String, + sawClass: Boolean = false, + sawTrait: Boolean = false, + sawObject: Boolean = false + ): Unit = { if (!skipProvidedNames) { val fullPackageName = nameParts.mkString(".") if (!providedSymbolsByScope.contains(fullPackageName)) { @@ -107,7 +114,7 @@ class SourceAnalysisTraverser extends Traverser { val newSymbol = ProvidedSymbol( sawClass = existingSymbol.sawClass || sawClass, sawTrait = existingSymbol.sawTrait || sawTrait, - sawObject = existingSymbol.sawObject || sawObject, + sawObject = existingSymbol.sawObject || sawObject ) providedSymbols(symbolName) = newSymbol } else { @@ -157,16 +164,19 @@ class SourceAnalysisTraverser extends Traverser { def visitTemplate(templ: Template, name: String): Unit = { templ.inits.foreach(init => apply(init)) - withNamePart(name, () => { - apply(templ.early) - apply(templ.stats) - }) + withNamePart( + name, + () => { + apply(templ.early) + apply(templ.stats) + } + ) } def visitMods(mods: List[Mod]): Unit = { mods.foreach({ - case Mod.Annot(init) => apply(init) // rely on `Init` extraction in main parsing match code - case _ => () + case Mod.Annot(init) => apply(init) // rely on `Init` extraction in main parsing match code + case _ => () }) } @@ -265,7 +275,7 @@ class SourceAnalysisTraverser extends Traverser { recordImport( s"${baseName}.${extractName(nameNode)}", if (alias == "_") None else Some(alias), - false, + false ) } case _ => @@ -314,25 +324,31 @@ class SourceAnalysisTraverser extends Traverser { } def gatherProvidedSymbols(): Vector[String] = { - providedSymbolsByScope.flatMap({ case (scopeName, symbolsForScope) => - symbolsForScope.keys.map(symbolName => s"${scopeName}.${symbolName}").toVector - }).toVector + providedSymbolsByScope + .flatMap({ case (scopeName, symbolsForScope) => + symbolsForScope.keys.map(symbolName => s"${scopeName}.${symbolName}").toVector + }) + .toVector } def gatherEncodedProvidedSymbols(): Vector[String] = { - providedSymbolsByScope.flatMap({ case (scopeName, symbolsForScope) => - val encodedSymbolsForScope = symbolsForScope.flatMap({ case (symbolName, symbol) => { - val encodedSymbolName = NameTransformer.encode(symbolName) - val result = ArrayBuffer[String](encodedSymbolName) - if (symbol.sawObject) { - result.append(encodedSymbolName + "$") - result.append(encodedSymbolName + "$.MODULE$") - } - result.toVector - }}) - - encodedSymbolsForScope.map(symbolName => s"${scopeName}.${symbolName}") - }).toVector + providedSymbolsByScope + .flatMap({ case (scopeName, symbolsForScope) => + val encodedSymbolsForScope = symbolsForScope.flatMap({ + case (symbolName, symbol) => { + val encodedSymbolName = NameTransformer.encode(symbolName) + val result = ArrayBuffer[String](encodedSymbolName) + if (symbol.sawObject) { + result.append(encodedSymbolName + "$") + result.append(encodedSymbolName + "$.MODULE$") + } + result.toVector + } + }) + + encodedSymbolsForScope.map(symbolName => s"${scopeName}.${symbolName}") + }) + .toVector } def toAnalysis: Analysis = { @@ -341,7 +357,7 @@ class SourceAnalysisTraverser extends Traverser { providedSymbolsEncoded = gatherEncodedProvidedSymbols(), importsByScope = importsByScope, consumedSymbolsByScope = consumedSymbolsByScope, - scopes = scopes.toVector, + scopes = scopes.toVector ) } } @@ -365,7 +381,11 @@ object ScalaParser { val analysis = analyze(args(1)) val json = analysis.asJson.noSpaces - java.nio.file.Files.write(outputPath, json.getBytes(), - java.nio.file.StandardOpenOption.CREATE_NEW, java.nio.file.StandardOpenOption.WRITE) + java.nio.file.Files.write( + outputPath, + json.getBytes(), + java.nio.file.StandardOpenOption.CREATE_NEW, + java.nio.file.StandardOpenOption.WRITE + ) } } diff --git a/testprojects/src/jvm/org/pantsbuild/example/app/ExampleApp.scala b/testprojects/src/jvm/org/pantsbuild/example/app/ExampleApp.scala index fd60360b000..6a9842d1af0 100644 --- a/testprojects/src/jvm/org/pantsbuild/example/app/ExampleApp.scala +++ b/testprojects/src/jvm/org/pantsbuild/example/app/ExampleApp.scala @@ -3,7 +3,7 @@ package org.pantsbuild.example.app; import org.pantsbuild.example.lib.ExampleLib class ExampleApp { - def main(args: Array[String]): Unit = { - println(ExampleLib.hello()) - } + def main(args: Array[String]): Unit = { + println(ExampleLib.hello()) + } } diff --git a/testprojects/src/jvm/org/pantsbuild/example/lib/ExampleLib.java b/testprojects/src/jvm/org/pantsbuild/example/lib/ExampleLib.java index d651519516b..7924df3602f 100644 --- a/testprojects/src/jvm/org/pantsbuild/example/lib/ExampleLib.java +++ b/testprojects/src/jvm/org/pantsbuild/example/lib/ExampleLib.java @@ -1,7 +1,7 @@ package org.pantsbuild.example.lib; public class ExampleLib { - public static String hello() { - return "Hello, World!"; - } + public static String hello() { + return "Hello, World!"; + } }