aboutsummaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorJulien Eluard <[email protected]>2010-11-15 20:48:19 +0100
committerJulien Eluard <[email protected]>2010-11-15 20:48:19 +0100
commitfc1d06d8226763e6c702865affc879b8a43afb80 (patch)
treebfdc7e446fa99622ac0f9c4b1480097cc22aca5f /api
parent2e5f3cb8085ed0d1707fa820b4c308c4936c37a2 (diff)
Cleanup.
Diffstat (limited to 'api')
-rw-r--r--api/src/main/java/org/semver/Checker.java11
-rw-r--r--api/src/main/java/org/semver/Version.java8
-rw-r--r--api/src/main/java/org/semver/jardiff/AccumulatingDiffHandler.java7
3 files changed, 11 insertions, 15 deletions
diff --git a/api/src/main/java/org/semver/Checker.java b/api/src/main/java/org/semver/Checker.java
index d63b980..af208a9 100644
--- a/api/src/main/java/org/semver/Checker.java
+++ b/api/src/main/java/org/semver/Checker.java
@@ -19,7 +19,6 @@
package org.semver;
import java.io.File;
-import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
@@ -102,9 +101,8 @@ public class Checker {
* @param excludes
* @return all {@link Difference} between both JARs
* @throws IOException
- * @throws FileNotFoundException
*/
- public final Set<AccumulatingDiffHandler.Difference> diff(final File previousJAR, final File currentJAR, final Set<String> includes, final Set<String> excludes) throws IOException, FileNotFoundException {
+ public final Set<AccumulatingDiffHandler.Difference> diff(final File previousJAR, final File currentJAR, final Set<String> includes, final Set<String> excludes) throws IOException {
if (!previousJAR.isFile()) {
throw new IllegalArgumentException("<"+previousJAR+"> is not a valid file");
}
@@ -209,9 +207,8 @@ public class Checker {
* @param includes
* @param excludes
* @throws IOException
- * @throws FileNotFoundException
*/
- public final void dumpDiff(final File previousJAR, final File currentJAR, final Set<String> includes, final Set<String> excludes) throws IOException, FileNotFoundException {
+ public final void dumpDiff(final File previousJAR, final File currentJAR, final Set<String> includes, final Set<String> excludes) throws IOException {
final Set<AccumulatingDiffHandler.Difference> differences = diff(previousJAR, currentJAR, includes, excludes);
final List<AccumulatingDiffHandler.Difference> sortedDifferences = new LinkedList<AccumulatingDiffHandler.Difference>(differences);
Collections.sort(sortedDifferences);
@@ -249,7 +246,7 @@ public class Checker {
}
}
- public final CompatibilityType check(final File previousJAR, final File currentJAR, final Set<String> includes, final Set<String> excludes) throws IOException, FileNotFoundException {
+ public final CompatibilityType check(final File previousJAR, final File currentJAR, final Set<String> includes, final Set<String> excludes) throws IOException {
return computeCompatibilityType(diff(previousJAR, currentJAR, includes, excludes));
}
@@ -303,7 +300,7 @@ public class Checker {
}
}
- public static void main(final String[] arguments) throws Exception {
+ public static void main(final String[] arguments) throws IOException {
Checker.failIfNotEnoughArguments(arguments, 3, "Usage: ["+DIFF_ACTION+"|"+CHECK_ACTION+"|"+INFER_ACTION+"|"+VALIDATE_ACTION+"] (previousVersion) previousJar (currentVersion) currentJar (includes) (excludes)");
final String action = arguments[0];
diff --git a/api/src/main/java/org/semver/Version.java b/api/src/main/java/org/semver/Version.java
index 45f4833..a138b49 100644
--- a/api/src/main/java/org/semver/Version.java
+++ b/api/src/main/java/org/semver/Version.java
@@ -29,7 +29,7 @@ import javax.annotation.Nullable;
* Version following semantic defined by <a href="http://semver.org/">Semantic Versioning</a> document.
*
*/
-public class Version implements Comparable<Version> {
+public final class Version implements Comparable<Version> {
/**
* {@link Version} element type. From most meaningful to less meaningful.
@@ -43,8 +43,8 @@ public class Version implements Comparable<Version> {
}
- private final static String FORMAT = "(\\d)\\.(\\d)\\.(\\d)([A-Za-z][0-9A-Za-z-]*)?";
- private final static Pattern PATTERN = Pattern.compile(Version.FORMAT);
+ private static final String FORMAT = "(\\d)\\.(\\d)\\.(\\d)([A-Za-z][0-9A-Za-z-]*)?";
+ private static final Pattern PATTERN = Pattern.compile(Version.FORMAT);
private final int major;
private final int minor;
@@ -101,7 +101,7 @@ public class Version implements Comparable<Version> {
* @param type
* @return int representation of provided number
*/
- private static @Nonnegative int parseElement(@Nonnull final String number, @Nonnull final Version.Type type) {
+ private @Nonnegative static int parseElement(@Nonnull final String number, @Nonnull final Version.Type type) {
try {
return Integer.valueOf(number);
} catch (NumberFormatException e) {
diff --git a/api/src/main/java/org/semver/jardiff/AccumulatingDiffHandler.java b/api/src/main/java/org/semver/jardiff/AccumulatingDiffHandler.java
index 5bbbd42..3ca479d 100644
--- a/api/src/main/java/org/semver/jardiff/AccumulatingDiffHandler.java
+++ b/api/src/main/java/org/semver/jardiff/AccumulatingDiffHandler.java
@@ -27,16 +27,15 @@ import org.osjava.jardiff.AbstractDiffHandler;
import org.osjava.jardiff.AbstractInfo;
import org.osjava.jardiff.ClassInfo;
import org.osjava.jardiff.DiffException;
-import org.osjava.jardiff.DiffHandler;
import org.osjava.jardiff.FieldInfo;
import org.osjava.jardiff.MethodInfo;
/**
*
- * {@link DiffHandler} implementation accumulating changes.
+ * {@link org.osjava.jardiff.DiffHandler} implementation accumulating changes.
*
*/
-public class AccumulatingDiffHandler extends AbstractDiffHandler {
+public final class AccumulatingDiffHandler extends AbstractDiffHandler {
public static class Difference implements Comparable<Difference> {
@@ -261,7 +260,7 @@ public class AccumulatingDiffHandler extends AbstractDiffHandler {
*
* @return
*/
- protected final boolean isConsidered() {
+ private boolean isConsidered() {
for (final String exclude : this.excludes) {
if (this.currentClassName.startsWith(exclude)) {
return false;