How to do embedded query using OQL in MAT Eclipse

≡放荡痞女 提交于 2019-12-22 13:53:18

问题


I can get all Thread objects by using query as below

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

then if I want to do further analysis of the returned result objects, the OQL I think should be like below:

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

But it turns to 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)

Does OQL in MAT Eclipse supports embedded query, and how can I get the results I want?


回答1:


It is a little bit tricky to make the sub-query work. Try following:

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

I got the solution from below link: https://www.eclipse.org/forums/index.php/t/608746/



来源:https://stackoverflow.com/questions/11554176/how-to-do-embedded-query-using-oql-in-mat-eclipse

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!