RFR: 8223553: Fix code constructs that do not compile with the Eclipse Java Compiler

Daniel Fuchs daniel.fuchs at oracle.com
Thu May 9 15:23:31 UTC 2019

Hi Christoph,

I'm only commenting on the HttpClient changes, I'll let
others comment on the other changes...


I have a profound dislike for using @SuppressedWarnings, unless
it's the only alternative. My preference would be to introduce
local variables, if that can make the compiler happy, until such time
where the issue is actually resolved...

For instance, it seems that the following would work:

     // Use local variable assignments to keep other java compilers
     // happy and avoid unchecked casts warnings
     BiFunction<Http2Connection, Throwable, CompletableFuture<? extends 
         factory = (h2c, t) -> createExchangeImpl(h2c, t, exchange, 
     Function<CompletableFuture<? extends ExchangeImpl<U>>, 
CompletableFuture<? extends ExchangeImpl<U>>>
         identity = (cf) -> cf;
     return c2f.handle(factory).thenCompose(identity);

best regards,

-- daniel

On 08/05/2019 09:02, Langer, Christoph wrote:
> Hi,
> please review a small change that I’d like to see in OpenJDK to get rid 
> of compilation errors in the Eclipse IDE.
> It seems the root cause for the compilation errors is that javac would 
> sometimes widen capture variables and is hence able to compile the 
> places that I touch here. The EC4J compiler claims that it’s following 
> the spec more strictly and bails out at these places. I had posted about 
> this on compiler-dev but got no reaction [0].
> So, as this seems to be some field of open work for the compiler/spec 
> folks, I’d like to get EC4J quiesced by introducing some slight 
> modifications to the original places which makes the code appeal a bit 
> less elegant and fluent but will get rid of the compile errors.
> Please review:
> Bug: https://bugs.openjdk.java.net/browse/JDK-8223553
> Webrev: http://cr.openjdk.java.net/~clanger/webrevs/8223553.0/
> The modification to 
> src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListMap.java 
> belongs to JSR-166, so I don’t know if it needs some special handling.
> Thanks & Best regards
> Christoph
> [0] 
> https://mail.openjdk.java.net/pipermail/compiler-dev/2019-March/013054.html

More information about the compiler-dev mailing list