You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Shai Erera <se...@gmail.com> on 2010/09/25 22:57:32 UTC

Strange error with IBM Java 5

Hi

I svn upped today (actually saw this few days ago too), and ran 'ant clean'.
Then from lucene/contrib/benchmark I ran 'ant compile' and hit this:

    [javac] An exception has occurred in the compiler (1.5.0). Please file a
bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport)
after
 checking the Bug Parade for duplicates. Include your program and the
following diagnostic in your report.  Thank you.
    [javac] java.lang.AssertionError: {unused}
    [javac]     at
com.sun.tools.javac.tree.TreeMaker$AnnotationBuilder.visitArray(TreeMaker.java:655)
    [javac]     at
com.sun.tools.javac.code.Attribute$Array.accept(Attribute.java:151)
    [javac]     at
com.sun.tools.javac.tree.TreeMaker$AnnotationBuilder.translate(TreeMaker.java:658)

BUILD FAILED

This only happened w/ IBM Java 5, and didn't happen w/ Sun's 5 or IBM/Sun's
6. I've found this related;
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6297416. Searched the
code for "unused" suppresses and found TestPositionIncrement had this
pattern. So I've committed this to trunk (doesn't happen on 3x 'cause the
Suppress isn't there):

Index: lucene/src/test/org/apache/lucene/search/TestPositionIncrement.java
===================================================================
--- lucene/src/test/org/apache/lucene/search/TestPositionIncrement.java
(revision 1001313)
+++ lucene/src/test/org/apache/lucene/search/TestPositionIncrement.java
(working copy)
@@ -287,12 +287,10 @@
       }
       Collection<byte[]> payloads = pspans.getPayload();
       sawZero |= pspans.start() == 0;
-      for (@SuppressWarnings("unused") byte[] bytes : payloads) {
+      for (byte[] bytes : payloads) {
         count++;
-        if (!VERBOSE) {
-          // do nothing
-        } else {
-          System.out.println("  payload: " + new String((byte[]) bytes));
+        if (VERBOSE) {
+          System.out.println("  payload: " + new String(bytes));
         }
       }
     }

BTW, the Suppress was not necessary because the byte[] is used in the print.

FYI in case you run into it one day :).

Shai

RE: Strange error with IBM Java 5

Posted by Uwe Schindler <uw...@thetaphi.de>.
This error also happened with an older Sun javac. This crashed our Hudson
build, too, until we upgraded to latest 1.5 version. But in my opinion, we
should remove any annotation from the extended for-loop. And you are right
the Suppress is no longer needed J

 

-----

Uwe Schindler

H.-H.-Meier-Allee 63, D-28213 Bremen

 <http://www.thetaphi.de/> http://www.thetaphi.de

eMail: uwe@thetaphi.de

 

From: Shai Erera [mailto:serera@gmail.com] 
Sent: Saturday, September 25, 2010 1:58 PM
To: dev@lucene.apache.org
Subject: Strange error with IBM Java 5

 

Hi

I svn upped today (actually saw this few days ago too), and ran 'ant clean'.
Then from lucene/contrib/benchmark I ran 'ant compile' and hit this:

    [javac] An exception has occurred in the compiler (1.5.0). Please file a
bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport)
after
 checking the Bug Parade for duplicates. Include your program and the
following diagnostic in your report.  Thank you.
    [javac] java.lang.AssertionError: {unused}
    [javac]     at
com.sun.tools.javac.tree.TreeMaker$AnnotationBuilder.visitArray(TreeMaker.ja
va:655)
    [javac]     at
com.sun.tools.javac.code.Attribute$Array.accept(Attribute.java:151)
    [javac]     at
com.sun.tools.javac.tree.TreeMaker$AnnotationBuilder.translate(TreeMaker.jav
a:658)

BUILD FAILED

This only happened w/ IBM Java 5, and didn't happen w/ Sun's 5 or IBM/Sun's
6. I've found this related;
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6297416. Searched the
code for "unused" suppresses and found TestPositionIncrement had this
pattern. So I've committed this to trunk (doesn't happen on 3x 'cause the
Suppress isn't there):

Index: lucene/src/test/org/apache/lucene/search/TestPositionIncrement.java
===================================================================
--- lucene/src/test/org/apache/lucene/search/TestPositionIncrement.java
(revision 1001313)
+++ lucene/src/test/org/apache/lucene/search/TestPositionIncrement.java
(working copy)
@@ -287,12 +287,10 @@
       }
       Collection<byte[]> payloads = pspans.getPayload();
       sawZero |= pspans.start() == 0;
-      for (@SuppressWarnings("unused") byte[] bytes : payloads) {
+      for (byte[] bytes : payloads) {
         count++;
-        if (!VERBOSE) {
-          // do nothing
-        } else {
-          System.out.println("  payload: " + new String((byte[]) bytes));
+        if (VERBOSE) {
+          System.out.println("  payload: " + new String(bytes));
         }
       }
     }

BTW, the Suppress was not necessary because the byte[] is used in the print.

FYI in case you run into it one day :).

Shai