diff options
author | Ilpo Ruotsalainen <ilpo.ruotsalainen@oath.com> | 2018-11-30 15:22:48 +0100 |
---|---|---|
committer | Ilpo Ruotsalainen <ilpo.ruotsalainen@oath.com> | 2018-11-30 15:22:48 +0100 |
commit | bb2e5a29c64b06cebd4146f5cdfe9537ae81885f (patch) | |
tree | ae5c3ac84a5c60c1d305a0a0ba0a1a502d4f5f08 /abi-check-plugin/src/main/java/com/yahoo/abicheck/mojo/AbiCheck.java | |
parent | 3bcc130a874ff19359ee25bd7ce0b29b815291da (diff) |
Reformat file, no semantic changes.
Diffstat (limited to 'abi-check-plugin/src/main/java/com/yahoo/abicheck/mojo/AbiCheck.java')
-rw-r--r-- | abi-check-plugin/src/main/java/com/yahoo/abicheck/mojo/AbiCheck.java | 68 |
1 files changed, 34 insertions, 34 deletions
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<String, JavaClassSignature> 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<String, JavaClassSignature> 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<String, JavaClassSignature> readSpec(String fileName) throws IOException { try (FileReader reader = new FileReader(fileName)) { TypeToken<Map<String, JavaClassSignature>> 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<String, JavaClassSignature> 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<String, JavaClassSignature> 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); + } + } } |