You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by us...@apache.org on 2015/04/20 17:22:08 UTC

svn commit: r1674926 [2/2] - in /lucene/dev/trunk: dev-tools/maven/ dev-tools/maven/lucene/ dev-tools/maven/lucene/analysis/stempel/ dev-tools/maven/lucene/backward-codecs/ dev-tools/maven/lucene/benchmark/ dev-tools/maven/lucene/core/src/java/ dev-too...

Modified: lucene/dev/trunk/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/QueryParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/QueryParser.java?rev=1674926&r1=1674925&r2=1674926&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/QueryParser.java (original)
+++ lucene/dev/trunk/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/QueryParser.java Mon Apr 20 15:22:06 2015
@@ -185,7 +185,7 @@ public class QueryParser implements Quer
           fieldName = jj_consume_token(TERM);
       jj_consume_token(COLON);
       if (fieldNames == null) {
-        fieldNames = new ArrayList<>();
+        fieldNames = new ArrayList<String>();
       }
       fieldNames.add(fieldName.image);
     }
@@ -211,7 +211,7 @@ public class QueryParser implements Quer
       oprt = jj_consume_token(OR);
                   /* keep only last used operator */
       if (queries == null) {
-        queries = new ArrayList<>();
+        queries = new ArrayList<SrndQuery>();
         queries.add(q);
       }
       q = AndQuery();
@@ -239,7 +239,7 @@ public class QueryParser implements Quer
       oprt = jj_consume_token(AND);
                    /* keep only last used operator */
       if (queries == null) {
-        queries = new ArrayList<>();
+        queries = new ArrayList<SrndQuery>();
         queries.add(q);
       }
       q = NotQuery();
@@ -267,7 +267,7 @@ public class QueryParser implements Quer
       oprt = jj_consume_token(NOT);
                     /* keep only last used operator */
       if (queries == null) {
-        queries = new ArrayList<>();
+        queries = new ArrayList<SrndQuery>();
         queries.add(q);
       }
       q = NQuery();
@@ -293,7 +293,7 @@ public class QueryParser implements Quer
         break label_5;
       }
       dt = jj_consume_token(N);
-      queries = new ArrayList<>();
+      queries = new ArrayList<SrndQuery>();
       queries.add(q); /* left associative */
 
       q = WQuery();
@@ -320,7 +320,7 @@ public class QueryParser implements Quer
         break label_6;
       }
       wt = jj_consume_token(W);
-      queries = new ArrayList<>();
+      queries = new ArrayList<SrndQuery>();
       queries.add(q); /* left associative */
 
       q = PrimaryQuery();
@@ -401,7 +401,7 @@ public class QueryParser implements Quer
 
   final public List<SrndQuery> FieldsQueryList() throws ParseException {
   SrndQuery q;
-  ArrayList<SrndQuery> queries = new ArrayList<>();
+  ArrayList<SrndQuery> queries = new ArrayList<SrndQuery>();
     jj_consume_token(LPAREN);
     q = FieldsQuery();
                      queries.add(q);
@@ -644,7 +644,7 @@ public class QueryParser implements Quer
       return (jj_ntk = jj_nt.kind);
   }
 
-  private java.util.List<int[]> jj_expentries = new java.util.ArrayList<>();
+  private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>();
   private int[] jj_expentry;
   private int jj_kind = -1;
   private int[] jj_lasttokens = new int[100];

Modified: lucene/dev/trunk/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/QueryParserTokenManager.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/QueryParserTokenManager.java?rev=1674926&r1=1674925&r2=1674926&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/QueryParserTokenManager.java (original)
+++ lucene/dev/trunk/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/QueryParserTokenManager.java Mon Apr 20 15:22:06 2015
@@ -18,10 +18,7 @@ import org.apache.lucene.queryparser.sur
 public class QueryParserTokenManager implements QueryParserConstants
 {
 
-  /** Debug output. */
-  public  java.io.PrintStream debugStream = System.out;
-  /** Set debug output. */
-  public  void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
+  
 private final int jjStopStringLiteralDfa_1(int pos, long active0)
 {
    switch (pos)

Modified: lucene/dev/trunk/lucene/test-framework/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/build.xml?rev=1674926&r1=1674925&r2=1674926&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/build.xml (original)
+++ lucene/dev/trunk/lucene/test-framework/build.xml Mon Apr 20 15:22:06 2015
@@ -22,11 +22,6 @@
 
   <property name="build.dir" location="../build/test-framework"/>
 
-  <!-- file is part of the API -->
-  <property name="forbidden-base-excludes" value="
-    org/apache/lucene/mockfile/FilterPath.class
-  "/>
-
   <import file="../common-build.xml"/>
 
   <path id="classpath">

Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/mockfile/FilterPath.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/mockfile/FilterPath.java?rev=1674926&r1=1674925&r2=1674926&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/mockfile/FilterPath.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/mockfile/FilterPath.java Mon Apr 20 15:22:06 2015
@@ -30,6 +30,8 @@ import java.nio.file.WatchKey;
 import java.nio.file.WatchService;
 import java.util.Iterator;
 
+import org.apache.lucene.util.SuppressForbidden;
+
 /**  
  * A {@code FilterPath} contains another 
  * {@code Path}, which it uses as its basic 
@@ -193,6 +195,7 @@ public class FilterPath implements Path
   }
 
   @Override
+  @SuppressForbidden(reason = "Abstract API requires to use java.io.File")
   public File toFile() {
     // TODO: should we throw exception here?
     return delegate.toFile();

Modified: lucene/dev/trunk/solr/common-build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/common-build.xml?rev=1674926&r1=1674925&r2=1674926&view=diff
==============================================================================
--- lucene/dev/trunk/solr/common-build.xml (original)
+++ lucene/dev/trunk/solr/common-build.xml Mon Apr 20 15:22:06 2015
@@ -491,7 +491,7 @@
   <!-- Forbidden API Task, customizations for Solr -->
   <target name="-check-forbidden-all" depends="-init-forbidden-apis,compile-core,compile-test">
     <property file="${common.dir}/ivy-versions.properties"/> <!-- for commons-io version -->
-    <forbidden-apis internalRuntimeForbidden="true" classpathref="forbidden-apis.allclasses.classpath">
+    <forbidden-apis internalRuntimeForbidden="true" suppressAnnotation="**.SuppressForbidden" classpathref="forbidden-apis.allclasses.classpath">
       <bundledSignatures name="jdk-unsafe-${javac.target}"/>
       <bundledSignatures name="jdk-deprecated-${javac.target}"/>
       <bundledSignatures name="commons-io-unsafe-${/commons-io/commons-io}"/>

Modified: lucene/dev/trunk/solr/core/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/build.xml?rev=1674926&r1=1674925&r2=1674926&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/build.xml (original)
+++ lucene/dev/trunk/solr/core/build.xml Mon Apr 20 15:22:06 2015
@@ -25,7 +25,6 @@
 
   <property name="forbidden-tests-excludes" value="
     org/apache/solr/internal/**
-    org/apache/solr/search/DocSetPerf.class
   "/>
 
   <import file="../common-build.xml"/>

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/DocSetPerf.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/DocSetPerf.java?rev=1674926&r1=1674925&r2=1674926&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/DocSetPerf.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/DocSetPerf.java Mon Apr 20 15:22:06 2015
@@ -17,10 +17,10 @@
 
 package org.apache.solr.search;
 
-import java.util.BitSet;
 import java.util.Random;
 
 import org.apache.lucene.util.FixedBitSet;
+import org.apache.lucene.util.SuppressForbidden;
 
 /**
  */
@@ -33,13 +33,18 @@ public class DocSetPerf {
       }
   }
 
-  static Random rand = new Random();
-
   static FixedBitSet bs;
   static BitDocSet bds;
   static HashDocSet hds;
   static int[] ids; // not unique
 
+  static Random rand = getRandom();
+  
+  @SuppressForbidden(reason = "No testcase, use of java.util.Random allowed")
+  private static Random getRandom() {
+    return new Random();
+  }
+
   static void generate(int maxSize, int bitsToSet) {
     bs = new FixedBitSet(maxSize);
     ids = new int[bitsToSet];
@@ -57,8 +62,6 @@ public class DocSetPerf {
     hds = new HashDocSet(ids,0,count);
   }
 
-
-
   public static void main(String[] args) {
     String bsSize=args[0];
     boolean randSize=false;
@@ -79,8 +82,7 @@ public class DocSetPerf {
     FixedBitSet[] sets = new FixedBitSet[numSets];
     DocSet[] bset = new DocSet[numSets];
     DocSet[] hset = new DocSet[numSets];
-    BitSet scratch=new BitSet();
-
+    
     for (int i=0; i<numSets; i++) {
       generate(randSize ? rand.nextInt(bitSetSize) : bitSetSize, numBitsSet);
       sets[i] = bs;
@@ -166,7 +168,6 @@ public class DocSetPerf {
     long end = System.currentTimeMillis();
     System.out.println("TIME="+(end-start));
 
-    // System.out.println("ret="+ret + " scratchsize="+scratch.size());
     System.out.println("ret="+ret);
   }
 

Modified: lucene/dev/trunk/solr/solrj/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/build.xml?rev=1674926&r1=1674925&r2=1674926&view=diff
==============================================================================
--- lucene/dev/trunk/solr/solrj/build.xml (original)
+++ lucene/dev/trunk/solr/solrj/build.xml Mon Apr 20 15:22:06 2015
@@ -20,16 +20,6 @@
 
   <property name="test.lib.dir" location="test-lib"/>
 
-  <!-- Uses ThreadPoolExecutor constructors directly -->
-  <property name="forbidden-base-excludes" value="
-    org/apache/solr/common/util/ExecutorUtil$MDCAwareThreadPoolExecutor.class
-  "/>
-
-  <!-- violates the servlet-api restrictions, but it is safe to do so in this test: -->
-  <property name="forbidden-tests-excludes" value="
-    org/apache/solr/client/solrj/impl/BasicHttpSolrClientTest$DebugServlet.class
-  "/>
-
   <import file="../common-build.xml"/>
 
   <!-- Specialized compile classpath: to only depend on what solrj should depend on (e.g. not lucene) -->

Modified: lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java?rev=1674926&r1=1674925&r2=1674926&view=diff
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java (original)
+++ lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java Mon Apr 20 15:22:06 2015
@@ -104,6 +104,7 @@ public class ExecutorUtil {
         threadFactory);
   }
 
+  @SuppressForbidden(reason = "class customizes ThreadPoolExecutor so it can be used instead")
   public static class MDCAwareThreadPoolExecutor extends ThreadPoolExecutor {
 
     private static final int MAX_THREAD_NAME_LEN = 512;

Added: lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/common/util/SuppressForbidden.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/common/util/SuppressForbidden.java?rev=1674926&view=auto
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/common/util/SuppressForbidden.java (added)
+++ lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/common/util/SuppressForbidden.java Mon Apr 20 15:22:06 2015
@@ -0,0 +1,34 @@
+package org.apache.solr.common.util;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+
+/**
+ * Annotation to suppress forbidden-apis errors inside a whole class, a method, or a field.
+ * @lucene.internal
+ */
+@Retention(RetentionPolicy.CLASS)
+@Target({ ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.METHOD, ElementType.TYPE })
+public @interface SuppressForbidden {
+  /** A reason for suppressing should always be given. */
+  String reason();
+}

Modified: lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrClientTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrClientTest.java?rev=1674926&r1=1674925&r2=1674926&view=diff
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrClientTest.java (original)
+++ lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrClientTest.java Mon Apr 20 15:22:06 2015
@@ -36,6 +36,7 @@ import org.apache.solr.common.SolrExcept
 import org.apache.solr.common.SolrInputDocument;
 import org.apache.solr.common.params.CommonParams;
 import org.apache.solr.common.util.NamedList;
+import org.apache.solr.common.util.SuppressForbidden;
 import org.apache.solr.util.SSLTestConfig;
 import org.eclipse.jetty.servlet.ServletHolder;
 import org.junit.BeforeClass;
@@ -45,6 +46,7 @@ import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.Socket;
@@ -111,6 +113,7 @@ public class BasicHttpSolrClientTest ext
       }
     }
 
+    @SuppressForbidden(reason = "fake servlet only")
     private void setParameters(HttpServletRequest req) {
       parameters = req.getParameterMap();
     }