2

我可以通过使用如下查询来获取所有 Thread 对象

SELECT OBJECTS dominators(s) FROM java.lang.Thread s

那么如果我想进一步分析返回的结果对象,我认为 OQL 应该如下所示:

SELECT * from (SELECT OBJECTS dominators(s) FROM java.lang.Thread s)

但它转向 ClassCastException。

Problem reported: 
ClassCastException occured. Remember: sub queries with the modifier INSTANCESOF or INCLUDING SUBCLASSES must return only class objects 

java.lang.ClassCastException: org.eclipse.mat.parser.model.InstanceImpl cannot be cast to org.eclipse.mat.snapshot.model.IClass
    at org.eclipse.mat.parser.internal.oql.OQLQueryImpl.doSubQuery(OQLQueryImpl.java:752)
    at org.eclipse.mat.parser.internal.oql.OQLQueryImpl.internalExecute(OQLQueryImpl.java:642)
    at org.eclipse.mat.parser.internal.oql.OQLQueryImpl.execute(OQLQueryImpl.java:627)
    at org.eclipse.mat.inspections.OQLQuery.execute(OQLQuery.java:50)
    at org.eclipse.mat.inspections.OQLQuery.execute(OQLQuery.java:1)
    at org.eclipse.mat.query.registry.ArgumentSet.execute(ArgumentSet.java:129)
    at org.eclipse.mat.ui.snapshot.panes.OQLPane$OQLJob.doRun(OQLPane.java:339)
    at org.eclipse.mat.ui.editor.AbstractPaneJob.run(AbstractPaneJob.java:34)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

MAT Eclipse 中的 OQL 是否支持嵌入式查询,如何获得我想要的结果?

4

1 回答 1

6

使子查询工作有点棘手。尝试以下操作:

SELECT * from OBJECTS (SELECT OBJECTS dominators(s) FROM java.lang.Thread s)

我从以下链接获得了解决方案: https ://www.eclipse.org/forums/index.php/t/608746/

于 2015-02-11T02:38:13.437 回答