aboutsummaryrefslogtreecommitdiffstats
path: root/api/src/main
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-04-03 23:49:31 +0200
committerSven Gothel <[email protected]>2015-04-03 23:49:31 +0200
commit0d2e314ef48bd2fd38b45f781c4573bdb2b32a69 (patch)
tree5b647e0cb7bef96dedff92143a8fb1ff9f594496 /api/src/main
parenta6d08112c8e09e3bb32dcdb8397919d664c9c14c (diff)
*DiffCriteria.differs[Binary](FieldInfo ..): Need to take value type into account!
Diffstat (limited to 'api/src/main')
-rw-r--r--api/src/main/java/org/osjava/jardiff/PublicDiffCriteria.java8
-rw-r--r--api/src/main/java/org/osjava/jardiff/SimpleDiffCriteria.java8
-rwxr-xr-xapi/src/main/java/org/semver/Dumper.java12
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("]");