From 45e18a543f7f11bf5e701f898e7c1221bd2f2672 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 3 Apr 2015 05:54:12 +0200 Subject: Expose 'fieldCompatChanged', allowing user to fail if fields have changed (binary compatible) --- .../main/java/org/semver/jardiff/DifferenceAccumulatingHandler.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'api/src/main/java/org/semver/jardiff/DifferenceAccumulatingHandler.java') diff --git a/api/src/main/java/org/semver/jardiff/DifferenceAccumulatingHandler.java b/api/src/main/java/org/semver/jardiff/DifferenceAccumulatingHandler.java index 8f7fb22..f697ef4 100755 --- a/api/src/main/java/org/semver/jardiff/DifferenceAccumulatingHandler.java +++ b/api/src/main/java/org/semver/jardiff/DifferenceAccumulatingHandler.java @@ -49,6 +49,7 @@ public final class DifferenceAccumulatingHandler extends AbstractDiffHandler { private final Set excludes; private final boolean excludesAreRegExp; private final Set differences = new HashSet(); + private boolean fieldCompatChanged; public DifferenceAccumulatingHandler() { this(Collections.emptySet(), Collections.emptySet()); @@ -63,6 +64,7 @@ public final class DifferenceAccumulatingHandler extends AbstractDiffHandler { this.includesAreRegExp = includesAreRegExp; this.excludes = excludes; this.excludesAreRegExp = excludesAreRegExp; + this.fieldCompatChanged = false; } public String getCurrentClassName() { @@ -173,7 +175,7 @@ public final class DifferenceAccumulatingHandler extends AbstractDiffHandler { if (!isClassConsidered(getCurrentClassName())) { return; } - + this.fieldCompatChanged = true; this.differences.add(new CompatChange(getCurrentClassName(), oldFieldInfo, newFieldInfo)); } @@ -354,7 +356,7 @@ public final class DifferenceAccumulatingHandler extends AbstractDiffHandler { } public Delta getDelta() { - return new Delta(this.differences); + return new Delta(this.differences, this.fieldCompatChanged); } } -- cgit v1.2.3