VIATRA-Generator icon indicating copy to clipboard operation
VIATRA-Generator copied to clipboard

Solver has issues with variables of native java type

Open michding opened this issue 6 years ago • 0 comments

If a variable has a java primitive type (such as java.lang.Integer), the solver throws an exception when invoked, while the VIATRA Query Result view is able to show the matches without issues for the pattern.

Error occured (ClassCastException): org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey cannot be cast to org.eclipse.viatra.query.runtime.emf.types.BaseEMFTypeKey
    hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2Logic.transformQueryHeader(Viatra2Logic.java:148)
    hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2Logic.transformQueries(Viatra2Logic.java:95)
    hu.bme.mit.inf.dslreasoner.application.execution.GenerationTaskExecutor.executeGenerationTask(GenerationTaskExecutor.java:189)
    hu.bme.mit.inf.dslreasoner.application.execution.ScriptExecutor._execute(ScriptExecutor.java:137)
    hu.bme.mit.inf.dslreasoner.application.execution.ScriptExecutor.execute(ScriptExecutor.java:348)
    hu.bme.mit.inf.dslreasoner.application.execution.ScriptExecutor.executeScript(ScriptExecutor.java:116)
    hu.bme.mit.inf.dslreasoner.application.execution.ScriptExecutor$1.run(ScriptExecutor.java:78)
    org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)

After a bit of debugging, we figured this line (among a few others in this same unit) assumes that the type key is of type BaseEMFTypeKey<...>, but this is not always true (in this case it is JavaTransitiveInstancesKey).

michding avatar Jun 02 '18 16:06 michding