I think this one should be filed as a separate issue.

On 24.03.2015 14:07, Uwe Schindler wrote:
Hi,

could you please attach the given Bug2.java file to the same issue? This is another 
variant of the same bug that affects simple method calls (without diamond), so it is not 
only the constructor with diamond affected. You have to infer the type for those 
"wrapper" methods, too.

The following code does not compile with -source/target 1.7:

import java.util.*;

class Bug2 {
   /* This method just emulates the common Google Guava/Guice pattern to wrap 
collections, e.g.
    * 
<http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/collect/Iterators.html#peekingIterator(java.util.Iterator)>
    */
   static <V> Set<V> asSet(Collection<? extends V> collection) {
     return new HashSet<V>(collection);
   }

   // this causes the bug -> type is inferred by parameter not left side 
assignment
   static <V> void bug(Collection<? extends V> collection) {
     Set<V> set1 = Bug2.asSet(collection);
     // workaround that compiles:
     Set<V> set2 = Bug2.<V>asSet(collection);
   }
}

$ javac -source 1.7 -target 1.7 Bug2.java
warning: [options] bootstrap class path not set in conjunction with -source 1.7
Bug2.java:12: error: incompatible types: Set<CAP#1> cannot be converted to 
Set<V>
     Set<V> set = Bug2.asSet(collection);
                            ^
   where V is a type-variable:
     V extends Object declared in method <V>bug(Collection<? extends V>)
   where CAP#1 is a fresh type-variable:
     CAP#1 extends V from capture of ? extends V
1 error
1 warning

This type was discovered by the elasticsearch people, who use a lot of code of 
Google Guava/Guice that has a lot of static methods that wrap collections and 
return views of a different type.
Usage of most of the Methods in e.g. com.google.common.collect.Iterators or 
com.google.common.collect.Lists and similars are affected by this bug, so it's 
really serious!

To work around the bug you can do whats written in the example code: Just infer the 
generics using the <T> between static class name and method name [like the common 
pattern Arrays.<String>asList (....)].

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: u...@thetaphi.de


-----Original Message-----
From: Uwe Schindler [mailto:u...@thetaphi.de]
Sent: Tuesday, March 24, 2015 10:05 AM
To: 'Balchandra Vaidya'; 'Rory O'Donnell'; dev@lucene.apache.org
Cc: 'Dalibor Topic'; rcm...@gmail.com
Subject: RE: [JENKINS] Lucene-Solr-5.x-Linux (32bit/jdk1.9.0-ea-b54) - Build #
11848 - Failure!

Hi,

Many thanks! I CCed Robert Muir from Elasticsearch who took care of this at
ES (https://github.com/elastic/elasticsearch/issues/10145).

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: u...@thetaphi.de


-----Original Message-----
From: Balchandra Vaidya [mailto:balchandra.vai...@oracle.com]
Sent: Tuesday, March 24, 2015 8:27 AM
To: Uwe Schindler; 'Rory O'Donnell'; dev@lucene.apache.org
Cc: 'Dalibor Topic'
Subject: Re: [JENKINS] Lucene-Solr-5.x-Linux (32bit/jdk1.9.0-ea-b54) -
Build #
11848 - Failure!


Hi Uwe,

JBS bug id is https://bugs.openjdk.java.net/browse/JDK-8075793

Thanks
Balchandra

On 3/24/2015 5:57 AM, Uwe Schindler wrote:
Hi Rory,

do you have an update on this bug?  Searched for it in the openjdk
bugtracker but did not find it. This also affects lots of code from
Google Guava / Guice and because of that also our friends at Elasticsearch.

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de
eMail: u...@thetaphi.de


-----Original Message-----
From: Rory O'Donnell [mailto:rory.odonn...@oracle.com]
Sent: Friday, March 20, 2015 10:00 AM
To: Uwe Schindler; dev@lucene.apache.org
Cc: rory.odonn...@oracle.com; 'Dalibor Topic'; 'Balchandra Vaidya'
Subject: Re: [JENKINS] Lucene-Solr-5.x-Linux (32bit/jdk1.9.0-ea-b54)
- Build #
11848 - Failure!

Thanks Uwe, we will update you with the bug id .

Rgds,Rory
On 19/03/2015 16:28, Uwe Schindler wrote:
Hi,

I opened Review ID: JI-9019884 "Java 9 b54 breaks compiling code
with
source/target 1.7 and diamond operator"
Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de
eMail: u...@thetaphi.de


-----Original Message-----
From: Rory O'Donnell [mailto:rory.odonn...@oracle.com]
Sent: Thursday, March 19, 2015 4:12 PM
To: Uwe Schindler; dev@lucene.apache.org
Cc: rory.odonn...@oracle.com; Dalibor Topic; Balchandra Vaidya
Subject: Re: [JENKINS] Lucene-Solr-5.x-Linux (32bit/jdk1.9.0-ea-b54)
- Build #
11848 - Failure!


On 19/03/2015 14:30, Uwe Schindler wrote:
Hi,

this seems to be a bug (or feature?) in the most recent Java 9 build
54:

compile-core:
        [mkdir] Created dir: /home/jenkins/workspace/Lucene-Solr-5.x-
Linux/lucene/build/analysis/common/classes/java
        [javac] Compiling 461 source files to
/home/jenkins/workspace/Lucene-
Solr-5.x-Linux/lucene/build/analysis/common/classes/java
        [javac] /home/jenkins/workspace/Lucene-Solr-5.x-

Linux/lucene/analysis/common/src/java/org/apache/lucene/analysis/util
/Ch
arArrayMap.java:568: error: incompatible types:
CharArrayMap<CAP#1>
cannot be converted to CharArrayMap<V>
        [javac]     return new CharArrayMap<>(map, false);
        [javac]            ^
        [javac]   where V is a type-variable:
        [javac]     V extends Object declared in method
<V>copy(Map<?,?
extends V>)
        [javac]   where CAP#1 is a fresh type-variable:
        [javac]     CAP#1 extends V from capture of ? extends V

This is the code:

      @SuppressWarnings("unchecked")
      public static <V> CharArrayMap<V> copy(final Map<?,? extends
V>
map)
{
        if(map == EMPTY_MAP)
          return emptyMap();
        if(map instanceof CharArrayMap) {
          CharArrayMap<V> m = (CharArrayMap<V>) map;
          // use fast path instead of iterating all values
          // this is even on very small sets ~10 times faster than iterating
          final char[][] keys = new char[m.keys.length][];
          System.arraycopy(m.keys, 0, keys, 0, keys.length);
          final V[] values = (V[]) new Object[m.values.length];
          System.arraycopy(m.values, 0, values, 0, values.length);
          m = new CharArrayMap<>(m);
          m.keys = keys;
          m.values = values;
          return m;
        }
        return new CharArrayMap<>(map, false);
      }

At least this breaks compiling existing code. Rory, should I open a
bug
report with an example code?
Hi Uwe,

Please do log a bug.

Rgds,Rory
Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de
eMail: u...@thetaphi.de


-----Original Message-----
From: Policeman Jenkins Server [mailto:jenk...@thetaphi.de]
Sent: Thursday, March 19, 2015 1:15 PM
To: dev@lucene.apache.org
Subject: [JENKINS] Lucene-Solr-5.x-Linux (32bit/jdk1.9.0-ea-b54) -
Build #
11848 - Failure!

Build: http://jenkins.thetaphi.de/job/Lucene-Solr-5.x-
Linux/11848/
Java: 32bit/jdk1.9.0-ea-b54 -server -XX:+UseConcMarkSweepGC

All tests passed

Build Log:
[...truncated 1899 lines...]
        [javac] Compiling 461 source files to
/home/jenkins/workspace/Lucene- Solr-5.x-
Linux/lucene/build/analysis/common/classes/java
        [javac] /home/jenkins/workspace/Lucene-Solr-5.x-


Linux/lucene/analysis/common/src/java/org/apache/lucene/analysis/util
/Ch
arArrayMap.java:568: error: incompatible types:
CharArrayMap<CAP#1>
cannot be converted to CharArrayMap<V>
        [javac]     return new CharArrayMap<>(map, false);
        [javac]            ^
        [javac]   where V is a type-variable:
        [javac]     V extends Object declared in method
<V>copy(Map<?,?
extends
V>)
        [javac]   where CAP#1 is a fresh type-variable:
        [javac]     CAP#1 extends V from capture of ? extends V
        [javac] /home/jenkins/workspace/Lucene-Solr-5.x-


Linux/lucene/analysis/common/src/java/org/apache/lucene/analysis/huns
p
ell/Stemmer.java:270: warning: [rawtypes] found raw type: Arc
        [javac]   final FST.Arc<IntsRef> prefixArcs[] = new FST.Arc[3];
        [javac]                                                ^
        [javac]   missing type arguments for generic class Arc<T>
        [javac]   where T is a type-variable:
        [javac]     T extends Object declared in class Arc
        [javac] /home/jenkins/workspace/Lucene-Solr-5.x-


Linux/lucene/analysis/common/src/java/org/apache/lucene/analysis/huns
p
ell/Stemmer.java:274: warning: [rawtypes] found raw type: Arc
        [javac]   final FST.Arc<IntsRef> suffixArcs[] = new FST.Arc[3];
        [javac]                                                ^
        [javac]   missing type arguments for generic class Arc<T>
        [javac]   where T is a type-variable:
        [javac]     T extends Object declared in class Arc
        [javac] /home/jenkins/workspace/Lucene-Solr-5.x-



Linux/lucene/analysis/common/src/java/org/tartarus/snowball/Among.java:
46: warning: [rawtypes] found raw type: Class
        [javac]   private static final Class<?>[] EMPTY_PARAMS = new
Class[0];
        [javac]                                                      ^
        [javac]   missing type arguments for generic class Class<T>
        [javac]   where T is a type-variable:
        [javac]     T extends Object declared in class Class
        [javac] Note: Some input files use or override a deprecated
API.
        [javac] Note: Recompile with -Xlint:deprecation for details.
        [javac] 1 error

[...truncated 1 lines...]
BUILD FAILED
/home/jenkins/workspace/Lucene-Solr-5.x-Linux/build.xml:529:
The
following error occurred while executing this line:
/home/jenkins/workspace/Lucene-Solr-5.x-Linux/build.xml:477:
The
following error occurred while executing this line:
/home/jenkins/workspace/Lucene-Solr-5.x-Linux/build.xml:61:
The
following error occurred while executing this line:
/home/jenkins/workspace/Lucene-Solr-5.x-Linux/extra-
targets.xml:39:
The following error occurred while executing this line:
/home/jenkins/workspace/Lucene-Solr-5.x-
Linux/lucene/build.xml:456:
The following error occurred while executing this line:
/home/jenkins/workspace/Lucene-Solr-5.x-
Linux/lucene/common-
build.xml:2166: The following error occurred while executing this
line:
/home/jenkins/workspace/Lucene-Solr-5.x-
Linux/lucene/analysis/build.xml:106: The following error occurred
while executing this line:
/home/jenkins/workspace/Lucene-Solr-5.x-
Linux/lucene/analysis/build.xml:38: The following error occurred
while executing this line:
/home/jenkins/workspace/Lucene-Solr-5.x-Linux/lucene/module-
build.xml:58: The following error occurred while executing this line:
/home/jenkins/workspace/Lucene-Solr-5.x-Linux/lucene/module-
build.xml:55: The following error occurred while executing this line:
/home/jenkins/workspace/Lucene-Solr-5.x-
Linux/lucene/common-
build.xml:520: The following error occurred while executing this
line:
/home/jenkins/workspace/Lucene-Solr-5.x-
Linux/lucene/common-
build.xml:1882: Compile failed; see the compiler error output for
details.
Total time: 15 minutes 25 seconds
Build step 'Invoke Ant' marked build as failure [description-setter]
Description set: Java: 32bit/jdk1.9.0-ea-b54 -server -
XX:+UseConcMarkSweepGC Archiving artifacts Recording test
results
Email was triggered for: Failure - Any Sending email for trigger:
Failure - Any

--
Rgds,Rory O'Donnell
Quality Engineering Manager
Oracle EMEA , Dublin, Ireland


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org
--
Rgds,Rory O'Donnell
Quality Engineering Manager
Oracle EMEA , Dublin, Ireland


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

--
<http://www.oracle.com> Dalibor Topic | Principal Product Manager
Phone: +494089091214 <tel:+494089091214> | Mobile: +491737185961
<tel:+491737185961>

ORACLE Deutschland B.V. & Co. KG | Kühnehöfe 5 | 22761 Hamburg

ORACLE Deutschland B.V. & Co. KG
Hauptverwaltung: Riesstr. 25, D-80992 München
Registergericht: Amtsgericht München, HRA 95603
Geschäftsführer: Jürgen Kunz

Komplementärin: ORACLE Deutschland Verwaltung B.V.
Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
Geschäftsführer: Alexander van der Ven, Astrid Kepper, Val Maher

<http://www.oracle.com/commitment> Oracle is committed to developing
practices and products that help protect the environment

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to