Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
af1f342c
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看板
提交
af1f342c
编写于
1月 14, 2013
作者:
K
ksrini
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8005252: pack200 should support MethodParameters
Reviewed-by: jrose
上级
bb45e575
变更
13
显示空白变更内容
内联
并排
Showing
13 changed file
with
134 addition
and
27 deletion
+134
-27
src/share/classes/com/sun/java/util/jar/pack/Attribute.java
src/share/classes/com/sun/java/util/jar/pack/Attribute.java
+2
-1
src/share/classes/com/sun/java/util/jar/pack/BandStructure.java
...are/classes/com/sun/java/util/jar/pack/BandStructure.java
+12
-1
src/share/classes/com/sun/java/util/jar/pack/Constants.java
src/share/classes/com/sun/java/util/jar/pack/Constants.java
+5
-1
src/share/classes/com/sun/java/util/jar/pack/PackageReader.java
...are/classes/com/sun/java/util/jar/pack/PackageReader.java
+8
-2
src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java
...are/classes/com/sun/java/util/jar/pack/PackageWriter.java
+6
-4
src/share/native/com/sun/java/util/jar/pack/bands.cpp
src/share/native/com/sun/java/util/jar/pack/bands.cpp
+4
-1
src/share/native/com/sun/java/util/jar/pack/bands.h
src/share/native/com/sun/java/util/jar/pack/bands.h
+7
-1
src/share/native/com/sun/java/util/jar/pack/constants.h
src/share/native/com/sun/java/util/jar/pack/constants.h
+6
-1
src/share/native/com/sun/java/util/jar/pack/main.cpp
src/share/native/com/sun/java/util/jar/pack/main.cpp
+2
-2
src/share/native/com/sun/java/util/jar/pack/unpack.cpp
src/share/native/com/sun/java/util/jar/pack/unpack.cpp
+24
-6
test/ProblemList.txt
test/ProblemList.txt
+0
-3
test/tools/pack200/AttributeTests.java
test/tools/pack200/AttributeTests.java
+43
-3
test/tools/pack200/pack200-verifier/src/xmlkit/ClassReader.java
...ools/pack200/pack200-verifier/src/xmlkit/ClassReader.java
+15
-1
未找到文件。
src/share/classes/com/sun/java/util/jar/pack/Attribute.java
浏览文件 @
af1f342c
/*
* Copyright (c) 2003, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 201
3
, 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
...
...
@@ -177,6 +177,7 @@ class Attribute implements Comparable<Attribute> {
define
(
sd
,
ATTR_CONTEXT_METHOD
,
"Synthetic"
,
""
);
define
(
sd
,
ATTR_CONTEXT_METHOD
,
"Deprecated"
,
""
);
define
(
sd
,
ATTR_CONTEXT_METHOD
,
"Exceptions"
,
"NH[RCH]"
);
define
(
sd
,
ATTR_CONTEXT_METHOD
,
"MethodParameters"
,
"NB[RUNHI]"
);
//define(sd, ATTR_CONTEXT_METHOD, "Code", "HHNI[B]NH[PHPOHPOHRCNH]NH[RUHNI[B]]");
define
(
sd
,
ATTR_CONTEXT_CODE
,
"StackMapTable"
,
...
...
src/share/classes/com/sun/java/util/jar/pack/BandStructure.java
浏览文件 @
af1f342c
/*
* Copyright (c) 2001, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 201
3
, 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
...
...
@@ -1502,6 +1502,10 @@ class BandStructure {
CPRefBand
method_Exceptions_RC
=
method_attr_bands
.
newCPRefBand
(
"method_Exceptions_RC"
,
CONSTANT_Class
);
CPRefBand
method_Signature_RS
=
method_attr_bands
.
newCPRefBand
(
"method_Signature_RS"
,
CONSTANT_Signature
);
MultiBand
method_metadata_bands
=
method_attr_bands
.
newMultiBand
(
"(method_metadata_bands)"
,
UNSIGNED5
);
// band for predefine method parameters
IntBand
method_MethodParameters_NB
=
method_attr_bands
.
newIntBand
(
"method_MethodParameters_NB"
,
BYTE1
);
CPRefBand
method_MethodParameters_name_RUN
=
method_attr_bands
.
newCPRefBand
(
"method_MethodParameters_name_RUN"
,
UNSIGNED5
,
CONSTANT_Utf8
,
NULL_IS_OK
);
IntBand
method_MethodParameters_flag_I
=
method_attr_bands
.
newIntBand
(
"method_MethodParameters_flag_I"
);
MultiBand
class_attr_bands
=
class_bands
.
newMultiBand
(
"(class_attr_bands)"
,
UNSIGNED5
);
IntBand
class_flags_hi
=
class_attr_bands
.
newIntBand
(
"class_flags_hi"
);
...
...
@@ -1768,6 +1772,13 @@ class BandStructure {
method_Exceptions_RC
},
"Exceptions"
,
"NH[RCH]"
);
predefineAttribute
(
METHOD_ATTR_MethodParameters
,
ATTR_CONTEXT_METHOD
,
new
Band
[]{
method_MethodParameters_NB
,
method_MethodParameters_name_RUN
,
method_MethodParameters_flag_I
},
"MethodParameters"
,
"NB[RUNHI]"
);
assert
(
attrCodeEmpty
==
Package
.
attrCodeEmpty
);
predefineAttribute
(
X_ATTR_Signature
,
ATTR_CONTEXT_METHOD
,
new
Band
[]
{
method_Signature_RS
},
...
...
src/share/classes/com/sun/java/util/jar/pack/Constants.java
浏览文件 @
af1f342c
/*
* Copyright (c) 2001, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 201
3
, 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
...
...
@@ -73,6 +73,9 @@ class Constants {
public
final
static
Package
.
Version
JAVA7_PACKAGE_VERSION
=
Package
.
Version
.
of
(
170
,
1
);
public
final
static
Package
.
Version
JAVA8_PACKAGE_VERSION
=
Package
.
Version
.
of
(
171
,
0
);
// upper limit, should point to the latest class version
public
final
static
Package
.
Version
JAVA_MAX_CLASS_VERSION
=
JAVA8_MAX_CLASS_VERSION
;
...
...
@@ -158,6 +161,7 @@ class Constants {
METHOD_ATTR_RuntimeInvisibleParameterAnnotations
=
24
,
CLASS_ATTR_ClassFile_version
=
24
,
METHOD_ATTR_AnnotationDefault
=
25
,
METHOD_ATTR_MethodParameters
=
26
,
CODE_ATTR_StackMapTable
=
0
,
// new in Java 6
CODE_ATTR_LineNumberTable
=
1
,
CODE_ATTR_LocalVariableTable
=
2
,
...
...
src/share/classes/com/sun/java/util/jar/pack/PackageReader.java
浏览文件 @
af1f342c
/*
* Copyright (c) 2001, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 201
3
, 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
...
...
@@ -242,6 +242,7 @@ class PackageReader extends BandStructure {
void
checkArchiveVersion
()
throws
IOException
{
Package
.
Version
versionFound
=
null
;
for
(
Package
.
Version
v
:
new
Package
.
Version
[]
{
JAVA8_PACKAGE_VERSION
,
JAVA7_PACKAGE_VERSION
,
JAVA6_PACKAGE_VERSION
,
JAVA5_PACKAGE_VERSION
...
...
@@ -252,7 +253,9 @@ class PackageReader extends BandStructure {
}
}
if
(
versionFound
==
null
)
{
String
expVer
=
JAVA7_PACKAGE_VERSION
.
toString
()
String
expVer
=
JAVA8_PACKAGE_VERSION
.
toString
()
+
"OR"
+
JAVA7_PACKAGE_VERSION
.
toString
()
+
" OR "
+
JAVA6_PACKAGE_VERSION
.
toString
()
+
" OR "
...
...
@@ -1516,6 +1519,9 @@ class PackageReader extends BandStructure {
// method_metadata_bands
// *method_Exceptions_N :UNSIGNED5
// *method_Exceptions_RC :UNSIGNED5 (cp_Class)
// *method_MethodParameters_NB: BYTE1
// *method_MethodParameters_RUN: UNSIGNED5 (cp_Utf8)
// *method_MethodParameters_I: UNSIGNED5 (flag)
//
// code_attr_bands:
// *code_flags :UNSIGNED5
...
...
src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java
浏览文件 @
af1f342c
/*
* Copyright (c) 2001, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 201
3
, 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
...
...
@@ -142,12 +142,14 @@ class PackageWriter extends BandStructure {
}
else
if
(
highV
.
equals
(
JAVA6_MAX_CLASS_VERSION
)
||
(
highV
.
equals
(
JAVA7_MAX_CLASS_VERSION
)
&&
!
pkg
.
cp
.
haveExtraTags
()))
{
// force down the package version if we have jdk7 classes without
// any Indy references, this is because jdk7 class file (5
2
.0) without
// Indy is identical to jdk6 class file (5
1
.0).
// any Indy references, this is because jdk7 class file (5
1
.0) without
// Indy is identical to jdk6 class file (5
0
.0).
packageVersion
=
JAVA6_PACKAGE_VERSION
;
}
else
if
(
highV
.
equals
(
JAVA7_MAX_CLASS_VERSION
))
{
packageVersion
=
JAVA7_PACKAGE_VERSION
;
}
else
{
// Normal case. Use the newest archive format, when available
packageVersion
=
JAVA
7
_PACKAGE_VERSION
;
packageVersion
=
JAVA
8
_PACKAGE_VERSION
;
}
if
(
verbose
>
0
)
{
...
...
src/share/native/com/sun/java/util/jar/pack/bands.cpp
浏览文件 @
af1f342c
/*
* Copyright (c) 2002, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 201
3
, 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
...
...
@@ -352,6 +352,9 @@ const band_init all_band_inits[] = {
BAND_INIT
(
method_Exceptions_RC
,
UNSIGNED5_spec
,
INDEX
(
CONSTANT_Class
)),
BAND_INIT
(
method_Signature_RS
,
UNSIGNED5_spec
,
INDEX
(
CONSTANT_Signature
)),
BAND_INIT
(
method_metadata_bands
,
-
1
,
-
1
),
BAND_INIT
(
method_MethodParameters_NB
,
BYTE1_spec
,
0
),
BAND_INIT
(
method_MethodParameters_name_RUN
,
UNSIGNED5_spec
,
NULL_OR_INDEX
(
CONSTANT_Utf8
)),
BAND_INIT
(
method_MethodParameters_flag_I
,
UNSIGNED5_spec
,
0
),
BAND_INIT
(
method_attr_bands
,
-
1
,
-
1
),
BAND_INIT
(
class_flags_hi
,
UNSIGNED5_spec
,
0
),
BAND_INIT
(
class_flags_lo
,
UNSIGNED5_spec
,
0
),
...
...
src/share/native/com/sun/java/util/jar/pack/bands.h
浏览文件 @
af1f342c
/*
* Copyright (c) 2002, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 201
3
, 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
...
...
@@ -212,6 +212,9 @@ enum band_number {
e_method_Exceptions_RC
,
e_method_Signature_RS
,
e_method_metadata_bands
,
e_method_MethodParameters_NB
,
e_method_MethodParameters_name_RUN
,
e_method_MethodParameters_flag_I
,
e_method_attr_bands
,
e_class_flags_hi
,
...
...
@@ -388,6 +391,9 @@ enum band_number {
#define method_Exceptions_N all_bands[e_method_Exceptions_N]
#define method_Exceptions_RC all_bands[e_method_Exceptions_RC]
#define method_Signature_RS all_bands[e_method_Signature_RS]
#define method_MethodParameters_NB all_bands[e_method_MethodParameters_NB]
#define method_MethodParameters_name_RUN all_bands[e_method_MethodParameters_name_RUN]
#define method_MethodParameters_flag_I all_bands[e_method_MethodParameters_flag_I]
#define method_attr_bands all_bands[e_method_attr_bands]
#define class_flags_hi all_bands[e_class_flags_hi]
#define class_flags_lo all_bands[e_class_flags_lo]
...
...
src/share/native/com/sun/java/util/jar/pack/constants.h
浏览文件 @
af1f342c
/*
* Copyright (c) 2001, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 201
3
, 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
...
...
@@ -59,6 +59,9 @@
#define JAVA7_PACKAGE_MAJOR_VERSION 170
#define JAVA7_PACKAGE_MINOR_VERSION 1
#define JAVA8_PACKAGE_MAJOR_VERSION 171
#define JAVA8_PACKAGE_MINOR_VERSION 0
// magic number for gzip streams (for processing pack200-gzip data)
#define GZIP_MAGIC 0x1F8B0800
#define GZIP_MAGIC_MASK 0xFFFFFF00 // last byte is variable "flg" field
...
...
@@ -120,6 +123,7 @@ enum {
METHOD_ATTR_RuntimeVisibleParameterAnnotations
=
23
,
METHOD_ATTR_RuntimeInvisibleParameterAnnotations
=
24
,
METHOD_ATTR_AnnotationDefault
=
25
,
METHOD_ATTR_MethodParameters
=
26
,
CODE_ATTR_StackMapTable
=
0
,
CODE_ATTR_LineNumberTable
=
1
,
CODE_ATTR_LocalVariableTable
=
2
,
...
...
@@ -160,6 +164,7 @@ enum {
F(METHOD_ATTR_RuntimeVisibleParameterAnnotations,RuntimeVisibleParameterAnnotations) \
F(METHOD_ATTR_RuntimeInvisibleParameterAnnotations,RuntimeInvisibleParameterAnnotations) \
F(METHOD_ATTR_AnnotationDefault,AnnotationDefault) \
F(METHOD_ATTR_MethodParameters,MethodParameters) \
/*(end)*/
#define CODE_ATTR_DO(F) \
F(CODE_ATTR_StackMapTable,StackMapTable) \
...
...
src/share/native/com/sun/java/util/jar/pack/main.cpp
浏览文件 @
af1f342c
/*
* Copyright (c) 2003, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 201
3
, 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
...
...
@@ -71,7 +71,7 @@ NOT_PRODUCT(static THRTYPE uThread = -1;)
unpacker
*
unpacker
::
non_mt_current
=
null
;
unpacker
*
unpacker
::
current
()
{
assert
(
uThread
==
THREAD_SELF
);
//
assert(uThread == THREAD_SELF);
return
non_mt_current
;
}
static
void
set_current_unpacker
(
unpacker
*
u
)
{
...
...
src/share/native/com/sun/java/util/jar/pack/unpack.cpp
浏览文件 @
af1f342c
/*
* Copyright (c) 2001, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 201
3
, 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
...
...
@@ -648,13 +648,14 @@ void unpacker::read_file_header() {
majver
=
hdr
.
getInt
();
hdrVals
+=
2
;
int
majmin
[
3
][
2
]
=
{
int
majmin
[
4
][
2
]
=
{
{
JAVA5_PACKAGE_MAJOR_VERSION
,
JAVA5_PACKAGE_MINOR_VERSION
},
{
JAVA6_PACKAGE_MAJOR_VERSION
,
JAVA6_PACKAGE_MINOR_VERSION
},
{
JAVA7_PACKAGE_MAJOR_VERSION
,
JAVA7_PACKAGE_MINOR_VERSION
}
{
JAVA7_PACKAGE_MAJOR_VERSION
,
JAVA7_PACKAGE_MINOR_VERSION
},
{
JAVA8_PACKAGE_MAJOR_VERSION
,
JAVA8_PACKAGE_MINOR_VERSION
}
};
int
majminfound
=
false
;
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
if
(
majver
==
majmin
[
i
][
0
]
&&
minver
==
majmin
[
i
][
1
])
{
majminfound
=
true
;
break
;
...
...
@@ -663,11 +664,12 @@ void unpacker::read_file_header() {
if
(
majminfound
==
null
)
{
char
message
[
200
];
sprintf
(
message
,
"@"
ERROR_FORMAT
": magic/ver = "
"%08X/%d.%d should be %08X/%d.%d OR %08X/%d.%d OR %08X/%d.%d
\n
"
,
"%08X/%d.%d should be %08X/%d.%d OR %08X/%d.%d OR %08X/%d.%d
OR %08X/%d.%d
\n
"
,
magic
,
majver
,
minver
,
JAVA_PACKAGE_MAGIC
,
JAVA5_PACKAGE_MAJOR_VERSION
,
JAVA5_PACKAGE_MINOR_VERSION
,
JAVA_PACKAGE_MAGIC
,
JAVA6_PACKAGE_MAJOR_VERSION
,
JAVA6_PACKAGE_MINOR_VERSION
,
JAVA_PACKAGE_MAGIC
,
JAVA7_PACKAGE_MAJOR_VERSION
,
JAVA7_PACKAGE_MINOR_VERSION
);
JAVA_PACKAGE_MAGIC
,
JAVA7_PACKAGE_MAJOR_VERSION
,
JAVA7_PACKAGE_MINOR_VERSION
,
JAVA_PACKAGE_MAGIC
,
JAVA8_PACKAGE_MAJOR_VERSION
,
JAVA8_PACKAGE_MINOR_VERSION
);
abort
(
message
);
}
CHECK
;
...
...
@@ -2481,6 +2483,13 @@ void unpacker::read_attrs(int attrc, int obj_count) {
ad
.
readBandData
(
METHOD_ATTR_RuntimeInvisibleParameterAnnotations
);
ad
.
readBandData
(
METHOD_ATTR_AnnotationDefault
);
CHECK
;
count
=
ad
.
predefCount
(
METHOD_ATTR_MethodParameters
);
method_MethodParameters_NB
.
readData
(
count
);
count
=
method_MethodParameters_NB
.
getIntTotal
();
method_MethodParameters_name_RUN
.
readData
(
count
);
method_MethodParameters_flag_I
.
readData
(
count
);
CHECK
;
break
;
case
ATTR_CONTEXT_CODE
:
...
...
@@ -4417,6 +4426,15 @@ int unpacker::write_attrs(int attrc, julong indexBits) {
}
break
;
case
ADH_BYTE
(
ATTR_CONTEXT_METHOD
,
METHOD_ATTR_MethodParameters
):
aname
=
cp
.
sym
[
cpool
::
s_MethodParameters
];
putu1
(
count
=
method_MethodParameters_NB
.
getByte
());
for
(
j
=
0
;
j
<
count
;
j
++
)
{
putref
(
method_MethodParameters_name_RUN
.
getRefN
());
putu4
(
method_MethodParameters_flag_I
.
getInt
());
}
break
;
case
ADH_BYTE
(
ATTR_CONTEXT_CODE
,
CODE_ATTR_StackMapTable
):
aname
=
cp
.
sym
[
cpool
::
s_StackMapTable
];
// (keep this code aligned with its brother in unpacker::read_attrs)
...
...
test/ProblemList.txt
浏览文件 @
af1f342c
...
...
@@ -321,9 +321,6 @@ tools/pack200/Pack200Test.java generic-all
# 7150569
tools/launcher/UnicodeTest.java macosx-all
# 8005252
tools/pack200/AttributeTests.java generic-all
############################################################################
# jdk_jdi
...
...
test/tools/pack200/AttributeTests.java
浏览文件 @
af1f342c
/*
* Copyright (c) 2010, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 201
3
, 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
...
...
@@ -21,13 +21,15 @@
* questions.
*/
import
java.io.File
;
import
java.io.IOException
;
import
java.nio.charset.Charset
;
import
java.nio.file.Files
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
static
java
.
nio
.
file
.
StandardOpenOption
.*;
/*
* @test
* @bug 6746111
* @bug 6746111
8005252
* @summary tests various classfile format and attribute handling by pack200
* @compile -XDignore.symbol.file Utils.java AttributeTests.java
* @run main AttributeTests
...
...
@@ -37,8 +39,46 @@ public class AttributeTests {
public
static
void
main
(
String
...
args
)
throws
Exception
{
test6746111
();
testMethodParameters
();
}
/*
* this tests ensure that MethodParameters produces by javac is packed
* correctly. Usually this is not the case as new attributes are available
* in the sdk jars, since MethodParameters happens to be an optional
* attribute, thus this test.
*/
static
void
testMethodParameters
()
throws
Exception
{
List
<
String
>
scratch
=
new
ArrayList
<>();
final
String
fname
=
"MP"
;
String
javaFileName
=
fname
+
Utils
.
JAVA_FILE_EXT
;
String
javaClassName
=
fname
+
Utils
.
CLASS_FILE_EXT
;
scratch
.
add
(
"class "
+
fname
+
" {"
);
scratch
.
add
(
"void foo2(int j, final int k){}"
);
scratch
.
add
(
"}"
);
File
cwd
=
new
File
(
"."
);
File
javaFile
=
new
File
(
cwd
,
javaFileName
);
Files
.
write
(
javaFile
.
toPath
(),
scratch
,
Charset
.
defaultCharset
(),
CREATE
,
TRUNCATE_EXISTING
);
Utils
.
compiler
(
javaFile
.
getName
(),
"-parameters"
);
// jar the file up
File
testjarFile
=
new
File
(
cwd
,
"test"
+
Utils
.
JAR_FILE_EXT
);
Utils
.
jar
(
"cvf"
,
testjarFile
.
getName
(),
javaClassName
);
// pack using --repack
File
outjarFile
=
new
File
(
cwd
,
"out"
+
Utils
.
JAR_FILE_EXT
);
scratch
.
clear
();
scratch
.
add
(
Utils
.
getPack200Cmd
());
scratch
.
add
(
"--repack"
);
scratch
.
add
(
"--unknown-attribute=error"
);
scratch
.
add
(
outjarFile
.
getName
());
scratch
.
add
(
testjarFile
.
getName
());
Utils
.
runExec
(
scratch
);
Utils
.
doCompareVerify
(
testjarFile
,
outjarFile
);
}
/*
* this test checks to see if we get the expected strings for output
*/
...
...
test/tools/pack200/pack200-verifier/src/xmlkit/ClassReader.java
浏览文件 @
af1f342c
/*
* Copyright (c) 2010, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 201
3
, 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
...
...
@@ -53,6 +53,7 @@ import com.sun.tools.classfile.LineNumberTable_attribute;
import
com.sun.tools.classfile.LocalVariableTable_attribute
;
import
com.sun.tools.classfile.LocalVariableTypeTable_attribute
;
import
com.sun.tools.classfile.Method
;
import
com.sun.tools.classfile.MethodParameters_attribute
;
import
com.sun.tools.classfile.Opcode
;
import
com.sun.tools.classfile.RuntimeInvisibleAnnotations_attribute
;
import
com.sun.tools.classfile.RuntimeInvisibleParameterAnnotations_attribute
;
...
...
@@ -1073,6 +1074,19 @@ class AttributeVisitor implements Attribute.Visitor<Element, Element> {
return
null
;
// already added to parent
}
@Override
public
Element
visitMethodParameters
(
MethodParameters_attribute
mp
,
Element
p
)
{
String
name
=
x
.
getCpString
(
mp
.
attribute_name_index
);
for
(
MethodParameters_attribute
.
Entry
e
:
mp
.
method_parameter_table
)
{
Element
l
=
new
Element
(
name
);
l
.
setAttr
(
"name"
,
x
.
getCpString
(
e
.
name_index
));
l
.
setAttr
(
"flag"
,
""
+
e
.
flags
);
l
.
trimToSize
();
p
.
add
(
l
);
}
return
null
;
// already added to parent
}
private
void
parseAnnotations
(
Annotation
[]
ra
,
Element
p
)
{
for
(
Annotation
anno
:
ra
)
{
Element
ea
=
new
Element
(
"Member"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录