mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
Merge
This commit is contained in:
commit
776ef6a071
381 changed files with 8349 additions and 3043 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1994, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1994, 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
|
||||
|
@ -3420,8 +3420,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();
|
||||
|
|
|
@ -1864,12 +1864,12 @@ public abstract class ClassLoader {
|
|||
* <p> The default system class loader is an implementation-dependent
|
||||
* instance of this class.
|
||||
*
|
||||
* <p> If the system property "{@code java.system.class.loader}" is defined
|
||||
* when this method is first invoked then the value of that property is
|
||||
* taken to be the name of a class that will be returned as the system
|
||||
* class loader. The class is loaded using the default system class loader
|
||||
* and must define a public constructor that takes a single parameter of
|
||||
* type {@code ClassLoader} which is used as the delegation parent. An
|
||||
* <p> If the system property "{@systemProperty java.system.class.loader}"
|
||||
* is defined when this method is first invoked then the value of that
|
||||
* property is taken to be the name of a class that will be returned as the
|
||||
* system class loader. The class is loaded using the default system class
|
||||
* loader and must define a public constructor that takes a single parameter
|
||||
* of type {@code ClassLoader} which is used as the delegation parent. An
|
||||
* instance is then created using this constructor with the default system
|
||||
* class loader as the parameter. The resulting class loader is defined
|
||||
* to be the system class loader. During construction, the class loader
|
||||
|
|
|
@ -664,7 +664,7 @@ public final class String
|
|||
* object.
|
||||
*/
|
||||
public int length() {
|
||||
return isLatin1() ? value.length : value.length >> UTF16;
|
||||
return value.length >> coder();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2813,8 +2813,7 @@ public final class String
|
|||
* lines are then concatenated and returned.
|
||||
* <p>
|
||||
* If {@code n > 0} then {@code n} spaces (U+0020) are inserted at the
|
||||
* beginning of each line. {@link String#isBlank() Blank lines} are
|
||||
* unaffected.
|
||||
* beginning of each line.
|
||||
* <p>
|
||||
* If {@code n < 0} then up to {@code n}
|
||||
* {@link Character#isWhitespace(int) white space characters} are removed
|
||||
|
@ -2849,7 +2848,7 @@ public final class String
|
|||
: lines();
|
||||
if (n > 0) {
|
||||
final String spaces = " ".repeat(n);
|
||||
stream = stream.map(s -> s.isBlank() ? s : spaces + s);
|
||||
stream = stream.map(s -> spaces + s);
|
||||
} else if (n == Integer.MIN_VALUE) {
|
||||
stream = stream.map(s -> s.stripLeading());
|
||||
} else if (n < 0) {
|
||||
|
@ -2868,120 +2867,13 @@ public final class String
|
|||
: StringUTF16.lastIndexOfNonWhitespace(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes vertical and horizontal white space margins from around the
|
||||
* essential body of a multi-line string, while preserving relative
|
||||
* indentation.
|
||||
* <p>
|
||||
* This string is first conceptually separated into lines as if by
|
||||
* {@link String#lines()}.
|
||||
* <p>
|
||||
* Then, the <i>minimum indentation</i> (min) is determined as follows. For
|
||||
* each non-blank line (as defined by {@link String#isBlank()}), the
|
||||
* leading {@link Character#isWhitespace(int) white space} characters are
|
||||
* counted. The <i>min</i> value is the smallest of these counts.
|
||||
* <p>
|
||||
* For each non-blank line, <i>min</i> leading white space characters are
|
||||
* removed. Each white space character is treated as a single character. In
|
||||
* particular, the tab character {@code "\t"} (U+0009) is considered a
|
||||
* single character; it is not expanded.
|
||||
* <p>
|
||||
* Leading and trailing blank lines, if any, are removed. Trailing spaces are
|
||||
* preserved.
|
||||
* <p>
|
||||
* Each line is suffixed with a line feed character {@code "\n"} (U+000A).
|
||||
* <p>
|
||||
* Finally, the lines are concatenated into a single string and returned.
|
||||
*
|
||||
* @apiNote
|
||||
* This method's primary purpose is to shift a block of lines as far as
|
||||
* possible to the left, while preserving relative indentation. Lines
|
||||
* that were indented the least will thus have no leading white space.
|
||||
*
|
||||
* Example:
|
||||
* <blockquote><pre>
|
||||
* `
|
||||
* This is the first line
|
||||
* This is the second line
|
||||
* `.align();
|
||||
*
|
||||
* returns
|
||||
* This is the first line
|
||||
* This is the second line
|
||||
* </pre></blockquote>
|
||||
*
|
||||
* @return string with margins removed and line terminators normalized
|
||||
*
|
||||
* @see String#lines()
|
||||
* @see String#isBlank()
|
||||
* @see String#indent(int)
|
||||
* @see Character#isWhitespace(int)
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
public String align() {
|
||||
return align(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes vertical and horizontal white space margins from around the
|
||||
* essential body of a multi-line string, while preserving relative
|
||||
* indentation and with optional indentation adjustment.
|
||||
* <p>
|
||||
* Invoking this method is equivalent to:
|
||||
* <blockquote>
|
||||
* {@code this.align().indent(n)}
|
||||
* </blockquote>
|
||||
*
|
||||
* @apiNote
|
||||
* Examples:
|
||||
* <blockquote><pre>
|
||||
* `
|
||||
* This is the first line
|
||||
* This is the second line
|
||||
* `.align(0);
|
||||
*
|
||||
* returns
|
||||
* This is the first line
|
||||
* This is the second line
|
||||
*
|
||||
*
|
||||
* `
|
||||
* This is the first line
|
||||
* This is the second line
|
||||
* `.align(4);
|
||||
* returns
|
||||
* This is the first line
|
||||
* This is the second line
|
||||
* </pre></blockquote>
|
||||
*
|
||||
* @param n number of leading white space characters
|
||||
* to add or remove
|
||||
*
|
||||
* @return string with margins removed, indentation adjusted and
|
||||
* line terminators normalized
|
||||
*
|
||||
* @see String#align()
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
public String align(int n) {
|
||||
if (isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
int outdent = lines().filter(not(String::isBlank))
|
||||
.mapToInt(String::indexOfNonWhitespace)
|
||||
.min()
|
||||
.orElse(0);
|
||||
// overflow-conscious code
|
||||
int indent = n - outdent;
|
||||
return indent(indent > n ? Integer.MIN_VALUE : indent, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method allows the application of a function to {@code this}
|
||||
* string. The function should expect a single String argument
|
||||
* and produce an {@code R} result.
|
||||
* <p>
|
||||
* Any exception thrown by {@code f()} will be propagated to the
|
||||
* caller.
|
||||
*
|
||||
* @param f functional interface to a apply
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 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
|
||||
|
@ -97,7 +97,10 @@ public interface ClassDesc
|
|||
*/
|
||||
static ClassDesc of(String packageName, String className) {
|
||||
ConstantUtils.validateBinaryClassName(requireNonNull(packageName));
|
||||
validateMemberName(requireNonNull(className));
|
||||
if (packageName.isEmpty()) {
|
||||
return of(className);
|
||||
}
|
||||
validateMemberName(requireNonNull(className), false);
|
||||
return ofDescriptor(String.format("L%s%s%s;",
|
||||
binaryToInternal(packageName),
|
||||
(packageName.length() > 0 ? "/" : ""),
|
||||
|
@ -130,6 +133,9 @@ public interface ClassDesc
|
|||
*/
|
||||
static ClassDesc ofDescriptor(String descriptor) {
|
||||
requireNonNull(descriptor);
|
||||
if (descriptor.isEmpty()) {
|
||||
throw new IllegalArgumentException(String.format("not a valid reference type descriptor: %s", descriptor));
|
||||
}
|
||||
int depth = ConstantUtils.arrayDepth(descriptor);
|
||||
if (depth > ConstantUtils.MAX_ARRAY_TYPE_DESC_DIMENSIONS) {
|
||||
throw new IllegalArgumentException(String.format("Cannot create an array type descriptor with more than %d dimensions",
|
||||
|
@ -192,7 +198,7 @@ public interface ClassDesc
|
|||
* @throws IllegalArgumentException if the nested class name is invalid
|
||||
*/
|
||||
default ClassDesc nested(String nestedName) {
|
||||
validateMemberName(nestedName);
|
||||
validateMemberName(nestedName, false);
|
||||
if (!isClassOrInterface())
|
||||
throw new IllegalStateException("Outer class is not a class or interface type");
|
||||
return ClassDesc.ofDescriptor(String.format("%s$%s;", dropLastChar(descriptorString()), nestedName));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 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
|
||||
|
@ -65,7 +65,7 @@ class ConstantUtils {
|
|||
* @return the name passed if valid
|
||||
* @throws IllegalArgumentException if the member name is invalid
|
||||
*/
|
||||
public static String validateMemberName(String name) {
|
||||
public static String validateMemberName(String name, boolean method) {
|
||||
requireNonNull(name);
|
||||
if (name.length() == 0)
|
||||
throw new IllegalArgumentException("zero-length member name");
|
||||
|
@ -73,7 +73,7 @@ class ConstantUtils {
|
|||
char ch = name.charAt(i);
|
||||
if (ch == '.' || ch == ';' || ch == '[' || ch == '/')
|
||||
throw new IllegalArgumentException("Invalid member name: " + name);
|
||||
if (ch == '<' || ch == '>') {
|
||||
if (method && (ch == '<' || ch == '>')) {
|
||||
if (!pointyNames.contains(name))
|
||||
throw new IllegalArgumentException("Invalid member name: " + name);
|
||||
}
|
||||
|
@ -126,8 +126,8 @@ class ConstantUtils {
|
|||
|
||||
++cur; // skip '('
|
||||
while (cur < end && descriptor.charAt(cur) != ')') {
|
||||
int len = matchSig(descriptor, cur, end);
|
||||
if (len == 0 || descriptor.charAt(cur) == 'V')
|
||||
int len = skipOverFieldSignature(descriptor, cur, end, false);
|
||||
if (len == 0)
|
||||
throw new IllegalArgumentException("Bad method descriptor: " + descriptor);
|
||||
ptypes.add(descriptor.substring(cur, cur + len));
|
||||
cur += len;
|
||||
|
@ -136,41 +136,103 @@ class ConstantUtils {
|
|||
throw new IllegalArgumentException("Bad method descriptor: " + descriptor);
|
||||
++cur; // skip ')'
|
||||
|
||||
int rLen = matchSig(descriptor, cur, end);
|
||||
int rLen = skipOverFieldSignature(descriptor, cur, end, true);
|
||||
if (rLen == 0 || cur + rLen != end)
|
||||
throw new IllegalArgumentException("Bad method descriptor: " + descriptor);
|
||||
ptypes.add(0, descriptor.substring(cur, cur + rLen));
|
||||
return ptypes;
|
||||
}
|
||||
|
||||
private static final char JVM_SIGNATURE_ARRAY = '[';
|
||||
private static final char JVM_SIGNATURE_BYTE = 'B';
|
||||
private static final char JVM_SIGNATURE_CHAR = 'C';
|
||||
private static final char JVM_SIGNATURE_CLASS = 'L';
|
||||
private static final char JVM_SIGNATURE_ENDCLASS = ';';
|
||||
private static final char JVM_SIGNATURE_ENUM = 'E';
|
||||
private static final char JVM_SIGNATURE_FLOAT = 'F';
|
||||
private static final char JVM_SIGNATURE_DOUBLE = 'D';
|
||||
private static final char JVM_SIGNATURE_FUNC = '(';
|
||||
private static final char JVM_SIGNATURE_ENDFUNC = ')';
|
||||
private static final char JVM_SIGNATURE_INT = 'I';
|
||||
private static final char JVM_SIGNATURE_LONG = 'J';
|
||||
private static final char JVM_SIGNATURE_SHORT = 'S';
|
||||
private static final char JVM_SIGNATURE_VOID = 'V';
|
||||
private static final char JVM_SIGNATURE_BOOLEAN = 'Z';
|
||||
|
||||
/**
|
||||
* Validates that the characters at [start, end) within the provided string
|
||||
* describe a valid field type descriptor.
|
||||
*
|
||||
* @param str the descriptor string
|
||||
* @param descriptor the descriptor string
|
||||
* @param start the starting index into the string
|
||||
* @param end the ending index within the string
|
||||
* @param voidOK is void acceptable?
|
||||
* @return the length of the descriptor, or 0 if it is not a descriptor
|
||||
* @throws IllegalArgumentException if the descriptor string is not valid
|
||||
*/
|
||||
static int matchSig(String str, int start, int end) {
|
||||
if (start >= end || start >= str.length() || end > str.length())
|
||||
return 0;
|
||||
char c = str.charAt(start);
|
||||
if (c == 'L') {
|
||||
int endc = str.indexOf(';', start);
|
||||
int badc = str.indexOf('.', start);
|
||||
if (badc >= 0 && badc < endc)
|
||||
return 0;
|
||||
badc = str.indexOf('[', start);
|
||||
if (badc >= 0 && badc < endc)
|
||||
return 0;
|
||||
return (endc < 0) ? 0 : endc - start + 1;
|
||||
} else if (c == '[') {
|
||||
int t = matchSig(str, start+1, end);
|
||||
return (t > 0) ? t + 1 : 0;
|
||||
} else {
|
||||
return ("IJCSBFDZV".indexOf(c) >= 0) ? 1 : 0;
|
||||
@SuppressWarnings("fallthrough")
|
||||
static int skipOverFieldSignature(String descriptor, int start, int end, boolean voidOK) {
|
||||
int arrayDim = 0;
|
||||
int index = start;
|
||||
while (index < end) {
|
||||
switch (descriptor.charAt(index)) {
|
||||
case JVM_SIGNATURE_VOID: if (!voidOK) { return index; }
|
||||
case JVM_SIGNATURE_BOOLEAN:
|
||||
case JVM_SIGNATURE_BYTE:
|
||||
case JVM_SIGNATURE_CHAR:
|
||||
case JVM_SIGNATURE_SHORT:
|
||||
case JVM_SIGNATURE_INT:
|
||||
case JVM_SIGNATURE_FLOAT:
|
||||
case JVM_SIGNATURE_LONG:
|
||||
case JVM_SIGNATURE_DOUBLE:
|
||||
return index - start + 1;
|
||||
case JVM_SIGNATURE_CLASS:
|
||||
// Skip leading 'L' and ignore first appearance of ';'
|
||||
index++;
|
||||
int indexOfSemi = descriptor.indexOf(';', index);
|
||||
if (indexOfSemi != -1) {
|
||||
String unqualifiedName = descriptor.substring(index, indexOfSemi);
|
||||
boolean legal = verifyUnqualifiedClassName(unqualifiedName);
|
||||
if (!legal) {
|
||||
return 0;
|
||||
}
|
||||
return index - start + unqualifiedName.length() + 1;
|
||||
}
|
||||
return 0;
|
||||
case JVM_SIGNATURE_ARRAY:
|
||||
arrayDim++;
|
||||
if (arrayDim > MAX_ARRAY_TYPE_DESC_DIMENSIONS) {
|
||||
throw new IllegalArgumentException(String.format("Cannot create an array type descriptor with more than %d dimensions",
|
||||
ConstantUtils.MAX_ARRAY_TYPE_DESC_DIMENSIONS));
|
||||
}
|
||||
// The rest of what's there better be a legal descriptor
|
||||
index++;
|
||||
voidOK = false;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static boolean verifyUnqualifiedClassName(String name) {
|
||||
for (int index = 0; index < name.length(); index++) {
|
||||
char ch = name.charAt(index);
|
||||
if (ch < 128) {
|
||||
if (ch == '.' || ch == ';' || ch == '[' ) {
|
||||
return false; // do not permit '.', ';', or '['
|
||||
}
|
||||
if (ch == '/') {
|
||||
// check for '//' or leading or trailing '/' which are not legal
|
||||
// unqualified name must not be empty
|
||||
if (index == 0 || index + 1 >= name.length() || name.charAt(index + 1) == '/') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
index ++;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 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
|
||||
|
@ -68,7 +68,7 @@ final class DirectMethodHandleDescImpl implements DirectMethodHandleDesc {
|
|||
|
||||
requireNonNull(kind);
|
||||
validateClassOrInterface(requireNonNull(owner));
|
||||
validateMemberName(requireNonNull(name));
|
||||
validateMemberName(requireNonNull(name), true);
|
||||
requireNonNull(type);
|
||||
|
||||
switch (kind) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 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
|
||||
|
@ -75,7 +75,7 @@ public class DynamicCallSiteDesc {
|
|||
String invocationName,
|
||||
MethodTypeDesc invocationType,
|
||||
ConstantDesc[] bootstrapArgs) {
|
||||
this.invocationName = validateMemberName(requireNonNull(invocationName));
|
||||
this.invocationName = validateMemberName(requireNonNull(invocationName), true);
|
||||
this.invocationType = requireNonNull(invocationType);
|
||||
this.bootstrapMethod = requireNonNull(bootstrapMethod);
|
||||
this.bootstrapArgs = requireNonNull(bootstrapArgs.clone());
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 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
|
||||
|
@ -96,7 +96,7 @@ public abstract class DynamicConstantDesc<T>
|
|||
ClassDesc constantType,
|
||||
ConstantDesc... bootstrapArgs) {
|
||||
this.bootstrapMethod = requireNonNull(bootstrapMethod);
|
||||
this.constantName = validateMemberName(requireNonNull(constantName));
|
||||
this.constantName = validateMemberName(requireNonNull(constantName), true);
|
||||
this.constantType = requireNonNull(constantType);
|
||||
this.bootstrapArgs = requireNonNull(bootstrapArgs).clone();
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 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
|
||||
|
@ -49,7 +49,7 @@ final class ReferenceClassDescImpl implements ClassDesc {
|
|||
*/
|
||||
ReferenceClassDescImpl(String descriptor) {
|
||||
requireNonNull(descriptor);
|
||||
int len = ConstantUtils.matchSig(descriptor, 0, descriptor.length());
|
||||
int len = ConstantUtils.skipOverFieldSignature(descriptor, 0, descriptor.length(), false);
|
||||
if (len == 0 || len == 1
|
||||
|| len != descriptor.length())
|
||||
throw new IllegalArgumentException(String.format("not a valid reference type descriptor: %s", descriptor));
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -304,7 +304,7 @@ public final class URL implements java.io.Serializable {
|
|||
* or all providers have been exhausted.
|
||||
* <li>If the previous step fails to find a protocol handler, the
|
||||
* constructor reads the value of the system property:
|
||||
* <blockquote>{@code
|
||||
* <blockquote>{@systemProperty
|
||||
* java.protocol.handler.pkgs
|
||||
* }</blockquote>
|
||||
* If the value of that system property is not {@code null},
|
||||
|
|
|
@ -709,6 +709,13 @@ public final class AccessController {
|
|||
return context;
|
||||
}
|
||||
|
||||
/**
|
||||
* The value needs to be physically located in the frame, so that it
|
||||
* can be found by a stack walk.
|
||||
*/
|
||||
@Hidden
|
||||
private static native void ensureMaterializedForStackWalk(Object o);
|
||||
|
||||
/**
|
||||
* Sanity check that the caller context is indeed privileged.
|
||||
*
|
||||
|
@ -734,6 +741,11 @@ public final class AccessController {
|
|||
AccessControlContext context,
|
||||
Class<?> caller)
|
||||
{
|
||||
// Ensure context has a physical value in the frame
|
||||
if (context != null) {
|
||||
ensureMaterializedForStackWalk(context);
|
||||
}
|
||||
|
||||
assert isPrivileged(); // sanity check invariant
|
||||
T result = action.run();
|
||||
assert isPrivileged(); // sanity check invariant
|
||||
|
@ -742,7 +754,6 @@ public final class AccessController {
|
|||
// retrieved by getStackAccessControlContext().
|
||||
Reference.reachabilityFence(context);
|
||||
Reference.reachabilityFence(caller);
|
||||
Reference.reachabilityFence(action);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -761,6 +772,11 @@ public final class AccessController {
|
|||
Class<?> caller)
|
||||
throws Exception
|
||||
{
|
||||
// Ensure context has a physical value in the frame
|
||||
if (context != null) {
|
||||
ensureMaterializedForStackWalk(context);
|
||||
}
|
||||
|
||||
assert isPrivileged(); // sanity check invariant
|
||||
T result = action.run();
|
||||
assert isPrivileged(); // sanity check invariant
|
||||
|
@ -769,7 +785,6 @@ public final class AccessController {
|
|||
// retrieved by getStackAccessControlContext().
|
||||
Reference.reachabilityFence(context);
|
||||
Reference.reachabilityFence(caller);
|
||||
Reference.reachabilityFence(action);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 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
|
||||
|
@ -94,7 +94,7 @@ import sun.util.calendar.CalendarDate;
|
|||
* dates before Meiji 6, January 1 are not supported.
|
||||
* The number of the valid eras may increase, as new eras may be
|
||||
* defined by the Japanese government. Once an era is defined,
|
||||
* subsequent versions of this class will add a singleton instance
|
||||
* future versions of the platform may add a singleton instance
|
||||
* for it. The defined era is expected to have a consecutive integer
|
||||
* associated with it.
|
||||
*
|
||||
|
|
|
@ -99,7 +99,7 @@ import java.util.Collections;
|
|||
* <p>
|
||||
* The Java virtual machine has a default provider that provides zone rules
|
||||
* for the time-zones defined by IANA Time Zone Database (TZDB). If the system
|
||||
* property {@code java.time.zone.DefaultZoneRulesProvider} is defined then
|
||||
* property {@systemProperty java.time.zone.DefaultZoneRulesProvider} is defined then
|
||||
* it is taken to be the fully-qualified name of a concrete ZoneRulesProvider
|
||||
* class to be loaded as the default provider, using the system class loader.
|
||||
* If this system property is not defined, a system-default provider will be
|
||||
|
|
|
@ -60,7 +60,7 @@ import sun.util.logging.PlatformLogger;
|
|||
* the <code>getInstance</code> methods.
|
||||
* <p>
|
||||
* Users can supersede the Java runtime currency data by means of the system
|
||||
* property {@code java.util.currency.data}. If this system property is
|
||||
* property {@systemProperty java.util.currency.data}. If this system property is
|
||||
* defined then its value is the location of a properties file, the contents of
|
||||
* which are key/value pairs of the ISO 3166 country codes and the ISO 4217
|
||||
* currency data respectively. The value part consists of three ISO 4217 values
|
||||
|
|
|
@ -115,7 +115,7 @@ import sun.util.ResourceBundleEnumeration;
|
|||
* input stream, then the {@code PropertyResourceBundle} instance resets to the state
|
||||
* before the exception, re-reads the input stream in {@code ISO-8859-1}, and
|
||||
* continues reading. If the system property
|
||||
* {@code java.util.PropertyResourceBundle.encoding} is set to either
|
||||
* {@systemProperty java.util.PropertyResourceBundle.encoding} is set to either
|
||||
* "ISO-8859-1" or "UTF-8", the input stream is solely read in that encoding,
|
||||
* and throws the exception if it encounters an invalid sequence.
|
||||
* If "ISO-8859-1" is specified, characters that cannot be represented in
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
|
@ -58,14 +58,10 @@ public class Manifest implements Cloneable {
|
|||
// associated JarVerifier, not null when called by JarFile::getManifest.
|
||||
private final JarVerifier jv;
|
||||
|
||||
// name of the corresponding jar archive if available.
|
||||
private final String jarFilename;
|
||||
|
||||
/**
|
||||
* Constructs a new, empty Manifest.
|
||||
*/
|
||||
public Manifest() {
|
||||
jarFilename = null;
|
||||
jv = null;
|
||||
}
|
||||
|
||||
|
@ -84,7 +80,7 @@ public class Manifest implements Cloneable {
|
|||
*
|
||||
* @param is the input stream containing manifest data
|
||||
* @param jarFilename the name of the corresponding jar archive if available
|
||||
* @throws IOException if an I/O error has occured
|
||||
* @throws IOException if an I/O error has occurred
|
||||
*/
|
||||
Manifest(InputStream is, String jarFilename) throws IOException {
|
||||
this(null, is, jarFilename);
|
||||
|
@ -93,10 +89,14 @@ public class Manifest implements Cloneable {
|
|||
/**
|
||||
* Constructs a new Manifest from the specified input stream
|
||||
* and associates it with a JarVerifier.
|
||||
*
|
||||
* @param jv the JarVerifier to use
|
||||
* @param is the input stream containing manifest data
|
||||
* @param jarFilename the name of the corresponding jar archive if available
|
||||
* @throws IOException if an I/O error has occurred
|
||||
*/
|
||||
Manifest(JarVerifier jv, InputStream is, String jarFilename) throws IOException {
|
||||
read(is);
|
||||
this.jarFilename = jarFilename;
|
||||
read(is, jarFilename);
|
||||
this.jv = jv;
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,6 @@ public class Manifest implements Cloneable {
|
|||
public Manifest(Manifest man) {
|
||||
attr.putAll(man.getMainAttributes());
|
||||
entries.putAll(man.getEntries());
|
||||
jarFilename = null;
|
||||
jv = man.jv;
|
||||
}
|
||||
|
||||
|
@ -250,6 +249,10 @@ public class Manifest implements Cloneable {
|
|||
* @exception IOException if an I/O error has occurred
|
||||
*/
|
||||
public void read(InputStream is) throws IOException {
|
||||
read(is, null);
|
||||
}
|
||||
|
||||
private void read(InputStream is, String jarFilename) throws IOException {
|
||||
// Buffered input stream for reading manifest data
|
||||
FastInputStream fis = new FastInputStream(is);
|
||||
// Line buffer
|
||||
|
@ -285,7 +288,7 @@ public class Manifest implements Cloneable {
|
|||
if (name == null) {
|
||||
name = parseName(lbuf, len);
|
||||
if (name == null) {
|
||||
throw new IOException("invalid manifest format"
|
||||
throw new IOException("invalid manifest format ("
|
||||
+ getErrorPosition(jarFilename, lineNumber) + ")");
|
||||
}
|
||||
if (fis.peek() == ' ') {
|
||||
|
|
|
@ -112,7 +112,7 @@ public abstract class Pack200 {
|
|||
/**
|
||||
* Obtain new instance of a class that implements Packer.
|
||||
* <ul>
|
||||
* <li><p>If the system property {@code java.util.jar.Pack200.Packer}
|
||||
* <li><p>If the system property {@systemProperty java.util.jar.Pack200.Packer}
|
||||
* is defined, then the value is taken to be the fully-qualified name
|
||||
* of a concrete implementation class, which must implement Packer.
|
||||
* This class is loaded and instantiated. If this process fails
|
||||
|
@ -138,7 +138,7 @@ public abstract class Pack200 {
|
|||
/**
|
||||
* Obtain new instance of a class that implements Unpacker.
|
||||
* <ul>
|
||||
* <li><p>If the system property {@code java.util.jar.Pack200.Unpacker}
|
||||
* <li><p>If the system property {@systemProperty java.util.jar.Pack200.Unpacker}
|
||||
* is defined, then the value is taken to be the fully-qualified
|
||||
* name of a concrete implementation class, which must implement Unpacker.
|
||||
* The class is loaded and instantiated. If this process fails
|
||||
|
|
|
@ -113,7 +113,7 @@ import java.util.Locale;
|
|||
* described above as if the locale was not supported.
|
||||
* <p>
|
||||
* The search order of locale sensitive services can
|
||||
* be configured by using the "java.locale.providers" system property.
|
||||
* be configured by using the {@systemProperty java.locale.providers} system property.
|
||||
* This system property declares the user's preferred order for looking up
|
||||
* the locale sensitive services separated by a comma. It is only read at
|
||||
* the Java runtime startup, so the later call to System.setProperty() won't
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue