diff options
-rw-r--r-- | api/src/main/java/org/osjava/jardiff/PublicDiffCriteria.java | 8 | ||||
-rw-r--r-- | api/src/main/java/org/osjava/jardiff/SimpleDiffCriteria.java | 8 | ||||
-rwxr-xr-x | api/src/main/java/org/semver/Dumper.java | 12 |
3 files changed, 18 insertions, 10 deletions
diff --git a/api/src/main/java/org/osjava/jardiff/PublicDiffCriteria.java b/api/src/main/java/org/osjava/jardiff/PublicDiffCriteria.java index c7fea4b..c5e2f02 100644 --- a/api/src/main/java/org/osjava/jardiff/PublicDiffCriteria.java +++ b/api/src/main/java/org/osjava/jardiff/PublicDiffCriteria.java @@ -116,13 +116,13 @@ public class PublicDiffCriteria implements DiffCriteria @Override public boolean differs(final FieldInfo oldInfo, final FieldInfo newInfo) { - return Tools.isFieldAccessChange(oldInfo.getAccess(), newInfo.getAccess()) || - // Tools.isFieldTypeChange(oldInfo.getValue(), newInfo.getValue()) || + return Tools.isFieldTypeChange(oldInfo.getValue(), newInfo.getValue()) || + Tools.isFieldAccessChange(oldInfo.getAccess(), newInfo.getAccess()) || Tools.isFieldValueChange(oldInfo.getValue(), newInfo.getValue()); } @Override public boolean differsBinary(final FieldInfo oldInfo, final FieldInfo newInfo) { - return Tools.isFieldAccessChange(oldInfo.getAccess(), newInfo.getAccess()); // && - // Tools.isFieldTypeChange(oldInfo.getValue(), newInfo.getValue()); + return Tools.isFieldTypeChange(oldInfo.getValue(), newInfo.getValue()) || + Tools.isFieldAccessChange(oldInfo.getAccess(), newInfo.getAccess()); } } diff --git a/api/src/main/java/org/osjava/jardiff/SimpleDiffCriteria.java b/api/src/main/java/org/osjava/jardiff/SimpleDiffCriteria.java index 062baca..09d1108 100644 --- a/api/src/main/java/org/osjava/jardiff/SimpleDiffCriteria.java +++ b/api/src/main/java/org/osjava/jardiff/SimpleDiffCriteria.java @@ -116,13 +116,13 @@ public class SimpleDiffCriteria implements DiffCriteria @Override public boolean differs(final FieldInfo oldInfo, final FieldInfo newInfo) { - return Tools.isFieldAccessChange(oldInfo.getAccess(), newInfo.getAccess()) || - // Tools.isFieldTypeChange(oldInfo.getValue(), newInfo.getValue()) || + return Tools.isFieldTypeChange(oldInfo.getValue(), newInfo.getValue()) || + Tools.isFieldAccessChange(oldInfo.getAccess(), newInfo.getAccess()) || Tools.isFieldValueChange(oldInfo.getValue(), newInfo.getValue()); } @Override public boolean differsBinary(final FieldInfo oldInfo, final FieldInfo newInfo) { - return Tools.isFieldAccessChange(oldInfo.getAccess(), newInfo.getAccess()); // && - // Tools.isFieldTypeChange(oldInfo.getValue(), newInfo.getValue()); + return Tools.isFieldTypeChange(oldInfo.getValue(), newInfo.getValue()) || + Tools.isFieldAccessChange(oldInfo.getAccess(), newInfo.getAccess()); } } diff --git a/api/src/main/java/org/semver/Dumper.java b/api/src/main/java/org/semver/Dumper.java index bf2448b..30824f5 100755 --- a/api/src/main/java/org/semver/Dumper.java +++ b/api/src/main/java/org/semver/Dumper.java @@ -98,9 +98,11 @@ public class Dumper { final FieldInfo fCurInfo = (FieldInfo)currentInfo; final Object preValue = fPreInfo.getValue(); final Object curValue = fCurInfo.getValue(); + final String preType = null != preValue ? preValue.getClass().getName() : "nil"; + final String curType = null != curValue ? curValue.getClass().getName() : "nil"; if (Tools.isFieldTypeChange(preValue, curValue)) { - builder.append(", type[").append(preValue.getClass()) - .append(" -> ").append(curValue.getClass()).append("]"); + builder.append(", type[").append(preType) + .append(" -> ").append(curType).append("]"); } } builder.append(", access["); @@ -138,6 +140,12 @@ public class Dumper { final FieldInfo fCurInfo = (FieldInfo)currentInfo; final Object preValue = fPreInfo.getValue(); final Object curValue = fCurInfo.getValue(); + final String preType = null != preValue ? preValue.getClass().getName() : "nil"; + final String curType = null != curValue ? curValue.getClass().getName() : "nil"; + if (Tools.isFieldTypeChange(preValue, curValue)) { + builder.append(", type[").append(preType) + .append(" -> ").append(curType).append("]"); + } if (Tools.isFieldValueChange(preValue, curValue)) { builder.append(", value[").append(preValue) .append(" -> ").append(curValue).append("]"); |