lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r1451584 - in /lucene/dev/trunk: lucene/analysis/common/src/test/org/apache/lucene/analysis/core/ lucene/test-framework/src/java/org/apache/lucene/util/ solr/solrj/src/java/org/apache/solr/client/solrj/beans/
Date Fri, 01 Mar 2013 13:12:16 GMT
Author: uschindler
Date: Fri Mar  1 13:12:16 2013
New Revision: 1451584

URL: http://svn.apache.org/r1451584
Log:
LUCENE-4808: Add workaround for a JDK 8 "class library bug" which is still under discussion
and may *not* be fixed

Modified:
    lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/core/TestRandomChains.java
    lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java
    lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/beans/DocumentObjectBinder.java

Modified: lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/core/TestRandomChains.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/core/TestRandomChains.java?rev=1451584&r1=1451583&r2=1451584&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/core/TestRandomChains.java
(original)
+++ lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/core/TestRandomChains.java
Fri Mar  1 13:12:16 2013
@@ -252,12 +252,14 @@ public class TestRandomChains extends Ba
     tokenfilters = new ArrayList<Constructor<? extends TokenFilter>>();
     charfilters = new ArrayList<Constructor<? extends CharFilter>>();
     for (final Class<?> c : analysisClasses) {
+      // TODO: Fix below code to use c.isAnnotationPresent(). It was changed
+      // to the null check to work around a bug in JDK 8 b78 (see LUCENE-4808).
       final int modifiers = c.getModifiers();
       if (
         // don't waste time with abstract classes or deprecated known-buggy ones
         Modifier.isAbstract(modifiers) || !Modifier.isPublic(modifiers)
         || c.isSynthetic() || c.isAnonymousClass() || c.isMemberClass() || c.isInterface()
-        || c.isAnnotationPresent(Deprecated.class)
+        || c.getAnnotation(Deprecated.class) != null
         || !(Tokenizer.class.isAssignableFrom(c) || TokenFilter.class.isAssignableFrom(c)
|| CharFilter.class.isAssignableFrom(c))
       ) {
         continue;
@@ -265,7 +267,7 @@ public class TestRandomChains extends Ba
       
       for (final Constructor<?> ctor : c.getConstructors()) {
         // don't test synthetic or deprecated ctors, they likely have known bugs:
-        if (ctor.isSynthetic() || ctor.isAnnotationPresent(Deprecated.class) || brokenConstructors.get(ctor)
== ALWAYS) {
+        if (ctor.isSynthetic() || ctor.getAnnotation(Deprecated.class) != null || brokenConstructors.get(ctor)
== ALWAYS) {
           continue;
         }
         if (Tokenizer.class.isAssignableFrom(c)) {

Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java?rev=1451584&r1=1451583&r2=1451584&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java
(original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java
Fri Mar  1 13:12:16 2013
@@ -131,7 +131,9 @@ final class TestRuleSetupAndRestoreClass
 
     Class<?> targetClass = RandomizedContext.current().getTargetClass();
     avoidCodecs = new HashSet<String>();
-    if (targetClass.isAnnotationPresent(SuppressCodecs.class)) {
+    // TODO: Fix below code to use c.isAnnotationPresent(). It was changed
+    // to the null check to work around a bug in JDK 8 b78 (see LUCENE-4808).
+    if (targetClass.getAnnotation(SuppressCodecs.class) != null) {
       SuppressCodecs a = targetClass.getAnnotation(SuppressCodecs.class);
       avoidCodecs.addAll(Arrays.asList(a.value()));
     }

Modified: lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/beans/DocumentObjectBinder.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/beans/DocumentObjectBinder.java?rev=1451584&r1=1451583&r2=1451584&view=diff
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/beans/DocumentObjectBinder.java
(original)
+++ lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/beans/DocumentObjectBinder.java
Fri Mar  1 13:12:16 2013
@@ -114,7 +114,9 @@ public class DocumentObjectBinder {
     }
 
     for (AccessibleObject member : members) {
-      if (member.isAnnotationPresent(Field.class)) {
+      // TODO: Fix below code to use c.isAnnotationPresent(). It was changed
+      // to the null check to work around a bug in JDK 8 b78 (see LUCENE-4808).
+      if (member.getAnnotation(Field.class) != null) {
         member.setAccessible(true);
         fields.add(new DocField(member));
       }



Mime
View raw message