Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
552b1a32
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
552b1a32
编写于
8月 15, 2011
作者:
J
jjg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7077389: Reflection classes do not build with javac -Xlint:all -Werror
Reviewed-by: darcy Contributed-by: alexandre.boulgakov@oracle.com
上级
a925cd89
变更
26
显示空白变更内容
内联
并排
Showing
26 changed file
with
148 addition
and
153 deletion
+148
-153
make/java/java/Makefile
make/java/java/Makefile
+1
-0
src/share/classes/java/lang/reflect/Array.java
src/share/classes/java/lang/reflect/Array.java
+2
-2
src/share/classes/java/lang/reflect/Constructor.java
src/share/classes/java/lang/reflect/Constructor.java
+6
-5
src/share/classes/java/lang/reflect/Executable.java
src/share/classes/java/lang/reflect/Executable.java
+2
-5
src/share/classes/java/lang/reflect/Field.java
src/share/classes/java/lang/reflect/Field.java
+1
-0
src/share/classes/java/lang/reflect/Method.java
src/share/classes/java/lang/reflect/Method.java
+3
-2
src/share/classes/java/lang/reflect/Proxy.java
src/share/classes/java/lang/reflect/Proxy.java
+7
-10
src/share/classes/sun/reflect/AccessorGenerator.java
src/share/classes/sun/reflect/AccessorGenerator.java
+10
-10
src/share/classes/sun/reflect/BootstrapConstructorAccessorImpl.java
...classes/sun/reflect/BootstrapConstructorAccessorImpl.java
+2
-2
src/share/classes/sun/reflect/ClassDefiner.java
src/share/classes/sun/reflect/ClassDefiner.java
+2
-2
src/share/classes/sun/reflect/ConstantPool.java
src/share/classes/sun/reflect/ConstantPool.java
+4
-4
src/share/classes/sun/reflect/Label.java
src/share/classes/sun/reflect/Label.java
+2
-4
src/share/classes/sun/reflect/MethodAccessorGenerator.java
src/share/classes/sun/reflect/MethodAccessorGenerator.java
+27
-31
src/share/classes/sun/reflect/NativeConstructorAccessorImpl.java
...re/classes/sun/reflect/NativeConstructorAccessorImpl.java
+3
-3
src/share/classes/sun/reflect/Reflection.java
src/share/classes/sun/reflect/Reflection.java
+24
-25
src/share/classes/sun/reflect/ReflectionFactory.java
src/share/classes/sun/reflect/ReflectionFactory.java
+26
-28
src/share/classes/sun/reflect/UnsafeFieldAccessorFactory.java
...share/classes/sun/reflect/UnsafeFieldAccessorFactory.java
+1
-1
src/share/classes/sun/reflect/UnsafeFieldAccessorImpl.java
src/share/classes/sun/reflect/UnsafeFieldAccessorImpl.java
+5
-2
src/share/classes/sun/reflect/annotation/AnnotationParser.java
...hare/classes/sun/reflect/annotation/AnnotationParser.java
+9
-5
src/share/classes/sun/reflect/annotation/EnumConstantNotPresentExceptionProxy.java
...lect/annotation/EnumConstantNotPresentExceptionProxy.java
+2
-3
src/share/classes/sun/reflect/generics/reflectiveObjects/TypeVariableImpl.java
.../reflect/generics/reflectiveObjects/TypeVariableImpl.java
+1
-1
src/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java
...un/reflect/generics/repository/GenericDeclRepository.java
+1
-1
src/share/classes/sun/reflect/generics/scope/AbstractScope.java
...are/classes/sun/reflect/generics/scope/AbstractScope.java
+2
-2
src/share/classes/sun/reflect/generics/scope/ConstructorScope.java
.../classes/sun/reflect/generics/scope/ConstructorScope.java
+3
-3
src/share/classes/sun/reflect/generics/tree/ClassSignature.java
...are/classes/sun/reflect/generics/tree/ClassSignature.java
+1
-1
src/share/classes/sun/reflect/generics/tree/MethodTypeSignature.java
...lasses/sun/reflect/generics/tree/MethodTypeSignature.java
+1
-1
未找到文件。
make/java/java/Makefile
浏览文件 @
552b1a32
...
@@ -34,6 +34,7 @@ LIBRARY = java
...
@@ -34,6 +34,7 @@ LIBRARY = java
PRODUCT
=
java
PRODUCT
=
java
SUBDIRS_MAKEFLAGS
+=
JAVAC_MAX_WARNINGS
=
true
SUBDIRS_MAKEFLAGS
+=
JAVAC_MAX_WARNINGS
=
true
SUBDIRS_MAKEFLAGS
+=
JAVAC_WARNINGS_FATAL
=
true
SUBDIRS_MAKEFLAGS
+=
JAVAC_WARNINGS_FATAL
=
true
JAVAC_MAX_WARNINGS
=
true
include
$(BUILDDIR)/common/Defs.gmk
include
$(BUILDDIR)/common/Defs.gmk
# windows compiler flags
# windows compiler flags
...
...
src/share/classes/java/lang/reflect/Array.java
浏览文件 @
552b1a32
...
@@ -474,10 +474,10 @@ class Array {
...
@@ -474,10 +474,10 @@ class Array {
* Private
* Private
*/
*/
private
static
native
Object
newArray
(
Class
componentType
,
int
length
)
private
static
native
Object
newArray
(
Class
<?>
componentType
,
int
length
)
throws
NegativeArraySizeException
;
throws
NegativeArraySizeException
;
private
static
native
Object
multiNewArray
(
Class
componentType
,
private
static
native
Object
multiNewArray
(
Class
<?>
componentType
,
int
[]
dimensions
)
int
[]
dimensions
)
throws
IllegalArgumentException
,
NegativeArraySizeException
;
throws
IllegalArgumentException
,
NegativeArraySizeException
;
...
...
src/share/classes/java/lang/reflect/Constructor.java
浏览文件 @
552b1a32
...
@@ -27,14 +27,12 @@ package java.lang.reflect;
...
@@ -27,14 +27,12 @@ package java.lang.reflect;
import
sun.reflect.ConstructorAccessor
;
import
sun.reflect.ConstructorAccessor
;
import
sun.reflect.Reflection
;
import
sun.reflect.Reflection
;
import
sun.reflect.annotation.AnnotationParser
;
import
sun.reflect.generics.repository.ConstructorRepository
;
import
sun.reflect.generics.repository.ConstructorRepository
;
import
sun.reflect.generics.factory.CoreReflectionFactory
;
import
sun.reflect.generics.factory.CoreReflectionFactory
;
import
sun.reflect.generics.factory.GenericsFactory
;
import
sun.reflect.generics.factory.GenericsFactory
;
import
sun.reflect.generics.scope.ConstructorScope
;
import
sun.reflect.generics.scope.ConstructorScope
;
import
java.lang.annotation.Annotation
;
import
java.lang.annotation.Annotation
;
import
java.lang.annotation.AnnotationFormatError
;
import
java.lang.annotation.AnnotationFormatError
;
import
java.lang.reflect.Modifier
;
/**
/**
* {@code Constructor} provides information about, and access to, a single
* {@code Constructor} provides information about, and access to, a single
...
@@ -184,6 +182,7 @@ public final class Constructor<T> extends Executable {
...
@@ -184,6 +182,7 @@ public final class Constructor<T> extends Executable {
* @since 1.5
* @since 1.5
*/
*/
@Override
@Override
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
public
TypeVariable
<
Constructor
<
T
>>[]
getTypeParameters
()
{
public
TypeVariable
<
Constructor
<
T
>>[]
getTypeParameters
()
{
if
(
getSignature
()
!=
null
)
{
if
(
getSignature
()
!=
null
)
{
return
(
TypeVariable
<
Constructor
<
T
>>[])
getGenericInfo
().
getTypeParameters
();
return
(
TypeVariable
<
Constructor
<
T
>>[])
getGenericInfo
().
getTypeParameters
();
...
@@ -197,7 +196,7 @@ public final class Constructor<T> extends Executable {
...
@@ -197,7 +196,7 @@ public final class Constructor<T> extends Executable {
*/
*/
@Override
@Override
public
Class
<?>[]
getParameterTypes
()
{
public
Class
<?>[]
getParameterTypes
()
{
return
(
Class
<?>[])
parameterTypes
.
clone
();
return
parameterTypes
.
clone
();
}
}
/**
/**
...
@@ -217,7 +216,7 @@ public final class Constructor<T> extends Executable {
...
@@ -217,7 +216,7 @@ public final class Constructor<T> extends Executable {
*/
*/
@Override
@Override
public
Class
<?>[]
getExceptionTypes
()
{
public
Class
<?>[]
getExceptionTypes
()
{
return
(
Class
<?>[])
exceptionTypes
.
clone
();
return
exceptionTypes
.
clone
();
}
}
...
@@ -392,7 +391,9 @@ public final class Constructor<T> extends Executable {
...
@@ -392,7 +391,9 @@ public final class Constructor<T> extends Executable {
if
(
ca
==
null
)
{
if
(
ca
==
null
)
{
ca
=
acquireConstructorAccessor
();
ca
=
acquireConstructorAccessor
();
}
}
return
(
T
)
ca
.
newInstance
(
initargs
);
@SuppressWarnings
(
"unchecked"
)
T
inst
=
(
T
)
ca
.
newInstance
(
initargs
);
return
inst
;
}
}
/**
/**
...
...
src/share/classes/java/lang/reflect/Executable.java
浏览文件 @
552b1a32
...
@@ -29,9 +29,6 @@ import java.lang.annotation.*;
...
@@ -29,9 +29,6 @@ import java.lang.annotation.*;
import
java.util.Map
;
import
java.util.Map
;
import
sun.reflect.annotation.AnnotationParser
;
import
sun.reflect.annotation.AnnotationParser
;
import
sun.reflect.generics.repository.ConstructorRepository
;
import
sun.reflect.generics.repository.ConstructorRepository
;
import
sun.reflect.generics.factory.CoreReflectionFactory
;
import
sun.reflect.generics.factory.GenericsFactory
;
import
sun.reflect.generics.scope.ConstructorScope
;
/**
/**
* A shared superclass for the common functionality of {@link Method}
* A shared superclass for the common functionality of {@link Method}
...
...
src/share/classes/java/lang/reflect/Field.java
浏览文件 @
552b1a32
...
@@ -1012,6 +1012,7 @@ class Field extends AccessibleObject implements Member {
...
@@ -1012,6 +1012,7 @@ class Field extends AccessibleObject implements Member {
* @throws NullPointerException {@inheritDoc}
* @throws NullPointerException {@inheritDoc}
* @since 1.5
* @since 1.5
*/
*/
@SuppressWarnings
(
"unchecked"
)
public
<
T
extends
Annotation
>
T
getAnnotation
(
Class
<
T
>
annotationClass
)
{
public
<
T
extends
Annotation
>
T
getAnnotation
(
Class
<
T
>
annotationClass
)
{
if
(
annotationClass
==
null
)
if
(
annotationClass
==
null
)
throw
new
NullPointerException
();
throw
new
NullPointerException
();
...
...
src/share/classes/java/lang/reflect/Method.java
浏览文件 @
552b1a32
...
@@ -194,6 +194,7 @@ public final class Method extends Executable {
...
@@ -194,6 +194,7 @@ public final class Method extends Executable {
* @since 1.5
* @since 1.5
*/
*/
@Override
@Override
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
public
TypeVariable
<
Method
>[]
getTypeParameters
()
{
public
TypeVariable
<
Method
>[]
getTypeParameters
()
{
if
(
getGenericSignature
()
!=
null
)
if
(
getGenericSignature
()
!=
null
)
return
(
TypeVariable
<
Method
>[])
getGenericInfo
().
getTypeParameters
();
return
(
TypeVariable
<
Method
>[])
getGenericInfo
().
getTypeParameters
();
...
@@ -246,7 +247,7 @@ public final class Method extends Executable {
...
@@ -246,7 +247,7 @@ public final class Method extends Executable {
*/
*/
@Override
@Override
public
Class
<?>[]
getParameterTypes
()
{
public
Class
<?>[]
getParameterTypes
()
{
return
(
Class
<?>[])
parameterTypes
.
clone
();
return
parameterTypes
.
clone
();
}
}
/**
/**
...
@@ -266,7 +267,7 @@ public final class Method extends Executable {
...
@@ -266,7 +267,7 @@ public final class Method extends Executable {
*/
*/
@Override
@Override
public
Class
<?>[]
getExceptionTypes
()
{
public
Class
<?>[]
getExceptionTypes
()
{
return
(
Class
<?>[])
exceptionTypes
.
clone
();
return
exceptionTypes
.
clone
();
}
}
/**
/**
...
...
src/share/classes/java/lang/reflect/Proxy.java
浏览文件 @
552b1a32
...
@@ -604,15 +604,12 @@ public class Proxy implements java.io.Serializable {
...
@@ -604,15 +604,12 @@ public class Proxy implements java.io.Serializable {
* Invoke its constructor with the designated invocation handler.
* Invoke its constructor with the designated invocation handler.
*/
*/
try
{
try
{
Constructor
cons
=
cl
.
getConstructor
(
constructorParams
);
Constructor
<?>
cons
=
cl
.
getConstructor
(
constructorParams
);
return
cons
.
newInstance
(
new
Object
[]
{
h
});
return
cons
.
newInstance
(
new
Object
[]
{
h
});
}
catch
(
NoSuchMethodException
e
)
{
}
catch
(
NoSuchMethodException
|
throw
new
InternalError
(
e
.
toString
());
IllegalAccessException
|
}
catch
(
IllegalAccessException
e
)
{
InstantiationException
|
throw
new
InternalError
(
e
.
toString
());
InvocationTargetException
e
)
{
}
catch
(
InstantiationException
e
)
{
throw
new
InternalError
(
e
.
toString
());
}
catch
(
InvocationTargetException
e
)
{
throw
new
InternalError
(
e
.
toString
());
throw
new
InternalError
(
e
.
toString
());
}
}
}
}
...
@@ -661,6 +658,6 @@ public class Proxy implements java.io.Serializable {
...
@@ -661,6 +658,6 @@ public class Proxy implements java.io.Serializable {
return
p
.
h
;
return
p
.
h
;
}
}
private
static
native
Class
defineClass0
(
ClassLoader
loader
,
String
name
,
private
static
native
Class
<?>
defineClass0
(
ClassLoader
loader
,
String
name
,
byte
[]
b
,
int
off
,
int
len
);
byte
[]
b
,
int
off
,
int
len
);
}
}
src/share/classes/sun/reflect/AccessorGenerator.java
浏览文件 @
552b1a32
...
@@ -382,7 +382,7 @@ class AccessorGenerator implements ClassFileConstants {
...
@@ -382,7 +382,7 @@ class AccessorGenerator implements ClassFileConstants {
/** Returns class name in "internal" form (i.e., '/' separators
/** Returns class name in "internal" form (i.e., '/' separators
instead of '.') */
instead of '.') */
protected
static
String
getClassName
protected
static
String
getClassName
(
Class
c
,
boolean
addPrefixAndSuffixForNonPrimitiveTypes
)
(
Class
<?>
c
,
boolean
addPrefixAndSuffixForNonPrimitiveTypes
)
{
{
if
(
c
.
isPrimitive
())
{
if
(
c
.
isPrimitive
())
{
if
(
c
==
Boolean
.
TYPE
)
{
if
(
c
==
Boolean
.
TYPE
)
{
...
@@ -490,7 +490,7 @@ class AccessorGenerator implements ClassFileConstants {
...
@@ -490,7 +490,7 @@ class AccessorGenerator implements ClassFileConstants {
}
}
}
}
protected
short
indexForPrimitiveType
(
Class
type
)
{
protected
short
indexForPrimitiveType
(
Class
<?>
type
)
{
if
(
type
==
Boolean
.
TYPE
)
{
if
(
type
==
Boolean
.
TYPE
)
{
return
booleanIdx
;
return
booleanIdx
;
}
else
if
(
type
==
Byte
.
TYPE
)
{
}
else
if
(
type
==
Byte
.
TYPE
)
{
...
@@ -511,7 +511,7 @@ class AccessorGenerator implements ClassFileConstants {
...
@@ -511,7 +511,7 @@ class AccessorGenerator implements ClassFileConstants {
throw
new
InternalError
(
"Should have found primitive type"
);
throw
new
InternalError
(
"Should have found primitive type"
);
}
}
protected
short
ctorIndexForPrimitiveType
(
Class
type
)
{
protected
short
ctorIndexForPrimitiveType
(
Class
<?>
type
)
{
if
(
type
==
Boolean
.
TYPE
)
{
if
(
type
==
Boolean
.
TYPE
)
{
return
booleanCtorIdx
;
return
booleanCtorIdx
;
}
else
if
(
type
==
Byte
.
TYPE
)
{
}
else
if
(
type
==
Byte
.
TYPE
)
{
...
@@ -534,7 +534,7 @@ class AccessorGenerator implements ClassFileConstants {
...
@@ -534,7 +534,7 @@ class AccessorGenerator implements ClassFileConstants {
/** Returns true for widening or identity conversions for primitive
/** Returns true for widening or identity conversions for primitive
types only */
types only */
protected
static
boolean
canWidenTo
(
Class
type
,
Class
otherType
)
{
protected
static
boolean
canWidenTo
(
Class
<?>
type
,
Class
<?>
otherType
)
{
if
(!
type
.
isPrimitive
())
{
if
(!
type
.
isPrimitive
())
{
return
false
;
return
false
;
}
}
...
@@ -609,8 +609,8 @@ class AccessorGenerator implements ClassFileConstants {
...
@@ -609,8 +609,8 @@ class AccessorGenerator implements ClassFileConstants {
called and returned true. */
called and returned true. */
protected
static
void
emitWideningBytecodeForPrimitiveConversion
protected
static
void
emitWideningBytecodeForPrimitiveConversion
(
ClassFileAssembler
cb
,
(
ClassFileAssembler
cb
,
Class
fromType
,
Class
<?>
fromType
,
Class
toType
)
Class
<?>
toType
)
{
{
// Note that widening conversions for integral types (i.e., "b2s",
// Note that widening conversions for integral types (i.e., "b2s",
// "s2i") are no-ops since values on the Java stack are
// "s2i") are no-ops since values on the Java stack are
...
@@ -650,7 +650,7 @@ class AccessorGenerator implements ClassFileConstants {
...
@@ -650,7 +650,7 @@ class AccessorGenerator implements ClassFileConstants {
// Otherwise, was identity or no-op conversion. Fall through.
// Otherwise, was identity or no-op conversion. Fall through.
}
}
protected
short
unboxingMethodForPrimitiveType
(
Class
primType
)
{
protected
short
unboxingMethodForPrimitiveType
(
Class
<?>
primType
)
{
if
(
primType
==
Boolean
.
TYPE
)
{
if
(
primType
==
Boolean
.
TYPE
)
{
return
booleanUnboxIdx
;
return
booleanUnboxIdx
;
}
else
if
(
primType
==
Byte
.
TYPE
)
{
}
else
if
(
primType
==
Byte
.
TYPE
)
{
...
@@ -671,7 +671,7 @@ class AccessorGenerator implements ClassFileConstants {
...
@@ -671,7 +671,7 @@ class AccessorGenerator implements ClassFileConstants {
throw
new
InternalError
(
"Illegal primitive type "
+
primType
.
getName
());
throw
new
InternalError
(
"Illegal primitive type "
+
primType
.
getName
());
}
}
protected
static
final
Class
[]
primitiveTypes
=
new
Class
[]
{
protected
static
final
Class
<?>[]
primitiveTypes
=
new
Class
<?>
[]
{
Boolean
.
TYPE
,
Boolean
.
TYPE
,
Byte
.
TYPE
,
Byte
.
TYPE
,
Character
.
TYPE
,
Character
.
TYPE
,
...
@@ -683,11 +683,11 @@ class AccessorGenerator implements ClassFileConstants {
...
@@ -683,11 +683,11 @@ class AccessorGenerator implements ClassFileConstants {
};
};
/** We don't consider "Void" to be a primitive type */
/** We don't consider "Void" to be a primitive type */
protected
static
boolean
isPrimitive
(
Class
c
)
{
protected
static
boolean
isPrimitive
(
Class
<?>
c
)
{
return
(
c
.
isPrimitive
()
&&
c
!=
Void
.
TYPE
);
return
(
c
.
isPrimitive
()
&&
c
!=
Void
.
TYPE
);
}
}
protected
int
typeSizeInStackSlots
(
Class
c
)
{
protected
int
typeSizeInStackSlots
(
Class
<?>
c
)
{
if
(
c
==
Void
.
TYPE
)
{
if
(
c
==
Void
.
TYPE
)
{
return
0
;
return
0
;
}
}
...
...
src/share/classes/sun/reflect/BootstrapConstructorAccessorImpl.java
浏览文件 @
552b1a32
...
@@ -32,9 +32,9 @@ import java.lang.reflect.Constructor;
...
@@ -32,9 +32,9 @@ import java.lang.reflect.Constructor;
bootstrapping. */
bootstrapping. */
class
BootstrapConstructorAccessorImpl
extends
ConstructorAccessorImpl
{
class
BootstrapConstructorAccessorImpl
extends
ConstructorAccessorImpl
{
private
Constructor
constructor
;
private
Constructor
<?>
constructor
;
BootstrapConstructorAccessorImpl
(
Constructor
c
)
{
BootstrapConstructorAccessorImpl
(
Constructor
<?>
c
)
{
this
.
constructor
=
c
;
this
.
constructor
=
c
;
}
}
...
...
src/share/classes/sun/reflect/ClassDefiner.java
浏览文件 @
552b1a32
...
@@ -51,7 +51,7 @@ class ClassDefiner {
...
@@ -51,7 +51,7 @@ class ClassDefiner {
than would otherwise be possible, decreasing run-time
than would otherwise be possible, decreasing run-time
footprint. </P>
footprint. </P>
*/
*/
static
Class
defineClass
(
String
name
,
byte
[]
bytes
,
int
off
,
int
len
,
static
Class
<?>
defineClass
(
String
name
,
byte
[]
bytes
,
int
off
,
int
len
,
final
ClassLoader
parentClassLoader
)
final
ClassLoader
parentClassLoader
)
{
{
ClassLoader
newLoader
=
AccessController
.
doPrivileged
(
ClassLoader
newLoader
=
AccessController
.
doPrivileged
(
...
...
src/share/classes/sun/reflect/ConstantPool.java
浏览文件 @
552b1a32
...
@@ -34,8 +34,8 @@ import java.lang.reflect.*;
...
@@ -34,8 +34,8 @@ import java.lang.reflect.*;
public
class
ConstantPool
{
public
class
ConstantPool
{
// Number of entries in this constant pool (= maximum valid constant pool index)
// Number of entries in this constant pool (= maximum valid constant pool index)
public
int
getSize
()
{
return
getSize0
(
constantPoolOop
);
}
public
int
getSize
()
{
return
getSize0
(
constantPoolOop
);
}
public
Class
getClassAt
(
int
index
)
{
return
getClassAt0
(
constantPoolOop
,
index
);
}
public
Class
<?>
getClassAt
(
int
index
)
{
return
getClassAt0
(
constantPoolOop
,
index
);
}
public
Class
getClassAtIfLoaded
(
int
index
)
{
return
getClassAtIfLoaded0
(
constantPoolOop
,
index
);
}
public
Class
<?>
getClassAtIfLoaded
(
int
index
)
{
return
getClassAtIfLoaded0
(
constantPoolOop
,
index
);
}
// Returns either a Method or Constructor.
// Returns either a Method or Constructor.
// Static initializers are returned as Method objects.
// Static initializers are returned as Method objects.
public
Member
getMethodAt
(
int
index
)
{
return
getMethodAt0
(
constantPoolOop
,
index
);
}
public
Member
getMethodAt
(
int
index
)
{
return
getMethodAt0
(
constantPoolOop
,
index
);
}
...
@@ -64,8 +64,8 @@ public class ConstantPool {
...
@@ -64,8 +64,8 @@ public class ConstantPool {
private
Object
constantPoolOop
;
private
Object
constantPoolOop
;
private
native
int
getSize0
(
Object
constantPoolOop
);
private
native
int
getSize0
(
Object
constantPoolOop
);
private
native
Class
getClassAt0
(
Object
constantPoolOop
,
int
index
);
private
native
Class
<?>
getClassAt0
(
Object
constantPoolOop
,
int
index
);
private
native
Class
getClassAtIfLoaded0
(
Object
constantPoolOop
,
int
index
);
private
native
Class
<?>
getClassAtIfLoaded0
(
Object
constantPoolOop
,
int
index
);
private
native
Member
getMethodAt0
(
Object
constantPoolOop
,
int
index
);
private
native
Member
getMethodAt0
(
Object
constantPoolOop
,
int
index
);
private
native
Member
getMethodAtIfLoaded0
(
Object
constantPoolOop
,
int
index
);
private
native
Member
getMethodAtIfLoaded0
(
Object
constantPoolOop
,
int
index
);
private
native
Field
getFieldAt0
(
Object
constantPoolOop
,
int
index
);
private
native
Field
getFieldAt0
(
Object
constantPoolOop
,
int
index
);
...
...
src/share/classes/sun/reflect/Label.java
浏览文件 @
552b1a32
...
@@ -25,7 +25,6 @@
...
@@ -25,7 +25,6 @@
package
sun.reflect
;
package
sun.reflect
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.List
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -53,7 +52,7 @@ class Label {
...
@@ -53,7 +52,7 @@ class Label {
short
patchBCI
;
short
patchBCI
;
int
stackDepth
;
int
stackDepth
;
}
}
private
List
/*<PatchInfo>*/
patches
=
new
ArrayList
();
private
List
<
PatchInfo
>
patches
=
new
ArrayList
<>
();
public
Label
()
{
public
Label
()
{
}
}
...
@@ -67,8 +66,7 @@ class Label {
...
@@ -67,8 +66,7 @@ class Label {
}
}
public
void
bind
()
{
public
void
bind
()
{
for
(
Iterator
iter
=
patches
.
iterator
();
iter
.
hasNext
();
)
{
for
(
PatchInfo
patch
:
patches
){
PatchInfo
patch
=
(
PatchInfo
)
iter
.
next
();
short
curBCI
=
patch
.
asm
.
getLength
();
short
curBCI
=
patch
.
asm
.
getLength
();
short
offset
=
(
short
)
(
curBCI
-
patch
.
instrBCI
);
short
offset
=
(
short
)
(
curBCI
-
patch
.
instrBCI
);
patch
.
asm
.
emitShort
(
patch
.
patchBCI
,
offset
);
patch
.
asm
.
emitShort
(
patch
.
patchBCI
,
offset
);
...
...
src/share/classes/sun/reflect/MethodAccessorGenerator.java
浏览文件 @
552b1a32
...
@@ -25,10 +25,8 @@
...
@@ -25,10 +25,8 @@
package
sun.reflect
;
package
sun.reflect
;
import
java.lang.reflect.*
;
import
java.security.AccessController
;
import
java.security.AccessController
;
import
java.security.PrivilegedAction
;
import
java.security.PrivilegedAction
;
import
sun.misc.Unsafe
;
/** Generator for sun.reflect.MethodAccessor and
/** Generator for sun.reflect.MethodAccessor and
sun.reflect.ConstructorAccessor objects using bytecodes to
sun.reflect.ConstructorAccessor objects using bytecodes to
...
@@ -50,9 +48,9 @@ class MethodAccessorGenerator extends AccessorGenerator {
...
@@ -50,9 +48,9 @@ class MethodAccessorGenerator extends AccessorGenerator {
private
static
volatile
int
constructorSymnum
=
0
;
private
static
volatile
int
constructorSymnum
=
0
;
private
static
volatile
int
serializationConstructorSymnum
=
0
;
private
static
volatile
int
serializationConstructorSymnum
=
0
;
private
Class
declaringClass
;
private
Class
<?>
declaringClass
;
private
Class
[]
parameterTypes
;
private
Class
<?>
[]
parameterTypes
;
private
Class
returnType
;
private
Class
<?>
returnType
;
private
boolean
isConstructor
;
private
boolean
isConstructor
;
private
boolean
forSerialization
;
private
boolean
forSerialization
;
...
@@ -67,11 +65,11 @@ class MethodAccessorGenerator extends AccessorGenerator {
...
@@ -67,11 +65,11 @@ class MethodAccessorGenerator extends AccessorGenerator {
}
}
/** This routine is not thread-safe */
/** This routine is not thread-safe */
public
MethodAccessor
generateMethod
(
Class
declaringClass
,
public
MethodAccessor
generateMethod
(
Class
<?>
declaringClass
,
String
name
,
String
name
,
Class
[]
parameterTypes
,
Class
<?>
[]
parameterTypes
,
Class
returnType
,
Class
<?>
returnType
,
Class
[]
checkedExceptions
,
Class
<?>
[]
checkedExceptions
,
int
modifiers
)
int
modifiers
)
{
{
return
(
MethodAccessor
)
generate
(
declaringClass
,
return
(
MethodAccessor
)
generate
(
declaringClass
,
...
@@ -86,9 +84,9 @@ class MethodAccessorGenerator extends AccessorGenerator {
...
@@ -86,9 +84,9 @@ class MethodAccessorGenerator extends AccessorGenerator {
}
}
/** This routine is not thread-safe */
/** This routine is not thread-safe */
public
ConstructorAccessor
generateConstructor
(
Class
declaringClass
,
public
ConstructorAccessor
generateConstructor
(
Class
<?>
declaringClass
,
Class
[]
parameterTypes
,
Class
<?>
[]
parameterTypes
,
Class
[]
checkedExceptions
,
Class
<?>
[]
checkedExceptions
,
int
modifiers
)
int
modifiers
)
{
{
return
(
ConstructorAccessor
)
generate
(
declaringClass
,
return
(
ConstructorAccessor
)
generate
(
declaringClass
,
...
@@ -104,11 +102,11 @@ class MethodAccessorGenerator extends AccessorGenerator {
...
@@ -104,11 +102,11 @@ class MethodAccessorGenerator extends AccessorGenerator {
/** This routine is not thread-safe */
/** This routine is not thread-safe */
public
SerializationConstructorAccessorImpl
public
SerializationConstructorAccessorImpl
generateSerializationConstructor
(
Class
declaringClass
,
generateSerializationConstructor
(
Class
<?>
declaringClass
,
Class
[]
parameterTypes
,
Class
<?>
[]
parameterTypes
,
Class
[]
checkedExceptions
,
Class
<?>
[]
checkedExceptions
,
int
modifiers
,
int
modifiers
,
Class
targetConstructorClass
)
Class
<?>
targetConstructorClass
)
{
{
return
(
SerializationConstructorAccessorImpl
)
return
(
SerializationConstructorAccessorImpl
)
generate
(
declaringClass
,
generate
(
declaringClass
,
...
@@ -123,15 +121,15 @@ class MethodAccessorGenerator extends AccessorGenerator {
...
@@ -123,15 +121,15 @@ class MethodAccessorGenerator extends AccessorGenerator {
}
}
/** This routine is not thread-safe */
/** This routine is not thread-safe */
private
MagicAccessorImpl
generate
(
final
Class
declaringClass
,
private
MagicAccessorImpl
generate
(
final
Class
<?>
declaringClass
,
String
name
,
String
name
,
Class
[]
parameterTypes
,
Class
<?>
[]
parameterTypes
,
Class
returnType
,
Class
<?>
returnType
,
Class
[]
checkedExceptions
,
Class
<?>
[]
checkedExceptions
,
int
modifiers
,
int
modifiers
,
boolean
isConstructor
,
boolean
isConstructor
,
boolean
forSerialization
,
boolean
forSerialization
,
Class
serializationTargetClass
)
Class
<?>
serializationTargetClass
)
{
{
ByteVector
vec
=
ByteVectorFactory
.
create
();
ByteVector
vec
=
ByteVectorFactory
.
create
();
asm
=
new
ClassFileAssembler
(
vec
);
asm
=
new
ClassFileAssembler
(
vec
);
...
@@ -340,7 +338,7 @@ class MethodAccessorGenerator extends AccessorGenerator {
...
@@ -340,7 +338,7 @@ class MethodAccessorGenerator extends AccessorGenerator {
// Output class information for non-primitive parameter types
// Output class information for non-primitive parameter types
nonPrimitiveParametersBaseIdx
=
add
(
asm
.
cpi
(),
S2
);
nonPrimitiveParametersBaseIdx
=
add
(
asm
.
cpi
(),
S2
);
for
(
int
i
=
0
;
i
<
parameterTypes
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
parameterTypes
.
length
;
i
++)
{
Class
c
=
parameterTypes
[
i
];
Class
<?>
c
=
parameterTypes
[
i
];
if
(!
isPrimitive
(
c
))
{
if
(!
isPrimitive
(
c
))
{
asm
.
emitConstantPoolUTF8
(
getClassName
(
c
,
false
));
asm
.
emitConstantPoolUTF8
(
getClassName
(
c
,
false
));
asm
.
emitConstantPoolClass
(
asm
.
cpi
());
asm
.
emitConstantPoolClass
(
asm
.
cpi
());
...
@@ -403,10 +401,8 @@ class MethodAccessorGenerator extends AccessorGenerator {
...
@@ -403,10 +401,8 @@ class MethodAccessorGenerator extends AccessorGenerator {
0
,
0
,
bytes
.
length
,
bytes
.
length
,
declaringClass
.
getClassLoader
()).
newInstance
();
declaringClass
.
getClassLoader
()).
newInstance
();
}
catch
(
InstantiationException
e
)
{
}
catch
(
InstantiationException
|
throw
(
InternalError
)
IllegalAccessException
e
)
{
new
InternalError
().
initCause
(
e
);
}
catch
(
IllegalAccessException
e
)
{
throw
(
InternalError
)
throw
(
InternalError
)
new
InternalError
().
initCause
(
e
);
new
InternalError
().
initCause
(
e
);
}
}
...
@@ -530,7 +526,7 @@ class MethodAccessorGenerator extends AccessorGenerator {
...
@@ -530,7 +526,7 @@ class MethodAccessorGenerator extends AccessorGenerator {
byte
count
=
1
;
// both invokeinterface opcode's "count" as well as
byte
count
=
1
;
// both invokeinterface opcode's "count" as well as
// num args of other invoke bytecodes
// num args of other invoke bytecodes
for
(
int
i
=
0
;
i
<
parameterTypes
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
parameterTypes
.
length
;
i
++)
{
Class
paramType
=
parameterTypes
[
i
];
Class
<?>
paramType
=
parameterTypes
[
i
];
count
+=
(
byte
)
typeSizeInStackSlots
(
paramType
);
count
+=
(
byte
)
typeSizeInStackSlots
(
paramType
);
if
(
nextParamLabel
!=
null
)
{
if
(
nextParamLabel
!=
null
)
{
nextParamLabel
.
bind
();
nextParamLabel
.
bind
();
...
@@ -577,7 +573,7 @@ class MethodAccessorGenerator extends AccessorGenerator {
...
@@ -577,7 +573,7 @@ class MethodAccessorGenerator extends AccessorGenerator {
nextParamLabel
=
new
Label
();
nextParamLabel
=
new
Label
();
for
(
int
j
=
0
;
j
<
primitiveTypes
.
length
;
j
++)
{
for
(
int
j
=
0
;
j
<
primitiveTypes
.
length
;
j
++)
{
Class
c
=
primitiveTypes
[
j
];
Class
<?>
c
=
primitiveTypes
[
j
];
if
(
canWidenTo
(
c
,
paramType
))
{
if
(
canWidenTo
(
c
,
paramType
))
{
if
(
l
!=
null
)
{
if
(
l
!=
null
)
{
l
.
bind
();
l
.
bind
();
...
...
src/share/classes/sun/reflect/NativeConstructorAccessorImpl.java
浏览文件 @
552b1a32
...
@@ -31,11 +31,11 @@ import java.lang.reflect.*;
...
@@ -31,11 +31,11 @@ import java.lang.reflect.*;
afterward, switches to bytecode-based implementation */
afterward, switches to bytecode-based implementation */
class
NativeConstructorAccessorImpl
extends
ConstructorAccessorImpl
{
class
NativeConstructorAccessorImpl
extends
ConstructorAccessorImpl
{
private
Constructor
c
;
private
Constructor
<?>
c
;
private
DelegatingConstructorAccessorImpl
parent
;
private
DelegatingConstructorAccessorImpl
parent
;
private
int
numInvocations
;
private
int
numInvocations
;
NativeConstructorAccessorImpl
(
Constructor
c
)
{
NativeConstructorAccessorImpl
(
Constructor
<?>
c
)
{
this
.
c
=
c
;
this
.
c
=
c
;
}
}
...
@@ -61,7 +61,7 @@ class NativeConstructorAccessorImpl extends ConstructorAccessorImpl {
...
@@ -61,7 +61,7 @@ class NativeConstructorAccessorImpl extends ConstructorAccessorImpl {
this
.
parent
=
parent
;
this
.
parent
=
parent
;
}
}
private
static
native
Object
newInstance0
(
Constructor
c
,
Object
[]
args
)
private
static
native
Object
newInstance0
(
Constructor
<?>
c
,
Object
[]
args
)
throws
InstantiationException
,
throws
InstantiationException
,
IllegalArgumentException
,
IllegalArgumentException
,
InvocationTargetException
;
InvocationTargetException
;
...
...
src/share/classes/sun/reflect/Reflection.java
浏览文件 @
552b1a32
...
@@ -26,7 +26,6 @@
...
@@ -26,7 +26,6 @@
package
sun.reflect
;
package
sun.reflect
;
import
java.lang.reflect.*
;
import
java.lang.reflect.*
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -39,17 +38,17 @@ public class Reflection {
...
@@ -39,17 +38,17 @@ public class Reflection {
view, where they are sensitive or they may contain VM-internal objects.
view, where they are sensitive or they may contain VM-internal objects.
These Maps are updated very rarely. Rather than synchronize on
These Maps are updated very rarely. Rather than synchronize on
each access, we use copy-on-write */
each access, we use copy-on-write */
private
static
volatile
Map
<
Class
,
String
[]>
fieldFilterMap
;
private
static
volatile
Map
<
Class
<?>
,
String
[]>
fieldFilterMap
;
private
static
volatile
Map
<
Class
,
String
[]>
methodFilterMap
;
private
static
volatile
Map
<
Class
<?>
,
String
[]>
methodFilterMap
;
static
{
static
{
Map
<
Class
,
String
[]>
map
=
new
HashMap
<
Class
,
String
[]>();
Map
<
Class
<?>,
String
[]>
map
=
new
HashMap
<
Class
<?>
,
String
[]>();
map
.
put
(
Reflection
.
class
,
map
.
put
(
Reflection
.
class
,
new
String
[]
{
"fieldFilterMap"
,
"methodFilterMap"
});
new
String
[]
{
"fieldFilterMap"
,
"methodFilterMap"
});
map
.
put
(
System
.
class
,
new
String
[]
{
"security"
});
map
.
put
(
System
.
class
,
new
String
[]
{
"security"
});
fieldFilterMap
=
map
;
fieldFilterMap
=
map
;
methodFilterMap
=
new
HashMap
<
Class
,
String
[]
>();
methodFilterMap
=
new
HashMap
<>();
}
}
/** Returns the class of the method <code>realFramesToSkip</code>
/** Returns the class of the method <code>realFramesToSkip</code>
...
@@ -61,7 +60,7 @@ public class Reflection {
...
@@ -61,7 +60,7 @@ public class Reflection {
java.lang.reflect.Method.invoke() and its implementation are
java.lang.reflect.Method.invoke() and its implementation are
completely ignored and do not count toward the number of "real"
completely ignored and do not count toward the number of "real"
frames skipped. */
frames skipped. */
public
static
native
Class
getCallerClass
(
int
realFramesToSkip
);
public
static
native
Class
<?>
getCallerClass
(
int
realFramesToSkip
);
/** Retrieves the access flags written to the class file. For
/** Retrieves the access flags written to the class file. For
inner classes these flags may differ from those returned by
inner classes these flags may differ from those returned by
...
@@ -71,18 +70,18 @@ public class Reflection {
...
@@ -71,18 +70,18 @@ public class Reflection {
to compatibility reasons; see 4471811. Only the values of the
to compatibility reasons; see 4471811. Only the values of the
low 13 bits (i.e., a mask of 0x1FFF) are guaranteed to be
low 13 bits (i.e., a mask of 0x1FFF) are guaranteed to be
valid. */
valid. */
private
static
native
int
getClassAccessFlags
(
Class
c
);
private
static
native
int
getClassAccessFlags
(
Class
<?>
c
);
/** A quick "fast-path" check to try to avoid getCallerClass()
/** A quick "fast-path" check to try to avoid getCallerClass()
calls. */
calls. */
public
static
boolean
quickCheckMemberAccess
(
Class
memberClass
,
public
static
boolean
quickCheckMemberAccess
(
Class
<?>
memberClass
,
int
modifiers
)
int
modifiers
)
{
{
return
Modifier
.
isPublic
(
getClassAccessFlags
(
memberClass
)
&
modifiers
);
return
Modifier
.
isPublic
(
getClassAccessFlags
(
memberClass
)
&
modifiers
);
}
}
public
static
void
ensureMemberAccess
(
Class
currentClass
,
public
static
void
ensureMemberAccess
(
Class
<?>
currentClass
,
Class
memberClass
,
Class
<?>
memberClass
,
Object
target
,
Object
target
,
int
modifiers
)
int
modifiers
)
throws
IllegalAccessException
throws
IllegalAccessException
...
@@ -101,10 +100,10 @@ public class Reflection {
...
@@ -101,10 +100,10 @@ public class Reflection {
}
}
}
}
public
static
boolean
verifyMemberAccess
(
Class
currentClass
,
public
static
boolean
verifyMemberAccess
(
Class
<?>
currentClass
,
// Declaring class of field
// Declaring class of field
// or method
// or method
Class
memberClass
,
Class
<?>
memberClass
,
// May be NULL in case of statics
// May be NULL in case of statics
Object
target
,
Object
target
,
int
modifiers
)
int
modifiers
)
...
@@ -162,7 +161,7 @@ public class Reflection {
...
@@ -162,7 +161,7 @@ public class Reflection {
if
(
Modifier
.
isProtected
(
modifiers
))
{
if
(
Modifier
.
isProtected
(
modifiers
))
{
// Additional test for protected members: JLS 6.6.2
// Additional test for protected members: JLS 6.6.2
Class
targetClass
=
(
target
==
null
?
memberClass
:
target
.
getClass
());
Class
<?>
targetClass
=
(
target
==
null
?
memberClass
:
target
.
getClass
());
if
(
targetClass
!=
currentClass
)
{
if
(
targetClass
!=
currentClass
)
{
if
(!
gotIsSameClassPackage
)
{
if
(!
gotIsSameClassPackage
)
{
isSameClassPackage
=
isSameClassPackage
(
currentClass
,
memberClass
);
isSameClassPackage
=
isSameClassPackage
(
currentClass
,
memberClass
);
...
@@ -179,7 +178,7 @@ public class Reflection {
...
@@ -179,7 +178,7 @@ public class Reflection {
return
true
;
return
true
;
}
}
private
static
boolean
isSameClassPackage
(
Class
c1
,
Class
c2
)
{
private
static
boolean
isSameClassPackage
(
Class
<?>
c1
,
Class
<?>
c2
)
{
return
isSameClassPackage
(
c1
.
getClassLoader
(),
c1
.
getName
(),
return
isSameClassPackage
(
c1
.
getClassLoader
(),
c1
.
getName
(),
c2
.
getClassLoader
(),
c2
.
getName
());
c2
.
getClassLoader
(),
c2
.
getName
());
}
}
...
@@ -234,8 +233,8 @@ public class Reflection {
...
@@ -234,8 +233,8 @@ public class Reflection {
}
}
}
}
static
boolean
isSubclassOf
(
Class
queryClass
,
static
boolean
isSubclassOf
(
Class
<?>
queryClass
,
Class
ofClass
)
Class
<?>
ofClass
)
{
{
while
(
queryClass
!=
null
)
{
while
(
queryClass
!=
null
)
{
if
(
queryClass
==
ofClass
)
{
if
(
queryClass
==
ofClass
)
{
...
@@ -247,31 +246,31 @@ public class Reflection {
...
@@ -247,31 +246,31 @@ public class Reflection {
}
}
// fieldNames must contain only interned Strings
// fieldNames must contain only interned Strings
public
static
synchronized
void
registerFieldsToFilter
(
Class
containingClass
,
public
static
synchronized
void
registerFieldsToFilter
(
Class
<?>
containingClass
,
String
...
fieldNames
)
{
String
...
fieldNames
)
{
fieldFilterMap
=
fieldFilterMap
=
registerFilter
(
fieldFilterMap
,
containingClass
,
fieldNames
);
registerFilter
(
fieldFilterMap
,
containingClass
,
fieldNames
);
}
}
// methodNames must contain only interned Strings
// methodNames must contain only interned Strings
public
static
synchronized
void
registerMethodsToFilter
(
Class
containingClass
,
public
static
synchronized
void
registerMethodsToFilter
(
Class
<?>
containingClass
,
String
...
methodNames
)
{
String
...
methodNames
)
{
methodFilterMap
=
methodFilterMap
=
registerFilter
(
methodFilterMap
,
containingClass
,
methodNames
);
registerFilter
(
methodFilterMap
,
containingClass
,
methodNames
);
}
}
private
static
Map
<
Class
,
String
[]>
registerFilter
(
Map
<
Class
,
String
[]>
map
,
private
static
Map
<
Class
<?>,
String
[]>
registerFilter
(
Map
<
Class
<?>
,
String
[]>
map
,
Class
containingClass
,
String
...
names
)
{
Class
<?>
containingClass
,
String
...
names
)
{
if
(
map
.
get
(
containingClass
)
!=
null
)
{
if
(
map
.
get
(
containingClass
)
!=
null
)
{
throw
new
IllegalArgumentException
throw
new
IllegalArgumentException
(
"Filter already registered: "
+
containingClass
);
(
"Filter already registered: "
+
containingClass
);
}
}
map
=
new
HashMap
<
Class
,
String
[]>(
map
);
map
=
new
HashMap
<
Class
<?>
,
String
[]>(
map
);
map
.
put
(
containingClass
,
names
);
map
.
put
(
containingClass
,
names
);
return
map
;
return
map
;
}
}
public
static
Field
[]
filterFields
(
Class
containingClass
,
public
static
Field
[]
filterFields
(
Class
<?>
containingClass
,
Field
[]
fields
)
{
Field
[]
fields
)
{
if
(
fieldFilterMap
==
null
)
{
if
(
fieldFilterMap
==
null
)
{
// Bootstrapping
// Bootstrapping
...
@@ -280,7 +279,7 @@ public class Reflection {
...
@@ -280,7 +279,7 @@ public class Reflection {
return
(
Field
[])
filter
(
fields
,
fieldFilterMap
.
get
(
containingClass
));
return
(
Field
[])
filter
(
fields
,
fieldFilterMap
.
get
(
containingClass
));
}
}
public
static
Method
[]
filterMethods
(
Class
containingClass
,
Method
[]
methods
)
{
public
static
Method
[]
filterMethods
(
Class
<?>
containingClass
,
Method
[]
methods
)
{
if
(
methodFilterMap
==
null
)
{
if
(
methodFilterMap
==
null
)
{
// Bootstrapping
// Bootstrapping
return
methods
;
return
methods
;
...
...
src/share/classes/sun/reflect/ReflectionFactory.java
浏览文件 @
552b1a32
...
@@ -161,7 +161,7 @@ public class ReflectionFactory {
...
@@ -161,7 +161,7 @@ public class ReflectionFactory {
}
}
}
}
public
ConstructorAccessor
newConstructorAccessor
(
Constructor
c
)
{
public
ConstructorAccessor
newConstructorAccessor
(
Constructor
<?>
c
)
{
checkInitted
();
checkInitted
();
Class
<?>
declaringClass
=
c
.
getDeclaringClass
();
Class
<?>
declaringClass
=
c
.
getDeclaringClass
();
...
@@ -250,7 +250,7 @@ public class ReflectionFactory {
...
@@ -250,7 +250,7 @@ public class ReflectionFactory {
/** Creates a new java.lang.reflect.Constructor. Access checks as
/** Creates a new java.lang.reflect.Constructor. Access checks as
per java.lang.reflect.AccessibleObject are not overridden. */
per java.lang.reflect.AccessibleObject are not overridden. */
public
Constructor
newConstructor
(
Class
<?>
declaringClass
,
public
Constructor
<?>
newConstructor
(
Class
<?>
declaringClass
,
Class
<?>[]
parameterTypes
,
Class
<?>[]
parameterTypes
,
Class
<?>[]
checkedExceptions
,
Class
<?>[]
checkedExceptions
,
int
modifiers
,
int
modifiers
,
...
@@ -281,13 +281,13 @@ public class ReflectionFactory {
...
@@ -281,13 +281,13 @@ public class ReflectionFactory {
/** Gets the ConstructorAccessor object for a
/** Gets the ConstructorAccessor object for a
java.lang.reflect.Constructor */
java.lang.reflect.Constructor */
public
ConstructorAccessor
getConstructorAccessor
(
Constructor
c
)
{
public
ConstructorAccessor
getConstructorAccessor
(
Constructor
<?>
c
)
{
return
langReflectAccess
().
getConstructorAccessor
(
c
);
return
langReflectAccess
().
getConstructorAccessor
(
c
);
}
}
/** Sets the ConstructorAccessor object for a
/** Sets the ConstructorAccessor object for a
java.lang.reflect.Constructor */
java.lang.reflect.Constructor */
public
void
setConstructorAccessor
(
Constructor
c
,
public
void
setConstructorAccessor
(
Constructor
<?>
c
,
ConstructorAccessor
accessor
)
ConstructorAccessor
accessor
)
{
{
langReflectAccess
().
setConstructorAccessor
(
c
,
accessor
);
langReflectAccess
().
setConstructorAccessor
(
c
,
accessor
);
...
@@ -320,8 +320,8 @@ public class ReflectionFactory {
...
@@ -320,8 +320,8 @@ public class ReflectionFactory {
//
//
//
//
public
Constructor
newConstructorForSerialization
public
Constructor
<?>
newConstructorForSerialization
(
Class
<?>
classToInstantiate
,
Constructor
constructorToCall
)
(
Class
<?>
classToInstantiate
,
Constructor
<?>
constructorToCall
)
{
{
// Fast path
// Fast path
if
(
constructorToCall
.
getDeclaringClass
()
==
classToInstantiate
)
{
if
(
constructorToCall
.
getDeclaringClass
()
==
classToInstantiate
)
{
...
@@ -334,7 +334,7 @@ public class ReflectionFactory {
...
@@ -334,7 +334,7 @@ public class ReflectionFactory {
constructorToCall
.
getExceptionTypes
(),
constructorToCall
.
getExceptionTypes
(),
constructorToCall
.
getModifiers
(),
constructorToCall
.
getModifiers
(),
constructorToCall
.
getDeclaringClass
());
constructorToCall
.
getDeclaringClass
());
Constructor
c
=
newConstructor
(
constructorToCall
.
getDeclaringClass
(),
Constructor
<?>
c
=
newConstructor
(
constructorToCall
.
getDeclaringClass
(),
constructorToCall
.
getParameterTypes
(),
constructorToCall
.
getParameterTypes
(),
constructorToCall
.
getExceptionTypes
(),
constructorToCall
.
getExceptionTypes
(),
constructorToCall
.
getModifiers
(),
constructorToCall
.
getModifiers
(),
...
@@ -393,9 +393,7 @@ public class ReflectionFactory {
...
@@ -393,9 +393,7 @@ public class ReflectionFactory {
try
{
try
{
inflationThreshold
=
Integer
.
parseInt
(
val
);
inflationThreshold
=
Integer
.
parseInt
(
val
);
}
catch
(
NumberFormatException
e
)
{
}
catch
(
NumberFormatException
e
)
{
throw
(
RuntimeException
)
throw
new
RuntimeException
(
"Unable to parse property sun.reflect.inflationThreshold"
,
e
);
new
RuntimeException
(
"Unable to parse property sun.reflect.inflationThreshold"
).
initCause
(
e
);
}
}
}
}
...
...
src/share/classes/sun/reflect/UnsafeFieldAccessorFactory.java
浏览文件 @
552b1a32
...
@@ -30,7 +30,7 @@ import java.lang.reflect.Modifier;
...
@@ -30,7 +30,7 @@ import java.lang.reflect.Modifier;
class
UnsafeFieldAccessorFactory
{
class
UnsafeFieldAccessorFactory
{
static
FieldAccessor
newFieldAccessor
(
Field
field
,
boolean
override
)
{
static
FieldAccessor
newFieldAccessor
(
Field
field
,
boolean
override
)
{
Class
type
=
field
.
getType
();
Class
<?>
type
=
field
.
getType
();
boolean
isStatic
=
Modifier
.
isStatic
(
field
.
getModifiers
());
boolean
isStatic
=
Modifier
.
isStatic
(
field
.
getModifiers
());
boolean
isFinal
=
Modifier
.
isFinal
(
field
.
getModifiers
());
boolean
isFinal
=
Modifier
.
isFinal
(
field
.
getModifiers
());
boolean
isVolatile
=
Modifier
.
isVolatile
(
field
.
getModifiers
());
boolean
isVolatile
=
Modifier
.
isVolatile
(
field
.
getModifiers
());
...
...
src/share/classes/sun/reflect/UnsafeFieldAccessorImpl.java
浏览文件 @
552b1a32
...
@@ -40,12 +40,15 @@ abstract class UnsafeFieldAccessorImpl extends FieldAccessorImpl {
...
@@ -40,12 +40,15 @@ abstract class UnsafeFieldAccessorImpl extends FieldAccessorImpl {
static
final
Unsafe
unsafe
=
Unsafe
.
getUnsafe
();
static
final
Unsafe
unsafe
=
Unsafe
.
getUnsafe
();
protected
final
Field
field
;
protected
final
Field
field
;
protected
final
int
fieldOffset
;
protected
final
long
fieldOffset
;
protected
final
boolean
isFinal
;
protected
final
boolean
isFinal
;
UnsafeFieldAccessorImpl
(
Field
field
)
{
UnsafeFieldAccessorImpl
(
Field
field
)
{
this
.
field
=
field
;
this
.
field
=
field
;
fieldOffset
=
unsafe
.
fieldOffset
(
field
);
if
(
Modifier
.
isStatic
(
field
.
getModifiers
()))
fieldOffset
=
unsafe
.
staticFieldOffset
(
field
);
else
fieldOffset
=
unsafe
.
objectFieldOffset
(
field
);
isFinal
=
Modifier
.
isFinal
(
field
.
getModifiers
());
isFinal
=
Modifier
.
isFinal
(
field
.
getModifiers
());
}
}
...
...
src/share/classes/sun/reflect/annotation/AnnotationParser.java
浏览文件 @
552b1a32
...
@@ -187,6 +187,7 @@ public class AnnotationParser {
...
@@ -187,6 +187,7 @@ public class AnnotationParser {
* TypeNotPresentException if a referenced annotation type is not
* TypeNotPresentException if a referenced annotation type is not
* available at runtime
* available at runtime
*/
*/
@SuppressWarnings
(
"unchecked"
)
private
static
Annotation
parseAnnotation
(
ByteBuffer
buf
,
private
static
Annotation
parseAnnotation
(
ByteBuffer
buf
,
ConstantPool
constPool
,
ConstantPool
constPool
,
Class
<?>
container
,
Class
<?>
container
,
...
@@ -200,7 +201,7 @@ public class AnnotationParser {
...
@@ -200,7 +201,7 @@ public class AnnotationParser {
annotationClass
=
(
Class
<?
extends
Annotation
>)
parseSig
(
sig
,
container
);
annotationClass
=
(
Class
<?
extends
Annotation
>)
parseSig
(
sig
,
container
);
}
catch
(
IllegalArgumentException
ex
)
{
}
catch
(
IllegalArgumentException
ex
)
{
// support obsolete early jsr175 format class files
// support obsolete early jsr175 format class files
annotationClass
=
constPool
.
getClassAt
(
typeIndex
);
annotationClass
=
(
Class
<?
extends
Annotation
>)
constPool
.
getClassAt
(
typeIndex
);
}
}
}
catch
(
NoClassDefFoundError
e
)
{
}
catch
(
NoClassDefFoundError
e
)
{
if
(
exceptionOnMissingAnnotationClass
)
if
(
exceptionOnMissingAnnotationClass
)
...
@@ -256,7 +257,7 @@ public class AnnotationParser {
...
@@ -256,7 +257,7 @@ public class AnnotationParser {
Class
<?
extends
Annotation
>
type
,
Map
<
String
,
Object
>
memberValues
)
Class
<?
extends
Annotation
>
type
,
Map
<
String
,
Object
>
memberValues
)
{
{
return
(
Annotation
)
Proxy
.
newProxyInstance
(
return
(
Annotation
)
Proxy
.
newProxyInstance
(
type
.
getClassLoader
(),
new
Class
[]
{
type
},
type
.
getClassLoader
(),
new
Class
<?>
[]
{
type
},
new
AnnotationInvocationHandler
(
type
,
memberValues
));
new
AnnotationInvocationHandler
(
type
,
memberValues
));
}
}
...
@@ -287,6 +288,7 @@ public class AnnotationParser {
...
@@ -287,6 +288,7 @@ public class AnnotationParser {
* The member must be of the indicated type. If it is not, this
* The member must be of the indicated type. If it is not, this
* method returns an AnnotationTypeMismatchExceptionProxy.
* method returns an AnnotationTypeMismatchExceptionProxy.
*/
*/
@SuppressWarnings
(
"unchecked"
)
public
static
Object
parseMemberValue
(
Class
<?>
memberType
,
public
static
Object
parseMemberValue
(
Class
<?>
memberType
,
ByteBuffer
buf
,
ByteBuffer
buf
,
ConstantPool
constPool
,
ConstantPool
constPool
,
...
@@ -411,6 +413,7 @@ public class AnnotationParser {
...
@@ -411,6 +413,7 @@ public class AnnotationParser {
* u2 const_name_index;
* u2 const_name_index;
* } enum_const_value;
* } enum_const_value;
*/
*/
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
private
static
Object
parseEnumValue
(
Class
<?
extends
Enum
>
enumType
,
ByteBuffer
buf
,
private
static
Object
parseEnumValue
(
Class
<?
extends
Enum
>
enumType
,
ByteBuffer
buf
,
ConstantPool
constPool
,
ConstantPool
constPool
,
Class
<?>
container
)
{
Class
<?>
container
)
{
...
@@ -433,7 +436,7 @@ public class AnnotationParser {
...
@@ -433,7 +436,7 @@ public class AnnotationParser {
return
Enum
.
valueOf
(
enumType
,
constName
);
return
Enum
.
valueOf
(
enumType
,
constName
);
}
catch
(
IllegalArgumentException
e
)
{
}
catch
(
IllegalArgumentException
e
)
{
return
new
EnumConstantNotPresentExceptionProxy
(
return
new
EnumConstantNotPresentExceptionProxy
(
(
Class
<?
extends
Enum
>)
enumType
,
constName
);
(
Class
<?
extends
Enum
<?>
>)
enumType
,
constName
);
}
}
}
}
...
@@ -451,6 +454,7 @@ public class AnnotationParser {
...
@@ -451,6 +454,7 @@ public class AnnotationParser {
* If the array values do not match arrayType, an
* If the array values do not match arrayType, an
* AnnotationTypeMismatchExceptionProxy will be returned.
* AnnotationTypeMismatchExceptionProxy will be returned.
*/
*/
@SuppressWarnings
(
"unchecked"
)
private
static
Object
parseArray
(
Class
<?>
arrayType
,
private
static
Object
parseArray
(
Class
<?>
arrayType
,
ByteBuffer
buf
,
ByteBuffer
buf
,
ConstantPool
constPool
,
ConstantPool
constPool
,
...
@@ -479,7 +483,7 @@ public class AnnotationParser {
...
@@ -479,7 +483,7 @@ public class AnnotationParser {
}
else
if
(
componentType
==
Class
.
class
)
{
}
else
if
(
componentType
==
Class
.
class
)
{
return
parseClassArray
(
length
,
buf
,
constPool
,
container
);
return
parseClassArray
(
length
,
buf
,
constPool
,
container
);
}
else
if
(
componentType
.
isEnum
())
{
}
else
if
(
componentType
.
isEnum
())
{
return
parseEnumArray
(
length
,
(
Class
<?
extends
Enum
>)
componentType
,
buf
,
return
parseEnumArray
(
length
,
(
Class
<?
extends
Enum
<?>
>)
componentType
,
buf
,
constPool
,
container
);
constPool
,
container
);
}
else
{
}
else
{
assert
componentType
.
isAnnotation
();
assert
componentType
.
isAnnotation
();
...
@@ -679,7 +683,7 @@ public class AnnotationParser {
...
@@ -679,7 +683,7 @@ public class AnnotationParser {
return
typeMismatch
?
exceptionProxy
(
tag
)
:
result
;
return
typeMismatch
?
exceptionProxy
(
tag
)
:
result
;
}
}
private
static
Object
parseEnumArray
(
int
length
,
Class
<?
extends
Enum
>
enumType
,
private
static
Object
parseEnumArray
(
int
length
,
Class
<?
extends
Enum
<?>
>
enumType
,
ByteBuffer
buf
,
ByteBuffer
buf
,
ConstantPool
constPool
,
ConstantPool
constPool
,
Class
<?>
container
)
{
Class
<?>
container
)
{
...
...
src/share/classes/sun/reflect/annotation/EnumConstantNotPresentExceptionProxy.java
浏览文件 @
552b1a32
...
@@ -24,7 +24,6 @@
...
@@ -24,7 +24,6 @@
*/
*/
package
sun.reflect.annotation
;
package
sun.reflect.annotation
;
import
java.lang.annotation.*
;
/**
/**
* ExceptionProxy for EnumConstantNotPresentException.
* ExceptionProxy for EnumConstantNotPresentException.
...
@@ -33,10 +32,10 @@ import java.lang.annotation.*;
...
@@ -33,10 +32,10 @@ import java.lang.annotation.*;
* @since 1.5
* @since 1.5
*/
*/
public
class
EnumConstantNotPresentExceptionProxy
extends
ExceptionProxy
{
public
class
EnumConstantNotPresentExceptionProxy
extends
ExceptionProxy
{
Class
<?
extends
Enum
>
enumType
;
Class
<?
extends
Enum
<?>
>
enumType
;
String
constName
;
String
constName
;
public
EnumConstantNotPresentExceptionProxy
(
Class
<?
extends
Enum
>
enumType
,
public
EnumConstantNotPresentExceptionProxy
(
Class
<?
extends
Enum
<?>
>
enumType
,
String
constName
)
{
String
constName
)
{
this
.
enumType
=
enumType
;
this
.
enumType
=
enumType
;
this
.
constName
=
constName
;
this
.
constName
=
constName
;
...
...
src/share/classes/sun/reflect/generics/reflectiveObjects/TypeVariableImpl.java
浏览文件 @
552b1a32
...
@@ -157,7 +157,7 @@ public class TypeVariableImpl<D extends GenericDeclaration>
...
@@ -157,7 +157,7 @@ public class TypeVariableImpl<D extends GenericDeclaration>
@Override
@Override
public
boolean
equals
(
Object
o
)
{
public
boolean
equals
(
Object
o
)
{
if
(
o
instanceof
TypeVariable
)
{
if
(
o
instanceof
TypeVariable
)
{
TypeVariable
that
=
(
TypeVariable
)
o
;
TypeVariable
<?>
that
=
(
TypeVariable
<?>
)
o
;
GenericDeclaration
thatDecl
=
that
.
getGenericDeclaration
();
GenericDeclaration
thatDecl
=
that
.
getGenericDeclaration
();
String
thatName
=
that
.
getName
();
String
thatName
=
that
.
getName
();
...
...
src/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java
浏览文件 @
552b1a32
...
@@ -69,7 +69,7 @@ public abstract class GenericDeclRepository<S extends Signature>
...
@@ -69,7 +69,7 @@ public abstract class GenericDeclRepository<S extends Signature>
// first, extract type parameter subtree(s) from AST
// first, extract type parameter subtree(s) from AST
FormalTypeParameter
[]
ftps
=
getTree
().
getFormalTypeParameters
();
FormalTypeParameter
[]
ftps
=
getTree
().
getFormalTypeParameters
();
// create array to store reified subtree(s)
// create array to store reified subtree(s)
TypeVariable
[]
tps
=
new
TypeVariable
[
ftps
.
length
];
TypeVariable
<?>[]
tps
=
new
TypeVariable
<?>
[
ftps
.
length
];
// reify all subtrees
// reify all subtrees
for
(
int
i
=
0
;
i
<
ftps
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
ftps
.
length
;
i
++)
{
Reifier
r
=
getReifier
();
// obtain visitor
Reifier
r
=
getReifier
();
// obtain visitor
...
...
src/share/classes/sun/reflect/generics/scope/AbstractScope.java
浏览文件 @
552b1a32
...
@@ -83,8 +83,8 @@ public abstract class AbstractScope<D extends GenericDeclaration>
...
@@ -83,8 +83,8 @@ public abstract class AbstractScope<D extends GenericDeclaration>
* @return the requested type variable, if found
* @return the requested type variable, if found
*/
*/
public
TypeVariable
<?>
lookup
(
String
name
)
{
public
TypeVariable
<?>
lookup
(
String
name
)
{
TypeVariable
[]
tas
=
getRecvr
().
getTypeParameters
();
TypeVariable
<?>
[]
tas
=
getRecvr
().
getTypeParameters
();
for
(
TypeVariable
/*<?>*/
tv
:
tas
)
{
for
(
TypeVariable
<?>
tv
:
tas
)
{
if
(
tv
.
getName
().
equals
(
name
))
{
return
tv
;}
if
(
tv
.
getName
().
equals
(
name
))
{
return
tv
;}
}
}
return
getEnclosingScope
().
lookup
(
name
);
return
getEnclosingScope
().
lookup
(
name
);
...
...
src/share/classes/sun/reflect/generics/scope/ConstructorScope.java
浏览文件 @
552b1a32
...
@@ -32,10 +32,10 @@ import java.lang.reflect.Constructor;
...
@@ -32,10 +32,10 @@ import java.lang.reflect.Constructor;
* This class represents the scope containing the type variables of
* This class represents the scope containing the type variables of
* a constructor.
* a constructor.
*/
*/
public
class
ConstructorScope
extends
AbstractScope
<
Constructor
>
{
public
class
ConstructorScope
extends
AbstractScope
<
Constructor
<?>
>
{
// constructor is private to enforce use of factory method
// constructor is private to enforce use of factory method
private
ConstructorScope
(
Constructor
c
){
private
ConstructorScope
(
Constructor
<?>
c
){
super
(
c
);
super
(
c
);
}
}
...
@@ -61,7 +61,7 @@ public class ConstructorScope extends AbstractScope<Constructor> {
...
@@ -61,7 +61,7 @@ public class ConstructorScope extends AbstractScope<Constructor> {
* @param m - A Constructor whose scope we want to obtain
* @param m - A Constructor whose scope we want to obtain
* @return The type-variable scope for the constructor m
* @return The type-variable scope for the constructor m
*/
*/
public
static
ConstructorScope
make
(
Constructor
c
)
{
public
static
ConstructorScope
make
(
Constructor
<?>
c
)
{
return
new
ConstructorScope
(
c
);
return
new
ConstructorScope
(
c
);
}
}
}
}
src/share/classes/sun/reflect/generics/tree/ClassSignature.java
浏览文件 @
552b1a32
...
@@ -52,5 +52,5 @@ public class ClassSignature implements Signature {
...
@@ -52,5 +52,5 @@ public class ClassSignature implements Signature {
public
ClassTypeSignature
getSuperclass
(){
return
superclass
;}
public
ClassTypeSignature
getSuperclass
(){
return
superclass
;}
public
ClassTypeSignature
[]
getSuperInterfaces
(){
return
superInterfaces
;}
public
ClassTypeSignature
[]
getSuperInterfaces
(){
return
superInterfaces
;}
public
void
accept
(
Visitor
v
){
v
.
visitClassSignature
(
this
);}
public
void
accept
(
Visitor
<?>
v
){
v
.
visitClassSignature
(
this
);}
}
}
src/share/classes/sun/reflect/generics/tree/MethodTypeSignature.java
浏览文件 @
552b1a32
...
@@ -57,5 +57,5 @@ public class MethodTypeSignature implements Signature {
...
@@ -57,5 +57,5 @@ public class MethodTypeSignature implements Signature {
public
ReturnType
getReturnType
(){
return
returnType
;}
public
ReturnType
getReturnType
(){
return
returnType
;}
public
FieldTypeSignature
[]
getExceptionTypes
(){
return
exceptionTypes
;}
public
FieldTypeSignature
[]
getExceptionTypes
(){
return
exceptionTypes
;}
public
void
accept
(
Visitor
v
){
v
.
visitMethodTypeSignature
(
this
);}
public
void
accept
(
Visitor
<?>
v
){
v
.
visitMethodTypeSignature
(
this
);}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录