deprecate Version.buildDate
Version.getBuildDate() now always returns null because we do not store the buildTimestamp anymore for reproducible builds
diff --git a/freemarker-core/src/main/java/freemarker/template/Configuration.java b/freemarker-core/src/main/java/freemarker/template/Configuration.java
index 8f2af85..9211cfa 100644
--- a/freemarker-core/src/main/java/freemarker/template/Configuration.java
+++ b/freemarker-core/src/main/java/freemarker/template/Configuration.java
@@ -512,22 +512,9 @@
String versionString = getRequiredVersionProperty(props, "version");
- Date buildDate;
- {
- String buildDateStr = getRequiredVersionProperty(props, "buildTimestamp");
- if (buildDateStr.endsWith("Z")) {
- buildDateStr = buildDateStr.substring(0, buildDateStr.length() - 1) + "+0000";
- }
- try {
- buildDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.US).parse(buildDateStr);
- } catch (java.text.ParseException e) {
- buildDate = null;
- }
- }
-
final Boolean gaeCompliant = Boolean.valueOf(getRequiredVersionProperty(props, "isGAECompliant"));
- VERSION = new Version(versionString, gaeCompliant, buildDate);
+ VERSION = new Version(versionString, gaeCompliant, null);
} catch (IOException e) {
throw new RuntimeException("Failed to load and parse " + VERSION_PROPERTIES_PATH, e);
}
diff --git a/freemarker-core/src/main/java/freemarker/template/Version.java b/freemarker-core/src/main/java/freemarker/template/Version.java
index dc08926..d66c969 100644
--- a/freemarker-core/src/main/java/freemarker/template/Version.java
+++ b/freemarker-core/src/main/java/freemarker/template/Version.java
@@ -42,7 +42,6 @@
private final String originalStringValue;
private final Boolean gaeCompliant;
- private final Date buildDate;
private final int intValue;
private volatile String calculatedStringValue; // not final because it's calculated on demand
@@ -116,7 +115,6 @@
intValue = calculateIntValue();
this.gaeCompliant = gaeCompliant;
- this.buildDate = buildDate;
}
@@ -142,7 +140,6 @@
this.extraInfo = null;
this.gaeCompliant = null;
- this.buildDate = null;
originalStringValue = null;
}
@@ -152,7 +149,6 @@
this.micro = micro;
this.extraInfo = extraInfo;
this.gaeCompliant = gaeCompatible;
- this.buildDate = buildDate;
intValue = calculateIntValue();
originalStringValue = null;
}
@@ -229,10 +225,11 @@
}
/**
+ * @deprecated will be removed. Always returns <code>null</code>.
* @return The build date if known, or {@code null}.
*/
public Date getBuildDate() {
- return buildDate;
+ return null;
}
/**
@@ -250,7 +247,6 @@
if (hashCode == 0) {
final int prime = 31;
int result = 1;
- result = prime * result + (buildDate == null ? 0 : buildDate.hashCode());
result = prime * result + (extraInfo == null ? 0 : extraInfo.hashCode());
result = prime * result + (gaeCompliant == null ? 0 : gaeCompliant.hashCode());
result = prime * result + intValue;
@@ -273,12 +269,6 @@
if (other.hashCode() != hashCode()) return false;
- if (buildDate == null) {
- if (other.buildDate != null) return false;
- } else if (!buildDate.equals(other.buildDate)) {
- return false;
- }
-
if (extraInfo == null) {
if (other.extraInfo != null) return false;
} else if (!extraInfo.equals(other.extraInfo)) {
diff --git a/freemarker-core/src/test/java/freemarker/template/VersionTest.java b/freemarker-core/src/test/java/freemarker/template/VersionTest.java
index 917b96e..55b965a 100644
--- a/freemarker-core/src/test/java/freemarker/template/VersionTest.java
+++ b/freemarker-core/src/test/java/freemarker/template/VersionTest.java
@@ -47,7 +47,7 @@
assertEquals("1.2.3-beta8", v.toString());
assertEquals("beta8", v.getExtraInfo());
assertTrue(v.isGAECompliant().booleanValue());
- assertEquals(new Date(5000), v.getBuildDate());
+ assertNull(v.getBuildDate());
}
@Test
@@ -63,7 +63,7 @@
assertEquals("2.3.24-rc01-incubating", v.toString());
assertEquals("rc01-incubating", v.getExtraInfo());
assertFalse(v.isGAECompliant().booleanValue());
- assertEquals(new Date(5000), v.getBuildDate());
+ assertNull(v.getBuildDate());
}
@Test
@@ -89,7 +89,7 @@
assertEquals(30, v.getMicro());
assertNull(v.getExtraInfo());
assertTrue(v.isGAECompliant().booleanValue());
- assertEquals(new Date(5000), v.getBuildDate());
+ assertNull(v.getBuildDate());
}
@Test
@@ -147,8 +147,8 @@
assertTrue(v1.hashCode() != v2.hashCode());
v2 = new Version(1, 2, 3, "beta2", null, new Date(5000));
- assertTrue(!v1.equals(v2));
- assertTrue(v1.hashCode() != v2.hashCode());
+ assertTrue(v1.equals(v2));
+ assertTrue(v1.hashCode() == v2.hashCode());
v2 = new Version("1.2.9-beta2");
assertTrue(!v1.equals(v2));