You've already forked linux-packaging-mono
Imported Upstream version 4.2.1.36
Former-commit-id: fb75898888a02f4d3a74cf0a5b841681bc4c7fa8
This commit is contained in:
committed by
Jo Shields
parent
9668de7cb8
commit
dd547c45d4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 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
|
||||
@@ -32,12 +32,14 @@
|
||||
package sun.reflect;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Executable;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.security.AccessController;
|
||||
import java.security.Permission;
|
||||
import java.security.PrivilegedAction;
|
||||
import sun.reflect.misc.ReflectUtil;
|
||||
|
||||
/** <P> The master factory for all reflective objects, both those in
|
||||
java.lang.reflect (Fields, Methods, Constructors) as well as their
|
||||
@@ -53,9 +55,9 @@ import java.security.PrivilegedAction;
|
||||
|
||||
public class ReflectionFactory {
|
||||
|
||||
private static Permission reflectionFactoryAccessPerm
|
||||
private static final Permission reflectionFactoryAccessPerm
|
||||
= new RuntimePermission("reflectionFactoryAccess");
|
||||
private static ReflectionFactory soleInstance = new ReflectionFactory();
|
||||
private static final ReflectionFactory soleInstance = new ReflectionFactory();
|
||||
// Provides access to package-private mechanisms in java.lang.reflect
|
||||
private static volatile LangReflectAccess langReflectAccess;
|
||||
|
||||
@@ -129,7 +131,7 @@ public class ReflectionFactory {
|
||||
|
||||
private native ConstructorAccessor newConstructorAccessor0(Constructor c);
|
||||
|
||||
public ConstructorAccessor newConstructorAccessor(Constructor c) {
|
||||
public ConstructorAccessor newConstructorAccessor(Constructor<?> c) {
|
||||
Class<?> declaringClass = c.getDeclaringClass();
|
||||
if (Modifier.isAbstract(declaringClass.getModifiers())) {
|
||||
return new InstantiationExceptionConstructorAccessorImpl(null);
|
||||
@@ -195,14 +197,14 @@ public class ReflectionFactory {
|
||||
|
||||
/** Creates a new java.lang.reflect.Constructor. Access checks as
|
||||
per java.lang.reflect.AccessibleObject are not overridden. */
|
||||
public Constructor newConstructor(Class<?> declaringClass,
|
||||
Class<?>[] parameterTypes,
|
||||
Class<?>[] checkedExceptions,
|
||||
int modifiers,
|
||||
int slot,
|
||||
String signature,
|
||||
byte[] annotations,
|
||||
byte[] parameterAnnotations)
|
||||
public Constructor<?> newConstructor(Class<?> declaringClass,
|
||||
Class<?>[] parameterTypes,
|
||||
Class<?>[] checkedExceptions,
|
||||
int modifiers,
|
||||
int slot,
|
||||
String signature,
|
||||
byte[] annotations,
|
||||
byte[] parameterAnnotations)
|
||||
{
|
||||
return langReflectAccess().newConstructor(declaringClass,
|
||||
parameterTypes,
|
||||
@@ -226,13 +228,13 @@ public class ReflectionFactory {
|
||||
|
||||
/** Gets the ConstructorAccessor object for a
|
||||
java.lang.reflect.Constructor */
|
||||
public ConstructorAccessor getConstructorAccessor(Constructor c) {
|
||||
public ConstructorAccessor getConstructorAccessor(Constructor<?> c) {
|
||||
return langReflectAccess().getConstructorAccessor(c);
|
||||
}
|
||||
|
||||
/** Sets the ConstructorAccessor object for a
|
||||
java.lang.reflect.Constructor */
|
||||
public void setConstructorAccessor(Constructor c,
|
||||
public void setConstructorAccessor(Constructor<?> c,
|
||||
ConstructorAccessor accessor)
|
||||
{
|
||||
langReflectAccess().setConstructorAccessor(c, accessor);
|
||||
@@ -259,6 +261,12 @@ public class ReflectionFactory {
|
||||
return langReflectAccess().copyConstructor(arg);
|
||||
}
|
||||
|
||||
/** Gets the byte[] that encodes TypeAnnotations on an executable.
|
||||
*/
|
||||
public byte[] getExecutableTypeAnnotationBytes(Executable ex) {
|
||||
return langReflectAccess().getExecutableTypeAnnotationBytes(ex);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
// Routines used by serialization
|
||||
@@ -267,8 +275,8 @@ public class ReflectionFactory {
|
||||
|
||||
private static native ConstructorAccessor newConstructorAccessorForSerialization(Class classToInstantiate, Constructor constructorToCall);
|
||||
|
||||
public Constructor newConstructorForSerialization
|
||||
(Class<?> classToInstantiate, Constructor constructorToCall)
|
||||
public Constructor<?> newConstructorForSerialization
|
||||
(Class<?> classToInstantiate, Constructor<?> constructorToCall)
|
||||
{
|
||||
// Fast path
|
||||
if (constructorToCall.getDeclaringClass() == classToInstantiate) {
|
||||
@@ -276,18 +284,18 @@ public class ReflectionFactory {
|
||||
}
|
||||
|
||||
ConstructorAccessor acc = newConstructorAccessorForSerialization(classToInstantiate, constructorToCall);
|
||||
Constructor c = newConstructor(constructorToCall.getDeclaringClass(),
|
||||
constructorToCall.getParameterTypes(),
|
||||
constructorToCall.getExceptionTypes(),
|
||||
constructorToCall.getModifiers(),
|
||||
langReflectAccess().
|
||||
getConstructorSlot(constructorToCall),
|
||||
langReflectAccess().
|
||||
getConstructorSignature(constructorToCall),
|
||||
langReflectAccess().
|
||||
getConstructorAnnotations(constructorToCall),
|
||||
langReflectAccess().
|
||||
getConstructorParameterAnnotations(constructorToCall));
|
||||
Constructor<?> c = newConstructor(constructorToCall.getDeclaringClass(),
|
||||
constructorToCall.getParameterTypes(),
|
||||
constructorToCall.getExceptionTypes(),
|
||||
constructorToCall.getModifiers(),
|
||||
langReflectAccess().
|
||||
getConstructorSlot(constructorToCall),
|
||||
langReflectAccess().
|
||||
getConstructorSignature(constructorToCall),
|
||||
langReflectAccess().
|
||||
getConstructorAnnotations(constructorToCall),
|
||||
langReflectAccess().
|
||||
getConstructorParameterAnnotations(constructorToCall));
|
||||
setConstructorAccessor(c, acc);
|
||||
return c;
|
||||
}
|
||||
|
Reference in New Issue
Block a user