From bb2e5a29c64b06cebd4146f5cdfe9537ae81885f Mon Sep 17 00:00:00 2001 From: Ilpo Ruotsalainen Date: Fri, 30 Nov 2018 15:22:48 +0100 Subject: Reformat file, no semantic changes. --- .../java/com/yahoo/abicheck/mojo/AbiCheck.java | 68 +++++++++++----------- 1 file changed, 34 insertions(+), 34 deletions(-) (limited to 'abi-check-plugin/src/main/java/com/yahoo') diff --git a/abi-check-plugin/src/main/java/com/yahoo/abicheck/mojo/AbiCheck.java b/abi-check-plugin/src/main/java/com/yahoo/abicheck/mojo/AbiCheck.java index 1017dec5941..67f5715da24 100644 --- a/abi-check-plugin/src/main/java/com/yahoo/abicheck/mojo/AbiCheck.java +++ b/abi-check-plugin/src/main/java/com/yahoo/abicheck/mojo/AbiCheck.java @@ -50,40 +50,6 @@ public class AbiCheck extends AbstractMojo { @Parameter private String specFileName = DEFAULT_SPEC_FILE; - @Override - public void execute() throws MojoExecutionException, MojoFailureException { - Artifact mainArtifact = project.getArtifact(); - if (mainArtifact.getFile() == null) { - throw new MojoExecutionException("Missing project artifact file"); - } else if (!mainArtifact.getType().equals("jar")) { - throw new MojoExecutionException("Project artifact is not a JAR"); - } - - getLog().debug("Analyzing " + mainArtifact.getFile()); - - try (JarFile jarFile = new JarFile(mainArtifact.getFile())) { - ClassFileTree tree = ClassFileTree.fromJar(jarFile); - Map signatures = new LinkedHashMap<>(); - for (ClassFileTree.Package pkg : tree.getRootPackages()) { - signatures.putAll(collectPublicAbiSignatures(pkg, publicApiAnnotation)); - } - if (System.getProperty(WRITE_SPEC_PROPERTY) != null) { - getLog().info("Writing ABI specs to " + specFileName); - writeSpec(signatures, specFileName); - } else { - Map abiSpec = readSpec(specFileName); - if (!SetMatcher.compare(abiSpec.keySet(), signatures.keySet(), - item -> matchingClasses(item, abiSpec.get(item), signatures.get(item), getLog()), - item -> getLog().error(String.format("Missing class: %s", item)), - item -> getLog().error(String.format("Extra class: %s", item)))) { - throw new MojoFailureException("ABI spec mismatch"); - } - } - } catch (IOException e) { - throw new MojoExecutionException("Error processing class signatures", e); - } - } - private static Map readSpec(String fileName) throws IOException { try (FileReader reader = new FileReader(fileName)) { TypeToken> typeToken = @@ -171,4 +137,38 @@ public class AbiCheck extends AbstractMojo { } return signatures; } + + @Override + public void execute() throws MojoExecutionException, MojoFailureException { + Artifact mainArtifact = project.getArtifact(); + if (mainArtifact.getFile() == null) { + throw new MojoExecutionException("Missing project artifact file"); + } else if (!mainArtifact.getType().equals("jar")) { + throw new MojoExecutionException("Project artifact is not a JAR"); + } + + getLog().debug("Analyzing " + mainArtifact.getFile()); + + try (JarFile jarFile = new JarFile(mainArtifact.getFile())) { + ClassFileTree tree = ClassFileTree.fromJar(jarFile); + Map signatures = new LinkedHashMap<>(); + for (ClassFileTree.Package pkg : tree.getRootPackages()) { + signatures.putAll(collectPublicAbiSignatures(pkg, publicApiAnnotation)); + } + if (System.getProperty(WRITE_SPEC_PROPERTY) != null) { + getLog().info("Writing ABI specs to " + specFileName); + writeSpec(signatures, specFileName); + } else { + Map abiSpec = readSpec(specFileName); + if (!SetMatcher.compare(abiSpec.keySet(), signatures.keySet(), + item -> matchingClasses(item, abiSpec.get(item), signatures.get(item), getLog()), + item -> getLog().error(String.format("Missing class: %s", item)), + item -> getLog().error(String.format("Extra class: %s", item)))) { + throw new MojoFailureException("ABI spec mismatch"); + } + } + } catch (IOException e) { + throw new MojoExecutionException("Error processing class signatures", e); + } + } } -- cgit v1.2.3