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

Reviewed-by: smarks, dfuchs
This commit is contained in:
Christoph Langer 2019-05-24 07:56:29 +01:00
parent 4dd6b687ef
commit fd67f8ee69
3 changed files with 17 additions and 11 deletions

View file

@ -4980,8 +4980,10 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
// Step 1C: determine loop return type. // Step 1C: determine loop return type.
// Step 1D: check other types. // Step 1D: check other types.
final Class<?> loopReturnType = fini.stream().filter(Objects::nonNull).map(MethodHandle::type). // local variable required here; see JDK-8223553
map(MethodType::returnType).findFirst().orElse(void.class); Stream<Class<?>> cstream = fini.stream().filter(Objects::nonNull).map(MethodHandle::type)
.map(MethodType::returnType);
final Class<?> loopReturnType = cstream.findFirst().orElse(void.class);
loopChecks1cd(pred, fini, loopReturnType); loopChecks1cd(pred, fini, loopReturnType);
// Step 2: determine parameter lists. // Step 2: determine parameter lists.

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -872,12 +872,13 @@ public class ManagementFactory {
public static Set<Class<? extends PlatformManagedObject>> public static Set<Class<? extends PlatformManagedObject>>
getPlatformManagementInterfaces() getPlatformManagementInterfaces()
{ {
return platformComponents() // local variable required here; see JDK-8223553
Stream<Class<? extends PlatformManagedObject>> pmos = platformComponents()
.stream() .stream()
.flatMap(pc -> pc.mbeanInterfaces().stream()) .flatMap(pc -> pc.mbeanInterfaces().stream())
.filter(clazz -> PlatformManagedObject.class.isAssignableFrom(clazz)) .filter(clazz -> PlatformManagedObject.class.isAssignableFrom(clazz))
.map(clazz -> clazz.asSubclass(PlatformManagedObject.class)) .map(clazz -> clazz.asSubclass(PlatformManagedObject.class));
.collect(Collectors.toSet()); return pmos.collect(Collectors.toSet());
} }
private static final String NOTIF_EMITTER = private static final String NOTIF_EMITTER =

View file

@ -26,14 +26,15 @@
package jdk.internal.net.http; package jdk.internal.net.http;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import java.util.function.Function;
import java.net.http.HttpClient; import java.net.http.HttpClient;
import java.net.http.HttpResponse; import java.net.http.HttpResponse;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import jdk.internal.net.http.common.Logger; import jdk.internal.net.http.common.Logger;
import jdk.internal.net.http.common.MinimalFuture; import jdk.internal.net.http.common.MinimalFuture;
import jdk.internal.net.http.common.Utils; import jdk.internal.net.http.common.Utils;
import static java.net.http.HttpClient.Version.HTTP_1_1; import static java.net.http.HttpClient.Version.HTTP_1_1;
/** /**
@ -92,8 +93,10 @@ abstract class ExchangeImpl<T> {
CompletableFuture<Http2Connection> c2f = c2.getConnectionFor(request, exchange); CompletableFuture<Http2Connection> c2f = c2.getConnectionFor(request, exchange);
if (debug.on()) if (debug.on())
debug.log("get: Trying to get HTTP/2 connection"); debug.log("get: Trying to get HTTP/2 connection");
return c2f.handle((h2c, t) -> createExchangeImpl(h2c, t, exchange, connection)) // local variable required here; see JDK-8223553
.thenCompose(Function.identity()); CompletableFuture<CompletableFuture<? extends ExchangeImpl<U>>> fxi =
c2f.handle((h2c, t) -> createExchangeImpl(h2c, t, exchange, connection));
return fxi.thenCompose(x->x);
} }
} }