8234335: Remove line break in class declaration in java.base
Remove line break in class declarations where applicable Reviewed-by: rriggs, lancea
This commit is contained in:
parent
e636c69e61
commit
a8a2246158
src/java.base/share/classes/java
io
BufferedInputStream.javaCharArrayWriter.javaDataInput.javaDataInputStream.javaDataOutput.javaDataOutputStream.javaEOFException.javaFileInputStream.javaFileOutputStream.javaFilterInputStream.javaIOException.javaInterruptedIOException.javaLineNumberInputStream.javaPipedOutputStream.javaPushbackInputStream.javaSequenceInputStream.javaStringBufferInputStream.javaUTFDataFormatException.java
lang
AbstractMethodError.javaArrayStoreException.javaClassCastException.javaClassFormatError.javaCloneNotSupportedException.javaIllegalArgumentException.javaIllegalMonitorStateException.javaIllegalStateException.javaIncompatibleClassChangeError.javaInstantiationError.javaInstantiationException.javaInterruptedException.javaLinkageError.javaNegativeArraySizeException.javaNoClassDefFoundError.javaNoSuchFieldError.javaNoSuchMethodError.javaNoSuchMethodException.javaNullPointerException.javaNumberFormatException.javaStackOverflowError.javaThread.javaThreadGroup.javaUnknownError.javaUnsatisfiedLinkError.javaUnsupportedClassVersionError.javaVerifyError.java
invoke
AbstractConstantGroup.javaBootstrapMethodInvoker.javaBoundMethodHandle.javaCallSite.javaClassSpecializer.javaDirectMethodHandle.javaInfoFromMemberName.javaInvokers.javaMemberName.javaMethodHandle.javaMethodHandleImpl.javaMethodHandleInfo.javaMethodHandleProxies.javaMethodHandleStatics.javaMethodHandles.javaMethodType.javaSimpleMethodHandle.javaWrongMethodTypeException.java
reflect
net
DatagramSocket.javaDatagramSocketImplFactory.javaHttpRetryException.javaInetAddress.javaMulticastSocket.javaProtocolException.javaServerSocket.javaSocket.javaSocketException.javaSocketImplFactory.javaUnknownHostException.java
text
util
@ -49,8 +49,7 @@ import jdk.internal.util.ArraysSupport;
|
||||
* @author Arthur van Hoff
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class BufferedInputStream extends FilterInputStream {
|
||||
public class BufferedInputStream extends FilterInputStream {
|
||||
|
||||
private static int DEFAULT_BUFFER_SIZE = 8192;
|
||||
|
||||
|
@ -39,8 +39,7 @@ import java.util.Arrays;
|
||||
* @author Herb Jellinek
|
||||
* @since 1.1
|
||||
*/
|
||||
public
|
||||
class CharArrayWriter extends Writer {
|
||||
public class CharArrayWriter extends Writer {
|
||||
/**
|
||||
* The buffer where data is stored.
|
||||
*/
|
||||
|
@ -154,8 +154,7 @@ package java.io;
|
||||
* @see java.io.DataOutput
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
interface DataInput {
|
||||
public interface DataInput {
|
||||
/**
|
||||
* Reads some bytes from an input
|
||||
* stream and stores them into the buffer
|
||||
|
@ -39,8 +39,7 @@ package java.io;
|
||||
* @see java.io.DataOutputStream
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class DataInputStream extends FilterInputStream implements DataInput {
|
||||
public class DataInputStream extends FilterInputStream implements DataInput {
|
||||
|
||||
/**
|
||||
* Creates a DataInputStream that uses the specified
|
||||
|
@ -46,8 +46,7 @@ package java.io;
|
||||
* @see java.io.DataOutputStream
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
interface DataOutput {
|
||||
public interface DataOutput {
|
||||
/**
|
||||
* Writes to the output stream the eight
|
||||
* low-order bits of the argument {@code b}.
|
||||
|
@ -34,8 +34,7 @@ package java.io;
|
||||
* @see java.io.DataInputStream
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class DataOutputStream extends FilterOutputStream implements DataOutput {
|
||||
public class DataOutputStream extends FilterOutputStream implements DataOutput {
|
||||
/**
|
||||
* The number of bytes written to the data output stream so far.
|
||||
* If this counter overflows, it will be wrapped to Integer.MAX_VALUE.
|
||||
|
@ -38,8 +38,7 @@ package java.io;
|
||||
* @see java.io.IOException
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class EOFException extends IOException {
|
||||
public class EOFException extends IOException {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 6433858223774886977L;
|
||||
|
||||
|
@ -61,8 +61,7 @@ import sun.nio.ch.FileChannelImpl;
|
||||
* @see java.nio.file.Files#newInputStream
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class FileInputStream extends InputStream
|
||||
public class FileInputStream extends InputStream
|
||||
{
|
||||
/* File Descriptor - handle to the open file */
|
||||
private final FileDescriptor fd;
|
||||
|
@ -66,8 +66,7 @@ import sun.nio.ch.FileChannelImpl;
|
||||
* @see java.nio.file.Files#newOutputStream
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class FileOutputStream extends OutputStream
|
||||
public class FileOutputStream extends OutputStream
|
||||
{
|
||||
/**
|
||||
* Access to FileDescriptor internals.
|
||||
|
@ -42,8 +42,7 @@ package java.io;
|
||||
* @author Jonathan Payne
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class FilterInputStream extends InputStream {
|
||||
public class FilterInputStream extends InputStream {
|
||||
/**
|
||||
* The input stream to be filtered.
|
||||
*/
|
||||
|
@ -35,8 +35,7 @@ package java.io;
|
||||
* @see java.io.OutputStream
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class IOException extends Exception {
|
||||
public class IOException extends Exception {
|
||||
@java.io.Serial
|
||||
static final long serialVersionUID = 7818375828146090155L;
|
||||
|
||||
|
@ -39,8 +39,7 @@ package java.io;
|
||||
* @see java.lang.Thread#interrupt()
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class InterruptedIOException extends IOException {
|
||||
public class InterruptedIOException extends IOException {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 4020568460727500567L;
|
||||
|
||||
|
@ -47,8 +47,7 @@ package java.io;
|
||||
* include a class for counting line numbers.
|
||||
*/
|
||||
@Deprecated
|
||||
public
|
||||
class LineNumberInputStream extends FilterInputStream {
|
||||
public class LineNumberInputStream extends FilterInputStream {
|
||||
int pushBack = -1;
|
||||
int lineNumber;
|
||||
int markLineNumber;
|
||||
|
@ -43,8 +43,7 @@ import java.io.*;
|
||||
* @see java.io.PipedInputStream
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class PipedOutputStream extends OutputStream {
|
||||
public class PipedOutputStream extends OutputStream {
|
||||
|
||||
/* REMIND: identification of the read and write sides needs to be
|
||||
more sophisticated. Either using thread groups (but what about
|
||||
|
@ -49,8 +49,7 @@ package java.io;
|
||||
* @author Jonathan Payne
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class PushbackInputStream extends FilterInputStream {
|
||||
public class PushbackInputStream extends FilterInputStream {
|
||||
/**
|
||||
* The pushback buffer.
|
||||
* @since 1.1
|
||||
|
@ -42,8 +42,7 @@ import java.util.Vector;
|
||||
* @author Author van Hoff
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class SequenceInputStream extends InputStream {
|
||||
public class SequenceInputStream extends InputStream {
|
||||
Enumeration<? extends InputStream> e;
|
||||
InputStream in;
|
||||
|
||||
|
@ -43,8 +43,7 @@ package java.io;
|
||||
* string is via the {@code StringReader} class.
|
||||
*/
|
||||
@Deprecated
|
||||
public
|
||||
class StringBufferInputStream extends InputStream {
|
||||
public class StringBufferInputStream extends InputStream {
|
||||
/**
|
||||
* The string from which bytes are read.
|
||||
*/
|
||||
|
@ -42,8 +42,7 @@ package java.io;
|
||||
* @see java.io.IOException
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class UTFDataFormatException extends IOException {
|
||||
public class UTFDataFormatException extends IOException {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 420743449228280612L;
|
||||
|
||||
|
@ -35,8 +35,7 @@ package java.lang;
|
||||
* @author unascribed
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class AbstractMethodError extends IncompatibleClassChangeError {
|
||||
public class AbstractMethodError extends IncompatibleClassChangeError {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = -1654391082989018462L;
|
||||
|
||||
|
@ -37,8 +37,7 @@ package java.lang;
|
||||
* @author unascribed
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class ArrayStoreException extends RuntimeException {
|
||||
public class ArrayStoreException extends RuntimeException {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = -4522193890499838241L;
|
||||
|
||||
|
@ -37,8 +37,7 @@ package java.lang;
|
||||
* @author unascribed
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class ClassCastException extends RuntimeException {
|
||||
public class ClassCastException extends RuntimeException {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = -9223365651070458532L;
|
||||
|
||||
|
@ -33,8 +33,7 @@ package java.lang;
|
||||
* @author unascribed
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class ClassFormatError extends LinkageError {
|
||||
public class ClassFormatError extends LinkageError {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = -8420114879011949195L;
|
||||
|
||||
|
@ -41,8 +41,7 @@ package java.lang;
|
||||
* @since 1.0
|
||||
*/
|
||||
|
||||
public
|
||||
class CloneNotSupportedException extends Exception {
|
||||
public class CloneNotSupportedException extends Exception {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 5195511250079656443L;
|
||||
|
||||
|
@ -32,8 +32,7 @@ package java.lang;
|
||||
* @author unascribed
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class IllegalArgumentException extends RuntimeException {
|
||||
public class IllegalArgumentException extends RuntimeException {
|
||||
/**
|
||||
* Constructs an {@code IllegalArgumentException} with no
|
||||
* detail message.
|
||||
|
@ -38,8 +38,7 @@ package java.lang;
|
||||
* @see java.lang.Object#wait(long, int)
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class IllegalMonitorStateException extends RuntimeException {
|
||||
public class IllegalMonitorStateException extends RuntimeException {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 3713306369498869069L;
|
||||
|
||||
|
@ -34,8 +34,7 @@ package java.lang;
|
||||
* @author Jonni Kanerva
|
||||
* @since 1.1
|
||||
*/
|
||||
public
|
||||
class IllegalStateException extends RuntimeException {
|
||||
public class IllegalStateException extends RuntimeException {
|
||||
/**
|
||||
* Constructs an IllegalStateException with no detail message.
|
||||
* A detail message is a String that describes this particular exception.
|
||||
|
@ -33,8 +33,7 @@ package java.lang;
|
||||
* @author unascribed
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class IncompatibleClassChangeError extends LinkageError {
|
||||
public class IncompatibleClassChangeError extends LinkageError {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = -4914975503642802119L;
|
||||
|
||||
|
@ -38,8 +38,7 @@ package java.lang;
|
||||
*/
|
||||
|
||||
|
||||
public
|
||||
class InstantiationError extends IncompatibleClassChangeError {
|
||||
public class InstantiationError extends IncompatibleClassChangeError {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = -4885810657349421204L;
|
||||
|
||||
|
@ -42,8 +42,7 @@ package java.lang;
|
||||
* @see java.lang.Class#newInstance()
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class InstantiationException extends ReflectiveOperationException {
|
||||
public class InstantiationException extends ReflectiveOperationException {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = -8441929162975509110L;
|
||||
|
||||
|
@ -46,8 +46,7 @@ package java.lang;
|
||||
* @see java.lang.Thread#interrupted()
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class InterruptedException extends Exception {
|
||||
public class InterruptedException extends Exception {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 6700697376100628473L;
|
||||
|
||||
|
@ -34,8 +34,7 @@ package java.lang;
|
||||
* @author Frank Yellin
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class LinkageError extends Error {
|
||||
public class LinkageError extends Error {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 3579600108157160122L;
|
||||
|
||||
|
@ -31,8 +31,7 @@ package java.lang;
|
||||
* @author unascribed
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class NegativeArraySizeException extends RuntimeException {
|
||||
public class NegativeArraySizeException extends RuntimeException {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = -8960118058596991861L;
|
||||
|
||||
|
@ -38,8 +38,7 @@ package java.lang;
|
||||
* @author unascribed
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class NoClassDefFoundError extends LinkageError {
|
||||
public class NoClassDefFoundError extends LinkageError {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 9095859863287012458L;
|
||||
|
||||
|
@ -36,8 +36,7 @@ package java.lang;
|
||||
* @author unascribed
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class NoSuchFieldError extends IncompatibleClassChangeError {
|
||||
public class NoSuchFieldError extends IncompatibleClassChangeError {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = -3456430195886129035L;
|
||||
|
||||
|
@ -37,8 +37,7 @@ package java.lang;
|
||||
* @author unascribed
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class NoSuchMethodError extends IncompatibleClassChangeError {
|
||||
public class NoSuchMethodError extends IncompatibleClassChangeError {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = -3765521442372831335L;
|
||||
|
||||
|
@ -31,8 +31,7 @@ package java.lang;
|
||||
* @author unascribed
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class NoSuchMethodException extends ReflectiveOperationException {
|
||||
public class NoSuchMethodException extends ReflectiveOperationException {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 5034388446362600923L;
|
||||
|
||||
|
@ -49,8 +49,7 @@ package java.lang;
|
||||
* @author unascribed
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class NullPointerException extends RuntimeException {
|
||||
public class NullPointerException extends RuntimeException {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 5162710183389028792L;
|
||||
|
||||
|
@ -34,8 +34,7 @@ package java.lang;
|
||||
* @see java.lang.Integer#parseInt(String)
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class NumberFormatException extends IllegalArgumentException {
|
||||
public class NumberFormatException extends IllegalArgumentException {
|
||||
@java.io.Serial
|
||||
static final long serialVersionUID = -2848938806368998894L;
|
||||
|
||||
|
@ -32,8 +32,7 @@ package java.lang;
|
||||
* @author unascribed
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class StackOverflowError extends VirtualMachineError {
|
||||
public class StackOverflowError extends VirtualMachineError {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 8609175038441759607L;
|
||||
|
||||
|
@ -140,8 +140,7 @@ import jdk.internal.HotSpotIntrinsicCandidate;
|
||||
* @see #stop()
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class Thread implements Runnable {
|
||||
public class Thread implements Runnable {
|
||||
/* Make sure registerNatives is the first thing <clinit> does. */
|
||||
private static native void registerNatives();
|
||||
static {
|
||||
|
@ -52,8 +52,7 @@ import java.util.Arrays;
|
||||
* and working off of that snapshot, rather than holding the thread group locked
|
||||
* while we work on the children.
|
||||
*/
|
||||
public
|
||||
class ThreadGroup implements Thread.UncaughtExceptionHandler {
|
||||
public class ThreadGroup implements Thread.UncaughtExceptionHandler {
|
||||
private final ThreadGroup parent;
|
||||
String name;
|
||||
int maxPriority;
|
||||
|
@ -32,8 +32,7 @@ package java.lang;
|
||||
* @author unascribed
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class UnknownError extends VirtualMachineError {
|
||||
public class UnknownError extends VirtualMachineError {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 2524784860676771849L;
|
||||
|
||||
|
@ -33,8 +33,7 @@ package java.lang;
|
||||
* @see java.lang.Runtime
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class UnsatisfiedLinkError extends LinkageError {
|
||||
public class UnsatisfiedLinkError extends LinkageError {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = -4019343241616879428L;
|
||||
|
||||
|
@ -32,8 +32,7 @@ package java.lang;
|
||||
*
|
||||
* @since 1.2
|
||||
*/
|
||||
public
|
||||
class UnsupportedClassVersionError extends ClassFormatError {
|
||||
public class UnsupportedClassVersionError extends ClassFormatError {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = -7123279212883497373L;
|
||||
|
||||
|
@ -33,8 +33,7 @@ package java.lang;
|
||||
* @author unascribed
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class VerifyError extends LinkageError {
|
||||
public class VerifyError extends LinkageError {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 7001962396098498785L;
|
||||
|
||||
|
@ -316,8 +316,7 @@ abstract class AbstractConstantGroup implements ConstantGroup {
|
||||
}
|
||||
|
||||
/** Skeleton implementation of BootstrapCallInfo. */
|
||||
static
|
||||
class BSCIWithCache<T> extends WithCache implements BootstrapCallInfo<T> {
|
||||
static class BSCIWithCache<T> extends WithCache implements BootstrapCallInfo<T> {
|
||||
private final MethodHandle bsm;
|
||||
private final String name;
|
||||
private final T type;
|
||||
|
@ -460,8 +460,8 @@ final class BootstrapMethodInvoker {
|
||||
}
|
||||
}
|
||||
|
||||
/*non-public*/ static final
|
||||
class PushAdapter {
|
||||
/*non-public*/
|
||||
static final class PushAdapter {
|
||||
// skeleton for push-mode BSM which wraps a pull-mode BSM:
|
||||
static Object pushToBootstrapMethod(MethodHandle pullModeBSM,
|
||||
MethodHandles.Lookup lookup, String name, Object type,
|
||||
@ -487,8 +487,8 @@ final class BootstrapMethodInvoker {
|
||||
}
|
||||
}
|
||||
|
||||
/*non-public*/ static final
|
||||
class PullAdapter {
|
||||
/*non-public*/
|
||||
static final class PullAdapter {
|
||||
// skeleton for pull-mode BSM which wraps a push-mode BSM:
|
||||
static Object pullFromBootstrapMethod(MethodHandle pushModeBSM,
|
||||
MethodHandles.Lookup lookup,
|
||||
|
@ -48,9 +48,11 @@ import static java.lang.invoke.MethodHandleStatics.uncaughtException;
|
||||
*
|
||||
* All bound arguments are encapsulated in dedicated species.
|
||||
*/
|
||||
/*non-public*/ abstract class BoundMethodHandle extends MethodHandle {
|
||||
/*non-public*/
|
||||
abstract class BoundMethodHandle extends MethodHandle {
|
||||
|
||||
/*non-public*/ BoundMethodHandle(MethodType type, LambdaForm form) {
|
||||
/*non-public*/
|
||||
BoundMethodHandle(MethodType type, LambdaForm form) {
|
||||
super(type, form);
|
||||
assert(speciesData() == speciesDataFor(form));
|
||||
}
|
||||
@ -141,9 +143,11 @@ import static java.lang.invoke.MethodHandleStatics.uncaughtException;
|
||||
* Return the {@link BoundMethodHandle.SpeciesData} instance representing this BMH species. All subclasses must provide a
|
||||
* static field containing this value, and they must accordingly implement this method.
|
||||
*/
|
||||
/*non-public*/ abstract BoundMethodHandle.SpeciesData speciesData();
|
||||
/*non-public*/
|
||||
abstract BoundMethodHandle.SpeciesData speciesData();
|
||||
|
||||
/*non-public*/ static BoundMethodHandle.SpeciesData speciesDataFor(LambdaForm form) {
|
||||
/*non-public*/
|
||||
static BoundMethodHandle.SpeciesData speciesDataFor(LambdaForm form) {
|
||||
Object c = form.names[0].constraint;
|
||||
if (c instanceof SpeciesData) {
|
||||
return (SpeciesData) c;
|
||||
@ -155,7 +159,8 @@ import static java.lang.invoke.MethodHandleStatics.uncaughtException;
|
||||
/**
|
||||
* Return the number of fields in this BMH. Equivalent to speciesData().fieldCount().
|
||||
*/
|
||||
/*non-public*/ final int fieldCount() { return speciesData().fieldCount(); }
|
||||
/*non-public*/
|
||||
final int fieldCount() { return speciesData().fieldCount(); }
|
||||
|
||||
@Override
|
||||
Object internalProperties() {
|
||||
@ -175,7 +180,8 @@ import static java.lang.invoke.MethodHandleStatics.uncaughtException;
|
||||
return sb.append("\n]").toString();
|
||||
}
|
||||
|
||||
/*non-public*/ final Object arg(int i) {
|
||||
/*non-public*/
|
||||
final Object arg(int i) {
|
||||
try {
|
||||
Class<?> fieldType = speciesData().fieldTypes().get(i);
|
||||
switch (BasicType.basicType(fieldType)) {
|
||||
@ -195,12 +201,18 @@ import static java.lang.invoke.MethodHandleStatics.uncaughtException;
|
||||
// cloning API
|
||||
//
|
||||
|
||||
/*non-public*/ abstract BoundMethodHandle copyWith(MethodType mt, LambdaForm lf);
|
||||
/*non-public*/ abstract BoundMethodHandle copyWithExtendL(MethodType mt, LambdaForm lf, Object narg);
|
||||
/*non-public*/ abstract BoundMethodHandle copyWithExtendI(MethodType mt, LambdaForm lf, int narg);
|
||||
/*non-public*/ abstract BoundMethodHandle copyWithExtendJ(MethodType mt, LambdaForm lf, long narg);
|
||||
/*non-public*/ abstract BoundMethodHandle copyWithExtendF(MethodType mt, LambdaForm lf, float narg);
|
||||
/*non-public*/ abstract BoundMethodHandle copyWithExtendD(MethodType mt, LambdaForm lf, double narg);
|
||||
/*non-public*/
|
||||
abstract BoundMethodHandle copyWith(MethodType mt, LambdaForm lf);
|
||||
/*non-public*/
|
||||
abstract BoundMethodHandle copyWithExtendL(MethodType mt, LambdaForm lf, Object narg);
|
||||
/*non-public*/
|
||||
abstract BoundMethodHandle copyWithExtendI(MethodType mt, LambdaForm lf, int narg);
|
||||
/*non-public*/
|
||||
abstract BoundMethodHandle copyWithExtendJ(MethodType mt, LambdaForm lf, long narg);
|
||||
/*non-public*/
|
||||
abstract BoundMethodHandle copyWithExtendF(MethodType mt, LambdaForm lf, float narg);
|
||||
/*non-public*/
|
||||
abstract BoundMethodHandle copyWithExtendD(MethodType mt, LambdaForm lf, double narg);
|
||||
|
||||
//
|
||||
// concrete BMH classes required to close bootstrap loops
|
||||
@ -217,21 +229,26 @@ import static java.lang.invoke.MethodHandleStatics.uncaughtException;
|
||||
}
|
||||
|
||||
@Override
|
||||
/*non-public*/ SpeciesData speciesData() {
|
||||
/*non-public*/
|
||||
SpeciesData speciesData() {
|
||||
return BMH_SPECIES;
|
||||
}
|
||||
|
||||
/*non-public*/ static @Stable SpeciesData BMH_SPECIES;
|
||||
/*non-public*/
|
||||
static @Stable SpeciesData BMH_SPECIES;
|
||||
|
||||
/*non-public*/ static BoundMethodHandle make(MethodType mt, LambdaForm lf, Object argL0) {
|
||||
/*non-public*/
|
||||
static BoundMethodHandle make(MethodType mt, LambdaForm lf, Object argL0) {
|
||||
return new Species_L(mt, lf, argL0);
|
||||
}
|
||||
@Override
|
||||
/*non-public*/ final BoundMethodHandle copyWith(MethodType mt, LambdaForm lf) {
|
||||
/*non-public*/
|
||||
final BoundMethodHandle copyWith(MethodType mt, LambdaForm lf) {
|
||||
return new Species_L(mt, lf, argL0);
|
||||
}
|
||||
@Override
|
||||
/*non-public*/ final BoundMethodHandle copyWithExtendL(MethodType mt, LambdaForm lf, Object narg) {
|
||||
/*non-public*/
|
||||
final BoundMethodHandle copyWithExtendL(MethodType mt, LambdaForm lf, Object narg) {
|
||||
try {
|
||||
return (BoundMethodHandle) BMH_SPECIES.extendWith(L_TYPE_NUM).factory().invokeBasic(mt, lf, argL0, narg);
|
||||
} catch (Throwable ex) {
|
||||
@ -239,7 +256,8 @@ import static java.lang.invoke.MethodHandleStatics.uncaughtException;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
/*non-public*/ final BoundMethodHandle copyWithExtendI(MethodType mt, LambdaForm lf, int narg) {
|
||||
/*non-public*/
|
||||
final BoundMethodHandle copyWithExtendI(MethodType mt, LambdaForm lf, int narg) {
|
||||
try {
|
||||
return (BoundMethodHandle) BMH_SPECIES.extendWith(I_TYPE_NUM).factory().invokeBasic(mt, lf, argL0, narg);
|
||||
} catch (Throwable ex) {
|
||||
@ -247,7 +265,8 @@ import static java.lang.invoke.MethodHandleStatics.uncaughtException;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
/*non-public*/ final BoundMethodHandle copyWithExtendJ(MethodType mt, LambdaForm lf, long narg) {
|
||||
/*non-public*/
|
||||
final BoundMethodHandle copyWithExtendJ(MethodType mt, LambdaForm lf, long narg) {
|
||||
try {
|
||||
return (BoundMethodHandle) BMH_SPECIES.extendWith(J_TYPE_NUM).factory().invokeBasic(mt, lf, argL0, narg);
|
||||
} catch (Throwable ex) {
|
||||
@ -255,7 +274,8 @@ import static java.lang.invoke.MethodHandleStatics.uncaughtException;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
/*non-public*/ final BoundMethodHandle copyWithExtendF(MethodType mt, LambdaForm lf, float narg) {
|
||||
/*non-public*/
|
||||
final BoundMethodHandle copyWithExtendF(MethodType mt, LambdaForm lf, float narg) {
|
||||
try {
|
||||
return (BoundMethodHandle) BMH_SPECIES.extendWith(F_TYPE_NUM).factory().invokeBasic(mt, lf, argL0, narg);
|
||||
} catch (Throwable ex) {
|
||||
@ -263,7 +283,8 @@ import static java.lang.invoke.MethodHandleStatics.uncaughtException;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
/*non-public*/ final BoundMethodHandle copyWithExtendD(MethodType mt, LambdaForm lf, double narg) {
|
||||
/*non-public*/
|
||||
final BoundMethodHandle copyWithExtendD(MethodType mt, LambdaForm lf, double narg) {
|
||||
try {
|
||||
return (BoundMethodHandle) BMH_SPECIES.extendWith(D_TYPE_NUM).factory().invokeBasic(mt, lf, argL0, narg);
|
||||
} catch (Throwable ex) {
|
||||
@ -277,7 +298,8 @@ import static java.lang.invoke.MethodHandleStatics.uncaughtException;
|
||||
//
|
||||
|
||||
/*non-public*/
|
||||
static final class SpeciesData extends ClassSpecializer<BoundMethodHandle, String, SpeciesData>.SpeciesData {
|
||||
static final class SpeciesData
|
||||
extends ClassSpecializer<BoundMethodHandle, String, SpeciesData>.SpeciesData {
|
||||
// This array is filled in lazily, as new species come into being over time.
|
||||
@Stable final private SpeciesData[] extensions = new SpeciesData[ARG_TYPE_LIMIT];
|
||||
|
||||
@ -346,7 +368,8 @@ import static java.lang.invoke.MethodHandleStatics.uncaughtException;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*non-public*/ SpeciesData extendWith(byte typeNum) {
|
||||
/*non-public*/
|
||||
SpeciesData extendWith(byte typeNum) {
|
||||
SpeciesData sd = extensions[typeNum];
|
||||
if (sd != null) return sd;
|
||||
sd = SPECIALIZER.findSpecies(key() + BasicType.basicType(typeNum).basicTypeChar());
|
||||
@ -363,7 +386,8 @@ import static java.lang.invoke.MethodHandleStatics.uncaughtException;
|
||||
}
|
||||
|
||||
/*non-public*/
|
||||
static final class Specializer extends ClassSpecializer<BoundMethodHandle, String, SpeciesData> {
|
||||
static final class Specializer
|
||||
extends ClassSpecializer<BoundMethodHandle, String, SpeciesData> {
|
||||
|
||||
private static final MemberName SPECIES_DATA_ACCESSOR;
|
||||
|
||||
|
@ -217,7 +217,8 @@ public class CallSite {
|
||||
*/
|
||||
public abstract MethodHandle dynamicInvoker();
|
||||
|
||||
/*non-public*/ MethodHandle makeDynamicInvoker() {
|
||||
/*non-public*/
|
||||
MethodHandle makeDynamicInvoker() {
|
||||
MethodHandle getTarget = getTargetHandle().bindArgumentL(0, this);
|
||||
MethodHandle invoker = MethodHandles.exactInvoker(this.type());
|
||||
return MethodHandles.foldArguments(invoker, getTarget);
|
||||
|
@ -544,31 +544,33 @@ abstract class ClassSpecializer<T,K,S extends ClassSpecializer<T,K,S>.SpeciesDat
|
||||
* has a shape like the following:
|
||||
*
|
||||
* <pre>
|
||||
* class TopClass { ... private static
|
||||
* final class Species_LLI extends TopClass {
|
||||
* final Object argL0;
|
||||
* final Object argL1;
|
||||
* final int argI2;
|
||||
* private Species_LLI(CT ctarg, ..., Object argL0, Object argL1, int argI2) {
|
||||
* super(ctarg, ...);
|
||||
* this.argL0 = argL0;
|
||||
* this.argL1 = argL1;
|
||||
* this.argI2 = argI2;
|
||||
* }
|
||||
* final SpeciesData speciesData() { return BMH_SPECIES; }
|
||||
* @Stable static SpeciesData BMH_SPECIES; // injected afterwards
|
||||
* static TopClass make(CT ctarg, ..., Object argL0, Object argL1, int argI2) {
|
||||
* return new Species_LLI(ctarg, ..., argL0, argL1, argI2);
|
||||
* }
|
||||
* final TopClass copyWith(CT ctarg, ...) {
|
||||
* return new Species_LLI(ctarg, ..., argL0, argL1, argI2);
|
||||
* }
|
||||
* // two transforms, for the sake of illustration:
|
||||
* final TopClass copyWithExtendL(CT ctarg, ..., Object narg) {
|
||||
* return BMH_SPECIES.transform(L_TYPE).invokeBasic(ctarg, ..., argL0, argL1, argI2, narg);
|
||||
* }
|
||||
* final TopClass copyWithExtendI(CT ctarg, ..., int narg) {
|
||||
* return BMH_SPECIES.transform(I_TYPE).invokeBasic(ctarg, ..., argL0, argL1, argI2, narg);
|
||||
* class TopClass {
|
||||
* ...
|
||||
* private static final class Species_LLI extends TopClass {
|
||||
* final Object argL0;
|
||||
* final Object argL1;
|
||||
* final int argI2;
|
||||
* private Species_LLI(CT ctarg, ..., Object argL0, Object argL1, int argI2) {
|
||||
* super(ctarg, ...);
|
||||
* this.argL0 = argL0;
|
||||
* this.argL1 = argL1;
|
||||
* this.argI2 = argI2;
|
||||
* }
|
||||
* final SpeciesData speciesData() { return BMH_SPECIES; }
|
||||
* @Stable static SpeciesData BMH_SPECIES; // injected afterwards
|
||||
* static TopClass make(CT ctarg, ..., Object argL0, Object argL1, int argI2) {
|
||||
* return new Species_LLI(ctarg, ..., argL0, argL1, argI2);
|
||||
* }
|
||||
* final TopClass copyWith(CT ctarg, ...) {
|
||||
* return new Species_LLI(ctarg, ..., argL0, argL1, argI2);
|
||||
* }
|
||||
* // two transforms, for the sake of illustration:
|
||||
* final TopClass copyWithExtendL(CT ctarg, ..., Object narg) {
|
||||
* return BMH_SPECIES.transform(L_TYPE).invokeBasic(ctarg, ..., argL0, argL1, argI2, narg);
|
||||
* }
|
||||
* final TopClass copyWithExtendI(CT ctarg, ..., int narg) {
|
||||
* return BMH_SPECIES.transform(I_TYPE).invokeBasic(ctarg, ..., argL0, argL1, argI2, narg);
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
@ -624,7 +626,8 @@ abstract class ClassSpecializer<T,K,S extends ClassSpecializer<T,K,S>.SpeciesDat
|
||||
}
|
||||
private static final int ACC_PPP = ACC_PUBLIC | ACC_PRIVATE | ACC_PROTECTED;
|
||||
|
||||
/*non-public*/ byte[] generateConcreteSpeciesCodeFile(String className0, ClassSpecializer<T,K,S>.SpeciesData speciesData) {
|
||||
/*non-public*/
|
||||
byte[] generateConcreteSpeciesCodeFile(String className0, ClassSpecializer<T,K,S>.SpeciesData speciesData) {
|
||||
final String className = classBCName(className0);
|
||||
final String superClassName = classBCName(speciesData.deriveSuperClass());
|
||||
|
||||
|
@ -306,21 +306,23 @@ class DirectMethodHandle extends MethodHandle {
|
||||
|
||||
/** Static wrapper for DirectMethodHandle.internalMemberName. */
|
||||
@ForceInline
|
||||
/*non-public*/ static Object internalMemberName(Object mh) {
|
||||
/*non-public*/
|
||||
static Object internalMemberName(Object mh) {
|
||||
return ((DirectMethodHandle)mh).member;
|
||||
}
|
||||
|
||||
/** Static wrapper for DirectMethodHandle.internalMemberName.
|
||||
* This one also forces initialization.
|
||||
*/
|
||||
/*non-public*/ static Object internalMemberNameEnsureInit(Object mh) {
|
||||
/*non-public*/
|
||||
static Object internalMemberNameEnsureInit(Object mh) {
|
||||
DirectMethodHandle dmh = (DirectMethodHandle)mh;
|
||||
dmh.ensureInitialized();
|
||||
return dmh.member;
|
||||
}
|
||||
|
||||
/*non-public*/ static
|
||||
boolean shouldBeInitialized(MemberName member) {
|
||||
/*non-public*/
|
||||
static boolean shouldBeInitialized(MemberName member) {
|
||||
switch (member.getReferenceKind()) {
|
||||
case REF_invokeStatic:
|
||||
case REF_getStatic:
|
||||
@ -396,7 +398,8 @@ class DirectMethodHandle extends MethodHandle {
|
||||
return true;
|
||||
}
|
||||
|
||||
/*non-public*/ static void ensureInitialized(Object mh) {
|
||||
/*non-public*/
|
||||
static void ensureInitialized(Object mh) {
|
||||
((DirectMethodHandle)mh).ensureInitialized();
|
||||
}
|
||||
|
||||
@ -472,12 +475,14 @@ class DirectMethodHandle extends MethodHandle {
|
||||
}
|
||||
}
|
||||
|
||||
/*non-public*/ static Object constructorMethod(Object mh) {
|
||||
/*non-public*/
|
||||
static Object constructorMethod(Object mh) {
|
||||
Constructor dmh = (Constructor)mh;
|
||||
return dmh.initMethod;
|
||||
}
|
||||
|
||||
/*non-public*/ static Object allocateInstance(Object mh) throws InstantiationException {
|
||||
/*non-public*/
|
||||
static Object allocateInstance(Object mh) throws InstantiationException {
|
||||
Constructor dmh = (Constructor)mh;
|
||||
return UNSAFE.allocateInstance(dmh.instanceClass);
|
||||
}
|
||||
@ -503,14 +508,16 @@ class DirectMethodHandle extends MethodHandle {
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
/*non-public*/ static long fieldOffset(Object accessorObj) {
|
||||
/*non-public*/
|
||||
static long fieldOffset(Object accessorObj) {
|
||||
// Note: We return a long because that is what Unsafe.getObject likes.
|
||||
// We store a plain int because it is more compact.
|
||||
return ((Accessor)accessorObj).fieldOffset;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
/*non-public*/ static Object checkBase(Object obj) {
|
||||
/*non-public*/
|
||||
static Object checkBase(Object obj) {
|
||||
// Note that the object's class has already been verified,
|
||||
// since the parameter type of the Accessor method handle
|
||||
// is either member.getDeclaringClass or a subclass.
|
||||
@ -545,22 +552,26 @@ class DirectMethodHandle extends MethodHandle {
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
/*non-public*/ static Object nullCheck(Object obj) {
|
||||
/*non-public*/
|
||||
static Object nullCheck(Object obj) {
|
||||
return Objects.requireNonNull(obj);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
/*non-public*/ static Object staticBase(Object accessorObj) {
|
||||
/*non-public*/
|
||||
static Object staticBase(Object accessorObj) {
|
||||
return ((StaticAccessor)accessorObj).staticBase;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
/*non-public*/ static long staticOffset(Object accessorObj) {
|
||||
/*non-public*/
|
||||
static long staticOffset(Object accessorObj) {
|
||||
return ((StaticAccessor)accessorObj).staticOffset;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
/*non-public*/ static Object checkCast(Object mh, Object obj) {
|
||||
/*non-public*/
|
||||
static Object checkCast(Object mh, Object obj) {
|
||||
return ((DirectMethodHandle) mh).checkCast(obj);
|
||||
}
|
||||
|
||||
|
@ -35,8 +35,7 @@ import static java.lang.invoke.MethodHandleStatics.*;
|
||||
* Auxiliary to MethodHandleInfo, wants to nest in MethodHandleInfo but must be non-public.
|
||||
*/
|
||||
/*non-public*/
|
||||
final
|
||||
class InfoFromMemberName implements MethodHandleInfo {
|
||||
final class InfoFromMemberName implements MethodHandleInfo {
|
||||
private final MemberName member;
|
||||
private final int referenceKind;
|
||||
|
||||
|
@ -58,25 +58,29 @@ class Invokers {
|
||||
/** Compute and cache information common to all collecting adapters
|
||||
* that implement members of the erasure-family of the given erased type.
|
||||
*/
|
||||
/*non-public*/ Invokers(MethodType targetType) {
|
||||
/*non-public*/
|
||||
Invokers(MethodType targetType) {
|
||||
this.targetType = targetType;
|
||||
}
|
||||
|
||||
/*non-public*/ MethodHandle exactInvoker() {
|
||||
/*non-public*/
|
||||
MethodHandle exactInvoker() {
|
||||
MethodHandle invoker = cachedInvoker(INV_EXACT);
|
||||
if (invoker != null) return invoker;
|
||||
invoker = makeExactOrGeneralInvoker(true);
|
||||
return setCachedInvoker(INV_EXACT, invoker);
|
||||
}
|
||||
|
||||
/*non-public*/ MethodHandle genericInvoker() {
|
||||
/*non-public*/
|
||||
MethodHandle genericInvoker() {
|
||||
MethodHandle invoker = cachedInvoker(INV_GENERIC);
|
||||
if (invoker != null) return invoker;
|
||||
invoker = makeExactOrGeneralInvoker(false);
|
||||
return setCachedInvoker(INV_GENERIC, invoker);
|
||||
}
|
||||
|
||||
/*non-public*/ MethodHandle basicInvoker() {
|
||||
/*non-public*/
|
||||
MethodHandle basicInvoker() {
|
||||
MethodHandle invoker = cachedInvoker(INV_BASIC);
|
||||
if (invoker != null) return invoker;
|
||||
MethodType basicType = targetType.basicType();
|
||||
@ -94,12 +98,14 @@ class Invokers {
|
||||
return setCachedInvoker(INV_BASIC, invoker);
|
||||
}
|
||||
|
||||
/*non-public*/ MethodHandle varHandleMethodInvoker(VarHandle.AccessMode ak) {
|
||||
/*non-public*/
|
||||
MethodHandle varHandleMethodInvoker(VarHandle.AccessMode ak) {
|
||||
// TODO cache invoker
|
||||
return makeVarHandleMethodInvoker(ak, false);
|
||||
}
|
||||
|
||||
/*non-public*/ MethodHandle varHandleMethodExactInvoker(VarHandle.AccessMode ak) {
|
||||
/*non-public*/
|
||||
MethodHandle varHandleMethodExactInvoker(VarHandle.AccessMode ak) {
|
||||
// TODO cache invoker
|
||||
return makeVarHandleMethodInvoker(ak, true);
|
||||
}
|
||||
@ -153,7 +159,8 @@ class Invokers {
|
||||
}
|
||||
|
||||
// This next one is called from LambdaForm.NamedFunction.<init>.
|
||||
/*non-public*/ static MemberName invokeBasicMethod(MethodType basicType) {
|
||||
/*non-public*/
|
||||
static MemberName invokeBasicMethod(MethodType basicType) {
|
||||
assert(basicType == basicType.basicType());
|
||||
try {
|
||||
//Lookup.findVirtual(MethodHandle.class, name, type);
|
||||
@ -190,7 +197,8 @@ class Invokers {
|
||||
* @param leadingArgCount the number of unchanged (non-spread) arguments
|
||||
* @return {@code invoker.invokeExact(mh, uarg*, C[]{sarg*}) := (RT)mh.invoke(uarg*, sarg*)}
|
||||
*/
|
||||
/*non-public*/ MethodHandle spreadInvoker(int leadingArgCount) {
|
||||
/*non-public*/
|
||||
MethodHandle spreadInvoker(int leadingArgCount) {
|
||||
int spreadArgCount = targetType.parameterCount() - leadingArgCount;
|
||||
MethodType postSpreadType = targetType;
|
||||
Class<?> argArrayType = impliedRestargType(postSpreadType, leadingArgCount);
|
||||
@ -445,9 +453,9 @@ class Invokers {
|
||||
return lform;
|
||||
}
|
||||
|
||||
/*non-public*/ static
|
||||
@ForceInline
|
||||
MethodHandle checkVarHandleGenericType(VarHandle handle, VarHandle.AccessDescriptor ad) {
|
||||
/*non-public*/
|
||||
static MethodHandle checkVarHandleGenericType(VarHandle handle, VarHandle.AccessDescriptor ad) {
|
||||
// Test for exact match on invoker types
|
||||
// TODO match with erased types and add cast of return value to lambda form
|
||||
MethodHandle mh = handle.getMethodHandle(ad.mode);
|
||||
@ -459,9 +467,9 @@ class Invokers {
|
||||
}
|
||||
}
|
||||
|
||||
/*non-public*/ static
|
||||
@ForceInline
|
||||
MethodHandle checkVarHandleExactType(VarHandle handle, VarHandle.AccessDescriptor ad) {
|
||||
/*non-public*/
|
||||
static MethodHandle checkVarHandleExactType(VarHandle handle, VarHandle.AccessDescriptor ad) {
|
||||
MethodHandle mh = handle.getMethodHandle(ad.mode);
|
||||
MethodType mt = mh.type();
|
||||
if (mt != ad.symbolicMethodTypeInvoker) {
|
||||
@ -470,16 +478,16 @@ class Invokers {
|
||||
return mh;
|
||||
}
|
||||
|
||||
/*non-public*/ static
|
||||
WrongMethodTypeException newWrongMethodTypeException(MethodType actual, MethodType expected) {
|
||||
/*non-public*/
|
||||
static WrongMethodTypeException newWrongMethodTypeException(MethodType actual, MethodType expected) {
|
||||
// FIXME: merge with JVM logic for throwing WMTE
|
||||
return new WrongMethodTypeException("expected "+expected+" but found "+actual);
|
||||
}
|
||||
|
||||
/** Static definition of MethodHandle.invokeExact checking code. */
|
||||
/*non-public*/ static
|
||||
@ForceInline
|
||||
void checkExactType(MethodHandle mh, MethodType expected) {
|
||||
/*non-public*/
|
||||
static void checkExactType(MethodHandle mh, MethodType expected) {
|
||||
MethodType actual = mh.type();
|
||||
if (actual != expected)
|
||||
throw newWrongMethodTypeException(expected, actual);
|
||||
@ -489,9 +497,9 @@ class Invokers {
|
||||
* Directly returns the type-adjusted MH to invoke, as follows:
|
||||
* {@code (R)MH.invoke(a*) => MH.asType(TYPEOF(a*:R)).invokeBasic(a*)}
|
||||
*/
|
||||
/*non-public*/ static
|
||||
@ForceInline
|
||||
MethodHandle checkGenericType(MethodHandle mh, MethodType expected) {
|
||||
/*non-public*/
|
||||
static MethodHandle checkGenericType(MethodHandle mh, MethodType expected) {
|
||||
return mh.asType(expected);
|
||||
/* Maybe add more paths here. Possible optimizations:
|
||||
* for (R)MH.invoke(a*),
|
||||
@ -559,24 +567,24 @@ class Invokers {
|
||||
}
|
||||
|
||||
/** Static definition of MethodHandle.invokeGeneric checking code. */
|
||||
/*non-public*/ static
|
||||
@ForceInline
|
||||
MethodHandle getCallSiteTarget(CallSite site) {
|
||||
/*non-public*/
|
||||
static MethodHandle getCallSiteTarget(CallSite site) {
|
||||
return site.getTarget();
|
||||
}
|
||||
|
||||
/*non-public*/ static
|
||||
@ForceInline
|
||||
void checkCustomized(MethodHandle mh) {
|
||||
/*non-public*/
|
||||
static void checkCustomized(MethodHandle mh) {
|
||||
if (MethodHandleImpl.isCompileConstant(mh)) return;
|
||||
if (mh.form.customized == null) {
|
||||
maybeCustomize(mh);
|
||||
}
|
||||
}
|
||||
|
||||
/*non-public*/ static
|
||||
@DontInline
|
||||
void maybeCustomize(MethodHandle mh) {
|
||||
/*non-public*/
|
||||
static void maybeCustomize(MethodHandle mh) {
|
||||
byte count = mh.customizationCount;
|
||||
if (count >= CUSTOMIZE_THRESHOLD) {
|
||||
mh.customize();
|
||||
|
@ -70,12 +70,14 @@ import static java.lang.invoke.MethodHandleStatics.newInternalError;
|
||||
* and those seven fields omit much of the information in Method.
|
||||
* @author jrose
|
||||
*/
|
||||
/*non-public*/ final class ResolvedMethodName {
|
||||
/*non-public*/
|
||||
final class ResolvedMethodName {
|
||||
//@Injected JVM_Method* vmtarget;
|
||||
//@Injected Class<?> vmholder;
|
||||
};
|
||||
|
||||
/*non-public*/ final class MemberName implements Member, Cloneable {
|
||||
/*non-public*/
|
||||
final class MemberName implements Member, Cloneable {
|
||||
private Class<?> clazz; // class in which the member is defined
|
||||
private String name; // may be null if not yet materialized
|
||||
private Object type; // may be null if not yet materialized
|
||||
@ -310,7 +312,9 @@ import static java.lang.invoke.MethodHandleStatics.newInternalError;
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
/*non-public*/ boolean referenceKindIsConsistentWith(int originalRefKind) {
|
||||
|
||||
/*non-public*/
|
||||
boolean referenceKindIsConsistentWith(int originalRefKind) {
|
||||
int refKind = getReferenceKind();
|
||||
if (refKind == originalRefKind) return true;
|
||||
switch (originalRefKind) {
|
||||
@ -977,13 +981,15 @@ import static java.lang.invoke.MethodHandleStatics.newInternalError;
|
||||
}
|
||||
|
||||
/** Actually making a query requires an access check. */
|
||||
/*non-public*/ static Factory getFactory() {
|
||||
/*non-public*/
|
||||
static Factory getFactory() {
|
||||
return Factory.INSTANCE;
|
||||
}
|
||||
/** A factory type for resolving member names with the help of the VM.
|
||||
* TBD: Define access-safe public constructors for this factory.
|
||||
*/
|
||||
/*non-public*/ static class Factory {
|
||||
/*non-public*/
|
||||
static class Factory {
|
||||
private Factory() { } // singleton pattern
|
||||
static Factory INSTANCE = new Factory();
|
||||
|
||||
@ -1098,9 +1104,8 @@ import static java.lang.invoke.MethodHandleStatics.newInternalError;
|
||||
* If lookup fails or access is not permitted, a {@linkplain ReflectiveOperationException} is thrown.
|
||||
* Otherwise a fresh copy of the given member is returned, with modifier bits filled in.
|
||||
*/
|
||||
public
|
||||
<NoSuchMemberException extends ReflectiveOperationException>
|
||||
MemberName resolveOrFail(byte refKind, MemberName m, Class<?> lookupClass,
|
||||
public <NoSuchMemberException extends ReflectiveOperationException>
|
||||
MemberName resolveOrFail(byte refKind, MemberName m, Class<?> lookupClass,
|
||||
Class<NoSuchMemberException> nsmClass)
|
||||
throws IllegalAccessException, NoSuchMemberException {
|
||||
MemberName result = resolve(refKind, m, lookupClass, false);
|
||||
@ -1116,8 +1121,7 @@ import static java.lang.invoke.MethodHandleStatics.newInternalError;
|
||||
* If lookup fails or access is not permitted, return null.
|
||||
* Otherwise a fresh copy of the given member is returned, with modifier bits filled in.
|
||||
*/
|
||||
public
|
||||
MemberName resolveOrNull(byte refKind, MemberName m, Class<?> lookupClass) {
|
||||
public MemberName resolveOrNull(byte refKind, MemberName m, Class<?> lookupClass) {
|
||||
MemberName result = resolve(refKind, m, lookupClass, true);
|
||||
if (result != null && result.isResolved())
|
||||
return result;
|
||||
|
@ -448,11 +448,14 @@ public abstract class MethodHandle implements Constable {
|
||||
@interface PolymorphicSignature { }
|
||||
|
||||
private final MethodType type;
|
||||
/*private*/ final LambdaForm form;
|
||||
/*private*/
|
||||
final LambdaForm form;
|
||||
// form is not private so that invokers can easily fetch it
|
||||
/*private*/ MethodHandle asTypeCache;
|
||||
/*private*/
|
||||
MethodHandle asTypeCache;
|
||||
// asTypeCache is not private so that invokers can easily fetch it
|
||||
/*non-public*/ byte customizationCount;
|
||||
/*non-public*/
|
||||
byte customizationCount;
|
||||
// customizationCount should be accessible from invokers
|
||||
|
||||
/**
|
||||
@ -470,7 +473,8 @@ public abstract class MethodHandle implements Constable {
|
||||
* the {@code java.lang.invoke} package.
|
||||
*/
|
||||
// @param type type (permanently assigned) of the new method handle
|
||||
/*non-public*/ MethodHandle(MethodType type, LambdaForm form) {
|
||||
/*non-public*/
|
||||
MethodHandle(MethodType type, LambdaForm form) {
|
||||
this.type = Objects.requireNonNull(type);
|
||||
this.form = Objects.requireNonNull(form).uncustomize();
|
||||
|
||||
@ -553,7 +557,8 @@ public abstract class MethodHandle implements Constable {
|
||||
* @return the signature-polymorphic result, statically represented using {@code Object}
|
||||
*/
|
||||
@HotSpotIntrinsicCandidate
|
||||
/*non-public*/ final native @PolymorphicSignature Object invokeBasic(Object... args) throws Throwable;
|
||||
/*non-public*/
|
||||
final native @PolymorphicSignature Object invokeBasic(Object... args) throws Throwable;
|
||||
|
||||
/**
|
||||
* Private method for trusted invocation of a MemberName of kind {@code REF_invokeVirtual}.
|
||||
@ -563,7 +568,8 @@ public abstract class MethodHandle implements Constable {
|
||||
* @return the signature-polymorphic result, statically represented using {@code Object}
|
||||
*/
|
||||
@HotSpotIntrinsicCandidate
|
||||
/*non-public*/ static native @PolymorphicSignature Object linkToVirtual(Object... args) throws Throwable;
|
||||
/*non-public*/
|
||||
static native @PolymorphicSignature Object linkToVirtual(Object... args) throws Throwable;
|
||||
|
||||
/**
|
||||
* Private method for trusted invocation of a MemberName of kind {@code REF_invokeStatic}.
|
||||
@ -573,7 +579,8 @@ public abstract class MethodHandle implements Constable {
|
||||
* @return the signature-polymorphic result, statically represented using {@code Object}
|
||||
*/
|
||||
@HotSpotIntrinsicCandidate
|
||||
/*non-public*/ static native @PolymorphicSignature Object linkToStatic(Object... args) throws Throwable;
|
||||
/*non-public*/
|
||||
static native @PolymorphicSignature Object linkToStatic(Object... args) throws Throwable;
|
||||
|
||||
/**
|
||||
* Private method for trusted invocation of a MemberName of kind {@code REF_invokeSpecial}.
|
||||
@ -583,7 +590,8 @@ public abstract class MethodHandle implements Constable {
|
||||
* @return the signature-polymorphic result, statically represented using {@code Object}
|
||||
*/
|
||||
@HotSpotIntrinsicCandidate
|
||||
/*non-public*/ static native @PolymorphicSignature Object linkToSpecial(Object... args) throws Throwable;
|
||||
/*non-public*/
|
||||
static native @PolymorphicSignature Object linkToSpecial(Object... args) throws Throwable;
|
||||
|
||||
/**
|
||||
* Private method for trusted invocation of a MemberName of kind {@code REF_invokeInterface}.
|
||||
@ -593,7 +601,8 @@ public abstract class MethodHandle implements Constable {
|
||||
* @return the signature-polymorphic result, statically represented using {@code Object}
|
||||
*/
|
||||
@HotSpotIntrinsicCandidate
|
||||
/*non-public*/ static native @PolymorphicSignature Object linkToInterface(Object... args) throws Throwable;
|
||||
/*non-public*/
|
||||
static native @PolymorphicSignature Object linkToInterface(Object... args) throws Throwable;
|
||||
|
||||
/**
|
||||
* Performs a variable arity invocation, passing the arguments in the given array
|
||||
@ -865,7 +874,8 @@ public abstract class MethodHandle implements Constable {
|
||||
}
|
||||
|
||||
/** Override this to change asType behavior. */
|
||||
/*non-public*/ MethodHandle asTypeUncached(MethodType newType) {
|
||||
/*non-public*/
|
||||
MethodHandle asTypeUncached(MethodType newType) {
|
||||
if (!type.isConvertibleTo(newType))
|
||||
throw new WrongMethodTypeException("cannot convert "+this+" to "+newType);
|
||||
return asTypeCache = MethodHandleImpl.makePairwiseConvert(this, newType, true);
|
||||
@ -1242,7 +1252,8 @@ assertEquals("[123]", (String) longsToString.invokeExact((long)123));
|
||||
* See if {@code asCollector} can be validly called with the given arguments.
|
||||
* Return false if the last parameter is not an exact match to arrayType.
|
||||
*/
|
||||
/*non-public*/ boolean asCollectorChecks(Class<?> arrayType, int pos, int arrayLength) {
|
||||
/*non-public*/
|
||||
boolean asCollectorChecks(Class<?> arrayType, int pos, int arrayLength) {
|
||||
spreadArrayChecks(arrayType, arrayLength);
|
||||
int nargs = type().parameterCount();
|
||||
if (pos < 0 || pos >= nargs) {
|
||||
|
@ -59,7 +59,8 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
|
||||
* Trusted implementation code for MethodHandle.
|
||||
* @author jrose
|
||||
*/
|
||||
/*non-public*/ abstract class MethodHandleImpl {
|
||||
/*non-public*/
|
||||
abstract class MethodHandleImpl {
|
||||
|
||||
/// Factory methods to create method handles:
|
||||
|
||||
@ -683,8 +684,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
|
||||
}
|
||||
|
||||
@Hidden
|
||||
static
|
||||
MethodHandle selectAlternative(boolean testResult, MethodHandle target, MethodHandle fallback) {
|
||||
static MethodHandle selectAlternative(boolean testResult, MethodHandle target, MethodHandle fallback) {
|
||||
if (testResult) {
|
||||
return target;
|
||||
} else {
|
||||
@ -695,8 +695,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
|
||||
// Intrinsified by C2. Counters are used during parsing to calculate branch frequencies.
|
||||
@Hidden
|
||||
@jdk.internal.HotSpotIntrinsicCandidate
|
||||
static
|
||||
boolean profileBoolean(boolean result, int[] counters) {
|
||||
static boolean profileBoolean(boolean result, int[] counters) {
|
||||
// Profile is int[2] where [0] and [1] correspond to false and true occurrences respectively.
|
||||
int idx = result ? 1 : 0;
|
||||
try {
|
||||
@ -711,13 +710,11 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
|
||||
// Intrinsified by C2. Returns true if obj is a compile-time constant.
|
||||
@Hidden
|
||||
@jdk.internal.HotSpotIntrinsicCandidate
|
||||
static
|
||||
boolean isCompileConstant(Object obj) {
|
||||
static boolean isCompileConstant(Object obj) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static
|
||||
MethodHandle makeGuardWithTest(MethodHandle test,
|
||||
static MethodHandle makeGuardWithTest(MethodHandle test,
|
||||
MethodHandle target,
|
||||
MethodHandle fallback) {
|
||||
MethodType type = target.type();
|
||||
@ -744,8 +741,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
MethodHandle profile(MethodHandle target) {
|
||||
static MethodHandle profile(MethodHandle target) {
|
||||
if (DONT_INLINE_THRESHOLD >= 0) {
|
||||
return makeBlockInliningWrapper(target);
|
||||
} else {
|
||||
@ -757,8 +753,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
|
||||
* Block inlining during JIT-compilation of a target method handle if it hasn't been invoked enough times.
|
||||
* Corresponding LambdaForm has @DontInline when compiled into bytecode.
|
||||
*/
|
||||
static
|
||||
MethodHandle makeBlockInliningWrapper(MethodHandle target) {
|
||||
static MethodHandle makeBlockInliningWrapper(MethodHandle target) {
|
||||
LambdaForm lform;
|
||||
if (DONT_INLINE_THRESHOLD > 0) {
|
||||
lform = Makers.PRODUCE_BLOCK_INLINING_FORM.apply(target);
|
||||
@ -895,8 +890,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
LambdaForm makeGuardWithTestForm(MethodType basicType) {
|
||||
static LambdaForm makeGuardWithTestForm(MethodType basicType) {
|
||||
LambdaForm lform = basicType.form().cachedLambdaForm(MethodTypeForm.LF_GWT);
|
||||
if (lform != null) return lform;
|
||||
final int THIS_MH = 0; // the BMH_LLL
|
||||
@ -1026,8 +1020,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
|
||||
return basicType.form().setCachedLambdaForm(MethodTypeForm.LF_GWC, lform);
|
||||
}
|
||||
|
||||
static
|
||||
MethodHandle makeGuardWithCatch(MethodHandle target,
|
||||
static MethodHandle makeGuardWithCatch(MethodHandle target,
|
||||
Class<? extends Throwable> exType,
|
||||
MethodHandle catcher) {
|
||||
MethodType type = target.type();
|
||||
@ -1078,8 +1071,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
|
||||
return newArray;
|
||||
}
|
||||
|
||||
static
|
||||
MethodHandle throwException(MethodType type) {
|
||||
static MethodHandle throwException(MethodType type) {
|
||||
assert(Throwable.class.isAssignableFrom(type.parameterType(0)));
|
||||
int arity = type.parameterCount();
|
||||
if (arity > 1) {
|
||||
@ -1137,8 +1129,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
|
||||
* is sensitive to its caller. A small number of system methods
|
||||
* are in this category, including Class.forName and Method.invoke.
|
||||
*/
|
||||
static
|
||||
MethodHandle bindCaller(MethodHandle mh, Class<?> hostClass) {
|
||||
static MethodHandle bindCaller(MethodHandle mh, Class<?> hostClass) {
|
||||
return BindCaller.bindCaller(mh, hostClass);
|
||||
}
|
||||
|
||||
@ -1147,8 +1138,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
|
||||
private static class BindCaller {
|
||||
private static MethodType INVOKER_MT = MethodType.methodType(Object.class, MethodHandle.class, Object[].class);
|
||||
|
||||
static
|
||||
MethodHandle bindCaller(MethodHandle mh, Class<?> hostClass) {
|
||||
static MethodHandle bindCaller(MethodHandle mh, Class<?> hostClass) {
|
||||
// Code in the boot layer should now be careful while creating method handles or
|
||||
// functional interface instances created from method references to @CallerSensitive methods,
|
||||
// it needs to be ensured the handles or interface instances are kept safe and are not passed
|
||||
@ -1665,7 +1655,8 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
|
||||
return getConstantHandle(MH_copyAsPrimitiveArray).bindTo(Wrapper.forPrimitiveType(elemType));
|
||||
}
|
||||
|
||||
/*non-public*/ static void assertSame(Object mh1, Object mh2) {
|
||||
/*non-public*/
|
||||
static void assertSame(Object mh1, Object mh2) {
|
||||
if (mh1 != mh2) {
|
||||
String msg = String.format("mh1 != mh2: mh1 = %s (form: %s); mh2 = %s (form: %s)",
|
||||
mh1, ((MethodHandle)mh1).form,
|
||||
|
@ -127,8 +127,7 @@ import static java.lang.invoke.MethodHandleStatics.*;
|
||||
* </table>
|
||||
* @since 1.8
|
||||
*/
|
||||
public
|
||||
interface MethodHandleInfo {
|
||||
public interface MethodHandleInfo {
|
||||
/**
|
||||
* A direct method handle reference kind,
|
||||
* as defined in the <a href="MethodHandleInfo.html#refkinds">table above</a>.
|
||||
|
@ -152,8 +152,7 @@ public class MethodHandleProxies {
|
||||
// generated adapter classes.
|
||||
//
|
||||
@CallerSensitive
|
||||
public static
|
||||
<T> T asInterfaceInstance(final Class<T> intfc, final MethodHandle target) {
|
||||
public static <T> T asInterfaceInstance(final Class<T> intfc, final MethodHandle target) {
|
||||
if (!intfc.isInterface() || !Modifier.isPublic(intfc.getModifiers()))
|
||||
throw newIllegalArgumentException("not a public interface", intfc.getName());
|
||||
final MethodHandle mh;
|
||||
@ -235,8 +234,7 @@ public class MethodHandleProxies {
|
||||
* @param x any reference
|
||||
* @return true if the reference is not null and points to an object produced by {@code asInterfaceInstance}
|
||||
*/
|
||||
public static
|
||||
boolean isWrapperInstance(Object x) {
|
||||
public static boolean isWrapperInstance(Object x) {
|
||||
return x instanceof WrapperInstance;
|
||||
}
|
||||
|
||||
@ -258,8 +256,7 @@ public class MethodHandleProxies {
|
||||
* @return a method handle implementing the unique method
|
||||
* @throws IllegalArgumentException if the reference x is not to a wrapper instance
|
||||
*/
|
||||
public static
|
||||
MethodHandle wrapperInstanceTarget(Object x) {
|
||||
public static MethodHandle wrapperInstanceTarget(Object x) {
|
||||
return asWrapperInstance(x).getWrapperInstanceTarget();
|
||||
}
|
||||
|
||||
@ -271,13 +268,11 @@ public class MethodHandleProxies {
|
||||
* @return the single-method interface type for which the wrapper was created
|
||||
* @throws IllegalArgumentException if the reference x is not to a wrapper instance
|
||||
*/
|
||||
public static
|
||||
Class<?> wrapperInstanceType(Object x) {
|
||||
public static Class<?> wrapperInstanceType(Object x) {
|
||||
return asWrapperInstance(x).getWrapperInstanceType();
|
||||
}
|
||||
|
||||
private static
|
||||
boolean isObjectMethod(Method m) {
|
||||
private static boolean isObjectMethod(Method m) {
|
||||
switch (m.getName()) {
|
||||
case "toString":
|
||||
return (m.getReturnType() == String.class
|
||||
@ -293,8 +288,7 @@ public class MethodHandleProxies {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static
|
||||
Object callObjectMethod(Object self, Method m, Object[] args) {
|
||||
private static Object callObjectMethod(Object self, Method m, Object[] args) {
|
||||
assert(isObjectMethod(m)) : m;
|
||||
switch (m.getName()) {
|
||||
case "toString":
|
||||
@ -307,8 +301,7 @@ public class MethodHandleProxies {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static
|
||||
Method[] getSingleNameMethods(Class<?> intfc) {
|
||||
private static Method[] getSingleNameMethods(Class<?> intfc) {
|
||||
ArrayList<Method> methods = new ArrayList<>();
|
||||
String uniqueName = null;
|
||||
for (Method m : intfc.getMethods()) {
|
||||
@ -325,13 +318,11 @@ public class MethodHandleProxies {
|
||||
return methods.toArray(new Method[methods.size()]);
|
||||
}
|
||||
|
||||
private static
|
||||
boolean isDefaultMethod(Method m) {
|
||||
private static boolean isDefaultMethod(Method m) {
|
||||
return !Modifier.isAbstract(m.getModifiers());
|
||||
}
|
||||
|
||||
private static
|
||||
boolean hasDefaultMethods(Class<?> intfc) {
|
||||
private static boolean hasDefaultMethods(Class<?> intfc) {
|
||||
for (Method m : intfc.getMethods()) {
|
||||
if (!isObjectMethod(m) &&
|
||||
!Modifier.isAbstract(m.getModifiers())) {
|
||||
@ -341,8 +332,7 @@ public class MethodHandleProxies {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static
|
||||
Object callDefaultMethod(ConcurrentHashMap<Method, MethodHandle> defaultMethodMap,
|
||||
private static Object callDefaultMethod(ConcurrentHashMap<Method, MethodHandle> defaultMethodMap,
|
||||
Object self, Class<?> intfc, Method m, Object[] args) throws Throwable {
|
||||
assert(isDefaultMethod(m) && !isObjectMethod(m)) : m;
|
||||
|
||||
|
@ -36,7 +36,8 @@ import java.util.Properties;
|
||||
* Usage: {@code import static java.lang.invoke.MethodHandleStatics.*}
|
||||
* @author John Rose, JSR 292 EG
|
||||
*/
|
||||
/*non-public*/ class MethodHandleStatics {
|
||||
/*non-public*/
|
||||
class MethodHandleStatics {
|
||||
|
||||
private MethodHandleStatics() { } // do not instantiate
|
||||
|
||||
@ -95,7 +96,8 @@ import java.util.Properties;
|
||||
/** Tell if any of the debugging switches are turned on.
|
||||
* If this is the case, it is reasonable to perform extra checks or save extra information.
|
||||
*/
|
||||
/*non-public*/ static boolean debugEnabled() {
|
||||
/*non-public*/
|
||||
static boolean debugEnabled() {
|
||||
return (DEBUG_METHOD_HANDLE_NAMES |
|
||||
DUMP_CLASS_FILES |
|
||||
TRACE_INTERPRETER |
|
||||
@ -104,32 +106,41 @@ import java.util.Properties;
|
||||
}
|
||||
|
||||
// handy shared exception makers (they simplify the common case code)
|
||||
/*non-public*/ static InternalError newInternalError(String message) {
|
||||
/*non-public*/
|
||||
static InternalError newInternalError(String message) {
|
||||
return new InternalError(message);
|
||||
}
|
||||
/*non-public*/ static InternalError newInternalError(String message, Exception cause) {
|
||||
/*non-public*/
|
||||
static InternalError newInternalError(String message, Exception cause) {
|
||||
return new InternalError(message, cause);
|
||||
}
|
||||
/*non-public*/ static InternalError newInternalError(Exception cause) {
|
||||
/*non-public*/
|
||||
static InternalError newInternalError(Exception cause) {
|
||||
return new InternalError(cause);
|
||||
}
|
||||
/*non-public*/ static RuntimeException newIllegalStateException(String message) {
|
||||
/*non-public*/
|
||||
static RuntimeException newIllegalStateException(String message) {
|
||||
return new IllegalStateException(message);
|
||||
}
|
||||
/*non-public*/ static RuntimeException newIllegalStateException(String message, Object obj) {
|
||||
/*non-public*/
|
||||
static RuntimeException newIllegalStateException(String message, Object obj) {
|
||||
return new IllegalStateException(message(message, obj));
|
||||
}
|
||||
/*non-public*/ static RuntimeException newIllegalArgumentException(String message) {
|
||||
/*non-public*/
|
||||
static RuntimeException newIllegalArgumentException(String message) {
|
||||
return new IllegalArgumentException(message);
|
||||
}
|
||||
/*non-public*/ static RuntimeException newIllegalArgumentException(String message, Object obj) {
|
||||
/*non-public*/
|
||||
static RuntimeException newIllegalArgumentException(String message, Object obj) {
|
||||
return new IllegalArgumentException(message(message, obj));
|
||||
}
|
||||
/*non-public*/ static RuntimeException newIllegalArgumentException(String message, Object obj, Object obj2) {
|
||||
/*non-public*/
|
||||
static RuntimeException newIllegalArgumentException(String message, Object obj, Object obj2) {
|
||||
return new IllegalArgumentException(message(message, obj, obj2));
|
||||
}
|
||||
/** Propagate unchecked exceptions and errors, but wrap anything checked and throw that instead. */
|
||||
/*non-public*/ static Error uncaughtException(Throwable ex) {
|
||||
/*non-public*/
|
||||
static Error uncaughtException(Throwable ex) {
|
||||
if (ex instanceof Error) throw (Error) ex;
|
||||
if (ex instanceof RuntimeException) throw (RuntimeException) ex;
|
||||
throw new InternalError("uncaught exception", ex);
|
||||
@ -142,11 +153,13 @@ import java.util.Properties;
|
||||
if (obj != null || obj2 != null) message = message + ": " + obj + ", " + obj2;
|
||||
return message;
|
||||
}
|
||||
/*non-public*/ static void rangeCheck2(int start, int end, int size) {
|
||||
/*non-public*/
|
||||
static void rangeCheck2(int start, int end, int size) {
|
||||
if (0 > start || start > end || end > size)
|
||||
throw new IndexOutOfBoundsException(start+".."+end);
|
||||
}
|
||||
/*non-public*/ static int rangeCheck1(int index, int size) {
|
||||
/*non-public*/
|
||||
static int rangeCheck1(int index, int size) {
|
||||
if (0 > index || index >= size)
|
||||
throw new IndexOutOfBoundsException(index);
|
||||
return index;
|
||||
|
@ -280,8 +280,7 @@ public class MethodHandles {
|
||||
* @throws ClassCastException if the member is not of the expected type
|
||||
* @since 1.8
|
||||
*/
|
||||
public static <T extends Member> T
|
||||
reflectAs(Class<T> expected, MethodHandle target) {
|
||||
public static <T extends Member> T reflectAs(Class<T> expected, MethodHandle target) {
|
||||
SecurityManager smgr = System.getSecurityManager();
|
||||
if (smgr != null) smgr.checkPermission(ACCESS_PERMISSION);
|
||||
Lookup lookup = Lookup.IMPL_LOOKUP; // use maximally privileged lookup
|
||||
@ -1764,8 +1763,7 @@ assertEquals("[x, y]", MH_asList.invoke("x", "y").toString());
|
||||
* <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
|
||||
* @throws NullPointerException if any argument is null
|
||||
*/
|
||||
public
|
||||
MethodHandle findStatic(Class<?> refc, String name, MethodType type) throws NoSuchMethodException, IllegalAccessException {
|
||||
public MethodHandle findStatic(Class<?> refc, String name, MethodType type) throws NoSuchMethodException, IllegalAccessException {
|
||||
MemberName method = resolveOrFail(REF_invokeStatic, refc, name, type);
|
||||
return getDirectMethod(REF_invokeStatic, refc, method, findBoundCallerClass(method));
|
||||
}
|
||||
@ -3177,7 +3175,8 @@ return mh1;
|
||||
/** Hook called from the JVM (via MethodHandleNatives) to link MH constants:
|
||||
*/
|
||||
/*non-public*/
|
||||
MethodHandle linkMethodHandleConstant(byte refKind, Class<?> defc, String name, Object type) throws ReflectiveOperationException {
|
||||
MethodHandle linkMethodHandleConstant(byte refKind, Class<?> defc, String name, Object type)
|
||||
throws ReflectiveOperationException {
|
||||
if (!(type instanceof Class || type instanceof MethodType))
|
||||
throw new InternalError("unresolved MemberName");
|
||||
MemberName member = new MemberName(refKind, defc, name, type);
|
||||
@ -3213,8 +3212,7 @@ return mh1;
|
||||
}
|
||||
return mh;
|
||||
}
|
||||
private
|
||||
boolean canBeCached(byte refKind, Class<?> defc, MemberName member) {
|
||||
private boolean canBeCached(byte refKind, Class<?> defc, MemberName member) {
|
||||
if (refKind == REF_invokeSpecial) {
|
||||
return false;
|
||||
}
|
||||
@ -3248,8 +3246,7 @@ return mh1;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private
|
||||
MethodHandle getDirectMethodForConstant(byte refKind, Class<?> defc, MemberName member)
|
||||
private MethodHandle getDirectMethodForConstant(byte refKind, Class<?> defc, MemberName member)
|
||||
throws ReflectiveOperationException {
|
||||
if (MethodHandleNatives.refKindIsField(refKind)) {
|
||||
return getDirectFieldNoSecurityManager(refKind, defc, member);
|
||||
@ -3282,8 +3279,7 @@ return mh1;
|
||||
* @jvms 6.5 {@code anewarray} Instruction
|
||||
* @since 9
|
||||
*/
|
||||
public static
|
||||
MethodHandle arrayConstructor(Class<?> arrayClass) throws IllegalArgumentException {
|
||||
public static MethodHandle arrayConstructor(Class<?> arrayClass) throws IllegalArgumentException {
|
||||
if (!arrayClass.isArray()) {
|
||||
throw newIllegalArgumentException("not an array class: " + arrayClass.getName());
|
||||
}
|
||||
@ -3308,8 +3304,7 @@ return mh1;
|
||||
* @jvms 6.5 {@code arraylength} Instruction
|
||||
* @since 9
|
||||
*/
|
||||
public static
|
||||
MethodHandle arrayLength(Class<?> arrayClass) throws IllegalArgumentException {
|
||||
public static MethodHandle arrayLength(Class<?> arrayClass) throws IllegalArgumentException {
|
||||
return MethodHandleImpl.makeArrayElementAccessor(arrayClass, MethodHandleImpl.ArrayAccess.LENGTH);
|
||||
}
|
||||
|
||||
@ -3333,8 +3328,7 @@ return mh1;
|
||||
* @throws IllegalArgumentException if arrayClass is not an array type
|
||||
* @jvms 6.5 {@code aaload} Instruction
|
||||
*/
|
||||
public static
|
||||
MethodHandle arrayElementGetter(Class<?> arrayClass) throws IllegalArgumentException {
|
||||
public static MethodHandle arrayElementGetter(Class<?> arrayClass) throws IllegalArgumentException {
|
||||
return MethodHandleImpl.makeArrayElementAccessor(arrayClass, MethodHandleImpl.ArrayAccess.GET);
|
||||
}
|
||||
|
||||
@ -3358,8 +3352,7 @@ return mh1;
|
||||
* @throws IllegalArgumentException if arrayClass is not an array type
|
||||
* @jvms 6.5 {@code aastore} Instruction
|
||||
*/
|
||||
public static
|
||||
MethodHandle arrayElementSetter(Class<?> arrayClass) throws IllegalArgumentException {
|
||||
public static MethodHandle arrayElementSetter(Class<?> arrayClass) throws IllegalArgumentException {
|
||||
return MethodHandleImpl.makeArrayElementAccessor(arrayClass, MethodHandleImpl.ArrayAccess.SET);
|
||||
}
|
||||
|
||||
@ -3423,8 +3416,7 @@ return mh1;
|
||||
* @throws IllegalArgumentException if arrayClass is not an array type
|
||||
* @since 9
|
||||
*/
|
||||
public static
|
||||
VarHandle arrayElementVarHandle(Class<?> arrayClass) throws IllegalArgumentException {
|
||||
public static VarHandle arrayElementVarHandle(Class<?> arrayClass) throws IllegalArgumentException {
|
||||
return VarHandles.makeArrayElementHandle(arrayClass);
|
||||
}
|
||||
|
||||
@ -3504,8 +3496,7 @@ return mh1;
|
||||
* viewArrayClass is not supported as a variable type
|
||||
* @since 9
|
||||
*/
|
||||
public static
|
||||
VarHandle byteArrayViewVarHandle(Class<?> viewArrayClass,
|
||||
public static VarHandle byteArrayViewVarHandle(Class<?> viewArrayClass,
|
||||
ByteOrder byteOrder) throws IllegalArgumentException {
|
||||
Objects.requireNonNull(byteOrder);
|
||||
return VarHandles.byteArrayViewHandle(viewArrayClass,
|
||||
@ -3592,8 +3583,7 @@ return mh1;
|
||||
* viewArrayClass is not supported as a variable type
|
||||
* @since 9
|
||||
*/
|
||||
public static
|
||||
VarHandle byteBufferViewVarHandle(Class<?> viewArrayClass,
|
||||
public static VarHandle byteBufferViewVarHandle(Class<?> viewArrayClass,
|
||||
ByteOrder byteOrder) throws IllegalArgumentException {
|
||||
Objects.requireNonNull(byteOrder);
|
||||
return VarHandles.makeByteBufferViewHandle(viewArrayClass,
|
||||
@ -3649,8 +3639,7 @@ return invoker;
|
||||
* or if the resulting method handle's type would have
|
||||
* <a href="MethodHandle.html#maxarity">too many parameters</a>
|
||||
*/
|
||||
public static
|
||||
MethodHandle spreadInvoker(MethodType type, int leadingArgCount) {
|
||||
public static MethodHandle spreadInvoker(MethodType type, int leadingArgCount) {
|
||||
if (leadingArgCount < 0 || leadingArgCount > type.parameterCount())
|
||||
throw newIllegalArgumentException("bad argument count", leadingArgCount);
|
||||
type = type.asSpreaderType(Object[].class, leadingArgCount, type.parameterCount() - leadingArgCount);
|
||||
@ -3692,8 +3681,7 @@ return invoker;
|
||||
* @throws IllegalArgumentException if the resulting method handle's type would have
|
||||
* <a href="MethodHandle.html#maxarity">too many parameters</a>
|
||||
*/
|
||||
public static
|
||||
MethodHandle exactInvoker(MethodType type) {
|
||||
public static MethodHandle exactInvoker(MethodType type) {
|
||||
return type.invokers().exactInvoker();
|
||||
}
|
||||
|
||||
@ -3731,8 +3719,7 @@ return invoker;
|
||||
* @throws IllegalArgumentException if the resulting method handle's type would have
|
||||
* <a href="MethodHandle.html#maxarity">too many parameters</a>
|
||||
*/
|
||||
public static
|
||||
MethodHandle invoker(MethodType type) {
|
||||
public static MethodHandle invoker(MethodType type) {
|
||||
return type.invokers().genericInvoker();
|
||||
}
|
||||
|
||||
@ -3750,8 +3737,7 @@ return invoker;
|
||||
* any VarHandle whose access mode type is of the given type.
|
||||
* @since 9
|
||||
*/
|
||||
static public
|
||||
MethodHandle varHandleExactInvoker(VarHandle.AccessMode accessMode, MethodType type) {
|
||||
public static MethodHandle varHandleExactInvoker(VarHandle.AccessMode accessMode, MethodType type) {
|
||||
return type.invokers().varHandleMethodExactInvoker(accessMode);
|
||||
}
|
||||
|
||||
@ -3779,13 +3765,12 @@ return invoker;
|
||||
* type.
|
||||
* @since 9
|
||||
*/
|
||||
static public
|
||||
MethodHandle varHandleInvoker(VarHandle.AccessMode accessMode, MethodType type) {
|
||||
public static MethodHandle varHandleInvoker(VarHandle.AccessMode accessMode, MethodType type) {
|
||||
return type.invokers().varHandleMethodInvoker(accessMode);
|
||||
}
|
||||
|
||||
static /*non-public*/
|
||||
MethodHandle basicInvoker(MethodType type) {
|
||||
/*non-public*/
|
||||
static MethodHandle basicInvoker(MethodType type) {
|
||||
return type.invokers().basicInvoker();
|
||||
}
|
||||
|
||||
@ -3835,8 +3820,7 @@ return invoker;
|
||||
* @throws WrongMethodTypeException if the conversion cannot be made
|
||||
* @see MethodHandle#asType
|
||||
*/
|
||||
public static
|
||||
MethodHandle explicitCastArguments(MethodHandle target, MethodType newType) {
|
||||
public static MethodHandle explicitCastArguments(MethodHandle target, MethodType newType) {
|
||||
explicitCastArgumentsChecks(target, newType);
|
||||
// use the asTypeCache when possible:
|
||||
MethodType oldType = target.type();
|
||||
@ -3915,8 +3899,7 @@ assert((int)twice.invokeExact(21) == 42);
|
||||
* or if two corresponding parameter types in
|
||||
* {@code target.type()} and {@code newType} are not identical,
|
||||
*/
|
||||
public static
|
||||
MethodHandle permuteArguments(MethodHandle target, MethodType newType, int... reorder) {
|
||||
public static MethodHandle permuteArguments(MethodHandle target, MethodType newType, int... reorder) {
|
||||
reorder = reorder.clone(); // get a private copy
|
||||
MethodType oldType = target.type();
|
||||
permuteArgumentChecks(reorder, newType, oldType);
|
||||
@ -4075,8 +4058,7 @@ assert((int)twice.invokeExact(21) == 42);
|
||||
* @throws ClassCastException if the value cannot be converted to the required return type
|
||||
* @throws IllegalArgumentException if the given type is {@code void.class}
|
||||
*/
|
||||
public static
|
||||
MethodHandle constant(Class<?> type, Object value) {
|
||||
public static MethodHandle constant(Class<?> type, Object value) {
|
||||
if (type.isPrimitive()) {
|
||||
if (type == void.class)
|
||||
throw newIllegalArgumentException("void type");
|
||||
@ -4099,8 +4081,7 @@ assert((int)twice.invokeExact(21) == 42);
|
||||
* @throws NullPointerException if the argument is null
|
||||
* @throws IllegalArgumentException if the given type is {@code void.class}
|
||||
*/
|
||||
public static
|
||||
MethodHandle identity(Class<?> type) {
|
||||
public static MethodHandle identity(Class<?> type) {
|
||||
Wrapper btw = (type.isPrimitive() ? Wrapper.forPrimitiveType(type) : Wrapper.OBJECT);
|
||||
int pos = btw.ordinal();
|
||||
MethodHandle ident = IDENTITY_MHS[pos];
|
||||
@ -4230,8 +4211,7 @@ assert((int)twice.invokeExact(21) == 42);
|
||||
* type.
|
||||
* @see MethodHandle#bindTo
|
||||
*/
|
||||
public static
|
||||
MethodHandle insertArguments(MethodHandle target, int pos, Object... values) {
|
||||
public static MethodHandle insertArguments(MethodHandle target, int pos, Object... values) {
|
||||
int insCount = values.length;
|
||||
Class<?>[] ptypes = insertArgumentsChecks(target, insCount, pos);
|
||||
if (insCount == 0) return target;
|
||||
@ -4316,8 +4296,7 @@ assertEquals("yz", (String) d0.invokeExact(123, "x", "y", "z"));
|
||||
* or if {@code pos} is negative or greater than the arity of the target,
|
||||
* or if the new method handle's type would have too many parameters
|
||||
*/
|
||||
public static
|
||||
MethodHandle dropArguments(MethodHandle target, int pos, List<Class<?>> valueTypes) {
|
||||
public static MethodHandle dropArguments(MethodHandle target, int pos, List<Class<?>> valueTypes) {
|
||||
return dropArguments0(target, pos, copyTypes(valueTypes.toArray()));
|
||||
}
|
||||
|
||||
@ -4325,8 +4304,7 @@ assertEquals("yz", (String) d0.invokeExact(123, "x", "y", "z"));
|
||||
return Arrays.asList(Arrays.copyOf(array, array.length, Class[].class));
|
||||
}
|
||||
|
||||
private static
|
||||
MethodHandle dropArguments0(MethodHandle target, int pos, List<Class<?>> valueTypes) {
|
||||
private static MethodHandle dropArguments0(MethodHandle target, int pos, List<Class<?>> valueTypes) {
|
||||
MethodType oldType = target.type(); // get NPE
|
||||
int dropped = dropArgumentChecks(oldType, pos, valueTypes);
|
||||
MethodType newType = oldType.insertParameterTypes(pos, valueTypes);
|
||||
@ -4399,8 +4377,7 @@ assertEquals("xz", (String) d12.invokeExact("x", 12, true, "z"));
|
||||
* or if the new method handle's type would have
|
||||
* <a href="MethodHandle.html#maxarity">too many parameters</a>
|
||||
*/
|
||||
public static
|
||||
MethodHandle dropArguments(MethodHandle target, int pos, Class<?>... valueTypes) {
|
||||
public static MethodHandle dropArguments(MethodHandle target, int pos, Class<?>... valueTypes) {
|
||||
return dropArguments0(target, pos, copyTypes(valueTypes));
|
||||
}
|
||||
|
||||
@ -4506,8 +4483,7 @@ assertEquals("xy", h3.invoke("x", "y", 1, "a", "b", "c"));
|
||||
* {@code pos}.
|
||||
* @since 9
|
||||
*/
|
||||
public static
|
||||
MethodHandle dropArgumentsToMatch(MethodHandle target, int skip, List<Class<?>> newTypes, int pos) {
|
||||
public static MethodHandle dropArgumentsToMatch(MethodHandle target, int skip, List<Class<?>> newTypes, int pos) {
|
||||
Objects.requireNonNull(target);
|
||||
Objects.requireNonNull(newTypes);
|
||||
return dropArgumentsToMatch(target, skip, newTypes, pos, false);
|
||||
@ -4590,8 +4566,7 @@ assertEquals("XY", (String) f2.invokeExact("x", "y")); // XY
|
||||
* or if the resulting method handle's type would have
|
||||
* <a href="MethodHandle.html#maxarity">too many parameters</a>
|
||||
*/
|
||||
public static
|
||||
MethodHandle filterArguments(MethodHandle target, int pos, MethodHandle... filters) {
|
||||
public static MethodHandle filterArguments(MethodHandle target, int pos, MethodHandle... filters) {
|
||||
// In method types arguments start at index 0, while the LF
|
||||
// editor have the MH receiver at position 0 - adjust appropriately.
|
||||
final int MH_RECEIVER_OFFSET = 1;
|
||||
@ -4649,8 +4624,8 @@ assertEquals("XY", (String) f2.invokeExact("x", "y")); // XY
|
||||
return result.copyWithExtendL(newType, lform, filter);
|
||||
}
|
||||
|
||||
/*non-public*/ static
|
||||
MethodHandle filterArgument(MethodHandle target, int pos, MethodHandle filter) {
|
||||
/*non-public*/
|
||||
static MethodHandle filterArgument(MethodHandle target, int pos, MethodHandle filter) {
|
||||
filterArgumentChecks(target, pos, filter);
|
||||
MethodType targetType = target.type();
|
||||
MethodType filterType = filter.type();
|
||||
@ -4796,8 +4771,7 @@ assertEquals("[top, [[up, down, strange], charm], bottom]",
|
||||
* @see MethodHandles#filterArguments
|
||||
* @see MethodHandles#filterReturnValue
|
||||
*/
|
||||
public static
|
||||
MethodHandle collectArguments(MethodHandle target, int pos, MethodHandle filter) {
|
||||
public static MethodHandle collectArguments(MethodHandle target, int pos, MethodHandle filter) {
|
||||
MethodType newType = collectArgumentsChecks(target, pos, filter);
|
||||
MethodType collectorType = filter.type();
|
||||
BoundMethodHandle result = target.rebind();
|
||||
@ -4890,8 +4864,7 @@ System.out.println((int) f0.invokeExact("x", "y")); // 2
|
||||
* @throws IllegalArgumentException if the argument list of {@code filter}
|
||||
* does not match the return type of target as described above
|
||||
*/
|
||||
public static
|
||||
MethodHandle filterReturnValue(MethodHandle target, MethodHandle filter) {
|
||||
public static MethodHandle filterReturnValue(MethodHandle target, MethodHandle filter) {
|
||||
MethodType targetType = target.type();
|
||||
MethodType filterType = filter.type();
|
||||
filterReturnValueChecks(targetType, filterType);
|
||||
@ -4999,8 +4972,7 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
|
||||
* (skipping one matching the {@code combiner}'s return type)
|
||||
* are not identical with the argument types of {@code combiner}
|
||||
*/
|
||||
public static
|
||||
MethodHandle foldArguments(MethodHandle target, MethodHandle combiner) {
|
||||
public static MethodHandle foldArguments(MethodHandle target, MethodHandle combiner) {
|
||||
return foldArguments(target, 0, combiner);
|
||||
}
|
||||
|
||||
@ -5127,7 +5099,8 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
|
||||
* (2) the {@code N} argument types at positions {@code argPositions[1...N]} of the target signature are
|
||||
* not identical with the argument types of {@code combiner}.
|
||||
*/
|
||||
/*non-public*/ static MethodHandle filterArgumentsWithCombiner(MethodHandle target, int position, MethodHandle combiner, int ... argPositions) {
|
||||
/*non-public*/
|
||||
static MethodHandle filterArgumentsWithCombiner(MethodHandle target, int position, MethodHandle combiner, int ... argPositions) {
|
||||
return argumentsWithCombiner(true, target, position, combiner, argPositions);
|
||||
}
|
||||
|
||||
@ -5149,7 +5122,8 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
|
||||
* (skipping {@code position} where the {@code combiner}'s return will be folded in) are not identical
|
||||
* with the argument types of {@code combiner}.
|
||||
*/
|
||||
/*non-public*/ static MethodHandle foldArgumentsWithCombiner(MethodHandle target, int position, MethodHandle combiner, int ... argPositions) {
|
||||
/*non-public*/
|
||||
static MethodHandle foldArgumentsWithCombiner(MethodHandle target, int position, MethodHandle combiner, int ... argPositions) {
|
||||
return argumentsWithCombiner(false, target, position, combiner, argPositions);
|
||||
}
|
||||
|
||||
@ -5236,8 +5210,7 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
|
||||
* or if all three method types do not match (with the return
|
||||
* type of {@code test} changed to match that of the target).
|
||||
*/
|
||||
public static
|
||||
MethodHandle guardWithTest(MethodHandle test,
|
||||
public static MethodHandle guardWithTest(MethodHandle test,
|
||||
MethodHandle target,
|
||||
MethodHandle fallback) {
|
||||
MethodType gtype = test.type();
|
||||
@ -5309,8 +5282,7 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
|
||||
* corresponding parameters
|
||||
* @see MethodHandles#tryFinally(MethodHandle, MethodHandle)
|
||||
*/
|
||||
public static
|
||||
MethodHandle catchException(MethodHandle target,
|
||||
public static MethodHandle catchException(MethodHandle target,
|
||||
Class<? extends Throwable> exType,
|
||||
MethodHandle handler) {
|
||||
MethodType ttype = target.type();
|
||||
@ -5341,8 +5313,7 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
|
||||
* @return method handle which can throw the given exceptions
|
||||
* @throws NullPointerException if either argument is null
|
||||
*/
|
||||
public static
|
||||
MethodHandle throwException(Class<?> returnType, Class<? extends Throwable> exType) {
|
||||
public static MethodHandle throwException(Class<?> returnType, Class<? extends Throwable> exType) {
|
||||
if (!Throwable.class.isAssignableFrom(exType))
|
||||
throw new ClassCastException(exType.getName());
|
||||
return MethodHandleImpl.throwException(methodType(returnType, exType));
|
||||
@ -6650,7 +6621,8 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
|
||||
return iterableType; // help the caller a bit
|
||||
}
|
||||
|
||||
/*non-public*/ static MethodHandle swapArguments(MethodHandle mh, int i, int j) {
|
||||
/*non-public*/
|
||||
static MethodHandle swapArguments(MethodHandle mh, int i, int j) {
|
||||
// there should be a better way to uncross my wires
|
||||
int arity = mh.type().parameterCount();
|
||||
int[] order = new int[arity];
|
||||
|
@ -142,7 +142,8 @@ class MethodType
|
||||
* {@code staticMethod(arg1, arg2, ..., arg255)} or
|
||||
* {@code x.virtualMethod(arg1, arg2, ..., arg254)}.
|
||||
*/
|
||||
/*non-public*/ static final int MAX_JVM_ARITY = 255; // this is mandated by the JVM spec.
|
||||
/*non-public*/
|
||||
static final int MAX_JVM_ARITY = 255; // this is mandated by the JVM spec.
|
||||
|
||||
/** This number is the maximum arity of a method handle, 254.
|
||||
* It is derived from the absolute JVM-imposed arity by subtracting one,
|
||||
@ -152,7 +153,8 @@ class MethodType
|
||||
* {@code mh.invoke(arg1, arg2, ..., arg254)}.
|
||||
*/
|
||||
// Issue: Should we allow MH.invokeWithArguments to go to the full 255?
|
||||
/*non-public*/ static final int MAX_MH_ARITY = MAX_JVM_ARITY-1; // deduct one for mh receiver
|
||||
/*non-public*/
|
||||
static final int MAX_MH_ARITY = MAX_JVM_ARITY-1; // deduct one for mh receiver
|
||||
|
||||
/** This number is the maximum arity of a method handle invoker, 253.
|
||||
* It is derived from the absolute JVM-imposed arity by subtracting two,
|
||||
@ -162,7 +164,8 @@ class MethodType
|
||||
* The longest possible invocation will look like
|
||||
* {@code invokermh.invoke(targetmh, arg1, arg2, ..., arg253)}.
|
||||
*/
|
||||
/*non-public*/ static final int MAX_MH_INVOKER_ARITY = MAX_MH_ARITY-1; // deduct one more for invoker
|
||||
/*non-public*/
|
||||
static final int MAX_MH_INVOKER_ARITY = MAX_MH_ARITY-1; // deduct one more for invoker
|
||||
|
||||
private static void checkRtype(Class<?> rtype) {
|
||||
Objects.requireNonNull(rtype);
|
||||
@ -210,8 +213,7 @@ class MethodType
|
||||
* @throws NullPointerException if {@code rtype} or {@code ptypes} or any element of {@code ptypes} is null
|
||||
* @throws IllegalArgumentException if any element of {@code ptypes} is {@code void.class}
|
||||
*/
|
||||
public static
|
||||
MethodType methodType(Class<?> rtype, Class<?>[] ptypes) {
|
||||
public static MethodType methodType(Class<?> rtype, Class<?>[] ptypes) {
|
||||
return makeImpl(rtype, ptypes, false);
|
||||
}
|
||||
|
||||
@ -224,8 +226,7 @@ class MethodType
|
||||
* @throws NullPointerException if {@code rtype} or {@code ptypes} or any element of {@code ptypes} is null
|
||||
* @throws IllegalArgumentException if any element of {@code ptypes} is {@code void.class}
|
||||
*/
|
||||
public static
|
||||
MethodType methodType(Class<?> rtype, List<Class<?>> ptypes) {
|
||||
public static MethodType methodType(Class<?> rtype, List<Class<?>> ptypes) {
|
||||
boolean notrust = false; // random List impl. could return evil ptypes array
|
||||
return makeImpl(rtype, listToArray(ptypes), notrust);
|
||||
}
|
||||
@ -247,8 +248,7 @@ class MethodType
|
||||
* @throws NullPointerException if {@code rtype} or {@code ptype0} or {@code ptypes} or any element of {@code ptypes} is null
|
||||
* @throws IllegalArgumentException if {@code ptype0} or {@code ptypes} or any element of {@code ptypes} is {@code void.class}
|
||||
*/
|
||||
public static
|
||||
MethodType methodType(Class<?> rtype, Class<?> ptype0, Class<?>... ptypes) {
|
||||
public static MethodType methodType(Class<?> rtype, Class<?> ptype0, Class<?>... ptypes) {
|
||||
Class<?>[] ptypes1 = new Class<?>[1+ptypes.length];
|
||||
ptypes1[0] = ptype0;
|
||||
System.arraycopy(ptypes, 0, ptypes1, 1, ptypes.length);
|
||||
@ -263,8 +263,7 @@ class MethodType
|
||||
* @return a method type with the given return value
|
||||
* @throws NullPointerException if {@code rtype} is null
|
||||
*/
|
||||
public static
|
||||
MethodType methodType(Class<?> rtype) {
|
||||
public static MethodType methodType(Class<?> rtype) {
|
||||
return makeImpl(rtype, NO_PTYPES, true);
|
||||
}
|
||||
|
||||
@ -278,8 +277,7 @@ class MethodType
|
||||
* @throws NullPointerException if {@code rtype} or {@code ptype0} is null
|
||||
* @throws IllegalArgumentException if {@code ptype0} is {@code void.class}
|
||||
*/
|
||||
public static
|
||||
MethodType methodType(Class<?> rtype, Class<?> ptype0) {
|
||||
public static MethodType methodType(Class<?> rtype, Class<?> ptype0) {
|
||||
return makeImpl(rtype, new Class<?>[]{ ptype0 }, true);
|
||||
}
|
||||
|
||||
@ -293,8 +291,7 @@ class MethodType
|
||||
* @return a method type with the given components
|
||||
* @throws NullPointerException if {@code rtype} or {@code ptypes} is null
|
||||
*/
|
||||
public static
|
||||
MethodType methodType(Class<?> rtype, MethodType ptypes) {
|
||||
public static MethodType methodType(Class<?> rtype, MethodType ptypes) {
|
||||
return makeImpl(rtype, ptypes.ptypes, true);
|
||||
}
|
||||
|
||||
@ -305,8 +302,8 @@ class MethodType
|
||||
* @param trusted whether the ptypes can be used without cloning
|
||||
* @return the unique method type of the desired structure
|
||||
*/
|
||||
/*trusted*/ static
|
||||
MethodType makeImpl(Class<?> rtype, Class<?>[] ptypes, boolean trusted) {
|
||||
/*trusted*/
|
||||
static MethodType makeImpl(Class<?> rtype, Class<?>[] ptypes, boolean trusted) {
|
||||
if (ptypes.length == 0) {
|
||||
ptypes = NO_PTYPES; trusted = true;
|
||||
}
|
||||
@ -342,8 +339,7 @@ class MethodType
|
||||
* @throws IllegalArgumentException if {@code objectArgCount} is negative or greater than 255 (or 254, if {@code finalArray} is true)
|
||||
* @see #genericMethodType(int)
|
||||
*/
|
||||
public static
|
||||
MethodType genericMethodType(int objectArgCount, boolean finalArray) {
|
||||
public static MethodType genericMethodType(int objectArgCount, boolean finalArray) {
|
||||
MethodType mt;
|
||||
checkSlotCount(objectArgCount);
|
||||
int ivarargs = (!finalArray ? 0 : 1);
|
||||
@ -371,8 +367,7 @@ class MethodType
|
||||
* @throws IllegalArgumentException if {@code objectArgCount} is negative or greater than 255
|
||||
* @see #genericMethodType(int, boolean)
|
||||
*/
|
||||
public static
|
||||
MethodType genericMethodType(int objectArgCount) {
|
||||
public static MethodType genericMethodType(int objectArgCount) {
|
||||
return genericMethodType(objectArgCount, false);
|
||||
}
|
||||
|
||||
@ -479,7 +474,8 @@ class MethodType
|
||||
* or if the resulting method type would have more than 255 parameter slots
|
||||
* @throws NullPointerException if {@code ptypesToInsert} or any of its elements is null
|
||||
*/
|
||||
/*non-public*/ MethodType replaceParameterTypes(int start, int end, Class<?>... ptypesToInsert) {
|
||||
/*non-public*/
|
||||
MethodType replaceParameterTypes(int start, int end, Class<?>... ptypesToInsert) {
|
||||
if (start == end)
|
||||
return insertParameterTypes(start, ptypesToInsert);
|
||||
int len = ptypes.length;
|
||||
@ -497,7 +493,8 @@ class MethodType
|
||||
* @param arrayLength the number of parameter types to change
|
||||
* @return the resulting type
|
||||
*/
|
||||
/*non-public*/ MethodType asSpreaderType(Class<?> arrayType, int pos, int arrayLength) {
|
||||
/*non-public*/
|
||||
MethodType asSpreaderType(Class<?> arrayType, int pos, int arrayLength) {
|
||||
assert(parameterCount() >= arrayLength);
|
||||
int spreadPos = pos;
|
||||
if (arrayLength == 0) return this; // nothing to change
|
||||
@ -527,7 +524,8 @@ class MethodType
|
||||
/** Return the leading parameter type, which must exist and be a reference.
|
||||
* @return the leading parameter type, after error checks
|
||||
*/
|
||||
/*non-public*/ Class<?> leadingReferenceParameter() {
|
||||
/*non-public*/
|
||||
Class<?> leadingReferenceParameter() {
|
||||
Class<?> ptype;
|
||||
if (ptypes.length == 0 ||
|
||||
(ptype = ptypes[0]).isPrimitive())
|
||||
@ -541,7 +539,8 @@ class MethodType
|
||||
* @param arrayLength the number of parameter types to insert
|
||||
* @return the resulting type
|
||||
*/
|
||||
/*non-public*/ MethodType asCollectorType(Class<?> arrayType, int pos, int arrayLength) {
|
||||
/*non-public*/
|
||||
MethodType asCollectorType(Class<?> arrayType, int pos, int arrayLength) {
|
||||
assert(parameterCount() >= 1);
|
||||
assert(pos < ptypes.length);
|
||||
assert(ptypes[pos].isAssignableFrom(arrayType));
|
||||
@ -652,7 +651,8 @@ class MethodType
|
||||
* such as {@link MethodHandle#invokeBasic invokeBasic}.
|
||||
* @return a version of the original type with all reference and subword types replaced
|
||||
*/
|
||||
/*non-public*/ MethodType basicType() {
|
||||
/*non-public*/
|
||||
MethodType basicType() {
|
||||
return form.basicType();
|
||||
}
|
||||
|
||||
@ -662,7 +662,8 @@ class MethodType
|
||||
/**
|
||||
* @return a version of the original type with MethodHandle prepended as the first argument
|
||||
*/
|
||||
/*non-public*/ MethodType invokerType() {
|
||||
/*non-public*/
|
||||
MethodType invokerType() {
|
||||
return insertParameterTypes(0, METHOD_HANDLE_ARRAY);
|
||||
}
|
||||
|
||||
@ -677,7 +678,8 @@ class MethodType
|
||||
return genericMethodType(parameterCount());
|
||||
}
|
||||
|
||||
/*non-public*/ boolean isGeneric() {
|
||||
/*non-public*/
|
||||
boolean isGeneric() {
|
||||
return this == erase() && !hasPrimitives();
|
||||
}
|
||||
|
||||
@ -1064,11 +1066,13 @@ class MethodType
|
||||
* generate bytecodes that process method handles and invokedynamic.
|
||||
* @return the number of JVM stack slots for this type's parameters
|
||||
*/
|
||||
/*non-public*/ int parameterSlotCount() {
|
||||
/*non-public*/
|
||||
int parameterSlotCount() {
|
||||
return form.parameterSlotCount();
|
||||
}
|
||||
|
||||
/*non-public*/ Invokers invokers() {
|
||||
/*non-public*/
|
||||
Invokers invokers() {
|
||||
Invokers inv = invokers;
|
||||
if (inv != null) return inv;
|
||||
invokers = inv = new Invokers(this);
|
||||
@ -1167,7 +1171,8 @@ class MethodType
|
||||
return toMethodDescriptorString();
|
||||
}
|
||||
|
||||
/*non-public*/ static String toFieldDescriptorString(Class<?> cls) {
|
||||
/*non-public*/
|
||||
static String toFieldDescriptorString(Class<?> cls) {
|
||||
return BytecodeDescriptor.unparse(cls);
|
||||
}
|
||||
|
||||
|
@ -40,19 +40,23 @@ final class SimpleMethodHandle extends BoundMethodHandle {
|
||||
super(type, form);
|
||||
}
|
||||
|
||||
/*non-public*/ static BoundMethodHandle make(MethodType type, LambdaForm form) {
|
||||
/*non-public*/
|
||||
static BoundMethodHandle make(MethodType type, LambdaForm form) {
|
||||
return new SimpleMethodHandle(type, form);
|
||||
}
|
||||
|
||||
/*non-public*/ static @Stable BoundMethodHandle.SpeciesData BMH_SPECIES;
|
||||
/*non-public*/
|
||||
static @Stable BoundMethodHandle.SpeciesData BMH_SPECIES;
|
||||
|
||||
@Override
|
||||
/*non-public*/ BoundMethodHandle.SpeciesData speciesData() {
|
||||
/*non-public*/
|
||||
BoundMethodHandle.SpeciesData speciesData() {
|
||||
return BMH_SPECIES;
|
||||
}
|
||||
|
||||
@Override
|
||||
/*non-public*/ BoundMethodHandle copyWith(MethodType mt, LambdaForm lf) {
|
||||
/*non-public*/
|
||||
BoundMethodHandle copyWith(MethodType mt, LambdaForm lf) {
|
||||
return make(mt, lf);
|
||||
}
|
||||
|
||||
@ -62,11 +66,13 @@ final class SimpleMethodHandle extends BoundMethodHandle {
|
||||
}
|
||||
|
||||
@Override
|
||||
/*non-public*/ final BoundMethodHandle copyWithExtendL(MethodType mt, LambdaForm lf, Object narg) {
|
||||
/*non-public*/
|
||||
final BoundMethodHandle copyWithExtendL(MethodType mt, LambdaForm lf, Object narg) {
|
||||
return BoundMethodHandle.bindSingle(mt, lf, narg); // Use known fast path.
|
||||
}
|
||||
@Override
|
||||
/*non-public*/ final BoundMethodHandle copyWithExtendI(MethodType mt, LambdaForm lf, int narg) {
|
||||
/*non-public*/
|
||||
final BoundMethodHandle copyWithExtendI(MethodType mt, LambdaForm lf, int narg) {
|
||||
try {
|
||||
return (BoundMethodHandle) BMH_SPECIES.extendWith(I_TYPE_NUM).factory().invokeBasic(mt, lf, narg);
|
||||
} catch (Throwable ex) {
|
||||
@ -74,7 +80,8 @@ final class SimpleMethodHandle extends BoundMethodHandle {
|
||||
}
|
||||
}
|
||||
@Override
|
||||
/*non-public*/ final BoundMethodHandle copyWithExtendJ(MethodType mt, LambdaForm lf, long narg) {
|
||||
/*non-public*/
|
||||
final BoundMethodHandle copyWithExtendJ(MethodType mt, LambdaForm lf, long narg) {
|
||||
try {
|
||||
return (BoundMethodHandle) BMH_SPECIES.extendWith(J_TYPE_NUM).factory().invokeBasic(mt, lf, narg);
|
||||
} catch (Throwable ex) {
|
||||
@ -82,7 +89,8 @@ final class SimpleMethodHandle extends BoundMethodHandle {
|
||||
}
|
||||
}
|
||||
@Override
|
||||
/*non-public*/ final BoundMethodHandle copyWithExtendF(MethodType mt, LambdaForm lf, float narg) {
|
||||
/*non-public*/
|
||||
final BoundMethodHandle copyWithExtendF(MethodType mt, LambdaForm lf, float narg) {
|
||||
try {
|
||||
return (BoundMethodHandle) BMH_SPECIES.extendWith(F_TYPE_NUM).factory().invokeBasic(mt, lf, narg);
|
||||
} catch (Throwable ex) {
|
||||
@ -90,7 +98,8 @@ final class SimpleMethodHandle extends BoundMethodHandle {
|
||||
}
|
||||
}
|
||||
@Override
|
||||
/*non-public*/ final BoundMethodHandle copyWithExtendD(MethodType mt, LambdaForm lf, double narg) {
|
||||
/*non-public*/
|
||||
final BoundMethodHandle copyWithExtendD(MethodType mt, LambdaForm lf, double narg) {
|
||||
try {
|
||||
return (BoundMethodHandle) BMH_SPECIES.extendWith(D_TYPE_NUM).factory().invokeBasic(mt, lf, narg);
|
||||
} catch (Throwable ex) {
|
||||
|
@ -69,7 +69,8 @@ public class WrongMethodTypeException extends RuntimeException {
|
||||
* @param cause the cause of the exception, or null.
|
||||
*/
|
||||
//FIXME: make this public in MR1
|
||||
/*non-public*/ WrongMethodTypeException(String s, Throwable cause) {
|
||||
/*non-public*/
|
||||
WrongMethodTypeException(String s, Throwable cause) {
|
||||
super(s, cause);
|
||||
}
|
||||
|
||||
@ -80,7 +81,8 @@ public class WrongMethodTypeException extends RuntimeException {
|
||||
* @param cause the cause of the exception, or null.
|
||||
*/
|
||||
//FIXME: make this public in MR1
|
||||
/*non-public*/ WrongMethodTypeException(Throwable cause) {
|
||||
/*non-public*/
|
||||
WrongMethodTypeException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
|
@ -37,8 +37,7 @@ package java.lang.reflect;
|
||||
* @author Nakul Saraiya
|
||||
* @since 1.1
|
||||
*/
|
||||
public
|
||||
interface Member {
|
||||
public interface Member {
|
||||
|
||||
/**
|
||||
* Identifies the set of all public members of a class or interface,
|
||||
|
@ -66,8 +66,7 @@ import java.util.Collections;
|
||||
* @see java.nio.channels.DatagramChannel
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class DatagramSocket implements java.io.Closeable {
|
||||
public class DatagramSocket implements java.io.Closeable {
|
||||
/**
|
||||
* Various states of this socket.
|
||||
*/
|
||||
|
@ -34,8 +34,7 @@ package java.net;
|
||||
* @see java.net.DatagramSocket
|
||||
* @since 1.3
|
||||
*/
|
||||
public
|
||||
interface DatagramSocketImplFactory {
|
||||
public interface DatagramSocketImplFactory {
|
||||
/**
|
||||
* Creates a new {@code DatagramSocketImpl} instance.
|
||||
*
|
||||
|
@ -35,8 +35,7 @@ import java.io.IOException;
|
||||
* @author Michael McMahon
|
||||
* @since 1.5
|
||||
*/
|
||||
public
|
||||
class HttpRetryException extends IOException {
|
||||
public class HttpRetryException extends IOException {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = -9186022286469111381L;
|
||||
|
||||
|
@ -196,8 +196,7 @@ import sun.net.util.IPAddressUtil;
|
||||
* @see java.net.InetAddress#getLocalHost()
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class InetAddress implements java.io.Serializable {
|
||||
public class InetAddress implements java.io.Serializable {
|
||||
|
||||
@Native static final int PREFER_IPV4_VALUE = 0;
|
||||
@Native static final int PREFER_IPV6_VALUE = 1;
|
||||
|
@ -83,8 +83,7 @@ import java.net.PortUnreachableException;
|
||||
* @author Pavani Diwanji
|
||||
* @since 1.1
|
||||
*/
|
||||
public
|
||||
class MulticastSocket extends DatagramSocket {
|
||||
public class MulticastSocket extends DatagramSocket {
|
||||
|
||||
/**
|
||||
* Used on some platforms to record if an outgoing interface
|
||||
|
@ -34,8 +34,7 @@ import java.io.IOException;
|
||||
* @author Chris Warth
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class ProtocolException extends IOException {
|
||||
public class ProtocolException extends IOException {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = -6098449442062388080L;
|
||||
|
||||
|
@ -52,8 +52,7 @@ import sun.net.PlatformSocketImpl;
|
||||
* @see java.nio.channels.ServerSocketChannel
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class ServerSocket implements java.io.Closeable {
|
||||
public class ServerSocket implements java.io.Closeable {
|
||||
/**
|
||||
* Various states of this socket.
|
||||
*/
|
||||
|
@ -56,8 +56,7 @@ import java.util.Collections;
|
||||
* @see java.nio.channels.SocketChannel
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class Socket implements java.io.Closeable {
|
||||
public class Socket implements java.io.Closeable {
|
||||
/**
|
||||
* Various states of this socket.
|
||||
*/
|
||||
|
@ -33,8 +33,7 @@ import java.io.IOException;
|
||||
* @author Jonathan Payne
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class SocketException extends IOException {
|
||||
public class SocketException extends IOException {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = -5935874303556886934L;
|
||||
|
||||
|
@ -36,8 +36,7 @@ package java.net;
|
||||
* @see java.net.ServerSocket
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
interface SocketImplFactory {
|
||||
public interface SocketImplFactory {
|
||||
/**
|
||||
* Creates a new {@code SocketImpl} instance.
|
||||
*
|
||||
|
@ -33,8 +33,7 @@ import java.io.IOException;
|
||||
* @author Jonathan Payne
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class UnknownHostException extends IOException {
|
||||
public class UnknownHostException extends IOException {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = -4639126076052875403L;
|
||||
|
||||
|
@ -47,8 +47,7 @@ package java.text;
|
||||
* @author Mark Davis
|
||||
* @since 1.1
|
||||
*/
|
||||
public
|
||||
class ParseException extends Exception {
|
||||
public class ParseException extends Exception {
|
||||
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 2703218443322787634L;
|
||||
|
@ -33,8 +33,7 @@ package java.util;
|
||||
* @see java.util.Stack
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class EmptyStackException extends RuntimeException {
|
||||
public class EmptyStackException extends RuntimeException {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 5084686378493302095L;
|
||||
|
||||
|
@ -34,8 +34,7 @@ package java.util;
|
||||
* @see java.util.Scanner
|
||||
* @since 1.5
|
||||
*/
|
||||
public
|
||||
class InputMismatchException extends NoSuchElementException {
|
||||
public class InputMismatchException extends NoSuchElementException {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 8811230760997066428L;
|
||||
|
||||
|
@ -47,8 +47,7 @@ package java.util;
|
||||
* @author Mark Davis
|
||||
* @since 1.1
|
||||
*/
|
||||
public
|
||||
class MissingResourceException extends RuntimeException {
|
||||
public class MissingResourceException extends RuntimeException {
|
||||
|
||||
/**
|
||||
* Constructs a MissingResourceException with the specified information.
|
||||
|
@ -34,8 +34,7 @@ package java.util;
|
||||
* @see java.util.Iterator#next()
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class NoSuchElementException extends RuntimeException {
|
||||
public class NoSuchElementException extends RuntimeException {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 6769829250639411880L;
|
||||
|
||||
|
@ -137,8 +137,7 @@ import jdk.internal.util.xml.PropertiesDefaultHandler;
|
||||
* @author Xueming Shen
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class Properties extends Hashtable<Object,Object> {
|
||||
public class Properties extends Hashtable<Object,Object> {
|
||||
/**
|
||||
* use serialVersionUID from JDK 1.1.X for interoperability
|
||||
*/
|
||||
|
@ -73,8 +73,7 @@ import jdk.internal.misc.Unsafe;
|
||||
* @author Frank Yellin
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class Random implements java.io.Serializable {
|
||||
public class Random implements java.io.Serializable {
|
||||
/** use serialVersionUID from JDK 1.1 for interoperability */
|
||||
@java.io.Serial
|
||||
static final long serialVersionUID = 3905348978240129619L;
|
||||
|
@ -45,8 +45,7 @@ package java.util;
|
||||
* @author Jonathan Payne
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class Stack<E> extends Vector<E> {
|
||||
public class Stack<E> extends Vector<E> {
|
||||
/**
|
||||
* Creates an empty Stack.
|
||||
*/
|
||||
|
@ -99,8 +99,7 @@ import java.lang.*;
|
||||
* @see java.io.StreamTokenizer
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class StringTokenizer implements Enumeration<Object> {
|
||||
public class StringTokenizer implements Enumeration<Object> {
|
||||
private int currentPosition;
|
||||
private int newPosition;
|
||||
private int maxPosition;
|
||||
|
@ -35,8 +35,7 @@ import java.security.cert.Certificate;
|
||||
*
|
||||
* @since 1.2
|
||||
*/
|
||||
public
|
||||
class JarEntry extends ZipEntry {
|
||||
public class JarEntry extends ZipEntry {
|
||||
Attributes attr;
|
||||
Certificate[] certs;
|
||||
CodeSigner[] signers;
|
||||
|
@ -32,8 +32,7 @@ package java.util.jar;
|
||||
* @author David Connelly
|
||||
* @since 1.2
|
||||
*/
|
||||
public
|
||||
class JarException extends java.util.zip.ZipException {
|
||||
public class JarException extends java.util.zip.ZipException {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 7159778400963954473L;
|
||||
|
||||
|
@ -145,8 +145,7 @@ import java.util.zip.ZipFile;
|
||||
* @see java.util.jar.JarEntry
|
||||
* @since 1.2
|
||||
*/
|
||||
public
|
||||
class JarFile extends ZipFile {
|
||||
public class JarFile extends ZipFile {
|
||||
private final static Runtime.Version BASE_VERSION;
|
||||
private final static int BASE_VERSION_FEATURE;
|
||||
private final static Runtime.Version RUNTIME_VERSION;
|
||||
|
@ -42,8 +42,7 @@ import jdk.internal.util.jar.JarIndex;
|
||||
* @see java.util.zip.ZipInputStream
|
||||
* @since 1.2
|
||||
*/
|
||||
public
|
||||
class JarInputStream extends ZipInputStream {
|
||||
public class JarInputStream extends ZipInputStream {
|
||||
private Manifest man;
|
||||
private JarEntry first;
|
||||
private JarVerifier jv;
|
||||
|
@ -41,8 +41,7 @@ import java.io.*;
|
||||
* @see java.util.zip.ZipOutputStream
|
||||
* @since 1.2
|
||||
*/
|
||||
public
|
||||
class JarOutputStream extends ZipOutputStream {
|
||||
public class JarOutputStream extends ZipOutputStream {
|
||||
private static final int JAR_MAGIC = 0xCAFE;
|
||||
|
||||
/**
|
||||
|
@ -41,8 +41,7 @@ import jdk.internal.HotSpotIntrinsicCandidate;
|
||||
* @author David Connelly
|
||||
* @since 1.1
|
||||
*/
|
||||
public
|
||||
class Adler32 implements Checksum {
|
||||
public class Adler32 implements Checksum {
|
||||
|
||||
private int adler = 1;
|
||||
|
||||
|
@ -40,8 +40,7 @@ import jdk.internal.HotSpotIntrinsicCandidate;
|
||||
* @author David Connelly
|
||||
* @since 1.1
|
||||
*/
|
||||
public
|
||||
class CRC32 implements Checksum {
|
||||
public class CRC32 implements Checksum {
|
||||
private int crc;
|
||||
|
||||
/**
|
||||
|
@ -37,8 +37,7 @@ import java.io.IOException;
|
||||
* @author David Connelly
|
||||
* @since 1.1
|
||||
*/
|
||||
public
|
||||
class CheckedInputStream extends FilterInputStream {
|
||||
public class CheckedInputStream extends FilterInputStream {
|
||||
private Checksum cksum;
|
||||
|
||||
/**
|
||||
|
@ -38,8 +38,7 @@ import java.io.IOException;
|
||||
* @author David Connelly
|
||||
* @since 1.1
|
||||
*/
|
||||
public
|
||||
class CheckedOutputStream extends FilterOutputStream {
|
||||
public class CheckedOutputStream extends FilterOutputStream {
|
||||
private Checksum cksum;
|
||||
|
||||
/**
|
||||
|
@ -31,8 +31,7 @@ package java.util.zip;
|
||||
* @author David Connelly
|
||||
* @since 1.1
|
||||
*/
|
||||
public
|
||||
class DataFormatException extends Exception {
|
||||
public class DataFormatException extends Exception {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 2219632870893641452L;
|
||||
|
||||
|
@ -39,8 +39,7 @@ import java.io.IOException;
|
||||
* @author David Connelly
|
||||
* @since 1.1
|
||||
*/
|
||||
public
|
||||
class DeflaterOutputStream extends FilterOutputStream {
|
||||
public class DeflaterOutputStream extends FilterOutputStream {
|
||||
/**
|
||||
* Compressor for this stream.
|
||||
*/
|
||||
|
@ -41,8 +41,7 @@ import java.io.EOFException;
|
||||
* @since 1.1
|
||||
*
|
||||
*/
|
||||
public
|
||||
class GZIPInputStream extends InflaterInputStream {
|
||||
public class GZIPInputStream extends InflaterInputStream {
|
||||
/**
|
||||
* CRC-32 for uncompressed data.
|
||||
*/
|
||||
|
@ -35,8 +35,7 @@ import java.io.IOException;
|
||||
* @since 1.1
|
||||
*
|
||||
*/
|
||||
public
|
||||
class GZIPOutputStream extends DeflaterOutputStream {
|
||||
public class GZIPOutputStream extends DeflaterOutputStream {
|
||||
/**
|
||||
* CRC-32 of uncompressed data.
|
||||
*/
|
||||
|
@ -39,8 +39,7 @@ import java.io.EOFException;
|
||||
* @author David Connelly
|
||||
* @since 1.1
|
||||
*/
|
||||
public
|
||||
class InflaterInputStream extends FilterInputStream {
|
||||
public class InflaterInputStream extends FilterInputStream {
|
||||
/**
|
||||
* Decompressor for this stream.
|
||||
*/
|
||||
|
@ -41,8 +41,7 @@ import static java.util.zip.ZipConstants64.*;
|
||||
* @author David Connelly
|
||||
* @since 1.1
|
||||
*/
|
||||
public
|
||||
class ZipEntry implements ZipConstants, Cloneable {
|
||||
public class ZipEntry implements ZipConstants, Cloneable {
|
||||
|
||||
String name; // entry name
|
||||
long xdostime = -1; // last modification time (in extended DOS time,
|
||||
|
@ -35,8 +35,7 @@ import java.io.IOException;
|
||||
* @since 1.1
|
||||
*/
|
||||
|
||||
public
|
||||
class ZipException extends IOException {
|
||||
public class ZipException extends IOException {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = 8000196834066748623L;
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user