I analyzed this bug a bit more, a second instance of this happens in Solr-Core 
build. This what I found out:

- It only happens on java 9b54 if you have "-source 1.7 -target 1.7", with 
Lucene trunk (where we are on Java 8 and pass "-source 1.8 -target 1.8", it 
does not happen and the exact same code passes compiler).
- The bug happens because the diamond operator is deducted in a different way: 
The actual type of the diamond is deducted from the parameter of the new 
HashMap(Map<?extends K,?extends V> other) constructor's parameters not from the 
return type of the method. Lucene was passing a slightly different type into 
the constructor that was returned from the surrounding method. A fix was to 
explicitly apply the type instead of using a diamond. I can write a sample code 
that reproduces this.

I fixed this with a workaround in http://svn.apache.org/r1667784

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: [email protected]


> -----Original Message-----
> From: Uwe Schindler [mailto:[email protected]]
> Sent: Thursday, March 19, 2015 3:30 PM
> To: [email protected]
> Cc: [email protected]; Dalibor Topic; Balchandra Vaidya
> Subject: RE: [JENKINS] Lucene-Solr-5.x-Linux (32bit/jdk1.9.0-ea-b54) - Build #
> 11848 - Failure!
> 
> 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?
> 
> Uwe
> 
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: [email protected]
> 
> 
> > -----Original Message-----
> > From: Policeman Jenkins Server [mailto:[email protected]]
> > Sent: Thursday, March 19, 2015 1:15 PM
> > To: [email protected]
> > 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/hunsp
> > 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/hunsp
> > 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
> >
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected] For additional
> commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to