Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
8e4f38f9
D
dragonwell8_langtools
项目概览
openanolis
/
dragonwell8_langtools
通知
0
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_langtools
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
8e4f38f9
编写于
3月 23, 2010
作者:
J
jjg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
Reviewed-by: darcy
上级
00f24ced
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
159 addition
and
12 deletion
+159
-12
src/share/classes/com/sun/tools/javap/ClassWriter.java
src/share/classes/com/sun/tools/javap/ClassWriter.java
+12
-12
test/tools/javap/6937244/T6937244.java
test/tools/javap/6937244/T6937244.java
+57
-0
test/tools/javap/6937244/T6937244A.java
test/tools/javap/6937244/T6937244A.java
+90
-0
未找到文件。
src/share/classes/com/sun/tools/javap/ClassWriter.java
浏览文件 @
8e4f38f9
...
...
@@ -225,15 +225,15 @@ public class ClassWriter extends BasicWriter {
writeModifiers
(
flags
.
getFieldModifiers
());
Signature_attribute
sigAttr
=
getSignature
(
f
.
attributes
);
if
(
sigAttr
==
null
)
print
(
getFieldType
(
f
.
descriptor
));
print
(
get
Java
FieldType
(
f
.
descriptor
));
else
{
try
{
Type
t
=
sigAttr
.
getParsedSignature
().
getType
(
constant_pool
);
print
(
t
);
print
(
getJavaName
(
t
.
toString
())
);
}
catch
(
ConstantPoolException
e
)
{
// report error?
// fall back on non-generic descriptor
print
(
getFieldType
(
f
.
descriptor
));
print
(
get
Java
FieldType
(
f
.
descriptor
));
}
}
print
(
" "
);
...
...
@@ -314,14 +314,14 @@ public class ClassWriter extends BasicWriter {
}
if
(
getName
(
m
).
equals
(
"<init>"
))
{
print
(
getJavaName
(
classFile
));
print
(
getParameterTypes
(
d
,
flags
));
print
(
get
Java
ParameterTypes
(
d
,
flags
));
}
else
if
(
getName
(
m
).
equals
(
"<clinit>"
))
{
print
(
"{}"
);
}
else
{
print
(
getReturnType
(
d
));
print
(
get
Java
ReturnType
(
d
));
print
(
" "
);
print
(
getName
(
m
));
print
(
getParameterTypes
(
d
,
flags
));
print
(
get
Java
ParameterTypes
(
d
,
flags
));
}
Attribute
e_attr
=
m
.
attributes
.
get
(
Attribute
.
Exceptions
);
...
...
@@ -460,9 +460,9 @@ public class ClassWriter extends BasicWriter {
}
}
String
getFieldType
(
Descriptor
d
)
{
String
get
Java
FieldType
(
Descriptor
d
)
{
try
{
return
d
.
getFieldType
(
constant_pool
);
return
getJavaName
(
d
.
getFieldType
(
constant_pool
)
);
}
catch
(
ConstantPoolException
e
)
{
return
report
(
e
);
}
catch
(
DescriptorException
e
)
{
...
...
@@ -470,9 +470,9 @@ public class ClassWriter extends BasicWriter {
}
}
String
getReturnType
(
Descriptor
d
)
{
String
get
Java
ReturnType
(
Descriptor
d
)
{
try
{
return
d
.
getReturnType
(
constant_pool
);
return
getJavaName
(
d
.
getReturnType
(
constant_pool
)
);
}
catch
(
ConstantPoolException
e
)
{
return
report
(
e
);
}
catch
(
DescriptorException
e
)
{
...
...
@@ -480,9 +480,9 @@ public class ClassWriter extends BasicWriter {
}
}
String
getParameterTypes
(
Descriptor
d
,
AccessFlags
flags
)
{
String
get
Java
ParameterTypes
(
Descriptor
d
,
AccessFlags
flags
)
{
try
{
return
adjustVarargs
(
flags
,
d
.
getParameterTypes
(
constant_pool
));
return
getJavaName
(
adjustVarargs
(
flags
,
d
.
getParameterTypes
(
constant_pool
)
));
}
catch
(
ConstantPoolException
e
)
{
return
report
(
e
);
}
catch
(
DescriptorException
e
)
{
...
...
test/tools/javap/6937244/T6937244.java
0 → 100644
浏览文件 @
8e4f38f9
/*
* Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 6937244
* @summary fields display with JVMS names, not Java names
*/
import
java.io.*
;
public
class
T6937244
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
new
T6937244
().
run
();
}
void
run
()
throws
Exception
{
StringWriter
sw
=
new
StringWriter
();
PrintWriter
pw
=
new
PrintWriter
(
sw
);
String
[]
args
=
{
"java.lang.String"
};
int
rc
=
com
.
sun
.
tools
.
javap
.
Main
.
run
(
args
,
pw
);
pw
.
close
();
String
out
=
sw
.
toString
();
System
.
err
.
println
(
out
);
if
(
rc
!=
0
)
throw
new
Exception
(
"unexpected exit from javap: "
+
rc
);
for
(
String
line:
out
.
split
(
"[\r\n]+"
))
{
if
(
line
.
contains
(
"CASE_INSENSITIVE_ORDER"
))
{
if
(
line
.
matches
(
"\\s*\\Qpublic static final java.util.Comparator<java.lang.String> CASE_INSENSITIVE_ORDER;\\E\\s*"
))
return
;
throw
new
Exception
(
"declaration not shown as expected"
);
}
}
throw
new
Exception
(
"declaration of CASE_INSENSITIVE_ORDER not found"
);
}
}
test/tools/javap/6937244/T6937244A.java
0 → 100644
浏览文件 @
8e4f38f9
/*
* Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 6937244
* @summary fields display with JVMS names, not Java names
*/
import
java.io.*
;
import
java.util.*
;
public
class
T6937244A
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
new
T6937244A
().
run
();
}
void
run
()
throws
Exception
{
StringWriter
sw
=
new
StringWriter
();
PrintWriter
pw
=
new
PrintWriter
(
sw
);
String
[]
args
=
{
"Test"
};
int
rc
=
com
.
sun
.
tools
.
javap
.
Main
.
run
(
args
,
pw
);
pw
.
close
();
String
out
=
sw
.
toString
();
System
.
err
.
println
(
out
);
if
(
rc
!=
0
)
throw
new
Exception
(
"unexpected exit from javap: "
+
rc
);
int
count
=
0
;
for
(
String
line:
out
.
split
(
"[\r\n]+"
))
{
if
(
line
.
contains
(
"extends"
))
{
verify
(
line
,
"extends java.lang.Object implements java.util.List<java.lang.String>"
);
count
++;
}
if
(
line
.
contains
(
"field"
))
{
verify
(
line
,
"java.util.List<java.lang.String> field"
);
count
++;
}
if
(
line
.
contains
(
"method"
))
{
verify
(
line
,
"java.util.List<java.lang.String> method(java.util.List<java.lang.String>) throws java.lang.Exception"
);
count
++;
}
}
// final backstop check
if
(
out
.
contains
(
"/"
))
throw
new
Exception
(
"unexpected \"/\" in output"
);
if
(
count
!=
3
)
throw
new
Exception
(
"wrong number of matches found: "
+
count
);
}
void
verify
(
String
line
,
String
expect
)
throws
Exception
{
if
(!
line
.
contains
(
expect
))
{
System
.
err
.
println
(
"line: "
+
line
);
System
.
err
.
println
(
"expect: "
+
expect
);
throw
new
Exception
(
"expected string not found in line"
);
}
}
}
abstract
class
Test
implements
List
<
String
>
{
public
List
<
String
>
field
;
public
List
<
String
>
method
(
List
<
String
>
arg
)
throws
Exception
{
return
null
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录