This commit is contained in:
Jesper Wilhelmsson 2019-01-14 23:05:26 +01:00
commit 528bc73ca4
51 changed files with 355 additions and 233 deletions

View file

@ -3419,8 +3419,8 @@ public final class Class<T> implements java.io.Serializable,
StringBuilder sb = new StringBuilder();
sb.append(getName() + "." + name + "(");
if (argTypes != null) {
Stream.of(argTypes).map(c -> {return (c == null) ? "null" : c.getName();}).
collect(Collectors.joining(","));
sb.append(Stream.of(argTypes).map(c -> {return (c == null) ? "null" : c.getName();}).
collect(Collectors.joining(",")));
}
sb.append(")");
return sb.toString();

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -1864,35 +1864,6 @@ public abstract class VarHandle implements Constable {
}
}
/**
* Compare this {@linkplain VarHandle} with another object for equality.
* Two {@linkplain VarHandle}s are considered equal if they both describe the
* same instance field, both describe the same static field, both describe
* array elements for arrays with the same component type, or both describe
* the same component of an off-heap structure.
*
* @param o the other object
* @return Whether this {@linkplain VarHandle} is equal to the other object
*/
@Override
public final boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
VarHandle that = (VarHandle) o;
return accessModeType(AccessMode.GET).equals(that.accessModeType(AccessMode.GET)) &&
internalEquals(that);
}
abstract boolean internalEquals(VarHandle vh);
@Override
public final int hashCode() {
return 31 * accessModeType(AccessMode.GET).hashCode() + internalHashCode();
}
abstract int internalHashCode();
/**
* Returns a compact textual description of this {@linkplain VarHandle},
* including the type of variable described, and a description of its coordinates.

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -63,17 +63,6 @@ final class VarHandle$Type$s {
return accessMode.at.accessModeType(receiverType, {#if[Object]?fieldType:$type$.class});
}
@Override
final boolean internalEquals(VarHandle vh) {
FieldInstanceReadOnly that = (FieldInstanceReadOnly) vh;
return fieldOffset == that.fieldOffset;
}
@Override
final int internalHashCode() {
return Long.hashCode(fieldOffset);
}
@Override
public Optional<VarHandleDesc> describeConstable() {
var receiverTypeRef = receiverType.describeConstable();
@ -349,17 +338,6 @@ final class VarHandle$Type$s {
#end[Object]
}
@Override
final boolean internalEquals(VarHandle vh) {
FieldStaticReadOnly that = (FieldStaticReadOnly) vh;
return base == that.base && fieldOffset == that.fieldOffset;
}
@Override
final int internalHashCode() {
return 31 * Long.hashCode(fieldOffset) + base.hashCode();
}
@Override
public Optional<VarHandleDesc> describeConstable() {
var fieldTypeRef = {#if[Object]?fieldType:$type$.class}.describeConstable();
@ -639,20 +617,6 @@ final class VarHandle$Type$s {
#end[Object]
}
@Override
final boolean internalEquals(VarHandle vh) {
// Equality of access mode types of AccessMode.GET is sufficient for
// equality checks
return true;
}
@Override
final int internalHashCode() {
// The hash code of the access mode types of AccessMode.GET is
// sufficient for hash code generation
return 0;
}
@Override
public Optional<VarHandleDesc> describeConstable() {
var arrayTypeRef = {#if[Object]?arrayType:$type$[].class}.describeConstable();

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -67,17 +67,6 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
super(form);
this.be = be;
}
@Override
final boolean internalEquals(VarHandle vh) {
ByteArrayViewVarHandle that = (ByteArrayViewVarHandle) vh;
return be == that.be;
}
@Override
final int internalHashCode() {
return Boolean.hashCode(be);
}
}
static final class ArrayHandle extends ByteArrayViewVarHandle {

View file

@ -31,8 +31,6 @@ import javax.net.ssl.SSLEngineResult.HandshakeStatus;
* Ciphertext
*/
final class Ciphertext {
static final Ciphertext CIPHERTEXT_NULL = new Ciphertext();
final byte contentType;
final byte handshakeType;
final long recordSN;

View file

@ -247,6 +247,19 @@ final class SSLEngineImpl extends SSLEngine implements SSLTransport {
hsStatus = ciphertext.handshakeStatus;
} else {
hsStatus = getHandshakeStatus();
if (ciphertext == null && !conContext.isNegotiated &&
conContext.isInboundClosed() &&
hsStatus == HandshakeStatus.NEED_WRAP) {
// Even the outboud is open, no futher data could be wrapped as:
// 1. the outbound is empty
// 2. no negotiated connection
// 3. the inbound has closed, cannot complete the handshake
//
// Mark the engine as closed if the handshake status is
// NEED_WRAP. Otherwise, it could lead to dead loops in
// applications.
status = Status.CLOSED;
}
}
int deltaSrcs = srcsRemains;
@ -279,7 +292,7 @@ final class SSLEngineImpl extends SSLEngine implements SSLTransport {
}
if (ciphertext == null) {
return Ciphertext.CIPHERTEXT_NULL;
return null;
}
// Is the handshake completed?

View file

@ -577,13 +577,7 @@ class TransportContext implements ConnectionContext {
} else if (!isOutboundClosed()) {
// Special case that the inbound was closed, but outbound open.
return HandshakeStatus.NEED_WRAP;
}
} else if (isOutboundClosed() && !isInboundClosed()) {
// Special case that the outbound was closed, but inbound open.
return HandshakeStatus.NEED_UNWRAP;
} else if (!isOutboundClosed() && isInboundClosed()) {
// Special case that the inbound was closed, but outbound open.
return HandshakeStatus.NEED_WRAP;
} // Otherwise, both inbound and outbound are closed.
}
return HandshakeStatus.NOT_HANDSHAKING;