Imported Upstream version 4.2.1.36

Former-commit-id: fb75898888a02f4d3a74cf0a5b841681bc4c7fa8
This commit is contained in:
Xamarin Public Jenkins
2015-09-24 06:06:07 -04:00
committed by Jo Shields
parent 9668de7cb8
commit dd547c45d4
172 changed files with 6570 additions and 11015 deletions

View File

@ -1 +1 @@
07fd7bd567e5b0ae8b3ae9c32741b56f6f363b0a
b11e668d455d97412eca312477103a8e19b9b2b6

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,85 @@
/*
Copyright (C) 2009-2015 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 java.lang;
import cli.System.Runtime.Serialization.IObjectReference;
import cli.System.Runtime.Serialization.SerializationException;
import cli.System.Runtime.Serialization.StreamingContext;
@cli.System.SerializableAttribute.Annotation
final class ClassSerializationProxy implements IObjectReference
{
private cli.System.Type type;
private String sig;
@cli.System.Security.SecurityCriticalAttribute.Annotation
public Object GetRealObject(StreamingContext context)
{
if (sig != null)
{
if (sig.length() == 1)
{
switch (sig.charAt(0))
{
case 'B':
return Byte.TYPE;
case 'C':
return Character.TYPE;
case 'D':
return Double.TYPE;
case 'F':
return Float.TYPE;
case 'I':
return Integer.TYPE;
case 'J':
return Long.TYPE;
case 'S':
return Short.TYPE;
case 'Z':
return Boolean.TYPE;
case 'V':
return Void.TYPE;
}
}
String className;
if (sig.charAt(0) == 'L')
{
className = sig.substring(1, sig.length() - 1);
}
else
{
className = sig;
}
try
{
return Class.forName(className, false, Thread.currentThread().getContextClassLoader());
}
catch (ClassNotFoundException x)
{
ikvm.runtime.Util.throwException(new SerializationException(x.getMessage(), x));
}
}
return ikvm.runtime.Util.getClassFromTypeHandle(type.get_TypeHandle());
}
}

View File

@ -1 +1 @@
98f7816c72a28907d154c1848447b1fda97ef6ca
de318623b06f63349c8a73909bc6fac4716b99ec

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
* 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
@ -25,24 +25,30 @@
package java.lang;
import java.io.*;
import java.lang.reflect.Executable;
import java.lang.annotation.Annotation;
import java.security.AccessControlContext;
import java.util.Properties;
import java.util.PropertyPermission;
import java.util.StringTokenizer;
import java.util.Map;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.AllPermission;
import java.nio.channels.Channel;
import java.nio.channels.spi.SelectorProvider;
import sun.nio.ch.Interruptible;
import sun.reflect.CallerSensitive;
import sun.reflect.Reflection;
import sun.security.util.SecurityConstants;
import sun.reflect.annotation.AnnotationType;
final class StdIO
{
private StdIO() { }
static InputStream in = new BufferedInputStream(new FileInputStream(FileDescriptor.in));
static PrintStream out = new PrintStream(new BufferedOutputStream(new FileOutputStream(FileDescriptor.out), 128), true);
static PrintStream err = new PrintStream(new BufferedOutputStream(new FileOutputStream(FileDescriptor.err), 128), true);
static PrintStream out = System.newPrintStream(new FileOutputStream(FileDescriptor.out), Props.props.getProperty("sun.stdout.encoding"));
static PrintStream err = System.newPrintStream(new FileOutputStream(FileDescriptor.err), Props.props.getProperty("sun.stderr.encoding"));
}
final class Props
@ -85,6 +91,18 @@ final class Props
*/
public final class System {
/* register the natives via the static initializer.
*
* VM will invoke the initializeSystemClass method to complete
* the initialization for this class separated from clinit.
* Note that to use properties set by the VM, see the constraints
* described in the initializeSystemClass method.
*/
private static native void registerNatives();
static {
//registerNatives();
}
/** Don't let anyone instantiate this class */
private System() {
}
@ -96,10 +114,8 @@ public final class System {
* the host environment or user.
*/
@ikvm.lang.Property(get="get_in")
public final static InputStream in;
static { in = null; }
public final static InputStream in = null;
private static InputStream get_in()
{
return StdIO.in;
@ -131,10 +147,8 @@ public final class System {
* @see java.io.PrintStream#println(java.lang.String)
*/
@ikvm.lang.Property(get="get_out")
public final static PrintStream out;
static { out = null; }
public final static PrintStream out = null;
private static PrintStream get_out()
{
return StdIO.out;
@ -153,9 +167,7 @@ public final class System {
* destination that is typically not continuously monitored.
*/
@ikvm.lang.Property(get="get_err")
public final static PrintStream err;
static { err = null ; }
public final static PrintStream err = null;
private static PrintStream get_err()
{
@ -164,7 +176,7 @@ public final class System {
/* The security manager for the system.
*/
private static volatile SecurityManager security;
private static volatile SecurityManager security = null;
/**
* Reassigns the "standard" input stream.
@ -188,7 +200,7 @@ public final class System {
*/
public static void setIn(InputStream in) {
checkIO();
StdIO.in = in;
setIn0(in);
}
/**
@ -212,7 +224,7 @@ public final class System {
*/
public static void setOut(PrintStream out) {
checkIO();
StdIO.out = out;
setOut0(out);
}
/**
@ -236,10 +248,10 @@ public final class System {
*/
public static void setErr(PrintStream err) {
checkIO();
StdIO.err = err;
setErr0(err);
}
private static volatile Console cons;
private static volatile Console cons = null;
/**
* Returns the unique {@link java.io.Console Console} object associated
* with the current Java virtual machine, if any.
@ -293,6 +305,10 @@ public final class System {
}
}
private static native void setIn0(InputStream in);
private static native void setOut0(PrintStream out);
private static native void setErr0(PrintStream err);
/**
* Sets the System security.
*
@ -576,7 +592,12 @@ public final class System {
* </dl>
*/
//private static native Properties initProperties(Properties props);
@ikvm.lang.Property(get="get_props", set="set_props")
private static Properties props;
private static native Properties initProperties(Properties props);
private static Properties get_props() { return Props.props; }
private static void set_props(Properties value) { Props.props = value; }
/**
* Determines the current system properties.
@ -597,7 +618,7 @@ public final class System {
* <tr><td><code>java.version</code></td>
* <td>Java Runtime Environment version</td></tr>
* <tr><td><code>java.vendor</code></td>
* <td>Java Runtime Environment vendor</td></tr
* <td>Java Runtime Environment vendor</td></tr>
* <tr><td><code>java.vendor.url</code></td>
* <td>Java vendor URL</td></tr>
* <tr><td><code>java.home</code></td>
@ -631,7 +652,10 @@ public final class System {
* <tr><td><code>java.compiler</code></td>
* <td>Name of JIT compiler to use</td></tr>
* <tr><td><code>java.ext.dirs</code></td>
* <td>Path of extension directory or directories</td></tr>
* <td>Path of extension directory or directories
* <b>Deprecated.</b> <i>This property, and the mechanism
* which implements it, may be removed in a future
* release.</i> </td></tr>
* <tr><td><code>os.name</code></td>
* <td>Operating system name</td></tr>
* <tr><td><code>os.arch</code></td>
@ -674,7 +698,7 @@ public final class System {
sm.checkPropertiesAccess();
}
return Props.props;
return props;
}
/**
@ -684,11 +708,20 @@ public final class System {
*
* <p>On UNIX systems, it returns {@code "\n"}; on Microsoft
* Windows systems it returns {@code "\r\n"}.
*
* @return the system-dependent line separator string
* @since 1.7
*/
public static String lineSeparator() {
return Props.lineSeparator;
return lineSeparator;
}
@ikvm.lang.Property(get="get_lineSeparator", set="set_lineSeparator")
private static String lineSeparator;
private static String get_lineSeparator() { return Props.lineSeparator; }
private static void set_lineSeparator(String value) { Props.lineSeparator = value; }
/**
* Sets the system properties to the <code>Properties</code>
* argument.
@ -718,9 +751,9 @@ public final class System {
}
if (props == null) {
props = new Properties();
VMSystemProperties.initProperties(props);
initProperties(props);
}
Props.props = props;
System.props = props;
}
/**
@ -756,7 +789,7 @@ public final class System {
sm.checkPropertyAccess(key);
}
return Props.props.getProperty(key);
return props.getProperty(key);
}
/**
@ -792,7 +825,7 @@ public final class System {
sm.checkPropertyAccess(key);
}
return Props.props.getProperty(key, def);
return props.getProperty(key, def);
}
/**
@ -832,7 +865,7 @@ public final class System {
SecurityConstants.PROPERTY_WRITE_ACTION));
}
return (String) Props.props.setProperty(key, value);
return (String) props.setProperty(key, value);
}
/**
@ -869,7 +902,7 @@ public final class System {
sm.checkPermission(new PropertyPermission(key, "write"));
}
return (String) Props.props.remove(key);
return (String) props.remove(key);
}
private static void checkKey(String key) {
@ -1081,13 +1114,25 @@ public final class System {
*/
@Deprecated
public static void runFinalizersOnExit(boolean value) {
Runtime.getRuntime().runFinalizersOnExit(value);
Runtime.runFinalizersOnExit(value);
}
/**
* Loads a code file with the specified filename from the local file
* system as a dynamic library. The filename
* argument must be a complete path name.
* Loads the native library specified by the filename argument. The filename
* argument must be an absolute path name.
*
* If the filename argument, when stripped of any platform-specific library
* prefix, path, and file extension, indicates a library whose name is,
* for example, L, and a native library called L is statically linked
* with the VM, then the JNI_OnLoad_L function exported by the library
* is invoked rather than attempting to load a dynamic library.
* A filename matching the argument does not have to exist in the
* file system.
* See the JNI Specification for more details.
*
* Otherwise, the filename argument is mapped to a native library image in
* an implementation-dependent manner.
*
* <p>
* The call <code>System.load(name)</code> is effectively equivalent
* to the call:
@ -1099,7 +1144,10 @@ public final class System {
* @exception SecurityException if a security manager exists and its
* <code>checkLink</code> method doesn't allow
* loading of the specified dynamic library
* @exception UnsatisfiedLinkError if the file does not exist.
* @exception UnsatisfiedLinkError if either the filename is not an
* absolute path name, the native library is not statically
* linked with the VM, or the library cannot be mapped to
* a native library image by the host system.
* @exception NullPointerException if <code>filename</code> is
* <code>null</code>
* @see java.lang.Runtime#load(java.lang.String)
@ -1111,9 +1159,16 @@ public final class System {
}
/**
* Loads the system library specified by the <code>libname</code>
* argument. The manner in which a library name is mapped to the
* actual system library is system dependent.
* Loads the native library specified by the <code>libname</code>
* argument. The <code>libname</code> argument must not contain any platform
* specific prefix, file extension or path. If a native library
* called <code>libname</code> is statically linked with the VM, then the
* JNI_OnLoad_<code>libname</code> function exported by the library is invoked.
* See the JNI Specification for more details.
*
* Otherwise, the libname argument is loaded from a system library
* location and mapped to a native library image in an implementation-
* dependent manner.
* <p>
* The call <code>System.loadLibrary(name)</code> is effectively
* equivalent to the call
@ -1125,7 +1180,10 @@ public final class System {
* @exception SecurityException if a security manager exists and its
* <code>checkLink</code> method doesn't allow
* loading of the specified dynamic library
* @exception UnsatisfiedLinkError if the library does not exist.
* @exception UnsatisfiedLinkError if either the libname argument
* contains a file path, the native library is not statically
* linked with the VM, or the library cannot be mapped to a
* native library image by the host system.
* @exception NullPointerException if <code>libname</code> is
* <code>null</code>
* @see java.lang.Runtime#loadLibrary(java.lang.String)
@ -1148,21 +1206,17 @@ public final class System {
* @see java.lang.ClassLoader#findLibrary(java.lang.String)
* @since 1.2
*/
public static String mapLibraryName(String libname) {
if (libname == null) {
throw new NullPointerException();
public static native String mapLibraryName(String libname);
/**
* Create PrintStream for stdout/err based on encoding.
*/
/*private*/ static PrintStream newPrintStream(FileOutputStream fos, String enc) {
if (enc != null) {
try {
return new PrintStream(new BufferedOutputStream(fos, 128), true, enc);
} catch (UnsupportedEncodingException uee) {}
}
if (ikvm.internal.Util.WINDOWS) {
return libname + ".dll";
} else if (ikvm.internal.Util.MACOSX) {
return "lib" + libname + ".jnilib";
} else {
return "lib" + libname + ".so";
}
}
/* returns the class of the caller. */
static Class<?> getCallerClass() {
// NOTE use of more generic Reflection.getCallerClass()
return Reflection.getCallerClass(3);
return new PrintStream(new BufferedOutputStream(fos, 128), true);
}
}

View File

@ -1 +1 @@
0ed6057830f61276302f31aec193002ca38ab39a
1341a0148621a18e4c88e2815a5d0e8f837fa015

View File

@ -1,5 +1,5 @@
/*
Copyright (C) 2004-2011 Jeroen Frijters
Copyright (C) 2004-2015 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,6 +24,7 @@
package java.lang;
import java.util.Properties;
import cli.System.Diagnostics.FileVersionInfo;
import static ikvm.internal.Util.SafeGetEnvironmentVariable;
final class VMSystemProperties
@ -31,7 +32,7 @@ final class VMSystemProperties
private VMSystemProperties() { }
public static final String SPEC_TITLE = "Java Platform API Specification";
public static final String SPEC_VERSION = "1.7";
public static final String SPEC_VERSION = "1.8";
public static final String SPEC_VENDOR = "Oracle Corporation";
private static String getLibraryPath()
@ -114,11 +115,11 @@ final class VMSystemProperties
private static void initCommonProperties(Properties p)
{
p.setProperty("java.version", "1.7.0");
p.setProperty("java.version", "1.8.0");
p.setProperty("java.vendor", "Jeroen Frijters");
p.setProperty("java.vendor.url", "http://ikvm.net/");
p.setProperty("java.vendor.url.bug", "http://www.ikvm.net/bugs");
p.setProperty("java.vm.specification.version", "1.7");
p.setProperty("java.vm.specification.version", "1.8");
p.setProperty("java.vm.specification.vendor", "Oracle Corporation");
p.setProperty("java.vm.specification.name", "Java Virtual Machine Specification");
p.setProperty("java.vm.version", PropertyConstants.java_vm_version);
@ -129,7 +130,7 @@ final class VMSystemProperties
p.setProperty("java.specification.version", SPEC_VERSION);
p.setProperty("java.specification.vendor", SPEC_VENDOR);
p.setProperty("java.specification.name", SPEC_TITLE);
p.setProperty("java.class.version", "51.0");
p.setProperty("java.class.version", "52.0");
p.setProperty("java.class.path", "");
p.setProperty("java.library.path", getLibraryPath());
try
@ -152,6 +153,13 @@ final class VMSystemProperties
switch(os.get_Platform().Value)
{
case cli.System.PlatformID.Win32NT:
// Windows lies about the version, so we extract the real version from kernel32.dll
FileVersionInfo kernel32 = getKernel32FileVersionInfo();
if (kernel32 != null)
{
major = kernel32.get_ProductMajorPart();
minor = kernel32.get_ProductMinorPart();
}
osname = "Windows NT (unknown)";
switch(major)
{
@ -189,6 +197,23 @@ final class VMSystemProperties
osver = "6.1";
osname = "Windows 7";
break;
case 2:
osver = "6.2";
osname = "Windows 8";
break;
case 3:
osver = "6.3";
osname = "Windows 8.1";
break;
}
break;
case 10:
switch(minor)
{
case 0:
osver = "10.0";
osname = "Windows 10";
break;
}
break;
}
@ -322,12 +347,32 @@ final class VMSystemProperties
p.setProperty("sun.nio.MaxDirectMemorySize", "-1");
p.setProperty("java.awt.graphicsenv", PropertyConstants.java_awt_graphicsenv);
p.setProperty("java.awt.printerjob", "sun.awt.windows.WPrinterJob");
String stdoutEncoding = getStdoutEncoding();
if(stdoutEncoding != null)
{
p.setProperty("sun.stdout.encoding", stdoutEncoding);
}
String stderrEncoding = getStderrEncoding();
if(stderrEncoding != null)
{
p.setProperty("sun.stderr.encoding", stderrEncoding);
}
if(ikvm.internal.Util.MACOSX)
{
p.setProperty("sun.jnu.encoding", "UTF-8");
}
else
{
p.setProperty("sun.jnu.encoding", cli.System.Text.Encoding.get_Default().get_WebName());
}
// TODO
// sun.cpu.isalist:=pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86
// sun.desktop:=windows
// sun.io.unicode.encoding:=UnicodeLittle
// sun.jnu.encoding:=Cp1252
// sun.management.compiler:=HotSpot Client Compiler
try
{
@ -418,4 +463,7 @@ final class VMSystemProperties
private static native String getVirtualFileSystemRoot();
private static native String getBootClassPath();
private static native String getStdoutEncoding();
private static native String getStderrEncoding();
private static native FileVersionInfo getKernel32FileVersionInfo();
}

View File

@ -0,0 +1,47 @@
/*
Copyright (C) 2015 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 java.lang.invoke;
/*
* This class represents a MethodHandle to an IKVM specific LambdaForm.
*/
final class LightWeightMethodHandle extends MethodHandle
{
LightWeightMethodHandle(MethodType type, LambdaForm form)
{
super(type, form);
}
@Override
BoundMethodHandle rebind()
{
return BoundMethodHandle.makeReinvoker(this);
}
@Override
MethodHandle copyWith(MethodType type, LambdaForm form)
{
return new LightWeightMethodHandle(type, form);
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 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
@ -34,8 +34,11 @@ import sun.reflect.generics.factory.GenericsFactory;
import sun.reflect.generics.scope.ClassScope;
import java.lang.annotation.Annotation;
import java.util.Map;
import java.util.Objects;
import sun.reflect.annotation.AnnotationParser;
import sun.reflect.annotation.AnnotationSupport;
import sun.reflect.annotation.TypeAnnotation;
import sun.reflect.annotation.TypeAnnotationParser;
/**
* A {@code Field} provides information about, and dynamic access to, a
@ -77,6 +80,9 @@ class Field extends AccessibleObject implements Member {
// For sharing of FieldAccessors. This branching structure is
// currently only two levels deep (i.e., one root Field and
// potentially many Field objects pointing to it.)
//
// If this branching structure would ever contain cycles, deadlocks can
// occur in annotation code.
private Field root;
// Generics infrastructure
@ -136,11 +142,15 @@ class Field extends AccessibleObject implements Member {
// which implicitly requires that new java.lang.reflect
// objects be fabricated for each reflective call on Class
// objects.)
if (this.root != null)
throw new IllegalArgumentException("Can not copy a non-root Field");
Field res = new Field(clazz, name, type, modifiers, slot, signature, null);
res.root = this;
// Might as well eagerly propagate this if already present
res.fieldAccessor = fieldAccessor;
res.overrideFieldAccessor = overrideFieldAccessor;
return res;
}
@ -280,12 +290,15 @@ class Field extends AccessibleObject implements Member {
* {@code protected} or {@code private} first, and then other
* modifiers in the following order: {@code static}, {@code final},
* {@code transient}, {@code volatile}.
*
* @return a string describing this {@code Field}
* @jls 8.3.1 Field Modifiers
*/
public String toString() {
int mod = getModifiers();
return (((mod == 0) ? "" : (Modifier.toString(mod) + " "))
+ getTypeName(getType()) + " "
+ getTypeName(getDeclaringClass()) + "."
+ getType().getTypeName() + " "
+ getDeclaringClass().getTypeName() + "."
+ getName());
}
@ -307,14 +320,14 @@ class Field extends AccessibleObject implements Member {
* its generic type
*
* @since 1.5
* @jls 8.3.1 Field Modifiers
*/
public String toGenericString() {
int mod = getModifiers();
Type fieldType = getGenericType();
return (((mod == 0) ? "" : (Modifier.toString(mod) + " "))
+ ((fieldType instanceof Class) ?
getTypeName((Class)fieldType): fieldType.toString())+ " "
+ getTypeName(getDeclaringClass()) + "."
+ fieldType.getTypeName() + " "
+ getDeclaringClass().getTypeName() + "."
+ getName());
}
@ -371,7 +384,8 @@ class Field extends AccessibleObject implements Member {
{
if (!override) {
if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
checkAccess(Reflection.getCallerClass(), clazz, obj, modifiers);
Class<?> caller = Reflection.getCallerClass();
checkAccess(caller, clazz, obj, modifiers);
}
}
return getFieldAccessor(obj).get(obj);
@ -405,7 +419,8 @@ class Field extends AccessibleObject implements Member {
{
if (!override) {
if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
checkAccess(Reflection.getCallerClass(), clazz, obj, modifiers);
Class<?> caller = Reflection.getCallerClass();
checkAccess(caller, clazz, obj, modifiers);
}
}
return getFieldAccessor(obj).getBoolean(obj);
@ -439,7 +454,8 @@ class Field extends AccessibleObject implements Member {
{
if (!override) {
if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
checkAccess(Reflection.getCallerClass(), clazz, obj, modifiers);
Class<?> caller = Reflection.getCallerClass();
checkAccess(caller, clazz, obj, modifiers);
}
}
return getFieldAccessor(obj).getByte(obj);
@ -475,7 +491,8 @@ class Field extends AccessibleObject implements Member {
{
if (!override) {
if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
checkAccess(Reflection.getCallerClass(), clazz, obj, modifiers);
Class<?> caller = Reflection.getCallerClass();
checkAccess(caller, clazz, obj, modifiers);
}
}
return getFieldAccessor(obj).getChar(obj);
@ -511,7 +528,8 @@ class Field extends AccessibleObject implements Member {
{
if (!override) {
if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
checkAccess(Reflection.getCallerClass(), clazz, obj, modifiers);
Class<?> caller = Reflection.getCallerClass();
checkAccess(caller, clazz, obj, modifiers);
}
}
return getFieldAccessor(obj).getShort(obj);
@ -547,7 +565,8 @@ class Field extends AccessibleObject implements Member {
{
if (!override) {
if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
checkAccess(Reflection.getCallerClass(), clazz, obj, modifiers);
Class<?> caller = Reflection.getCallerClass();
checkAccess(caller, clazz, obj, modifiers);
}
}
return getFieldAccessor(obj).getInt(obj);
@ -583,7 +602,8 @@ class Field extends AccessibleObject implements Member {
{
if (!override) {
if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
checkAccess(Reflection.getCallerClass(), clazz, obj, modifiers);
Class<?> caller = Reflection.getCallerClass();
checkAccess(caller, clazz, obj, modifiers);
}
}
return getFieldAccessor(obj).getLong(obj);
@ -619,7 +639,8 @@ class Field extends AccessibleObject implements Member {
{
if (!override) {
if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
checkAccess(Reflection.getCallerClass(), clazz, obj, modifiers);
Class<?> caller = Reflection.getCallerClass();
checkAccess(caller, clazz, obj, modifiers);
}
}
return getFieldAccessor(obj).getFloat(obj);
@ -655,7 +676,8 @@ class Field extends AccessibleObject implements Member {
{
if (!override) {
if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
checkAccess(Reflection.getCallerClass(), clazz, obj, modifiers);
Class<?> caller = Reflection.getCallerClass();
checkAccess(caller, clazz, obj, modifiers);
}
}
return getFieldAccessor(obj).getDouble(obj);
@ -733,7 +755,8 @@ class Field extends AccessibleObject implements Member {
{
if (!override) {
if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
checkAccess(Reflection.getCallerClass(), clazz, obj, modifiers);
Class<?> caller = Reflection.getCallerClass();
checkAccess(caller, clazz, obj, modifiers);
}
}
getFieldAccessor(obj).set(obj, value);
@ -769,7 +792,8 @@ class Field extends AccessibleObject implements Member {
{
if (!override) {
if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
checkAccess(Reflection.getCallerClass(), clazz, obj, modifiers);
Class<?> caller = Reflection.getCallerClass();
checkAccess(caller, clazz, obj, modifiers);
}
}
getFieldAccessor(obj).setBoolean(obj, z);
@ -805,7 +829,8 @@ class Field extends AccessibleObject implements Member {
{
if (!override) {
if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
checkAccess(Reflection.getCallerClass(), clazz, obj, modifiers);
Class<?> caller = Reflection.getCallerClass();
checkAccess(caller, clazz, obj, modifiers);
}
}
getFieldAccessor(obj).setByte(obj, b);
@ -841,7 +866,8 @@ class Field extends AccessibleObject implements Member {
{
if (!override) {
if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
checkAccess(Reflection.getCallerClass(), clazz, obj, modifiers);
Class<?> caller = Reflection.getCallerClass();
checkAccess(caller, clazz, obj, modifiers);
}
}
getFieldAccessor(obj).setChar(obj, c);
@ -877,7 +903,8 @@ class Field extends AccessibleObject implements Member {
{
if (!override) {
if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
checkAccess(Reflection.getCallerClass(), clazz, obj, modifiers);
Class<?> caller = Reflection.getCallerClass();
checkAccess(caller, clazz, obj, modifiers);
}
}
getFieldAccessor(obj).setShort(obj, s);
@ -913,7 +940,8 @@ class Field extends AccessibleObject implements Member {
{
if (!override) {
if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
checkAccess(Reflection.getCallerClass(), clazz, obj, modifiers);
Class<?> caller = Reflection.getCallerClass();
checkAccess(caller, clazz, obj, modifiers);
}
}
getFieldAccessor(obj).setInt(obj, i);
@ -949,7 +977,8 @@ class Field extends AccessibleObject implements Member {
{
if (!override) {
if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
checkAccess(Reflection.getCallerClass(), clazz, obj, modifiers);
Class<?> caller = Reflection.getCallerClass();
checkAccess(caller, clazz, obj, modifiers);
}
}
getFieldAccessor(obj).setLong(obj, l);
@ -985,7 +1014,8 @@ class Field extends AccessibleObject implements Member {
{
if (!override) {
if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
checkAccess(Reflection.getCallerClass(), clazz, obj, modifiers);
Class<?> caller = Reflection.getCallerClass();
checkAccess(caller, clazz, obj, modifiers);
}
}
getFieldAccessor(obj).setFloat(obj, f);
@ -1021,7 +1051,8 @@ class Field extends AccessibleObject implements Member {
{
if (!override) {
if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
checkAccess(Reflection.getCallerClass(), clazz, obj, modifiers);
Class<?> caller = Reflection.getCallerClass();
checkAccess(caller, clazz, obj, modifiers);
}
}
getFieldAccessor(obj).setDouble(obj, d);
@ -1078,57 +1109,66 @@ class Field extends AccessibleObject implements Member {
}
}
/*
* Utility routine to paper over array type names
*/
static String getTypeName(Class<?> type) {
if (type.isArray()) {
try {
Class<?> cl = type;
int dimensions = 0;
while (cl.isArray()) {
dimensions++;
cl = cl.getComponentType();
}
StringBuffer sb = new StringBuffer();
sb.append(cl.getName());
for (int i = 0; i < dimensions; i++) {
sb.append("[]");
}
return sb.toString();
} catch (Throwable e) { /*FALLTHRU*/ }
}
return type.getName();
}
/**
* @throws NullPointerException {@inheritDoc}
* @since 1.5
*/
public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
if (annotationClass == null)
throw new NullPointerException();
return (T) declaredAnnotations().get(annotationClass);
Objects.requireNonNull(annotationClass);
return annotationClass.cast(declaredAnnotations().get(annotationClass));
}
private static final Annotation[] EMPTY_ANNOTATION_ARRAY=new Annotation[0];
/**
* {@inheritDoc}
* @throws NullPointerException {@inheritDoc}
* @since 1.8
*/
@Override
public <T extends Annotation> T[] getAnnotationsByType(Class<T> annotationClass) {
Objects.requireNonNull(annotationClass);
return AnnotationSupport.getDirectlyAndIndirectlyPresent(declaredAnnotations(), annotationClass);
}
/**
* @since 1.5
* {@inheritDoc}
*/
public Annotation[] getDeclaredAnnotations() {
return declaredAnnotations().values().toArray(EMPTY_ANNOTATION_ARRAY);
return AnnotationParser.toArray(declaredAnnotations());
}
private transient Map<Class<? extends Annotation>, Annotation> declaredAnnotations;
private synchronized Map<Class<? extends Annotation>, Annotation> declaredAnnotations() {
if (declaredAnnotations == null) {
declaredAnnotations = getDeclaredAnnotationsImpl();
Field root = this.root;
if (root != null) {
declaredAnnotations = root.declaredAnnotations();
} else {
declaredAnnotations = getDeclaredAnnotationsImpl();
}
}
return declaredAnnotations;
}
private native Map<Class<? extends Annotation>, Annotation> getDeclaredAnnotationsImpl();
private native byte[] getTypeAnnotationBytes0();
/**
* Returns an AnnotatedType object that represents the use of a type to specify
* the declared type of the field represented by this Field.
* @return an object representing the declared type of the field
* represented by this Field
*
* @since 1.8
*/
public AnnotatedType getAnnotatedType() {
return TypeAnnotationParser.buildAnnotatedType(getTypeAnnotationBytes0(),
sun.misc.SharedSecrets.getJavaLangAccess().
getConstantPool(getDeclaringClass()),
this,
getDeclaringClass(),
getGenericType(),
TypeAnnotation.TypeAnnotationTarget.FIELD);
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff