提交 747aa491 编写于 作者: L lana

Merge

......@@ -429,7 +429,7 @@ ifeq ($(USE_EXTERNAL_LIBZ), true)
UNPACKEXE_CFLAGS := -DSYSTEM_ZLIB
UNPACKEXE_ZIPOBJS := -lz
else
UNPACKEXE_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5
UNPACKEXE_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.8
UNPACKEXE_ZIPOBJS := $(JDK_OUTPUTDIR)/objs/libzip/zcrc32$(OBJ_SUFFIX) \
$(JDK_OUTPUTDIR)/objs/libzip/deflate$(OBJ_SUFFIX) \
$(JDK_OUTPUTDIR)/objs/libzip/trees$(OBJ_SUFFIX) \
......
......@@ -1242,7 +1242,7 @@ ifndef BUILD_HEADLESS_ONLY
LIBSPLASHSCREEN_LDFLAGS_SUFFIX :=
ifneq ($(USE_EXTERNAL_LIBZ), true)
LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5
LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.8
LIBSPLASHSCREEN_CFLAGS += $(ZLIB_CPPFLAGS)
endif
......
......@@ -230,9 +230,9 @@ $(BUILD_LIBJAVA): $(BUILD_LIBFDLIBM)
BUILD_LIBZIP_EXCLUDES :=
ifeq ($(USE_EXTERNAL_LIBZ), true)
LIBZ := -lz
LIBZIP_EXCLUDES += zlib-1.2.5
LIBZIP_EXCLUDES += zlib-1.2.8
else
ZLIB_CPPFLAGS := -I$(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5
ZLIB_CPPFLAGS := -I$(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.8
endif
BUILD_LIBZIP_REORDER :=
......@@ -384,7 +384,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
endif
ifneq ($(USE_EXTERNAL_LIBZ), true)
BUILD_LIBJLI_SRC_DIRS += $(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5
BUILD_LIBJLI_SRC_DIRS += $(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.8
LIBJLI_CFLAGS += $(ZLIB_CPPFLAGS)
BUILD_LIBJLI_FILES += \
inflate.c \
......
......@@ -155,6 +155,7 @@ SUNWprivate_1.1 {
g_CMpDataID;
colorValueID;
mul8table;
div8table;
jvm;
# ProcessPath entry points and data
......
......@@ -359,7 +359,57 @@ int NET_Accept(int s, struct sockaddr *addr, int *addrlen) {
}
int NET_Connect(int s, struct sockaddr *addr, int addrlen) {
BLOCKING_IO_RETURN_INT( s, connect(s, addr, addrlen) );
int crc = -1, prc = -1;
threadEntry_t self;
fdEntry_t* fdEntry = getFdEntry(s);
if (fdEntry == NULL) {
errno = EBADF;
return -1;
}
/* On AIX, when the system call connect() is interrupted, the connection
* is not aborted and it will be established asynchronously by the kernel.
* Hence, no need to restart connect() when EINTR is received
*/
startOp(fdEntry, &self);
crc = connect(s, addr, addrlen);
endOp(fdEntry, &self);
if (crc == -1 && errno == EINTR) {
struct pollfd s_pollfd;
int sockopt_arg = 0;
socklen_t len;
s_pollfd.fd = s;
s_pollfd.events = POLLOUT | POLLERR;
/* poll the file descriptor */
do {
startOp(fdEntry, &self);
prc = poll(&s_pollfd, 1, -1);
endOp(fdEntry, &self);
} while (prc == -1 && errno == EINTR);
if (prc < 0)
return prc;
len = sizeof(sockopt_arg);
/* Check whether the connection has been established */
if (getsockopt(s, SOL_SOCKET, SO_ERROR, &sockopt_arg, &len) == -1)
return -1;
if (sockopt_arg != 0 ) {
errno = sockopt_arg;
return -1;
}
} else {
return crc;
}
/* At this point, fd is connected. Set successful return code */
return 0;
}
#ifndef USE_SELECT
......
此差异已折叠。
此差异已折叠。
'\" t
.\" Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
.\"
.\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
.\"
.\" This code is free software; you can redistribute it and/or modify it
.\" under the terms of the GNU General Public License version 2 only, as
.\" published by the Free Software Foundation.
.\"
.\" This code is distributed in the hope that it will be useful, but WITHOUT
.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
.\" version 2 for more details (a copy is included in the LICENSE file that
.\" accompanied this code).
.\"
.\" You should have received a copy of the GNU General Public License version
.\" 2 along with this work; if not, write to the Free Software Foundation,
.\" Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
.\"
.\" Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
.\" or visit www.oracle.com if you need additional information or have any
.\" questions.
.\"
.\" Arch: generic
.\" Software: JDK 8
.\" Date: 21 November 2013
.\" SectDesc: Basic Tools
.\" Title: javap.1
.\" Copyright (c) 1994, 2014, Oracle and/or its affiliates. All rights reserved.
.\"
.\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
.\"
.\" This code is free software; you can redistribute it and/or modify it
.\" under the terms of the GNU General Public License version 2 only, as
.\" published by the Free Software Foundation.
.\"
.\" This code is distributed in the hope that it will be useful, but WITHOUT
.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
.\" version 2 for more details (a copy is included in the LICENSE file that
.\" accompanied this code).
.\"
.\" You should have received a copy of the GNU General Public License version
.\" 2 along with this work; if not, write to the Free Software Foundation,
.\" Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
.\"
.\" Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
.\" or visit www.oracle.com if you need additional information or have any
.\" questions.
.\"
.\" Title: javap
.\" Language: English
.\" Date: 8 August 2014
.\" SectDesc: Basic Tools
.\" Software: JDK 8
.\" Arch: generic
.\" Part Number: E38207-03
.\"
.if n .pl 99999
.TH javap 1 "21 November 2013" "JDK 8" "Basic Tools"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH NAME
.TH "javap" "1" "8 August 2014" "JDK 8" "Basic Tools"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
javap \- Disassembles one or more class files\&.
.SH SYNOPSIS
.sp
.nf
.SH "SYNOPSIS"
.sp
.if n \{\
.RS 4
.\}
.nf
\fBjavap\fR [\fIoptions\fR] \fIclassfile\fR\&.\&.\&.
.fi
.sp
.TP
.fi
.if n \{\
.RE
.\}
.PP
\fIoptions\fR
The command-line options\&. See Options\&.
.TP
.RS 4
The command\-line options\&. See Options\&.
.RE
.PP
\fIclassfile\fR
One or more classes separated by spaces to be processed for annotations such as DocFooter\&.class\&. You can specify a class that can be found in the class path, by its file name or with a URL such as \f3file:///home/user/myproject/src/DocFooter\&.class\fR\&.
.SH DESCRIPTION
The \f3javap\fR command disassembles one or more class files\&. The output depends on the options used\&. When no options are used, then the \f3javap\fR command prints the package, protected and public fields, and methods of the classes passed to it\&. The \f3javap\fR command prints its output to \f3stdout\fR\&.
.SH OPTIONS
.TP
-help, --help, -?
.RS 4
One or more classes separated by spaces to be processed for annotations such as DocFooter\&.class\&. You can specify a class that can be found in the class path, by its file name or with a URL such as
\fBfile:///home/user/myproject/src/DocFooter\&.class\fR\&.
.RE
.SH "DESCRIPTION"
.PP
The
\fBjavap\fR
command disassembles one or more class files\&. The output depends on the options used\&. When no options are used, then the
\fBjavap\fR
command prints the package, protected and public fields, and methods of the classes passed to it\&. The
\fBjavap\fR
command prints its output to
\fBstdout\fR\&.
.SH "OPTIONS"
.PP
\-help
.br
Prints a help message for the \f3javap\fR command\&.
.TP
-version
\-\-help
.br
\-?
.RS 4
Prints a help message for the
\fBjavap\fR
command\&.
.RE
.PP
\-version
.RS 4
Prints release information\&.
.TP
-l
.br
.RE
.PP
\-l
.RS 4
Prints line and local variable tables\&.
.TP
-public
.br
.RE
.PP
\-public
.RS 4
Shows only public classes and members\&.
.TP
-protected
.br
.RE
.PP
\-protected
.RS 4
Shows only protected and public classes and members\&.
.TP
-private, -p
.RE
.PP
\-private
.br
\-p
.RS 4
Shows all classes and members\&.
.TP
-J\fIoption\fR
.br
.RE
.PP
\-J\fIoption\fR
.RS 4
Passes the specified option to the JVM\&. For example:
.sp
.nf
\f3javap \-J\-version\fP
.fi
.nf
\f3javap \-J\-Djava\&.security\&.manager \-J\-Djava\&.security\&.policy=MyPolicy MyClassName\fP
.fi
.nf
\f3\fP
.fi
.sp
For more information about JVM options, see the \f3java(1)\fR command documentation\&.
.TP
-s
.br
.sp
.if n \{\
.RS 4
.\}
.nf
\fBjavap \-J\-version\fR
\fBjavap \-J\-Djava\&.security\&.manager \-J\-Djava\&.security\&.policy=MyPolicy MyClassName\fR
.fi
.if n \{\
.RE
.\}
For more information about JVM options, see the command documentation\&.
.RE
.PP
\-s
.RS 4
Prints internal type signatures\&.
.TP
-sysinfo
.br
.RE
.PP
\-sysinfo
.RS 4
Shows system information (path, size, date, MD5 hash) of the class being processed\&.
.TP
-constants
.br
Shows \f3static final\fR constants\&.
.TP
-c
.br
.RE
.PP
\-constants
.RS 4
Shows
\fBstatic final\fR
constants\&.
.RE
.PP
\-c
.RS 4
Prints disassembled code, for example, the instructions that comprise the Java bytecodes, for each of the methods in the class\&.
.TP
-verbose
.br
.RE
.PP
\-verbose
.RS 4
Prints stack size, number of locals and arguments for methods\&.
.TP
-classpath \fIpath\fR
.br
Specifies the path the \f3javap\fR command uses to look up classes\&. Overrides the default or the \f3CLASSPATH\fR environment variable when it is set\&.
.TP
-bootclasspath \fIpath\fR
.br
Specifies the path from which to load bootstrap classes\&. By default, the bootstrap classes are the classes that implement the core Java platform located in \f3jre/lib/rt\&.jar\fR and several other JAR files\&.
.TP
-extdir \fIdirs\fR
.br
Overrides the location at which installed extensions are searched for\&. The default location for extensions is the value of \f3java\&.ext\&.dirs\fR\&.
.SH EXAMPLE
Compile the following \f3DocFooter\fR class:
.sp
.nf
\f3import java\&.awt\&.*;\fP
.fi
.nf
\f3import java\&.applet\&.*;\fP
.fi
.nf
\f3\fP
.fi
.nf
\f3public class DocFooter extends Applet {\fP
.fi
.nf
\f3 String date;\fP
.fi
.nf
\f3 String email;\fP
.fi
.nf
\f3\fP
.fi
.nf
\f3 public void init() {\fP
.fi
.nf
\f3 resize(500,100);\fP
.fi
.nf
\f3 date = getParameter("LAST_UPDATED");\fP
.fi
.nf
\f3 email = getParameter("EMAIL");\fP
.fi
.nf
\f3 }\fP
.fi
.nf
\f3\fP
.fi
.nf
\f3 public void paint(Graphics g) {\fP
.fi
.nf
\f3 g\&.drawString(date + " by ",100, 15);\fP
.fi
.nf
\f3 g\&.drawString(email,290,15);\fP
.fi
.nf
\f3 }\fP
.fi
.nf
\f3}\fP
.fi
.nf
\f3\fP
.fi
.sp
The output from the \f3javap DocFooter\&.class\fR command yields the following:
.sp
.nf
\f3Compiled from "DocFooter\&.java"\fP
.fi
.nf
\f3public class DocFooter extends java\&.applet\&.Applet {\fP
.fi
.nf
\f3 java\&.lang\&.String date;\fP
.fi
.nf
\f3 java\&.lang\&.String email;\fP
.fi
.nf
\f3 public DocFooter();\fP
.fi
.nf
\f3 public void init();\fP
.fi
.nf
\f3 public void paint(java\&.awt\&.Graphics);\fP
.fi
.nf
\f3}\fP
.fi
.nf
\f3\fP
.fi
.sp
The output from \f3javap -c DocFooter\&.class\fR command yields the following:
.sp
.nf
\f3Compiled from "DocFooter\&.java"\fP
.fi
.nf
\f3public class DocFooter extends java\&.applet\&.Applet {\fP
.fi
.nf
\f3 java\&.lang\&.String date;\fP
.fi
.nf
\f3 java\&.lang\&.String email;\fP
.fi
.nf
\f3\fP
.fi
.nf
\f3 public DocFooter();\fP
.fi
.nf
\f3 Code:\fP
.fi
.nf
\f3 0: aload_0 \fP
.fi
.nf
\f3 1: invokespecial #1 // Method\fP
.fi
.nf
\f3java/applet/Applet\&."<init>":()V\fP
.fi
.nf
\f3 4: return \fP
.fi
.nf
\f3\fP
.fi
.nf
\f3 public void init();\fP
.fi
.nf
\f3 Code:\fP
.fi
.nf
\f3 0: aload_0 \fP
.fi
.nf
\f3 1: sipush 500\fP
.fi
.nf
\f3 4: bipush 100\fP
.fi
.nf
\f3 6: invokevirtual #2 // Method resize:(II)V\fP
.fi
.nf
\f3 9: aload_0 \fP
.fi
.nf
\f3 10: aload_0 \fP
.fi
.nf
\f3 11: ldc #3 // String LAST_UPDATED\fP
.fi
.nf
\f3 13: invokevirtual #4 // Method\fP
.fi
.nf
\f3 getParameter:(Ljava/lang/String;)Ljava/lang/String;\fP
.fi
.nf
\f3 16: putfield #5 // Field date:Ljava/lang/String;\fP
.fi
.nf
\f3 19: aload_0 \fP
.fi
.nf
\f3 20: aload_0 \fP
.fi
.nf
\f3 21: ldc #6 // String EMAIL\fP
.fi
.nf
\f3 23: invokevirtual #4 // Method\fP
.fi
.nf
\f3 getParameter:(Ljava/lang/String;)Ljava/lang/String;\fP
.fi
.nf
\f3 26: putfield #7 // Field email:Ljava/lang/String;\fP
.fi
.nf
\f3 29: return \fP
.fi
.nf
\f3\fP
.fi
.nf
\f3 public void paint(java\&.awt\&.Graphics);\fP
.fi
.nf
\f3 Code:\fP
.fi
.nf
\f3 0: aload_1 \fP
.fi
.nf
\f3 1: new #8 // class java/lang/StringBuilder\fP
.fi
.nf
\f3 4: dup \fP
.fi
.nf
\f3 5: invokespecial #9 // Method\fP
.fi
.nf
\f3 java/lang/StringBuilder\&."<init>":()V\fP
.fi
.nf
\f3 8: aload_0 \fP
.fi
.nf
\f3 9: getfield #5 // Field date:Ljava/lang/String;\fP
.fi
.nf
\f3 12: invokevirtual #10 // Method\fP
.fi
.nf
\f3 java/lang/StringBuilder\&.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\fP
.fi
.nf
\f3 15: ldc #11 // String by \fP
.fi
.nf
\f3 17: invokevirtual #10 // Method\fP
.fi
.nf
\f3 java/lang/StringBuilder\&.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\fP
.fi
.nf
\f3 20: invokevirtual #12 // Method\fP
.fi
.nf
\f3 java/lang/StringBuilder\&.toString:()Ljava/lang/String;\fP
.fi
.nf
\f3 23: bipush 100\fP
.fi
.nf
\f3 25: bipush 15\fP
.fi
.nf
\f3 27: invokevirtual #13 // Method\fP
.fi
.nf
\f3 java/awt/Graphics\&.drawString:(Ljava/lang/String;II)V\fP
.fi
.nf
\f3 30: aload_1 \fP
.fi
.nf
\f3 31: aload_0 \fP
.fi
.nf
\f3 32: getfield #7 // Field email:Ljava/lang/String;\fP
.fi
.nf
\f3 35: sipush 290\fP
.fi
.nf
\f3 38: bipush 15\fP
.fi
.nf
\f3 40: invokevirtual #13 // Method\fP
.fi
.nf
\f3java/awt/Graphics\&.drawString:(Ljava/lang/String;II)V\fP
.fi
.nf
\f3 43: return \fP
.fi
.nf
\f3}\fP
.fi
.nf
\f3\fP
.fi
.sp
.SH SEE\ ALSO
.TP 0.2i
\(bu
javac(1)
.TP 0.2i
\(bu
.RE
.PP
\-classpath \fIpath\fR
.RS 4
Specifies the path the
\fBjavap\fR
command uses to look up classes\&. Overrides the default or the
\fBCLASSPATH\fR
environment variable when it is set\&.
.RE
.PP
\-bootclasspath \fIpath\fR
.RS 4
Specifies the path from which to load bootstrap classes\&. By default, the bootstrap classes are the classes that implement the core Java platform located in
\fBjre/lib/rt\&.jar\fR
and several other JAR files\&.
.RE
.PP
\-extdir \fIdirs\fR
.RS 4
Overrides the location at which installed extensions are searched for\&. The default location for extensions is the value of
\fBjava\&.ext\&.dirs\fR\&.
.RE
.SH "EXAMPLE"
.PP
Compile the following
\fBDocFooter\fR
class:
.sp
.if n \{\
.RS 4
.\}
.nf
\fBimport java\&.awt\&.*;\fR
\fBimport java\&.applet\&.*;\fR
\fB \fR
\fBpublic class DocFooter extends Applet {\fR
\fB String date;\fR
\fB String email;\fR
\fB \fR
\fB public void init() {\fR
\fB resize(500,100);\fR
\fB date = getParameter("LAST_UPDATED");\fR
\fB email = getParameter("EMAIL");\fR
\fB }\fR
\fB \fR
\fB public void paint(Graphics g) {\fR
\fB g\&.drawString(date + " by ",100, 15);\fR
\fB g\&.drawString(email,290,15);\fR
\fB }\fR
\fB}\fR
.fi
.if n \{\
.RE
.\}
.PP
The output from the
\fBjavap DocFooter\&.class\fR
command yields the following:
.sp
.if n \{\
.RS 4
.\}
.nf
\fBCompiled from "DocFooter\&.java"\fR
\fBpublic class DocFooter extends java\&.applet\&.Applet {\fR
\fB java\&.lang\&.String date;\fR
\fB java\&.lang\&.String email;\fR
\fB public DocFooter();\fR
\fB public void init();\fR
\fB public void paint(java\&.awt\&.Graphics);\fR
\fB}\fR
.fi
.if n \{\
.RE
.\}
.PP
The output from
\fBjavap \-c DocFooter\&.class\fR
command yields the following:
.sp
.if n \{\
.RS 4
.\}
.nf
\fBCompiled from "DocFooter\&.java"\fR
\fBpublic class DocFooter extends java\&.applet\&.Applet {\fR
\fB java\&.lang\&.String date;\fR
\fB java\&.lang\&.String email;\fR
\fB public DocFooter();\fR
\fB Code:\fR
\fB 0: aload_0 \fR
\fB 1: invokespecial #1 // Method\fR
\fBjava/applet/Applet\&."<init>":()V\fR
\fB 4: return \fR
\fB public void init();\fR
\fB Code:\fR
\fB 0: aload_0 \fR
\fB 1: sipush 500\fR
\fB 4: bipush 100\fR
\fB 6: invokevirtual #2 // Method resize:(II)V\fR
\fB 9: aload_0 \fR
\fB 10: aload_0 \fR
\fB 11: ldc #3 // String LAST_UPDATED\fR
\fB 13: invokevirtual #4 // Method\fR
\fB getParameter:(Ljava/lang/String;)Ljava/lang/String;\fR
\fB 16: putfield #5 // Field date:Ljava/lang/String;\fR
\fB 19: aload_0 \fR
\fB 20: aload_0 \fR
\fB 21: ldc #6 // String EMAIL\fR
\fB 23: invokevirtual #4 // Method\fR
\fB getParameter:(Ljava/lang/String;)Ljava/lang/String;\fR
\fB 26: putfield #7 // Field email:Ljava/lang/String;\fR
\fB 29: return \fR
\fB public void paint(java\&.awt\&.Graphics);\fR
\fB Code:\fR
\fB 0: aload_1 \fR
\fB 1: new #8 // class java/lang/StringBuilder\fR
\fB 4: dup \fR
\fB 5: invokespecial #9 // Method\fR
\fB java/lang/StringBuilder\&."<init>":()V\fR
\fB 8: aload_0 \fR
\fB 9: getfield #5 // Field date:Ljava/lang/String;\fR
\fB 12: invokevirtual #10 // Method\fR
\fB java/lang/StringBuilder\&.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\fR
\fB 15: ldc #11 // String by \fR
\fB 17: invokevirtual #10 // Method\fR
\fB java/lang/StringBuilder\&.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\fR
\fB 20: invokevirtual #12 // Method\fR
\fB java/lang/StringBuilder\&.toString:()Ljava/lang/String;\fR
\fB 23: bipush 100\fR
\fB 25: bipush 15\fR
\fB 27: invokevirtual #13 // Method\fR
\fB java/awt/Graphics\&.drawString:(Ljava/lang/String;II)V\fR
\fB 30: aload_1 \fR
\fB 31: aload_0 \fR
\fB 32: getfield #7 // Field email:Ljava/lang/String;\fR
\fB 35: sipush 290\fR
\fB 38: bipush 15\fR
\fB 40: invokevirtual #13 // Method\fR
\fBjava/awt/Graphics\&.drawString:(Ljava/lang/String;II)V\fR
\fB 43: return \fR
\fB}\fR
.fi
.if n \{\
.RE
.\}
.SH "SEE ALSO"
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
java(1)
.TP 0.2i
\(bu
jdb(1)
.TP 0.2i
\(bu
javah(1)
.TP 0.2i
\(bu
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
javac(1)
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
javadoc(1)
.RE
.br
'pl 8.5i
'bp
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
javah(1)
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
jdb(1)
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
jdeps(1)
.RE
.br
'pl 8.5i
'bp
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -120,6 +120,10 @@ class AquaComboBoxPopup extends BasicComboPopup {
public void show() {
final int startItemCount = comboBox.getItemCount();
if (startItemCount == 0) {
return;
}
final Rectangle popupBounds = adjustPopupAndGetBounds();
if (popupBounds == null) return; // null means don't show
......
......@@ -171,7 +171,9 @@ final class LWChoicePeer extends LWComponentPeer<Choice, JComboBox<String>>
SwingUtilities.invokeLater(() -> {
JPopupMenu popupMenu = getPopupMenu();
// Need to override the invoker for proper grab handling
if (popupMenu != null && popupMenu.getInvoker() != getTarget()) {
if (popupMenu != null
&& popupMenu.isShowing()
&& popupMenu.getInvoker() != getTarget()) {
// The popup is now visible with correct location
// Save it and restore after toggling visibility and changing invoker
Point loc = popupMenu.getLocationOnScreen();
......
......@@ -319,6 +319,8 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
* subclasses to initialize specific peers properties.
*/
void initializeImpl() {
// note that these methods can be overridden by the user and
// can return some strange values like null.
setBackground(target.getBackground());
setForeground(target.getForeground());
setFont(target.getFont());
......
......@@ -443,6 +443,12 @@ public class LWWindowPeer
getPlatformWindow().updateIconImages();
}
@Override
public void setBackground(final Color c) {
super.setBackground(c);
updateOpaque();
}
@Override
public void setOpacity(float opacity) {
getPlatformWindow().setOpacity(opacity);
......
......@@ -96,7 +96,8 @@ public class CEmbeddedFrame extends EmbeddedFrame {
public void handleKeyEvent(int eventType, int modifierFlags, String characters,
String charsIgnoringMods, boolean isRepeat, short keyCode,
boolean needsKeyTyped) {
responder.handleKeyEvent(eventType, modifierFlags, charsIgnoringMods, keyCode, needsKeyTyped, isRepeat);
responder.handleKeyEvent(eventType, modifierFlags, characters, charsIgnoringMods,
keyCode, needsKeyTyped, isRepeat);
}
public void handleInputEvent(String text) {
......
......@@ -29,12 +29,18 @@ import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Insets;
import java.awt.MenuBar;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Window;
import sun.awt.CGraphicsDevice;
import sun.awt.CGraphicsEnvironment;
import sun.awt.CausedFocusEvent;
import sun.awt.LightweightFrame;
import sun.java2d.SurfaceData;
import sun.lwawt.LWLightweightFramePeer;
import sun.lwawt.LWWindowPeer;
import sun.lwawt.PlatformWindow;
......@@ -72,11 +78,6 @@ public class CPlatformLWWindow extends CPlatformWindow {
return null;
}
@Override
public GraphicsDevice getGraphicsDevice() {
return null;
}
@Override
public SurfaceData getScreenSurface() {
return null;
......@@ -199,4 +200,24 @@ public class CPlatformLWWindow extends CPlatformWindow {
public long getLayerPtr() {
return 0;
}
@Override
public GraphicsDevice getGraphicsDevice() {
CGraphicsEnvironment ge = (CGraphicsEnvironment)GraphicsEnvironment.
getLocalGraphicsEnvironment();
LWLightweightFramePeer peer = (LWLightweightFramePeer)getPeer();
int scale = ((LightweightFrame)peer.getTarget()).getScaleFactor();
Rectangle bounds = ((LightweightFrame)peer.getTarget()).getHostBounds();
for (GraphicsDevice d : ge.getScreenDevices()) {
if (d.getDefaultConfiguration().getBounds().intersects(bounds) &&
((CGraphicsDevice)d).getScaleFactor() == scale)
{
return d;
}
}
// We shouldn't be here...
return ge.getDefaultScreenDevice();
}
}
......@@ -125,7 +125,7 @@ final class CPlatformResponder {
/**
* Handles key events.
*/
void handleKeyEvent(int eventType, int modifierFlags, String chars,
void handleKeyEvent(int eventType, int modifierFlags, String chars, String charsIgnoringModifiers,
short keyCode, boolean needsKeyTyped, boolean needsKeyReleased) {
boolean isFlagsChangedEvent =
isNpapiCallback ? (eventType == CocoaConstants.NPCocoaEventFlagsChanged) :
......@@ -153,7 +153,10 @@ final class CPlatformResponder {
testChar = chars.charAt(0);
}
int[] in = new int[] {testChar, isDeadChar ? 1 : 0, modifierFlags, keyCode};
char testCharIgnoringModifiers = charsIgnoringModifiers != null && charsIgnoringModifiers.length() > 0 ?
charsIgnoringModifiers.charAt(0) : KeyEvent.CHAR_UNDEFINED;
int[] in = new int[] {testCharIgnoringModifiers, isDeadChar ? 1 : 0, modifierFlags, keyCode};
int[] out = new int[3]; // [jkeyCode, jkeyLocation, deadChar]
postsTyped = NSEvent.nsToJavaKeyInfo(in, out);
......
......@@ -200,7 +200,7 @@ public class CPlatformView extends CFRetainedResource {
}
private void deliverKeyEvent(NSEvent event) {
responder.handleKeyEvent(event.getType(), event.getModifierFlags(),
responder.handleKeyEvent(event.getType(), event.getModifierFlags(), event.getCharacters(),
event.getCharactersIgnoringModifiers(), event.getKeyCode(), true, false);
}
......
......@@ -119,6 +119,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
static final int NONACTIVATING = 1 << 24;
static final int IS_DIALOG = 1 << 25;
static final int IS_MODAL = 1 << 26;
static final int IS_POPUP = 1 << 27;
static final int _STYLE_PROP_BITMASK = DECORATED | TEXTURED | UNIFIED | UTILITY | HUD | SHEET | CLOSEABLE | MINIMIZABLE | RESIZABLE;
......@@ -318,6 +319,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
styleBits = SET(styleBits, TEXTURED, false);
// Popups in applets don't activate applet's process
styleBits = SET(styleBits, NONACTIVATING, true);
styleBits = SET(styleBits, IS_POPUP, true);
}
if (Window.Type.UTILITY.equals(target.getType())) {
......@@ -745,20 +747,22 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
@Override
public void setOpaque(boolean isOpaque) {
CWrapper.NSWindow.setOpaque(getNSWindowPtr(), isOpaque);
boolean isTextured = (peer == null)? false : peer.isTextured();
if (!isOpaque && !isTextured) {
long clearColor = CWrapper.NSColor.clearColor();
CWrapper.NSWindow.setBackgroundColor(getNSWindowPtr(), clearColor);
boolean isTextured = (peer == null) ? false : peer.isTextured();
if (!isTextured) {
if (!isOpaque) {
CWrapper.NSWindow.setBackgroundColor(getNSWindowPtr(), 0);
} else if (peer != null) {
Color color = peer.getBackground();
if (color != null) {
int rgb = color.getRGB();
CWrapper.NSWindow.setBackgroundColor(getNSWindowPtr(), rgb);
}
}
}
//This is a temporary workaround. Looks like after 7124236 will be fixed
//the correct place for invalidateShadow() is CGLayer.drawInCGLContext.
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
invalidateShadow();
}
});
SwingUtilities.invokeLater(this::invalidateShadow);
}
@Override
......
......@@ -61,7 +61,14 @@ final class CWrapper {
static native void setAlphaValue(long window, float alpha);
static native void setOpaque(long window, boolean opaque);
static native void setBackgroundColor(long window, long color);
/**
* Sets background color of the NSWindow.
*
* @param window the pointer of the NSWindow
* @param color the color in argb format
*/
static native void setBackgroundColor(long window, int color);
static native void miniaturize(long window);
static native void deminiaturize(long window);
......@@ -82,8 +89,4 @@ final class CWrapper {
static native void setToolTip(long view, String msg);
}
static final class NSColor {
static native long clearColor();
}
}
......@@ -47,13 +47,15 @@ final class NSEvent {
// Key event information
private short keyCode;
private String characters;
private String charactersIgnoringModifiers;
// Called from native
NSEvent(int type, int modifierFlags, short keyCode, String charactersIgnoringModifiers) {
NSEvent(int type, int modifierFlags, short keyCode, String characters, String charactersIgnoringModifiers) {
this.type = type;
this.modifierFlags = modifierFlags;
this.keyCode = keyCode;
this.characters = characters;
this.charactersIgnoringModifiers = charactersIgnoringModifiers;
}
......@@ -121,12 +123,16 @@ final class NSEvent {
return charactersIgnoringModifiers;
}
String getCharacters() {
return characters;
}
@Override
public String toString() {
return "NSEvent[" + getType() + " ," + getModifierFlags() + " ,"
+ getClickCount() + " ," + getButtonNumber() + " ," + getX() + " ,"
+ getY() + " ," + getAbsX() + " ," + getAbsY()+ " ," + getKeyCode() + " ,"
+ getCharactersIgnoringModifiers() + "]";
+ getCharacters() + " ," + getCharactersIgnoringModifiers() + "]";
}
/*
......
......@@ -367,7 +367,7 @@ AWT_ASSERT_APPKIT_THREAD;
// TODO: need consitent way for doing that both with global as well as with local coordinates.
// The reason to do it here is one more native method for getting screen dimension otherwise.
NSRect screenRect = [[NSScreen mainScreen] frame];
NSRect screenRect = [[[NSScreen screens] objectAtIndex:0] frame];
absP.y = screenRect.size.height - absP.y;
jint clickCount;
......@@ -441,17 +441,20 @@ AWT_ASSERT_APPKIT_THREAD;
JNIEnv *env = [ThreadUtilities getJNIEnv];
jstring characters = NULL;
jstring charactersIgnoringModifiers = NULL;
if ([event type] != NSFlagsChanged) {
characters = JNFNSToJavaString(env, [event characters]);
charactersIgnoringModifiers = JNFNSToJavaString(env, [event charactersIgnoringModifiers]);
}
static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/NSEvent");
static JNF_CTOR_CACHE(jctor_NSEvent, jc_NSEvent, "(IISLjava/lang/String;)V");
static JNF_CTOR_CACHE(jctor_NSEvent, jc_NSEvent, "(IISLjava/lang/String;Ljava/lang/String;)V");
jobject jevent = JNFNewObject(env, jctor_NSEvent,
[event type],
[event modifierFlags],
[event keyCode],
characters);
characters,
charactersIgnoringModifiers);
static JNF_CLASS_CACHE(jc_PlatformView, "sun/lwawt/macosx/CPlatformView");
static JNF_MEMBER_CACHE(jm_deliverKeyEvent, jc_PlatformView,
......
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -252,6 +252,10 @@ AWT_ASSERT_APPKIT_THREAD;
self.ownerWindow = owner;
[self setPropertiesForStyleBits:styleBits mask:MASK(_METHOD_PROP_BITMASK)];
if (IS(self.styleBits, IS_POPUP)) {
[self.nsWindow setCollectionBehavior:(1 << 8) /*NSWindowCollectionBehaviorFullScreenAuxiliary*/];
}
return self;
}
......
......@@ -337,12 +337,17 @@ JNF_COCOA_EXIT(env);
*/
JNIEXPORT void JNICALL
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_setBackgroundColor
(JNIEnv *env, jclass cls, jlong windowPtr, jlong colorPtr)
(JNIEnv *env, jclass cls, jlong windowPtr, jint rgb)
{
JNF_COCOA_ENTER(env);
NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
NSColor *color = (NSColor *)jlong_to_ptr(colorPtr);
CGFloat alpha = (((rgb >> 24) & 0xff) / 255.0);
CGFloat red = (((rgb >> 16) & 0xff) / 255.0);
CGFloat green = (((rgb >> 8) & 0xff) / 255.0);
CGFloat blue = (((rgb >> 0) & 0xff) / 255.0);
NSColor *color = [NSColor colorWithCalibratedRed:red green:green blue:blue
alpha:alpha];
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[window setBackgroundColor:color];
}];
......@@ -575,26 +580,3 @@ JNF_COCOA_ENTER(env);
JNF_COCOA_EXIT(env);
}
/*
* Class: sun_lwawt_macosx_CWrapper$NSColor
* Method: clearColor
* Signature: ()J
*/
JNIEXPORT jlong JNICALL
Java_sun_lwawt_macosx_CWrapper_00024NSColor_clearColor
(JNIEnv *env, jclass cls)
{
__block jlong clearColorPtr = 0L;
JNF_COCOA_ENTER(env);
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
clearColorPtr = ptr_to_jlong([NSColor clearColor]);
}];
JNF_COCOA_EXIT(env);
return clearColorPtr;
}
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -459,10 +459,10 @@ public final class Connection implements Runnable {
// will be woken up before readTimeout only if reply is
// available
ldr.wait(readTimeout);
waited = true;
} else {
ldr.wait(15 * 1000); // 15 second timeout
}
waited = true;
} else {
break;
}
......@@ -474,7 +474,7 @@ public final class Connection implements Runnable {
}
if ((rber == null) && waited) {
removeRequest(ldr);
abandonRequest(ldr, null);
throw new NamingException("LDAP response read timed out, timeout used:"
+ readTimeout + "ms." );
......
/*
* Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -285,6 +285,8 @@ public abstract class Path2D implements Shape, Cloneable {
int grow = size;
if (grow > EXPAND_MAX) {
grow = EXPAND_MAX;
} else if (grow == 0) {
grow = 1;
}
pointTypes = Arrays.copyOf(pointTypes, size+grow);
}
......@@ -1121,6 +1123,8 @@ public abstract class Path2D implements Shape, Cloneable {
int grow = size;
if (grow > EXPAND_MAX) {
grow = EXPAND_MAX;
} else if (grow == 0) {
grow = 1;
}
pointTypes = Arrays.copyOf(pointTypes, size+grow);
}
......
......@@ -2697,12 +2697,26 @@ public final class Class<T> implements java.io.Serializable,
}
static class MethodArray {
// Don't add or remove methods except by add() or remove() calls.
private Method[] methods;
private int length;
private int defaults;
MethodArray() {
methods = new Method[20];
this(20);
}
MethodArray(int initialSize) {
if (initialSize < 2)
throw new IllegalArgumentException("Size should be 2 or more");
methods = new Method[initialSize];
length = 0;
defaults = 0;
}
boolean hasDefaults() {
return defaults != 0;
}
void add(Method m) {
......@@ -2710,6 +2724,9 @@ public final class Class<T> implements java.io.Serializable,
methods = Arrays.copyOf(methods, 2 * methods.length);
}
methods[length++] = m;
if (m != null && m.isDefault())
defaults++;
}
void addAll(Method[] ma) {
......@@ -2743,7 +2760,10 @@ public final class Class<T> implements java.io.Serializable,
}
}
void addAllNonStatic(Method[] methods) {
/* Add Methods declared in an interface to this MethodArray.
* Static methods declared in interfaces are not inherited.
*/
void addInterfaceMethods(Method[] methods) {
for (Method candidate : methods) {
if (!Modifier.isStatic(candidate.getModifiers())) {
add(candidate);
......@@ -2759,19 +2779,35 @@ public final class Class<T> implements java.io.Serializable,
return methods[i];
}
void removeByNameAndSignature(Method toRemove) {
Method getFirst() {
for (Method m : methods)
if (m != null)
return m;
return null;
}
void removeByNameAndDescriptor(Method toRemove) {
for (int i = 0; i < length; i++) {
Method m = methods[i];
if (m != null &&
m.getReturnType() == toRemove.getReturnType() &&
m.getName() == toRemove.getName() &&
arrayContentsEq(m.getParameterTypes(),
toRemove.getParameterTypes())) {
methods[i] = null;
if (m != null && matchesNameAndDescriptor(m, toRemove)) {
remove(i);
}
}
}
private void remove(int i) {
if (methods[i] != null && methods[i].isDefault())
defaults--;
methods[i] = null;
}
private boolean matchesNameAndDescriptor(Method m1, Method m2) {
return m1.getReturnType() == m2.getReturnType() &&
m1.getName() == m2.getName() && // name is guaranteed to be interned
arrayContentsEq(m1.getParameterTypes(),
m2.getParameterTypes());
}
void compactAndTrim() {
int newPos = 0;
// Get rid of null slots
......@@ -2789,9 +2825,48 @@ public final class Class<T> implements java.io.Serializable,
}
}
/* Removes all Methods from this MethodArray that have a more specific
* default Method in this MethodArray.
*
* Users of MethodArray are responsible for pruning Methods that have
* a more specific <em>concrete</em> Method.
*/
void removeLessSpecifics() {
if (!hasDefaults())
return;
for (int i = 0; i < length; i++) {
Method m = get(i);
if (m == null || !m.isDefault())
continue;
for (int j = 0; j < length; j++) {
if (i == j)
continue;
Method candidate = get(j);
if (candidate == null)
continue;
if (!matchesNameAndDescriptor(m, candidate))
continue;
if (hasMoreSpecificClass(m, candidate))
remove(j);
}
}
}
Method[] getArray() {
return methods;
}
// Returns true if m1 is more specific than m2
static boolean hasMoreSpecificClass(Method m1, Method m2) {
Class<?> m1Class = m1.getDeclaringClass();
Class<?> m2Class = m2.getDeclaringClass();
return m1Class != m2Class && m2Class.isAssignableFrom(m1Class);
}
}
......@@ -2819,9 +2894,8 @@ public final class Class<T> implements java.io.Serializable,
// out concrete implementations inherited from superclasses at
// the end.
MethodArray inheritedMethods = new MethodArray();
Class<?>[] interfaces = getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
inheritedMethods.addAllNonStatic(interfaces[i].privateGetPublicMethods());
for (Class<?> i : getInterfaces()) {
inheritedMethods.addInterfaceMethods(i.privateGetPublicMethods());
}
if (!isInterface()) {
Class<?> c = getSuperclass();
......@@ -2832,8 +2906,10 @@ public final class Class<T> implements java.io.Serializable,
// interface methods
for (int i = 0; i < supers.length(); i++) {
Method m = supers.get(i);
if (m != null && !Modifier.isAbstract(m.getModifiers())) {
inheritedMethods.removeByNameAndSignature(m);
if (m != null &&
!Modifier.isAbstract(m.getModifiers()) &&
!m.isDefault()) {
inheritedMethods.removeByNameAndDescriptor(m);
}
}
// Insert superclass's inherited methods before
......@@ -2846,9 +2922,10 @@ public final class Class<T> implements java.io.Serializable,
// Filter out all local methods from inherited ones
for (int i = 0; i < methods.length(); i++) {
Method m = methods.get(i);
inheritedMethods.removeByNameAndSignature(m);
inheritedMethods.removeByNameAndDescriptor(m);
}
methods.addAllIfNotPresent(inheritedMethods);
methods.removeLessSpecifics();
methods.compactAndTrim();
res = methods.getArray();
if (rd != null) {
......@@ -2923,8 +3000,21 @@ public final class Class<T> implements java.io.Serializable,
return (res == null ? res : getReflectionFactory().copyMethod(res));
}
private Method getMethod0(String name, Class<?>[] parameterTypes, boolean includeStaticMethods) {
MethodArray interfaceCandidates = new MethodArray(2);
Method res = privateGetMethodRecursive(name, parameterTypes, includeStaticMethods, interfaceCandidates);
if (res != null)
return res;
// Not found on class or superclass directly
interfaceCandidates.removeLessSpecifics();
return interfaceCandidates.getFirst(); // may be null
}
private Method privateGetMethodRecursive(String name,
Class<?>[] parameterTypes,
boolean includeStaticMethods,
MethodArray allInterfaceCandidates) {
// Note: the intent is that the search algorithm this routine
// uses be equivalent to the ordering imposed by
// privateGetPublicMethods(). It fetches only the declared
......@@ -2932,6 +3022,14 @@ public final class Class<T> implements java.io.Serializable,
// number of Method objects which have to be created for the
// common case where the method being requested is declared in
// the class which is being queried.
//
// Due to default methods, unless a method is found on a superclass,
// methods declared in any superinterface needs to be considered.
// Collect all candidates declared in superinterfaces in {@code
// allInterfaceCandidates} and select the most specific if no match on
// a superclass is found.
// Must _not_ return root methods
Method res;
// Search declared public methods
if ((res = searchMethods(privateGetDeclaredMethods(true),
......@@ -2953,7 +3051,7 @@ public final class Class<T> implements java.io.Serializable,
Class<?>[] interfaces = getInterfaces();
for (Class<?> c : interfaces)
if ((res = c.getMethod0(name, parameterTypes, false)) != null)
return res;
allInterfaceCandidates.add(res);
// Not found
return null;
}
......
......@@ -39,6 +39,7 @@ import java.lang.reflect.*;
import static java.lang.invoke.MethodHandleStatics.*;
import static java.lang.invoke.MethodHandleNatives.Constants.*;
import sun.invoke.util.VerifyType;
import sun.reflect.misc.ReflectUtil;
/**
* Code generation backend for LambdaForm.
......@@ -595,6 +596,8 @@ class InvokerBytecodeGenerator {
return false; // inner class of some sort
if (cls.getClassLoader() != MethodHandle.class.getClassLoader())
return false; // not on BCP
if (ReflectUtil.isVMAnonymousClass(cls)) // FIXME: switch to supported API once it is added
return false;
MethodType mtype = member.getMethodOrFieldType();
if (!isStaticallyNameable(mtype.returnType()))
return false;
......@@ -613,6 +616,8 @@ class InvokerBytecodeGenerator {
cls = cls.getComponentType();
if (cls.isPrimitive())
return true; // int[].class, for example
if (ReflectUtil.isVMAnonymousClass(cls)) // FIXME: switch to supported API once it is added
return false;
// could use VerifyAccess.isClassAccessible but the following is a safe approximation
if (cls.getClassLoader() != Object.class.getClassLoader())
return false;
......
......@@ -482,7 +482,7 @@ class LambdaForm {
assert(m.getName().equals("interpret" + sig.substring(sig.indexOf('_'))));
LambdaForm form = new LambdaForm(sig);
form.vmentry = m;
mt.form().setCachedLambdaForm(MethodTypeForm.LF_COUNTER, form);
form = mt.form().setCachedLambdaForm(MethodTypeForm.LF_COUNTER, form);
// FIXME: get rid of PREPARED_FORMS; use MethodTypeForm cache only
forms.put(sig, form);
}
......
......@@ -313,7 +313,8 @@ public class LambdaMetafactory {
* reference expression</em> features of the Java Programming Language.
*
* <p>This is the general, more flexible metafactory; a streamlined version
* is provided by {@link #altMetafactory(MethodHandles.Lookup, String, MethodType, Object...)}.
* is provided by {@link #metafactory(java.lang.invoke.MethodHandles.Lookup,
* String, MethodType, MethodType, MethodHandle, MethodType)}.
* A general description of the behavior of this method is provided
* {@link LambdaMetafactory above}.
*
......
......@@ -692,8 +692,7 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
lform = new LambdaForm("guardWithCatch", lambdaType.parameterCount(), names);
basicType.form().setCachedLambdaForm(MethodTypeForm.LF_GWC, lform);
return lform;
return basicType.form().setCachedLambdaForm(MethodTypeForm.LF_GWC, lform);
}
static
......
......@@ -1611,23 +1611,30 @@ return mh1;
checkSecurityManager(refc, method);
assert(!method.isMethodHandleInvoke());
Class<?> refcAsSuper;
if (refKind == REF_invokeSpecial &&
refc != lookupClass() &&
!refc.isInterface() &&
refc != (refcAsSuper = lookupClass().getSuperclass()) &&
refc != lookupClass().getSuperclass() &&
refc.isAssignableFrom(lookupClass())) {
assert(!method.getName().equals("<init>")); // not this code path
// Per JVMS 6.5, desc. of invokespecial instruction:
// If the method is in a superclass of the LC,
// and if our original search was above LC.super,
// repeat the search (symbolic lookup) from LC.super.
// repeat the search (symbolic lookup) from LC.super
// and continue with the direct superclass of that class,
// and so forth, until a match is found or no further superclasses exist.
// FIXME: MemberName.resolve should handle this instead.
MemberName m2 = new MemberName(refcAsSuper,
method.getName(),
method.getMethodType(),
REF_invokeSpecial);
m2 = IMPL_NAMES.resolveOrNull(refKind, m2, lookupClassOrNull());
Class<?> refcAsSuper = lookupClass();
MemberName m2;
do {
refcAsSuper = refcAsSuper.getSuperclass();
m2 = new MemberName(refcAsSuper,
method.getName(),
method.getMethodType(),
REF_invokeSpecial);
m2 = IMPL_NAMES.resolveOrNull(refKind, m2, lookupClassOrNull());
} while (m2 == null && // no method is found yet
refc != refcAsSuper); // search up to refc
if (m2 == null) throw new InternalError(method.toString());
method = m2;
refc = refcAsSuper;
......
......@@ -91,8 +91,10 @@ final class MethodTypeForm {
return lambdaForms[which];
}
public LambdaForm setCachedLambdaForm(int which, LambdaForm form) {
// Should we perform some sort of CAS, to avoid racy duplication?
synchronized public LambdaForm setCachedLambdaForm(int which, LambdaForm form) {
// Simulate a CAS, to avoid racy duplication of results.
LambdaForm prev = lambdaForms[which];
if (prev != null) return prev;
return lambdaForms[which] = form;
}
......
......@@ -644,7 +644,7 @@ public abstract class Executable extends AccessibleObject
getConstantPool(getDeclaringClass()),
this,
getDeclaringClass(),
getParameterTypes(),
getGenericParameterTypes(),
TypeAnnotation.TypeAnnotationTarget.METHOD_FORMAL_PARAMETER);
}
......
......@@ -700,7 +700,7 @@ public final class WeekFields implements Serializable {
* @see WeekFields#weekOfWeekBasedYear()
*/
static ComputedDayOfField ofWeekOfWeekBasedYearField(WeekFields weekDef) {
return new ComputedDayOfField("WeekOfWeekBasedYear", weekDef, WEEKS, IsoFields.WEEK_BASED_YEARS, WEEK_OF_YEAR_RANGE);
return new ComputedDayOfField("WeekOfWeekBasedYear", weekDef, WEEKS, IsoFields.WEEK_BASED_YEARS, WEEK_OF_WEEK_BASED_YEAR_RANGE);
}
/**
......@@ -753,6 +753,7 @@ public final class WeekFields implements Serializable {
private static final ValueRange DAY_OF_WEEK_RANGE = ValueRange.of(1, 7);
private static final ValueRange WEEK_OF_MONTH_RANGE = ValueRange.of(0, 1, 4, 6);
private static final ValueRange WEEK_OF_YEAR_RANGE = ValueRange.of(0, 1, 52, 54);
private static final ValueRange WEEK_OF_WEEK_BASED_YEAR_RANGE = ValueRange.of(1, 52, 53);
@Override
public long getFrom(TemporalAccessor temporal) {
......
......@@ -1967,7 +1967,7 @@ public class HashMap<K,V> extends AbstractMap<K,V>
dir = -1;
else if (ph < h)
dir = 1;
else if ((pk = p.key) == k || (pk != null && k.equals(pk)))
else if ((pk = p.key) == k || (k != null && k.equals(pk)))
return p;
else if ((kc == null &&
(kc = comparableClassFor(k)) == null) ||
......
......@@ -319,7 +319,8 @@ class ZipInputStream extends InflaterInputStream implements ZipConstants {
if (len > 0) {
byte[] extra = new byte[len];
readFully(extra, 0, len);
e.setExtra0(extra, true);
e.setExtra0(extra,
e.csize == ZIP64_MAGICVAL || e.size == ZIP64_MAGICVAL);
}
return e;
}
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册