Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell11
提交
889d2efa
D
dragonwell11
项目概览
openanolis
/
dragonwell11
通知
7
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell11
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
889d2efa
编写于
8月 07, 2013
作者:
S
sundar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8022483: Nashorn compatibility issues in jhat's OQL feature
Reviewed-by: lagergren, attila, hannesw
上级
91ffcc8a
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
75 addition
and
66 deletion
+75
-66
jdk/src/share/classes/com/sun/tools/hat/resources/hat.js
jdk/src/share/classes/com/sun/tools/hat/resources/hat.js
+66
-56
jdk/src/share/classes/com/sun/tools/hat/resources/oqlhelp.html
...rc/share/classes/com/sun/tools/hat/resources/oqlhelp.html
+9
-10
未找到文件。
jdk/src/share/classes/com/sun/tools/hat/resources/hat.js
浏览文件 @
889d2efa
...
...
@@ -263,18 +263,21 @@ function wrapJavaObject(thing) {
if
(
name
==
'
class
'
)
{
return
wrapJavaValue
(
instance
.
clazz
);
}
else
if
(
name
==
'
toString
'
)
{
return
function
()
{
return
instance
.
toString
();
}
}
else
if
(
name
==
'
wrapped-object
'
)
{
return
instance
;
}
return
undefined
;
},
__call__
:
function
(
name
)
{
if
(
name
==
'
toString
'
)
{
return
instance
.
toString
();
}
else
{
return
undefined
;
}
}
}
}
// return wrapper for Java Class objects
...
...
@@ -297,7 +300,7 @@ function wrapJavaObject(thing) {
return
true
;
}
}
return
theJavaClassProto
[
name
]
!=
undefined
;
return
false
;
},
__get__
:
function
(
name
)
{
for
(
var
i
in
fields
)
{
...
...
@@ -305,7 +308,7 @@ function wrapJavaObject(thing) {
return
wrapJavaValue
(
fields
[
i
].
value
);
}
}
return
theJavaClassProto
[
name
]
;
return
undefined
;
}
}
...
...
@@ -322,7 +325,12 @@ function wrapJavaObject(thing) {
this
.
name
=
jclass
.
name
;
this
.
fields
=
jclass
.
fields
;
this
[
'
wrapped-object
'
]
=
jclass
;
this
.
__proto__
=
this
.
statics
;
}
for
(
var
i
in
theJavaClassProto
)
{
if
(
typeof
theJavaClassProto
[
i
]
==
'
function
'
)
{
JavaClassWrapper
.
prototype
[
i
]
=
theJavaClassProto
[
i
];
}
}
// returns wrapper for Java object arrays
...
...
@@ -334,31 +342,34 @@ function wrapJavaObject(thing) {
__getIds__
:
function
()
{
var
res
=
new
Array
(
elements
.
length
);
for
(
var
i
=
0
;
i
<
elements
.
length
;
i
++
)
{
res
[
i
]
=
i
;
res
[
i
]
=
String
(
i
)
;
}
return
res
;
},
__has__
:
function
(
name
)
{
return
(
typeof
(
name
)
==
'
number
'
&&
name
>=
0
&&
name
<
elements
.
length
)
||
return
(
name
>=
0
&&
name
<
elements
.
length
)
||
name
==
'
length
'
||
name
==
'
class
'
||
name
==
'
toString
'
||
name
==
'
wrapped-object
'
;
},
__get__
:
function
(
name
)
{
if
(
typeof
(
name
)
==
'
number
'
&&
name
>=
0
&&
name
<
elements
.
length
)
{
if
(
name
>=
0
&&
name
<
elements
.
length
)
{
return
wrapJavaValue
(
elements
[
name
]);
}
else
if
(
name
==
'
length
'
)
{
return
elements
.
length
;
}
else
if
(
name
==
'
class
'
)
{
return
wrapJavaValue
(
array
.
clazz
);
}
else
if
(
name
==
'
toString
'
)
{
return
function
()
{
return
array
.
toString
();
}
}
else
if
(
name
==
'
wrapped-object
'
)
{
return
array
;
}
else
{
return
undefined
;
}
},
__call__
:
function
(
name
)
{
if
(
name
==
'
toString
'
)
{
return
array
.
toString
();
}
else
{
return
undefined
;
}
}
}
}
...
...
@@ -373,26 +384,22 @@ function wrapJavaObject(thing) {
__getIds__
:
function
()
{
var
r
=
new
Array
(
array
.
length
);
for
(
var
i
=
0
;
i
<
array
.
length
;
i
++
)
{
r
[
i
]
=
i
;
r
[
i
]
=
String
(
i
)
;
}
return
r
;
},
__has__
:
function
(
name
)
{
return
(
typeof
(
name
)
==
'
number
'
&&
name
>=
0
&&
name
<
array
.
length
)
||
return
(
name
>=
0
&&
name
<
array
.
length
)
||
name
==
'
length
'
||
name
==
'
class
'
||
name
==
'
toString
'
||
name
==
'
wrapped-object
'
;
},
__get__
:
function
(
name
)
{
if
(
typeof
(
name
)
==
'
number
'
&&
name
>=
0
&&
name
<
array
.
length
)
{
if
(
name
>=
0
&&
name
<
array
.
length
)
{
return
elements
[
name
];
}
if
(
name
==
'
length
'
)
{
return
array
.
length
;
}
else
if
(
name
==
'
toString
'
)
{
return
function
()
{
return
array
.
valueString
(
true
);
}
}
else
if
(
name
==
'
wrapped-object
'
)
{
return
array
;
}
else
if
(
name
==
'
class
'
)
{
...
...
@@ -400,6 +407,13 @@ function wrapJavaObject(thing) {
}
else
{
return
undefined
;
}
},
__call__
:
function
(
name
)
{
if
(
name
==
'
toString
'
)
{
return
array
.
valueString
(
true
);
}
else
{
return
undefined
;
}
}
}
}
...
...
@@ -673,34 +687,33 @@ function wrapHeapSnapshot(heap) {
__getIds__
:
function
()
{
var
res
=
new
Array
(
path
.
length
);
for
(
var
i
=
0
;
i
<
path
.
length
;
i
++
)
{
res
[
i
]
=
i
;
res
[
i
]
=
String
(
i
)
;
}
return
res
;
},
__has__
:
function
(
name
)
{
return
(
typeof
(
name
)
==
'
number
'
&&
name
>=
0
&&
name
<
path
.
length
)
||
return
(
name
>=
0
&&
name
<
path
.
length
)
||
name
==
'
length
'
||
name
==
'
toHtml
'
||
name
==
'
toString
'
;
},
__get__
:
function
(
name
)
{
if
(
typeof
(
name
)
==
'
number
'
&&
name
>=
0
&&
name
<
path
.
length
)
{
if
(
name
>=
0
&&
name
<
path
.
length
)
{
return
path
[
name
];
}
else
if
(
name
==
'
length
'
)
{
return
path
.
length
;
}
else
if
(
name
==
'
toHtml
'
)
{
return
function
()
{
return
computeDescription
(
true
);
}
else
{
return
undefined
;
}
},
__call__
:
function
(
name
)
{
if
(
name
==
'
toHtml
'
)
{
return
computeDescription
(
true
);
}
else
if
(
name
==
'
toString
'
)
{
return
function
()
{
return
computeDescription
(
false
);
}
}
else
{
return
undefined
;
}
}
,
}
};
}
...
...
@@ -1005,22 +1018,8 @@ function toHtml(obj) {
return
"
<a href='/object/
"
+
id
+
"
'>
"
+
name
+
"
@
"
+
id
+
"
</a>
"
;
}
}
else
if
((
typeof
(
obj
)
==
'
object
'
)
||
(
obj
instanceof
JSAdapter
))
{
if
(
obj
instanceof
java
.
lang
.
Object
)
{
// script wrapped Java object
obj
=
wrapIterator
(
obj
);
// special case for enumeration
if
(
obj
instanceof
java
.
util
.
Enumeration
)
{
var
res
=
"
[
"
;
while
(
obj
.
hasMoreElements
())
{
res
+=
toHtml
(
obj
.
nextElement
())
+
"
,
"
;
}
res
+=
"
]
"
;
return
res
;
}
else
{
return
obj
;
}
}
else
if
(
obj
instanceof
Array
)
{
}
else
if
(
obj
instanceof
Object
)
{
if
(
Array
.
isArray
(
obj
))
{
// script array
var
res
=
"
[
"
;
for
(
var
i
in
obj
)
{
...
...
@@ -1047,9 +1046,20 @@ function toHtml(obj) {
}
}
}
else
{
// JavaScript primitive value
// a Java object
obj
=
wrapIterator
(
obj
);
// special case for enumeration
if
(
obj
instanceof
java
.
util
.
Enumeration
)
{
var
res
=
"
[
"
;
while
(
obj
.
hasMoreElements
())
{
res
+=
toHtml
(
obj
.
nextElement
())
+
"
,
"
;
}
res
+=
"
]
"
;
return
res
;
}
else
{
return
obj
;
}
}
}
/*
...
...
jdk/src/share/classes/com/sun/tools/hat/resources/oqlhelp.html
浏览文件 @
889d2efa
...
...
@@ -79,7 +79,7 @@ bound to a JavaScript variable of the identifier name specified in <span class="
<li>
select all Strings of length 100 or more
<pre>
<code>
select s from java.lang.String s where s.
count
>= 100
select s from java.lang.String s where s.
value.length
>= 100
</code>
</pre>
<li>
select all int arrays of length 256 or more
...
...
@@ -92,7 +92,7 @@ bound to a JavaScript variable of the identifier name specified in <span class="
<pre>
<code>
select s.value.toString() from java.lang.String s
where /java/(s.value.toString())
where /java/
.test
(s.value.toString())
</code>
</pre>
<li>
show path value of all File objects
...
...
@@ -219,7 +219,6 @@ Examples:
<pre>
<code>
select heap.findClass("java.lang.System").statics.props
select heap.findClass("java.lang.System").props
</code>
</pre>
<li>
get number of fields of java.lang.String class
...
...
@@ -237,7 +236,7 @@ Examples:
<li>
select all classes that have name pattern java.net.*
<pre>
<code>
select
<a
href=
"#filter"
>
filter
</a>
(heap.classes(), "/java.net./(it.name)")
select
<a
href=
"#filter"
>
filter
</a>
(heap.classes(), "/java.net./
.test
(it.name)")
</code>
</pre>
</ul>
...
...
@@ -536,7 +535,7 @@ refer to the following built-in variables.
Example: print number of classes that have specific name pattern
<pre>
<code>
select count(
<a
href=
"#classes"
>
heap.classes()
</a>
, "/java.io./(it.name)")
select count(
<a
href=
"#classes"
>
heap.classes()
</a>
, "/java.io./
.test
(it.name)")
</code>
</pre>
...
...
@@ -559,14 +558,14 @@ Examples:
<li>
show all classes that have java.io.* name pattern
<pre>
<code>
select filter(
<a
href=
"#classes"
>
heap.classes
</a>
(), "/java.io./(it.name)")
select filter(
<a
href=
"#classes"
>
heap.classes
</a>
(), "/java.io./
.test
(it.name)")
</code>
</pre>
<li>
show all referrers of URL object where the referrer is not from
java.net package
<pre>
<code>
select filter(
<a
href=
"#referrers"
>
referrers
</a>
(u), "! /java.net./(
<a
href=
"#classof"
>
classof
</a>
(it).name)")
select filter(
<a
href=
"#referrers"
>
referrers
</a>
(u), "! /java.net./
.test
(
<a
href=
"#classof"
>
classof
</a>
(it).name)")
from java.net.URL u
</code>
</pre>
...
...
@@ -619,13 +618,13 @@ Examples:
<li>
find the maximum length of any String instance
<pre>
<code>
select max(map(heap.objects('java.lang.String', false), 'it.
count
'))
select max(map(heap.objects('java.lang.String', false), 'it.
value.length
'))
</code>
</pre>
<li>
find string instance that has the maximum length
<pre>
<code>
select max(heap.objects('java.lang.String'), 'lhs.
count > rhs.count
')
select max(heap.objects('java.lang.String'), 'lhs.
value.length > rhs.value.length
')
</code>
</pre>
</ul>
...
...
@@ -775,7 +774,7 @@ and walk until parent is null using the callback function to map call.
<pre>
<code>
select
<a
href=
"#map"
>
map
</a>
(
<a
href=
"#filter"
>
filter(
<a
href=
"#findClass"
>
heap.findClass
</a>
('java.lang.System').props.table, 'it != null'),
select
<a
href=
"#map"
>
map
</a>
(
<a
href=
"#filter"
>
filter(
<a
href=
"#findClass"
>
heap.findClass
</a>
('java.lang.System').
statics.
props.table, 'it != null'),
function (it) {
var res = "";
while (it != null) {
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录