Imported Upstream version 3.10.0

Former-commit-id: 172c8e3c300b39d5785c7a3e8dfb08ebdbc1a99b
This commit is contained in:
Jo Shields
2014-10-04 11:27:48 +01:00
parent fe777c5c82
commit 8b9b85e7f5
970 changed files with 20242 additions and 31308 deletions

View File

@ -30,18 +30,7 @@ jdk/src/share/classes/java/io/RandomAccessFile.java=java/io/RandomAccessFile.jav
jdk/src/share/classes/java/lang/Class.java=java/lang/Class.java
jdk/src/share/classes/java/lang/ClassLoader.java=java/lang/ClassLoader.java
jdk/src/share/classes/java/lang/Enum.java=java/lang/Enum.java
jdk/src/share/classes/java/lang/invoke/AdapterMethodHandle.java=java/lang/invoke/AdapterMethodHandle.java
jdk/src/share/classes/java/lang/invoke/BoundMethodHandle.java=java/lang/invoke/BoundMethodHandle.java
jdk/src/share/classes/java/lang/invoke/CallSite.java=java/lang/invoke/CallSite.java
jdk/src/share/classes/java/lang/invoke/ConstantCallSite.java=java/lang/invoke/ConstantCallSite.java
jdk/src/share/classes/java/lang/invoke/DirectMethodHandle.java=java/lang/invoke/DirectMethodHandle.java
jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java=java/lang/invoke/MethodHandleImpl.java
jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java=java/lang/invoke/MethodHandleNatives.java
jdk/src/share/classes/java/lang/invoke/MethodHandles.java=java/lang/invoke/MethodHandles.java
jdk/src/share/classes/java/lang/invoke/MutableCallSite.java=java/lang/invoke/MutableCallSite.java
jdk/src/share/classes/java/lang/invoke/VolatileCallSite.java=java/lang/invoke/VolatileCallSite.java
jdk/src/share/classes/java/lang/management/PlatformComponent.java=java/lang/management/PlatformComponent.java
jdk/src/share/classes/java/lang/Package.java=java/lang/Package.java
jdk/src/share/classes/java/lang/ref/SoftReference.java=java/lang/ref/SoftReference.java
jdk/src/share/classes/java/lang/reflect/Constructor.java=java/lang/reflect/Constructor.java
jdk/src/share/classes/java/lang/reflect/Field.java=java/lang/reflect/Field.java
@ -57,7 +46,6 @@ jdk/src/share/classes/java/net/SocketOutputStream.java=java/net/SocketOutputStre
jdk/src/share/classes/java/nio/Bits.java=java/nio/Bits.java
jdk/src/share/classes/java/security/AccessController.java=java/security/AccessController.java
jdk/src/share/classes/java/security/ProtectionDomain.java=java/security/ProtectionDomain.java
jdk/src/share/classes/java/sql/DriverManager.java=java/sql/DriverManager.java
jdk/src/share/classes/java/util/concurrent/atomic/AtomicBoolean.java=../classpath/java/util/concurrent/atomic/AtomicBoolean.java
jdk/src/share/classes/java/util/concurrent/atomic/AtomicInteger.java=../classpath/java/util/concurrent/atomic/AtomicInteger.java
jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java=../classpath/java/util/concurrent/atomic/AtomicIntegerArray.java
@ -67,9 +55,6 @@ jdk/src/share/classes/java/util/concurrent/atomic/AtomicReference.java=../classp
jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java=../classpath/java/util/concurrent/atomic/AtomicReferenceArray.java
jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java=java/util/concurrent/locks/AbstractQueuedSynchronizer.java
jdk/src/share/classes/java/util/concurrent/locks/LockSupport.java=java/util/concurrent/locks/LockSupport.java
jdk/src/share/classes/java/util/ResourceBundle.java=java/util/ResourceBundle.java
jdk/src/share/classes/java/util/TimeZone.java=java/util/TimeZone.java
jdk/src/share/classes/sun/awt/AppContext.java=sun/awt/AppContext.java
jdk/src/share/classes/sun/awt/EmbeddedFrame.java=sun/awt/EmbeddedFrame.java
jdk/src/share/classes/sun/awt/image/ByteInterleavedRaster.java=sun/awt/image/ByteInterleavedRaster.java
jdk/src/share/classes/sun/awt/image/ImagingLib.java=sun/awt/image/ImagingLib.java
@ -79,11 +64,8 @@ jdk/src/share/classes/sun/awt/image/ToolkitImage.java=sun/awt/image/ToolkitImage
jdk/src/share/classes/sun/awt/SunToolkit.java=sun/awt/SunToolkit.java
jdk/src/share/classes/sun/font/FontManager.java=sun/font/FontManager.java
jdk/src/share/classes/sun/font/StrikeCache.java=sun/font/StrikeCache.java
jdk/src/share/classes/sun/management/GcInfoBuilder.java=sun/management/GcInfoBuilder.java
jdk/src/share/classes/sun/management/ManagementFactoryHelper.java=sun/management/ManagementFactoryHelper.java
jdk/src/share/classes/sun/management/VMManagementImpl.java=sun/management/VMManagementImpl.java
jdk/src/share/classes/sun/misc/IoTrace.java=sun/misc/IoTrace.java
jdk/src/share/classes/sun/misc/JavaAWTAccess.java=sun/misc/JavaAWTAccess.java
jdk/src/share/classes/sun/misc/SharedSecrets.java=sun/misc/SharedSecrets.java
jdk/src/share/classes/sun/misc/VM.java=sun/misc/VM.java
jdk/src/share/classes/sun/net/sdp/SdpSupport.java=sun/net/sdp/SdpSupport.java
@ -94,9 +76,8 @@ jdk/src/share/classes/sun/nio/ch/IOUtil.java=sun/nio/ch/IOUtil.java
jdk/src/share/classes/sun/nio/ch/NativeDispatcher.java=sun/nio/ch/NativeDispatcher.java
jdk/src/share/classes/sun/nio/ch/Net.java=sun/nio/ch/Net.java
jdk/src/share/classes/sun/nio/ch/Util.java=sun/nio/ch/Util.java
jdk/src/share/classes/sun/reflect/CallerSensitive.java=sun/reflect/CallerSensitive.java
jdk/src/share/classes/sun/reflect/annotation/AnnotationType.java=sun/reflect/annotation/AnnotationType.java
jdk/src/share/classes/sun/reflect/MethodAccessor.java=sun/reflect/MethodAccessor.java
jdk/src/share/classes/sun/reflect/misc/ReflectUtil.java=sun/reflect/misc/ReflectUtil.java
jdk/src/share/classes/sun/reflect/Reflection.java=sun/reflect/Reflection.java
jdk/src/share/classes/sun/reflect/ReflectionFactory.java=sun/reflect/ReflectionFactory.java
jdk/src/solaris/classes/sun/nio/fs/UnixUriUtils.java=sun/nio/fs/UnixUriUtils.java

View File

@ -1 +1 @@
533d7645e2bb496cbbac8996759c133993dcc1bb
4911d54d998b7a044246f97683fb62901e9dc052

View File

@ -236,12 +236,14 @@ public abstract class AnnotationAttributeBase
{
// TODO consider checking that the type matches
// (or better yet (?), remove the first two redundant elements from the array)
decodeValues(values, annotationType, annotationType.getClassLoader(), definition);
decodeValues(values, annotationType, annotationType.getClassLoader(), unescapeInvalidSurrogates(definition));
definition = null;
}
}
}
private static native Object[] unescapeInvalidSurrogates(Object[] definition);
private static void decodeValues(HashMap map, Class annotationClass, ClassLoader loader, Object[] array)
{
for (int i = 2; i < array.length; i += 2)

View File

@ -1 +1 @@
bbc1d241f632078e8ecf146e9398406c5719dd2f
07fd7bd567e5b0ae8b3ae9c32741b56f6f363b0a

View File

@ -1,5 +1,5 @@
/*
Copyright (C) 2007-2011 Jeroen Frijters
Copyright (C) 2007-2014 Jeroen Frijters
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -24,80 +24,40 @@
package java.lang;
import ikvm.runtime.AssemblyClassLoader;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.AccessController;
import java.util.Enumeration;
import java.lang.annotation.Annotation;
import java.lang.reflect.Executable;
import java.security.AccessControlContext;
import java.util.Map;
import sun.nio.ch.Interruptible;
import sun.reflect.annotation.AnnotationType;
import sun.security.action.GetPropertyAction;
@ikvm.lang.Internal
public class LangHelper
{
private static boolean addedSystemPackages;
private static void addSystemPackage(Map pkgMap)
{
// NOTE caller must have acquired lock on pkgMap
if (!addedSystemPackages)
{
addedSystemPackages = true;
String[] pkgs = getBootClassPackages();
for (int i = 0; i < pkgs.length; i++)
{
pkgMap.put(pkgs[i],
new Package(pkgs[i],
VMSystemProperties.SPEC_TITLE, // specTitle
VMSystemProperties.SPEC_VERSION, // specVersion
VMSystemProperties.SPEC_VENDOR, // specVendor
"IKVM.NET OpenJDK", // implTitle
PropertyConstants.openjdk_version, // implVersion
"Oracle Corporation & others", // implVendor
null, // sealBase
null)); // class loader
}
}
}
private static native String[] getBootClassPackages();
/* this method gets called by Package.getSystemPackage() via a redefined method in map.xml */
static Package getSystemPackage(Map pkgs, String name)
{
synchronized (pkgs)
{
addSystemPackage(pkgs);
return (Package)pkgs.get(name);
}
}
/* this method gets called by Package.getSystemPackages() via a redefined method in map.xml */
static Package[] getSystemPackages(Map pkgs)
{
synchronized (pkgs)
{
addSystemPackage(pkgs);
return (Package[])pkgs.values().toArray(new Package[pkgs.size()]);
}
}
public static sun.misc.JavaLangAccess getJavaLangAccess()
{
return new sun.misc.JavaLangAccess() {
public sun.reflect.ConstantPool getConstantPool(Class klass) {
return null;
return klass.getConstantPool();
}
public void setAnnotationType(Class klass, AnnotationType type) {
klass.setAnnotationType(type);
public boolean casAnnotationType(Class<?> klass, AnnotationType oldType, AnnotationType newType) {
return klass.casAnnotationType(oldType, newType);
}
public AnnotationType getAnnotationType(Class klass) {
return klass.getAnnotationType();
}
public Map<Class<? extends Annotation>, Annotation> getDeclaredAnnotationMap(Class<?> klass) {
return klass.getDeclaredAnnotationMap();
}
public byte[] getRawClassAnnotations(Class<?> klass) {
throw new InternalError();
}
public byte[] getRawClassTypeAnnotations(Class<?> klass) {
return klass.getRawTypeAnnotations();
}
public byte[] getRawExecutableTypeAnnotations(Executable executable) {
return Class.getExecutableTypeAnnotationBytes(executable);
}
public <E extends Enum<E>>
E[] getEnumConstantsShared(Class<E> klass) {
return klass.getEnumConstantsShared();
@ -114,8 +74,14 @@ public class LangHelper
public StackTraceElement getStackTraceElement(Throwable t, int i) {
return t.getStackTraceElement(i);
}
public int getStringHash32(String string) {
return StringHelper.hash32(string);
public String newStringUnsafe(char[] chars) {
return String.valueOf(chars);
}
public Thread newThreadWithAcc(Runnable target, AccessControlContext acc) {
return new Thread(target, acc);
}
public void invokeFinalize(Object o) throws Throwable {
// we don't actually support invoking the finalize method explicitly
}
};
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 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
@ -42,9 +42,15 @@ import java.io.BufferedOutputStream;
import java.lang.ProcessBuilder.Redirect;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import cli.System.AsyncCallback;
import cli.System.IAsyncResult;
import cli.System.Diagnostics.ProcessStartInfo;
import cli.System.EventArgs;
import cli.System.EventHandler;
import cli.System.IO.FileAccess;
import cli.System.IO.FileShare;
import cli.System.IO.FileMode;
@ -146,8 +152,17 @@ final class ProcessImpl extends Process {
return new ProcessImpl(cmdarray, environment, dir,
stdHandles, redirectErrorStream);
} catch (Throwable t) {
if (f0 != null)
f0.close();
if (f1 != null)
f1.close();
if (f2 != null)
f2.close();
throw t;
} finally {
// HACK prevent the File[In|Out]putStream objects from closing the streams
// (the System.IO.FileStream will eventually be closed explicitly or by its finalizer)
if (f0 != null)
cli.System.GC.SuppressFinalize(f0);
if (f1 != null)
@ -158,50 +173,240 @@ final class ProcessImpl extends Process {
}
private static class LazyPattern {
// Escape-support version:
// "(\")((?:\\\\\\1|.)+?)\\1|([^\\s\"]+)";
private static final Pattern PATTERN =
Pattern.compile("[^\\s\"]+|\"[^\"]*\"");
};
/* Parses the command string parameter into the executable name and
* program arguments.
*
* The command string is broken into tokens. The token separator is a space
* or quota character. The space inside quotation is not a token separator.
* There are no escape sequences.
*/
private static String[] getTokensFromCommand(String command) {
ArrayList<String> matchList = new ArrayList<>(8);
Matcher regexMatcher = LazyPattern.PATTERN.matcher(command);
while (regexMatcher.find())
matchList.add(regexMatcher.group());
return matchList.toArray(new String[matchList.size()]);
}
private static final int VERIFICATION_CMD_BAT = 0;
private static final int VERIFICATION_WIN32 = 1;
private static final int VERIFICATION_LEGACY = 2;
private static final char ESCAPE_VERIFICATION[][] = {
// We guarantee the only command file execution for implicit [cmd.exe] run.
// http://technet.microsoft.com/en-us/library/bb490954.aspx
{' ', '\t', '<', '>', '&', '|', '^'},
{' ', '\t', '<', '>'},
{' ', '\t'}
};
private static String createCommandLine(int verificationType,
final String executablePath,
final String cmd[])
{
StringBuilder cmdbuf = new StringBuilder(80);
cmdbuf.append(executablePath);
for (int i = 1; i < cmd.length; ++i) {
cmdbuf.append(' ');
String s = cmd[i];
if (needsEscaping(verificationType, s)) {
cmdbuf.append('"').append(s);
// The code protects the [java.exe] and console command line
// parser, that interprets the [\"] combination as an escape
// sequence for the ["] char.
// http://msdn.microsoft.com/en-us/library/17w5ykft.aspx
//
// If the argument is an FS path, doubling of the tail [\]
// char is not a problem for non-console applications.
//
// The [\"] sequence is not an escape sequence for the [cmd.exe]
// command line parser. The case of the [""] tail escape
// sequence could not be realized due to the argument validation
// procedure.
if ((verificationType != VERIFICATION_CMD_BAT) && s.endsWith("\\")) {
cmdbuf.append('\\');
}
cmdbuf.append('"');
} else {
cmdbuf.append(s);
}
}
return cmdbuf.toString();
}
private static boolean isQuoted(boolean noQuotesInside, String arg,
String errorMessage) {
int lastPos = arg.length() - 1;
if (lastPos >=1 && arg.charAt(0) == '"' && arg.charAt(lastPos) == '"') {
// The argument has already been quoted.
if (noQuotesInside) {
if (arg.indexOf('"', 1) != lastPos) {
// There is ["] inside.
throw new IllegalArgumentException(errorMessage);
}
}
return true;
}
if (noQuotesInside) {
if (arg.indexOf('"') >= 0) {
// There is ["] inside.
throw new IllegalArgumentException(errorMessage);
}
}
return false;
}
private static boolean needsEscaping(int verificationType, String arg) {
// Switch off MS heuristic for internal ["].
// Please, use the explicit [cmd.exe] call
// if you need the internal ["].
// Example: "cmd.exe", "/C", "Extended_MS_Syntax"
// For [.exe] or [.com] file the unpaired/internal ["]
// in the argument is not a problem.
boolean argIsQuoted = isQuoted(
(verificationType == VERIFICATION_CMD_BAT),
arg, "Argument has embedded quote, use the explicit CMD.EXE call.");
if (!argIsQuoted) {
char testEscape[] = ESCAPE_VERIFICATION[verificationType];
for (int i = 0; i < testEscape.length; ++i) {
if (arg.indexOf(testEscape[i]) >= 0) {
return true;
}
}
}
return false;
}
private static String getExecutablePath(String path)
throws IOException
{
boolean pathIsQuoted = isQuoted(true, path,
"Executable name has embedded quote, split the arguments");
// Win32 CreateProcess requires path to be normalized
File fileToRun = new File(pathIsQuoted
? path.substring(1, path.length() - 1)
: path);
// From the [CreateProcess] function documentation:
//
// "If the file name does not contain an extension, .exe is appended.
// Therefore, if the file name extension is .com, this parameter
// must include the .com extension. If the file name ends in
// a period (.) with no extension, or if the file name contains a path,
// .exe is not appended."
//
// "If the file name !does not contain a directory path!,
// the system searches for the executable file in the following
// sequence:..."
//
// In practice ANY non-existent path is extended by [.exe] extension
// in the [CreateProcess] funcion with the only exception:
// the path ends by (.)
return fileToRun.getPath();
}
private boolean isShellFile(String executablePath) {
String upPath = executablePath.toUpperCase();
return (upPath.endsWith(".CMD") || upPath.endsWith(".BAT"));
}
private String quoteString(String arg) {
StringBuilder argbuf = new StringBuilder(arg.length() + 2);
return argbuf.append('"').append(arg).append('"').toString();
}
private cli.System.Diagnostics.Process handle;
private OutputStream stdin_stream;
private InputStream stdout_stream;
private InputStream stderr_stream;
private ProcessImpl(final String cmd[],
private ProcessImpl(String cmd[],
final java.util.Map<String,String> envblock,
final String path,
final Stream[] stdHandles,
final boolean redirectErrorStream)
throws IOException
{
// Win32 CreateProcess requires cmd[0] to be normalized
cmd[0] = new File(cmd[0]).getPath();
// give the runtime an opportunity to map executables from VFS to a real executable
cmd[0] = mapVfsExecutable(cmd[0]);
StringBuilder cmdbuf = new StringBuilder(80);
for (int i = 0; i < cmd.length; i++) {
if (i > 0) {
cmdbuf.append(' ');
}
String s = cmd[i];
if (s.indexOf(' ') >= 0 || s.indexOf('\t') >= 0) {
if (s.charAt(0) != '"') {
cmdbuf.append('"');
cmdbuf.append(s);
if (s.endsWith("\\")) {
cmdbuf.append("\\");
}
cmdbuf.append('"');
} else if (s.endsWith("\"")) {
/* The argument has already been quoted. */
cmdbuf.append(s);
} else {
/* Unmatched quote for the argument. */
throw new IllegalArgumentException();
}
} else {
cmdbuf.append(s);
}
String cmdstr;
SecurityManager security = System.getSecurityManager();
boolean allowAmbiguousCommands = false;
if (security == null) {
allowAmbiguousCommands = true;
String value = System.getProperty("jdk.lang.Process.allowAmbiguousCommands");
if (value != null)
allowAmbiguousCommands = !"false".equalsIgnoreCase(value);
}
if (allowAmbiguousCommands) {
// Legacy mode.
// Normalize path if possible.
String executablePath = new File(cmd[0]).getPath();
// No worry about internal, unpaired ["], and redirection/piping.
if (needsEscaping(VERIFICATION_LEGACY, executablePath) )
executablePath = quoteString(executablePath);
cmdstr = createCommandLine(
//legacy mode doesn't worry about extended verification
VERIFICATION_LEGACY,
executablePath,
cmd);
} else {
String executablePath;
try {
executablePath = getExecutablePath(cmd[0]);
} catch (IllegalArgumentException e) {
// Workaround for the calls like
// Runtime.getRuntime().exec("\"C:\\Program Files\\foo\" bar")
// No chance to avoid CMD/BAT injection, except to do the work
// right from the beginning. Otherwise we have too many corner
// cases from
// Runtime.getRuntime().exec(String[] cmd [, ...])
// calls with internal ["] and escape sequences.
// Restore original command line.
StringBuilder join = new StringBuilder();
// terminal space in command line is ok
for (String s : cmd)
join.append(s).append(' ');
// Parse the command line again.
cmd = getTokensFromCommand(join.toString());
executablePath = getExecutablePath(cmd[0]);
// Check new executable name once more
if (security != null)
security.checkExec(executablePath);
}
// Quotation protects from interpretation of the [path] argument as
// start of longer path with spaces. Quotation has no influence to
// [.exe] extension heuristic.
cmdstr = createCommandLine(
// We need the extended verification procedure for CMD files.
isShellFile(executablePath)
? VERIFICATION_CMD_BAT
: VERIFICATION_WIN32,
quoteString(executablePath),
cmd);
}
String cmdstr = cmdbuf.toString();
handle = create(cmdstr, envblock, path,
stdHandles, redirectErrorStream);
@ -261,6 +466,7 @@ final class ProcessImpl extends Process {
throw new InterruptedException();
return exitValue();
}
private static void waitForInterruptibly(cli.System.Diagnostics.Process handle) throws InterruptedException {
// to be interruptable we have to use polling
// (on .NET 2.0 WaitForExit is actually interruptible, but this isn't documented)
@ -269,7 +475,53 @@ final class ProcessImpl extends Process {
;
}
@Override
public boolean waitFor(long timeout, TimeUnit unit)
throws InterruptedException
{
if (handle.get_HasExited()) return true;
if (timeout <= 0) return false;
long msTimeout = unit.toMillis(timeout);
waitForTimeoutInterruptibly(handle, msTimeout);
if (Thread.interrupted())
throw new InterruptedException();
return handle.get_HasExited();
}
private static void waitForTimeoutInterruptibly(
cli.System.Diagnostics.Process handle, long timeout) {
long now = System.currentTimeMillis();
long exp = now + timeout;
if (exp < now) {
// if we overflowed, just wait for a really long time
exp = Long.MAX_VALUE;
}
Thread current = Thread.currentThread();
for (;;) {
if (current.isInterrupted()) {
return;
}
// wait for a maximum of 100 ms to be interruptible
if (handle.WaitForExit((int)Math.min(100, exp - now))) {
return;
}
now = System.currentTimeMillis();
if (now >= exp) {
return;
}
}
}
public void destroy() { terminateProcess(handle); }
@Override
public Process destroyForcibly() {
destroy();
return this;
}
private static void terminateProcess(cli.System.Diagnostics.Process handle) {
try {
if (false) throw new cli.System.ComponentModel.Win32Exception();
@ -280,10 +532,21 @@ final class ProcessImpl extends Process {
}
}
@Override
public boolean isAlive() {
return isProcessAlive(handle);
}
private static boolean isProcessAlive(cli.System.Diagnostics.Process handle) {
return !handle.get_HasExited();
}
/**
* Create a process using the win32 function CreateProcess.
* The method is synchronized due to MS kb315939 problem.
* All native handles should restore the inherit flag at the end of call.
*
* @param cmdstr the Windows commandline
* @param cmdstr the Windows command line
* @param envblock NUL-separated, double-NUL-terminated list of
* environment strings in VAR=VALUE form
* @param dir the working directory of the process, or null if
@ -312,7 +575,8 @@ final class ProcessImpl extends Process {
argumentsStart++;
}
ProcessStartInfo si = new ProcessStartInfo(cmdstr.substring(0, programEnd), cmdstr.substring(argumentsStart));
String fileName = cmdstr.substring(0, programEnd);
ProcessStartInfo si = new ProcessStartInfo(mapVfsExecutable(fileName), cmdstr.substring(argumentsStart));
si.set_UseShellExecute(false);
si.set_RedirectStandardError(true);
si.set_RedirectStandardOutput(true);
@ -338,6 +602,27 @@ final class ProcessImpl extends Process {
} catch (cli.System.InvalidOperationException x2) {
throw new IOException(x2.getMessage());
}
// if any of the handles is redirected to/from a file,
// we need to close the files as soon as the process exits
if (stdHandles[0] instanceof FileStream
|| stdHandles[1] instanceof FileStream
|| stdHandles[2] instanceof FileStream) {
final Stream s0 = stdHandles[0];
final Stream s1 = stdHandles[1];
final Stream s2 = stdHandles[2];
proc.set_EnableRaisingEvents(true);
proc.add_Exited(new EventHandler(new EventHandler.Method() {
public void Invoke(Object sender, EventArgs e) {
if (s0 instanceof FileStream)
s0.Close();
if (s1 instanceof FileStream)
s1.Close();
if (s2 instanceof FileStream)
s2.Close();
}
}));
}
Stream stdin = proc.get_StandardInput().get_BaseStream();
Stream stdout = proc.get_StandardOutput().get_BaseStream();

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
7ab53c76bb97c702c39866643a2547962ef3ead6

View File

@ -1 +1 @@
33393ac257cbddfb25bbbbef28c2d70a939dcc57
df6a641f2325337bd9354a4d23537dc48a60d0ee

View File

@ -1,16 +1,42 @@
<?xml version="1.0"?>
<!--
Copyright (C) 2002-2014 Jeroen Frijters
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Jeroen Frijters
jeroen@frijters.net
-->
<project name="ClassLibrary" default="all">
<include buildfile="../ikvm.include" />
<property name="pathsep" value=":" />
<property overwrite="false" name="signoption" value="" />
<property overwrite="false" name="SkipSystemCoreDependency" value="false" />
<property name="OPENJDK_VERSION" value="OpenJDK 7u6 b24" />
<property name="OpenJDK7.dir" value="${project::get-base-directory()}/../../openjdk-7u6-b24" />
<property name="OPENJDK_VERSION" value="OpenJDK 8 b132" />
<property name="IMPLEMENTATION_VERSION" value="1.8.0" />
<property name="SPECIFICATION_VERSION" value="1.8" />
<property name="FULL_VERSION" value="1.8.0-b132" />
<property name="OpenJDK.dir" value="${project::get-base-directory()}/../../openjdk-8-b132" />
<if test="${platform::is-win32()}">
<property name="pathsep" value=";" />
</if>
<target name="all" depends="classes rmi vfs resources core">
<target name="all" depends="classes rmi run-nasgen vfs resources core">
</target>
<target name="version">
@ -26,7 +52,7 @@
<copy file="allsources.lst" tofile="allsources.gen.lst" outputencoding="ascii" overwrite="true">
<filterchain>
<replacetokens>
<token key="OPENJDK7" value="${OpenJDK7.dir}" />
<token key="OPENJDK" value="${OpenJDK.dir}" />
</replacetokens>
</filterchain>
</copy>
@ -70,27 +96,38 @@
</delete>
</target>
<target name="classes" depends="version copyright allsources.gen.lst System.Core">
<target name="clean-classes">
<delete>
<fileset basedir="../classpath">
<include name="**.class"/>
</fileset>
</delete>
<delete>
<fileset basedir="${OpenJDK7.dir}">
<fileset basedir="${OpenJDK.dir}">
<include name="**.class"/>
</fileset>
</delete>
<delete>
<fileset basedir=".">
<include name="**.class"/>
</fileset>
</delete>
</target>
<target name="clean-stubjars">
<delete>
<fileset basedir=".">
<include name="mscorlib.jar" />
<include name="System.jar" />
<include name="System.Core.jar" />
<include name="System.Data.jar" />
<include name="System.Drawing.jar" />
<include name="System.XML.jar" />
</fileset>
</delete>
</target>
<target name="stubjars" depends="clean-stubjars System.Core">
<exec program="${project::get-base-directory()}/../bin/ikvmstub.exe" commandline="-bootstrap mscorlib" useruntimeengine="true" />
<exec program="${project::get-base-directory()}/../bin/ikvmstub.exe" commandline="-bootstrap System" useruntimeengine="true" />
<exec program="${project::get-base-directory()}/../bin/ikvmstub.exe" commandline="-bootstrap System.Core" useruntimeengine="true" unless="${SkipSystemCoreDependency}" />
@ -99,20 +136,33 @@
</if>
<exec program="${project::get-base-directory()}/../bin/ikvmstub.exe" commandline="-bootstrap System.Data" useruntimeengine="true" />
<exec program="${project::get-base-directory()}/../bin/ikvmstub.exe" commandline="-bootstrap System.Drawing" useruntimeengine="true" />
<exec program="${project::get-base-directory()}/../bin/ikvmstub.exe" commandline="-bootstrap System.XML" useruntimeengine="true" />
</target>
<target name="runtime-identity">
<property name="IKVM.Runtime" value="IKVM.Runtime" />
<property name="IKVM.AWT.WinForms" value="IKVM.AWT.WinForms" />
<if test="${signoption != ''}">
<loadfile file="../tools/pubkey.txt" property="publickey" />
<property name="IKVM.Runtime" value="IKVM.Runtime, PublicKey=${publickey}" />
<property name="IKVM.AWT.WinForms" value="IKVM.AWT.WinForms, PublicKey=${publickey}" />
</if>
</target>
<target name="AssemblyInfo.java" depends="runtime-identity version copyright">
<copy file="AssemblyInfo.java.in" tofile="AssemblyInfo.java" outputencoding="ascii" overwrite="true">
<filterchain>
<replacetokens>
<token key="RUNTIME" value="${IKVM.Runtime}" />
<token key="AWTWINFORMS" value="${IKVM.AWT.WinForms}" />
<token key="VERSION" value="${VERSION}" />
<token key="COPYRIGHT" value="${COPYRIGHT}" />
</replacetokens>
</filterchain>
</copy>
</target>
<target name="PropertyConstants.java" depends="version">
<copy file="java/lang/PropertyConstants.java.in" tofile="java/lang/PropertyConstants.java" outputencoding="ascii" overwrite="true">
<filterchain>
<replacetokens>
@ -122,14 +172,28 @@
</replacetokens>
</filterchain>
</copy>
<exec program="javac" commandline="-J-Xmx1536M -implicit:none -g -nowarn -cp dummy -bootclasspath mscorlib.jar${pathsep}System.jar${pathsep}System.Core.jar${pathsep}System.Data.jar${pathsep}System.Drawing.jar${pathsep}../runtime/IKVM.Runtime.jar @allsources.gen.lst" useruntimeengine="false" />
</target>
<target name="classes" depends="clean-classes stubjars allsources.gen.lst AssemblyInfo.java PropertyConstants.java">
<exec program="javac" useruntimeengine="false">
<arg value="-J-Xmx1536M" />
<arg value="-g" />
<arg value="-nowarn" />
<arg value="-implicit:none" />
<arg value="-parameters" />
<arg line="-cp dummy" />
<arg value="-bootclasspath" />
<arg path="mscorlib.jar;System.jar;System.Core.jar;System.Data.jar;System.Drawing.jar;System.XML.jar;../runtime/IKVM.Runtime.jar" />
<arg value="@allsources.gen.lst" />
</exec>
</target>
<target name="rmi">
<property name="VMARGS" value="-J-client -J-Xmx896m -J-Xms128m -J-XX:PermSize=32m -J-XX:MaxPermSize=160m" />
<property name="CLASSPATH" value="${OpenJDK7.dir}/jdk/src/share/classes/${pathsep}${OpenJDK7.dir}/build/linux-amd64/impsrc/${pathsep}." />
<property name="OUTPUT" value="${OpenJDK7.dir}/build/linux-amd64/classes/" />
<property name="ARGS" value="${VMARGS} -bootclasspath ${CLASSPATH} -d ${OUTPUT}" />
<mkdir dir="rmistubs" />
<property name="VMARGS" value="-J-client -J-Xmx896m -J-Xms128m" />
<property name="CLASSPATH" value="mscorlib.jar${pathsep}System.Xml.jar${pathsep}${OpenJDK.dir}/jdk/src/share/classes/${pathsep}${OpenJDK.dir}/corba/src/share/classes" />
<property name="OUTPUT" value="rmistubs" />
<property name="ARGS" value="${VMARGS} -nowarn -bootclasspath ${CLASSPATH} -d ${OUTPUT}" />
<exec program="rmic" commandline="${ARGS} -v1.1 sun.rmi.registry.RegistryImpl" />
<exec program="rmic" commandline="${ARGS} -v1.1 sun.rmi.transport.DGCImpl" />
<exec program="rmic" commandline="${ARGS} -v1.2 sun.rmi.server.Activation$ActivationSystemImpl" />
@ -147,10 +211,30 @@
<exec program="rmic" commandline="${ARGS} -iiop -standardPackage javax.management.remote.rmi.RMIServer" />
</target>
<target name="run-nasgen">
<!-- nasgen doesn't understand the MethodParameters attribute, so we have to recompile the classes it processes without parameters -->
<exec program="javac" useruntimeengine="false">
<arg value="-XDignore.symbol.file" />
<arg value="-g" />
<arg value="-nowarn" />
<arg value="-implicit:none" />
<arg value="-cp" />
<arg path="mscorlib.jar;../runtime/IKVM.Runtime.jar" />
<arg value="${OpenJDK.dir}/nashorn/src/jdk/nashorn/internal/objects/*.java" />
</exec>
<exec program="java" useruntimeengine="false">
<arg line="-cp ${OpenJDK.dir}/nashorn/buildtools/nasgen/src" />
<arg value="jdk.nashorn.internal.tools.nasgen.Main" />
<arg value="${OpenJDK.dir}/nashorn/src" />
<arg value="jdk.nashorn.internal.objects" />
<arg value="${OpenJDK.dir}/nashorn/src" />
</exec>
</target>
<target name="vfs">
<!-- This file is generated here, but it is added as a resource to IKVM.Runtime.dll, because Ref.Emit on .NET 1.1 doesn't support adding a raw resource. -->
<zip zipfile="vfs.zip">
<fileset basedir="${OpenJDK7.dir}/build/linux-amd64/j2re-image">
<fileset basedir="${OpenJDK.dir}/build/linux-x86_64-normal-server-release/jdk">
<include name="lib/calendars.properties" />
<include name="lib/logging.properties" />
<include name="lib/management/management.properties" />
@ -158,7 +242,7 @@
<include name="lib/psfontj2d.properties" />
<include name="lib/sound.properties" />
<include name="lib/cmm/*" />
<include name="lib/zi/**/*" />
<include name="lib/tzdb.dat" />
<include name="lib/currency.data" />
<include name="lib/security/java.policy" />
<include name="lib/security/java.security" />
@ -169,7 +253,7 @@
-->
<include name="lib/security/US_export_policy.jar" />
</fileset>
<fileset basedir="${OpenJDK7.dir}/jdk/src/windows">
<fileset basedir="${OpenJDK.dir}/jdk/src/windows">
<include name="lib/flavormap.properties" />
<include name="lib/content-types.properties" />
</fileset>
@ -177,13 +261,42 @@
</target>
<target name="resources">
<!-- resources that are not in @OPENJDK7@/build/linux-amd64/j2re-image/lib/resources.jar -->
<!-- collect the resources in a zip to make it easier to include them in the right assemblies -->
<zip zipfile="resources.zip">
<fileset basedir="${OpenJDK7.dir}/jdk/src/share/classes">
<fileset basedir="${OpenJDK.dir}/build/linux-x86_64-normal-server-release/jdk/classes">
<include name="com/sun/corba/se/impl/orbutil/resources/*.properties" />
<include name="com/sun/rowset/*.properties" />
<include name="javax/swing/text/html/parser/html32.bdtd" />
<include name="sun/rmi/registry/resources/*.properties" />
<include name="sun/rmi/server/resources/*.properties" />
<include name="sun/text/resources/*IteratorData" />
<include name="sun/text/resources/th/*IteratorData_th" />
<include name="sun/text/resources/th/thai_dict" />
</fileset>
<fileset basedir="${OpenJDK.dir}/corba/src/share/classes">
<include name="**/*.properties" />
</fileset>
<fileset basedir="${OpenJDK.dir}/jdk/src/share/classes">
<include name="**/*.properties" />
<include name="**/*.gif" />
<include name="**/*.png" />
<include name="**/*.wav" />
<include name="com/sun/org/apache/xml/internal/security/resource/config.*" />
<include name="com/sun/swing/internal/plaf/**/*" />
<include name="com/sun/java/swing/plaf/**/*.properties" />
<include name="com/sun/java/swing/plaf/**/*.gif" />
<include name="sun/launcher/resources/*.properties" />
<include name="javax/swing/text/html/default.css" />
<include name="javax/swing/text/rtf/charsets/*.txt" />
<include name="sun/text/resources/**/*.icu" />
</fileset>
<fileset basedir="${OpenJDK.dir}/jaxp/src">
<include name="**/*.properties" />
<include name="**/*.res" />
</fileset>
<fileset basedir="${OpenJDK.dir}/jaxws/src/share/jaf_classes">
<include name="**/*.properties" />
</fileset>
<fileset basedir="${OpenJDK.dir}/jaxws/src/share/jaxws_classes">
<include name="**/*.properties" />
<include name="**/*.xml" />
</fileset>
</zip>
</target>
@ -192,13 +305,35 @@
<copy file="response.txt" tofile="response.gen.txt" outputencoding="ascii" overwrite="true">
<filterchain>
<replacetokens>
<token key="OPENJDK7" value="${OpenJDK7.dir}" />
<token key="OPENJDK" value="${OpenJDK.dir}" />
</replacetokens>
</filterchain>
</copy>
</target>
<target name="core" depends="version response.gen.txt">
<target name="MANIFEST.MF">
<copy file="MANIFEST.MF.in" tofile="MANIFEST.MF" outputencoding="ascii" overwrite="true">
<filterchain>
<replacetokens>
<token key="IMPLEMENTATION_VERSION" value="${IMPLEMENTATION_VERSION}" />
<token key="SPECIFICATION_VERSION" value="${SPECIFICATION_VERSION}" />
</replacetokens>
</filterchain>
</copy>
</target>
<target name="nashorn-version">
<copy file="resources/nashorn/version.properties.in" tofile="resources/nashorn/version.properties" outputencoding="ascii" overwrite="true">
<filterchain>
<replacetokens>
<token key="FULL_VERSION" value="${FULL_VERSION}" />
<token key="IMPLEMENTATION_VERSION" value="${IMPLEMENTATION_VERSION}" />
</replacetokens>
</filterchain>
</copy>
</target>
<target name="core" depends="version response.gen.txt MANIFEST.MF nashorn-version">
<copy file="../bin/IKVM.Runtime.dll" todir="." />
<copy file="../bin/IKVM.AWT.WinForms.dll" todir="." />
<exec program="${project::get-base-directory()}/../bin/ikvmc.exe" useruntimeengine="true">
@ -217,6 +352,8 @@
<arg value="-r:IKVM.Runtime.dll" />
<!-- we already know that the JNI assembly is not available, so suppress the warning -->
<arg value="-nowarn:110" />
<arg value="-w4" />
<arg value="-noparameterreflection" />
<arg value="-warnaserror" />
<arg value="@response.gen.txt" />
</exec>
@ -225,11 +362,14 @@
<exec program="${peverify}" commandline="-nologo IKVM.OpenJDK.Charsets.dll" />
<exec program="${peverify}" commandline="-nologo IKVM.OpenJDK.Corba.dll" />
<exec program="${peverify}" commandline="-nologo IKVM.OpenJDK.Core.dll" />
<exec program="${peverify}" commandline="-nologo IKVM.OpenJDK.Cldrdata.dll" />
<exec program="${peverify}" commandline="-nologo IKVM.OpenJDK.Jdbc.dll" />
<exec program="${peverify}" commandline="-nologo IKVM.OpenJDK.Localedata.dll" />
<exec program="${peverify}" commandline="-nologo IKVM.OpenJDK.Management.dll" />
<exec program="${peverify}" commandline="-nologo IKVM.OpenJDK.Media.dll" />
<exec program="${peverify}" commandline="-nologo IKVM.OpenJDK.Misc.dll" />
<exec program="${peverify}" commandline="-nologo IKVM.OpenJDK.Naming.dll" />
<exec program="${peverify}" commandline="-nologo IKVM.OpenJDK.Nashorn.dll" />
<exec program="${peverify}" commandline="-nologo IKVM.OpenJDK.Remoting.dll" />
<exec program="${peverify}" commandline="-nologo IKVM.OpenJDK.Security.dll" />
<exec program="${peverify}" commandline="-nologo IKVM.OpenJDK.SwingAWT.dll" />
@ -268,7 +408,7 @@
<copy file="tools.rsp" tofile="tools.gen.rsp" outputencoding="ascii" overwrite="true">
<filterchain>
<replacetokens>
<token key="OPENJDK7" value="${OpenJDK7.dir}" />
<token key="OPENJDK" value="${OpenJDK.dir}" />
</replacetokens>
</filterchain>
</copy>
@ -280,6 +420,8 @@
<arg value="-version:${VERSION}" />
<arg value="${signoption}" />
<arg value="-warnaserror" />
<arg value="-w4" />
<arg value="-noparameterreflection" />
<arg value="@tools.gen.rsp" />
</exec>
</target>
@ -300,9 +442,14 @@
<exec program="${project::get-base-directory()}/../bin/ikvmc.exe" useruntimeengine="true">
<arg value="-version:${VERSION}" />
<arg value="-out:../bin/javap.exe" />
<arg value="-main:sun.tools.javap.Main" />
<arg value="-main:com.sun.tools.javap.Main" />
<arg value="-r:../bin/IKVM.OpenJDK.Tools.dll" />
</exec>
<exec program="${project::get-base-directory()}/../bin/ikvmc.exe" useruntimeengine="true">
<arg value="-version:${VERSION}" />
<arg value="-out:../bin/jjs.exe" />
<arg value="-main:jdk.nashorn.tools.Shell" />
</exec>
</target>
</project>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
0371c2e17040377153909ef9f19d553f527c5078

View File

@ -1,40 +0,0 @@
/*
Copyright (C) 2011 Jeroen Frijters
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Jeroen Frijters
jeroen@frijters.net
*/
package sun.management;
import ikvm.internal.NotYetImplementedError;
import java.io.File;
public class FileSystemImpl extends FileSystem
{
public boolean supportsFileSecurity(File f)
{
throw new NotYetImplementedError();
}
public boolean isAccessUserOnly(File f)
{
throw new NotYetImplementedError();
}
}

View File

@ -1,214 +0,0 @@
/*
* Copyright (c) 2003, 2008, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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.
*/
package sun.management;
import ikvm.internal.NotYetImplementedError;
import java.lang.management.GarbageCollectorMXBean;
import java.lang.management.MemoryUsage;
import javax.management.openmbean.OpenType;
import javax.management.openmbean.SimpleType;
import javax.management.openmbean.TabularType;
import javax.management.openmbean.TabularData;
import javax.management.openmbean.TabularDataSupport;
import javax.management.openmbean.CompositeType;
import javax.management.openmbean.CompositeData;
import javax.management.openmbean.CompositeDataSupport;
import javax.management.openmbean.OpenDataException;
import com.sun.management.GcInfo;
/**
* Helper class to build composite data.
*/
public class GcInfoBuilder {
private final GarbageCollectorMXBean gc;
private final String[] poolNames;
private String[] allItemNames;
// GC-specific composite type:
// Each GarbageCollectorMXBean may have different GC-specific attributes
// the CompositeType for the GcInfo could be different.
private CompositeType gcInfoCompositeType;
// GC-specific items
private final int gcExtItemCount;
private final String[] gcExtItemNames;
private final String[] gcExtItemDescs;
private final char[] gcExtItemTypes;
GcInfoBuilder(GarbageCollectorMXBean gc, String[] poolNames) {
this.gc = gc;
this.poolNames = poolNames;
this.gcExtItemCount = getNumGcExtAttributes(gc);
this.gcExtItemNames = new String[gcExtItemCount];
this.gcExtItemDescs = new String[gcExtItemCount];
this.gcExtItemTypes = new char[gcExtItemCount];
// Fill the information about extension attributes
fillGcAttributeInfo(gc, gcExtItemCount, gcExtItemNames,
gcExtItemTypes, gcExtItemDescs);
// lazily build the CompositeType for the GcInfo
// including the GC-specific extension attributes
this.gcInfoCompositeType = null;
}
GcInfo getLastGcInfo() {
MemoryUsage[] usageBeforeGC = new MemoryUsage[poolNames.length];
MemoryUsage[] usageAfterGC = new MemoryUsage[poolNames.length];
Object[] values = new Object[gcExtItemCount];
return getLastGcInfo0(gc, gcExtItemCount, values, gcExtItemTypes,
usageBeforeGC, usageAfterGC);
}
public String[] getPoolNames() {
return poolNames;
}
int getGcExtItemCount() {
return gcExtItemCount;
}
// Returns the CompositeType for the GcInfo including
// the extension attributes
synchronized CompositeType getGcInfoCompositeType() {
if (gcInfoCompositeType != null)
return gcInfoCompositeType;
// First, fill with the attributes in the GcInfo
String[] gcInfoItemNames = GcInfoCompositeData.getBaseGcInfoItemNames();
OpenType[] gcInfoItemTypes = GcInfoCompositeData.getBaseGcInfoItemTypes();
int numGcInfoItems = gcInfoItemNames.length;
int itemCount = numGcInfoItems + gcExtItemCount;
allItemNames = new String[itemCount];
String[] allItemDescs = new String[itemCount];
OpenType[] allItemTypes = new OpenType[itemCount];
System.arraycopy(gcInfoItemNames, 0, allItemNames, 0, numGcInfoItems);
System.arraycopy(gcInfoItemNames, 0, allItemDescs, 0, numGcInfoItems);
System.arraycopy(gcInfoItemTypes, 0, allItemTypes, 0, numGcInfoItems);
// Then fill with the extension GC-specific attributes, if any.
if (gcExtItemCount > 0) {
fillGcAttributeInfo(gc, gcExtItemCount, gcExtItemNames,
gcExtItemTypes, gcExtItemDescs);
System.arraycopy(gcExtItemNames, 0, allItemNames,
numGcInfoItems, gcExtItemCount);
System.arraycopy(gcExtItemDescs, 0, allItemDescs,
numGcInfoItems, gcExtItemCount);
for (int i = numGcInfoItems, j = 0; j < gcExtItemCount; i++, j++) {
switch (gcExtItemTypes[j]) {
case 'Z':
allItemTypes[i] = SimpleType.BOOLEAN;
break;
case 'B':
allItemTypes[i] = SimpleType.BYTE;
break;
case 'C':
allItemTypes[i] = SimpleType.CHARACTER;
break;
case 'S':
allItemTypes[i] = SimpleType.SHORT;
break;
case 'I':
allItemTypes[i] = SimpleType.INTEGER;
break;
case 'J':
allItemTypes[i] = SimpleType.LONG;
break;
case 'F':
allItemTypes[i] = SimpleType.FLOAT;
break;
case 'D':
allItemTypes[i] = SimpleType.DOUBLE;
break;
default:
throw new AssertionError(
"Unsupported type [" + gcExtItemTypes[i] + "]");
}
}
}
CompositeType gict = null;
try {
final String typeName =
"sun.management." + gc.getName() + ".GcInfoCompositeType";
gict = new CompositeType(typeName,
"CompositeType for GC info for " +
gc.getName(),
allItemNames,
allItemDescs,
allItemTypes);
} catch (OpenDataException e) {
// shouldn't reach here
throw Util.newException(e);
}
gcInfoCompositeType = gict;
return gcInfoCompositeType;
}
synchronized String[] getItemNames() {
if (allItemNames == null) {
// initialize when forming the composite type
getGcInfoCompositeType();
}
return allItemNames;
}
// Retrieve information about extension attributes
private /*native*/ int getNumGcExtAttributes(GarbageCollectorMXBean gc){
throw new NotYetImplementedError();
}
private /*native*/ void fillGcAttributeInfo(GarbageCollectorMXBean gc,
int numAttributes,
String[] attributeNames,
char[] types,
String[] descriptions){
throw new NotYetImplementedError();
}
/**
* Returns the last GcInfo
*
* @param gc GarbageCollectorMXBean that the gc info is associated with.
* @param numExtAtts number of extension attributes
* @param extAttValues Values of extension attributes to be filled.
* @param before Memory usage before GC to be filled.
* @param after Memory usage after GC to be filled.
*/
private /*native*/ GcInfo getLastGcInfo0(GarbageCollectorMXBean gc,
int numExtAtts,
Object[] extAttValues,
char[] extAttTypes,
MemoryUsage[] before,
MemoryUsage[] after){
throw new NotYetImplementedError();
}
}

View File

@ -338,7 +338,7 @@ final class NetFileSystemProvider extends AbstractFileSystemProvider
}
}
return FileChannelImpl.open(open(npath.path, mode, rights, share, options), npath.path, read, write, append, null);
return FileChannelImpl.open(open(npath.path, mode, rights, share, options), read, write, append, null);
}
private static FileDescriptor open(String path, int mode, int rights, int share, int options) throws IOException
@ -1104,7 +1104,7 @@ final class NetFileSystemProvider extends AbstractFileSystemProvider
public long size()
{
return info.get_Length();
return info.get_Exists() ? info.get_Length() : 0;
}
public boolean isArchive()
@ -1140,7 +1140,12 @@ final class NetFileSystemProvider extends AbstractFileSystemProvider
if (false) throw new cli.System.ArgumentException();
if (false) throw new cli.System.IO.FileNotFoundException();
if (false) throw new cli.System.IO.IOException();
return new DosFileAttributesImpl(new FileInfo(path));
FileInfo info = new FileInfo(path);
if (!info.get_Exists())
{
throw new NoSuchFileException(path);
}
return new DosFileAttributesImpl(info);
}
catch (cli.System.IO.FileNotFoundException _)
{
@ -1193,6 +1198,10 @@ final class NetFileSystemProvider extends AbstractFileSystemProvider
info.set_Attributes(cli.System.IO.FileAttributes.wrap(info.get_Attributes().Value & ~attr));
}
}
catch (cli.System.IO.FileNotFoundException _)
{
throw new NoSuchFileException(path);
}
catch (cli.System.ArgumentException
| cli.System.IO.IOException x)
{

View File

@ -0,0 +1,224 @@
/*
* Copyright (c) 2003, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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.
*/
package sun.reflect.annotation;
import sun.misc.JavaLangAccess;
import java.lang.annotation.*;
import java.lang.reflect.*;
import java.util.*;
import java.security.AccessController;
import java.security.PrivilegedAction;
/**
* Represents an annotation type at run time. Used to type-check annotations
* and apply member defaults.
*
* @author Josh Bloch
* @since 1.5
*/
public class AnnotationType {
/**
* Member name -> type mapping. Note that primitive types
* are represented by the class objects for the corresponding wrapper
* types. This matches the return value that must be used for a
* dynamic proxy, allowing for a simple isInstance test.
*/
private final Map<String, Class<?>> memberTypes;
/**
* Member name -> default value mapping.
*/
private final Map<String, Object> memberDefaults;
/**
* Member name -> Method object mapping. This (and its assoicated
* accessor) are used only to generate AnnotationTypeMismatchExceptions.
*/
private final Map<String, Method> members;
/**
* The retention policy for this annotation type.
*/
private final RetentionPolicy retention;
/**
* Whether this annotation type is inherited.
*/
private final boolean inherited;
/**
* Returns an AnnotationType instance for the specified annotation type.
*
* @throw IllegalArgumentException if the specified class object for
* does not represent a valid annotation type
*/
public static AnnotationType getInstance(
Class<? extends Annotation> annotationClass)
{
JavaLangAccess jla = sun.misc.SharedSecrets.getJavaLangAccess();
AnnotationType result = jla.getAnnotationType(annotationClass); // volatile read
if (result == null) {
result = new AnnotationType(annotationClass);
// try to CAS the AnnotationType: null -> result
if (!jla.casAnnotationType(annotationClass, null, result)) {
// somebody was quicker -> read it's result
result = jla.getAnnotationType(annotationClass);
assert result != null;
}
}
return result;
}
/**
* Sole constructor.
*
* @param annotationClass the class object for the annotation type
* @throw IllegalArgumentException if the specified class object for
* does not represent a valid annotation type
*/
private AnnotationType(final Class<? extends Annotation> annotationClass) {
if (!annotationClass.isAnnotation())
throw new IllegalArgumentException("Not an annotation type");
Method[] methods =
AccessController.doPrivileged(new PrivilegedAction<Method[]>() {
public Method[] run() {
// Initialize memberTypes and defaultValues
return annotationClass.getDeclaredMethods();
}
});
memberTypes = new HashMap<String,Class<?>>(methods.length+1, 1.0f);
memberDefaults = new HashMap<String, Object>(0);
members = new HashMap<String, Method>(methods.length+1, 1.0f);
for (Method method : methods) {
if (method.getParameterTypes().length != 0)
throw new IllegalArgumentException(method + " has params");
String name = method.getName();
Class<?> type = method.getReturnType();
memberTypes.put(name, invocationHandlerReturnType(type));
members.put(name, method);
Object defaultValue = method.getDefaultValue();
if (defaultValue != null)
memberDefaults.put(name, defaultValue);
}
// Initialize retention, & inherited fields. Special treatment
// of the corresponding annotation types breaks infinite recursion.
if (annotationClass != Retention.class &&
annotationClass != Inherited.class) {
Retention ret = (Retention) annotationClass.getDeclaredAnnotation(Retention.class);
retention = (ret == null ? RetentionPolicy.CLASS : ret.value());
inherited = annotationClass.isAnnotationPresent(Inherited.class);
}
else {
retention = RetentionPolicy.RUNTIME;
inherited = false;
}
}
/**
* Returns the type that must be returned by the invocation handler
* of a dynamic proxy in order to have the dynamic proxy return
* the specified type (which is assumed to be a legal member type
* for an annotation).
*/
public static Class<?> invocationHandlerReturnType(Class<?> type) {
// Translate primitives to wrappers
if (type == byte.class)
return Byte.class;
if (type == char.class)
return Character.class;
if (type == double.class)
return Double.class;
if (type == float.class)
return Float.class;
if (type == int.class)
return Integer.class;
if (type == long.class)
return Long.class;
if (type == short.class)
return Short.class;
if (type == boolean.class)
return Boolean.class;
// Otherwise, just return declared type
return type;
}
/**
* Returns member types for this annotation type
* (member name -> type mapping).
*/
public Map<String, Class<?>> memberTypes() {
return memberTypes;
}
/**
* Returns members of this annotation type
* (member name -> associated Method object mapping).
*/
public Map<String, Method> members() {
return members;
}
/**
* Returns the default values for this annotation type
* (Member name -> default value mapping).
*/
public Map<String, Object> memberDefaults() {
return memberDefaults;
}
/**
* Returns the retention policy for this annotation type.
*/
public RetentionPolicy retention() {
return retention;
}
/**
* Returns true if this this annotation type is inherited.
*/
public boolean isInherited() {
return inherited;
}
/**
* For debugging.
*/
public String toString() {
return "Annotation Type:\n" +
" Member types: " + memberTypes + "\n" +
" Member defaults: " + memberDefaults + "\n" +
" Retention policy: " + retention + "\n" +
" Inherited: " + inherited;
}
}