You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@lucene.apache.org by us...@apache.org on 2009/10/22 08:47:40 UTC

svn commit: r828327 - in /lucene/java/branches/lucene_2_9: CHANGES.txt src/java/org/apache/lucene/util/Constants.java

Author: uschindler
Date: Thu Oct 22 06:47:40 2009
New Revision: 828327

URL: http://svn.apache.org/viewvc?rev=828327&view=rev
Log:
LUCENE-2004: Constants.LUCENE_MAIN_VERSION may not be inlined in code compiled against Lucene JAR

Modified:
    lucene/java/branches/lucene_2_9/CHANGES.txt
    lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/util/Constants.java

Modified: lucene/java/branches/lucene_2_9/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9/CHANGES.txt?rev=828327&r1=828326&r2=828327&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9/CHANGES.txt (original)
+++ lucene/java/branches/lucene_2_9/CHANGES.txt Thu Oct 22 06:47:40 2009
@@ -26,6 +26,9 @@
    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)
+
 API Changes
 
  * Un-deprecate search(Weight weight, Filter filter, int n) from

Modified: lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/util/Constants.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/util/Constants.java?rev=828327&r1=828326&r2=828327&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/util/Constants.java (original)
+++ lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/util/Constants.java Thu Oct 22 06:47:40 2009
@@ -67,7 +67,13 @@
     }
   }
 
-  public static final String LUCENE_MAIN_VERSION = "2.9.1";
+  // 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("2.9.1");
 
   public static final String LUCENE_VERSION;
   static {
@@ -78,6 +84,6 @@
     } else if (v.indexOf(LUCENE_MAIN_VERSION) == -1) {
       v = v + " [" + LUCENE_MAIN_VERSION + "]";
     }
-    LUCENE_VERSION = v;
+    LUCENE_VERSION = ident(v);
   }
 }