LUCENE-2004: Constants.LUCENE_MAIN_VERSION may not be inlined in code compiled against Lucene JAR

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@828331 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2009-10-22 06:50:37 +00:00
parent d1fc6bece6
commit abf2f86302
3 changed files with 12 additions and 3 deletions

View File

@ -122,6 +122,9 @@ Bug fixes
cannot exceed 2048 MB, and throw IllegalArgumentException if it
does. (Aaron McKee, Yonik Seeley, Mike McCandless)
* LUCENE-2004: Fix Constants.LUCENE_MAIN_VERSION to not be inlined
by client code. (Uwe Schindler)
New features
* LUCENE-1933: Provide a convenience AttributeFactory that creates a

View File

@ -42,7 +42,7 @@
<property name="Name" value="Lucene"/>
<property name="dev.version" value="3.0-dev"/>
<property name="version" value="${dev.version}"/>
<property name="compatibility.tag" value="lucene_2_9_back_compat_tests_20091021a"/>
<property name="compatibility.tag" value="lucene_2_9_back_compat_tests_20091022"/>
<property name="spec.version" value="${version}"/>
<property name="year" value="2000-${current.year}"/>
<property name="final.name" value="lucene-${name}-${version}"/>

View File

@ -64,7 +64,13 @@ public final class Constants {
}
}
public static final String LUCENE_MAIN_VERSION = "3.0";
// this method prevents inlining the final version constant in compiled classes,
// see: http://www.javaworld.com/community/node/3400
private static String ident(final String s) {
return s.toString();
}
public static final String LUCENE_MAIN_VERSION = ident("3.0");
public static final String LUCENE_VERSION;
static {
@ -75,6 +81,6 @@ public final class Constants {
} else if (v.indexOf(LUCENE_MAIN_VERSION) == -1) {
v = v + " [" + LUCENE_MAIN_VERSION + "]";
}
LUCENE_VERSION = v;
LUCENE_VERSION = ident(v);
}
}