lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r889850 - in /lucene/java/branches/flex_1458/src: java/org/apache/lucene/index/ java/org/apache/lucene/search/ test/org/apache/lucene/ test/org/apache/lucene/index/ test/org/apache/lucene/store/
Date Fri, 11 Dec 2009 23:10:34 GMT
Author: mikemccand
Date: Fri Dec 11 23:10:33 2009
New Revision: 889850

URL: http://svn.apache.org/viewvc?rev=889850&view=rev
Log:
LUCENE-2111 (flex branch): fix unchecked warnings in core/test

Modified:
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DirectoryReader.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/MultiPhraseQuery.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/TestExternalCodecs.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestCodecs.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/store/MockRAMDirectory.java

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DirectoryReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DirectoryReader.java?rev=889850&r1=889849&r2=889850&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DirectoryReader.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DirectoryReader.java Fri
Dec 11 23:10:33 2009
@@ -1198,29 +1198,25 @@
     int base;
   }
 
-  private final static class FieldMergeQueue extends PriorityQueue {
+  private final static class FieldMergeQueue extends PriorityQueue<FieldsEnumWithBase>
{
     FieldMergeQueue(int size) {
       initialize(size);
     }
 
     @Override
-    protected final boolean lessThan(Object a, Object b) {
-      FieldsEnumWithBase fieldsA = (FieldsEnumWithBase) a;
-      FieldsEnumWithBase fieldsB = (FieldsEnumWithBase) b;
+    protected final boolean lessThan(FieldsEnumWithBase fieldsA, FieldsEnumWithBase fieldsB)
{
       return fieldsA.current.compareTo(fieldsB.current) < 0;
     }
   }
 
-  private final static class TermMergeQueue extends PriorityQueue {
+  private final static class TermMergeQueue extends PriorityQueue<TermsEnumWithBase>
{
     TermRef.Comparator termComp;
     TermMergeQueue(int size) {
       initialize(size);
     }
 
     @Override
-    protected final boolean lessThan(Object a, Object b) {
-      TermsEnumWithBase termsA = (TermsEnumWithBase) a;
-      TermsEnumWithBase termsB = (TermsEnumWithBase) b;
+    protected final boolean lessThan(TermsEnumWithBase termsA, TermsEnumWithBase termsB)
{
       final int cmp = termComp.compare(termsA.current, termsB.current);
       if (cmp != 0) {
         return cmp < 0;
@@ -1348,8 +1344,8 @@
       // gather equal top fields
       if (queue.size() > 0) {
         while(true) {
-          top[numTop++] = (FieldsEnumWithBase) queue.pop();
-          if (queue.size() == 0 || ((FieldsEnumWithBase) queue.top()).current != top[0].current)
{
+          top[numTop++] = queue.pop();
+          if (queue.size() == 0 || (queue.top()).current != top[0].current) {
             break;
           }
         }
@@ -1494,8 +1490,8 @@
     private final void pullTop() {
       assert numTop == 0;
       while(true) {
-        top[numTop++] = (TermsEnumWithBase) queue.pop();
-        if (queue.size() == 0 || !((TermsEnumWithBase) queue.top()).current.termEquals(top[0].current))
{
+        top[numTop++] = queue.pop();
+        if (queue.size() == 0 || !(queue.top()).current.termEquals(top[0].current)) {
           break;
         }
       } 

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/MultiPhraseQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/MultiPhraseQuery.java?rev=889850&r1=889849&r2=889850&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/MultiPhraseQuery.java
(original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/MultiPhraseQuery.java
Fri Dec 11 23:10:33 2009
@@ -455,7 +455,7 @@
   private final UnionPositionsEnum unionPositionsEnum;
 
   public UnionDocsEnum(IndexReader indexReader, Term[] terms) throws IOException {
-    List docsEnums = new LinkedList();
+    List<DocsEnum> docsEnums = new LinkedList<DocsEnum>();
     final Bits delDocs = indexReader.getDeletedDocs();
 
     for (int i = 0; i < terms.length; i++) {

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/TestExternalCodecs.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/TestExternalCodecs.java?rev=889850&r1=889849&r2=889850&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/TestExternalCodecs.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/TestExternalCodecs.java Fri
Dec 11 23:10:33 2009
@@ -512,7 +512,7 @@
 
     private class FieldsReader extends FieldsProducer {
 
-      private final Set<String> fields = new TreeSet();
+      private final Set<String> fields = new TreeSet<String>();
       private final Map<Codec,FieldsProducer> codecs = new HashMap<Codec,FieldsProducer>();
 
       public FieldsReader(Directory dir, FieldInfos fieldInfos,
@@ -603,7 +603,7 @@
     }
 
     @Override
-    public void files(Directory dir, SegmentInfo info, Collection files) throws IOException
{
+    public void files(Directory dir, SegmentInfo info, Collection<String> files) throws
IOException {
       Iterator<Codec> it = fields.values().iterator();
       Set<Codec> seen = new HashSet<Codec>();
       while(it.hasNext()) {
@@ -616,7 +616,7 @@
     }
 
     @Override
-    public void getExtensions(Collection extensions) {
+    public void getExtensions(Collection<String> extensions) {
       Iterator<Codec> it = fields.values().iterator();
       while(it.hasNext()) {
         final Codec codec = it.next();

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestCodecs.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestCodecs.java?rev=889850&r1=889849&r2=889850&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestCodecs.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestCodecs.java Fri Dec
11 23:10:33 2009
@@ -64,10 +64,6 @@
     return RANDOM.nextInt(lim);
   }
 
-  private boolean nextBoolean() {
-    return 0 == nextInt(1);
-  }
-
   char[] getRandomText() {
 
     final int len = 1+nextInt(10);
@@ -193,7 +189,7 @@
     //final int numTerms = 2;
     TermData[] terms = new TermData[numTerms];
 
-    final HashSet termsSeen = new HashSet();
+    final HashSet<String> termsSeen = new HashSet<String>();
 
     for(int i=0;i<numTerms;i++) {
 
@@ -404,8 +400,6 @@
 
     public void _run() throws Throwable {
       
-      final FieldsEnum fieldsEnum = termsDict.iterator();
-
       for(int iter=0;iter<NUM_TEST_ITER;iter++) {
         final FieldData field = fields[nextInt(fields.length)];
         if (Codec.DEBUG) {

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/store/MockRAMDirectory.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/store/MockRAMDirectory.java?rev=889850&r1=889849&r2=889850&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/store/MockRAMDirectory.java
(original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/store/MockRAMDirectory.java
Fri Dec 11 23:10:33 2009
@@ -50,11 +50,11 @@
   // order in which our constructor actually does this
   // member initialization vs when it calls super.  It seems
   // like super is called, then our members are initialized:
-  Map openFiles;
+  Map<String,Integer> openFiles;
 
   private synchronized void init() {
     if (openFiles == null)
-      openFiles = new HashMap();
+      openFiles = new HashMap<String,Integer>();
     if (createdFiles == null)
       createdFiles = new HashSet<String>();
     if (unSyncedFiles == null)
@@ -224,15 +224,6 @@
     return new MockRAMOutputStream(this, file, name);
   }
   
-  static class OpenFile {
-    final String name;
-    final Throwable stack;
-    OpenFile(String name) {
-      this.name = name;
-      this.stack = new Throwable();
-    }
-  }
-
   @Override
   public synchronized IndexInput openInput(String name) throws IOException {
     RAMFile file = fileMap.get(name);
@@ -244,7 +235,7 @@
         v = Integer.valueOf(v.intValue()+1);
         openFiles.put(name, v);
       } else {
-         openFiles.put(name, Integer.valueOf(1));
+        openFiles.put(name, Integer.valueOf(1));
       }
     }
     return new MockRAMInputStream(this, name, file);
@@ -280,14 +271,7 @@
     if (noDeleteOpenFile && openFiles.size() > 0) {
       // RuntimeException instead of IOException because
       // super() does not throw IOException currently:
-        Iterator it = openFiles.values().iterator();
-        System.out.println("\nMockRAMDirectory open files:");
-        while(it.hasNext()) {
-          OpenFile openFile = (OpenFile) it.next();
-          System.out.println("\nfile " + openFile.name + " opened from:\n");
-          openFile.stack.printStackTrace(System.out);
-        }
-        throw new RuntimeException("MockRAMDirectory: cannot close: there are still open
files");
+      throw new RuntimeException("MockRAMDirectory: cannot close: there are still open files");
     }
   }
 



Mime
View raw message