如何做到在MAT使用Eclipse OQL嵌入式查询(How to do embedded quer

2019-09-19 18:07发布

我可以通过如下使用查询获取所有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)

请问OQL在MAT Eclipse支持嵌入式查询,我怎样才能得到的结果我想要什么?

Answer 1:

这是一个有点棘手,使子查询工作。 尝试以下操作:

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

我得到了解决,从下面的链接: https://www.eclipse.org/forums/index.php/t/608746/



文章来源: How to do embedded query using OQL in MAT Eclipse
标签: java eclipse oql