Question

With Rascal I am trying to create a M3 model of another eclipse project. The java project I try to load is called eLib, it is opened in eclipse, I also can run the project. The project is located in my workspace. However, if I use the following commands in my rascal console (in the eclipse plugin):

import lang::java::m3::Core;
import lang::java::jdt::m3::Core;
myModel = createM3FromEclipseProject(|project://eLib|);

I get the following error:

|rascal://lang::java::m3::AST|(6315,172,<156,0>,<158,87>):  Java("IllegalArgumentException","Path must include project and resource name: /eLib")
at org.eclipse.core.runtime.Assert.isLegal(|file:///Assert.java|(0,0,<63,0>,<63,0>))
at org.eclipse.core.internal.resources.Workspace.newResource(|file:///Workspace.java|(0,0,<2164,0>,<2164,0>))
at org.eclipse.core.internal.resources.Container.getFolder(|file:///Container.java|(0,0,<215,0>,<215,0>))
at org.rascalmpl.eclipse.uri.ProjectURIResolver.resolve(|file:///ProjectURIResolver.java|(0,0,<107,0>,<107,0>))
at org.rascalmpl.eclipse.uri.ProjectURIResolver.getResourceURI(|file:///ProjectURIResolver.java|(0,0,<224,0>,<224,0>))
at org.rascalmpl.uri.URIResolverRegistry.getResourceURI(|file:///URIResolverRegistry.java|(0,0,<95,0>,<95,0>))
at org.rascalmpl.library.lang.java.m3.internal.EclipseJavaCompiler.setEnvironmentOptions(|file:///EclipseJavaCompiler.java|(0,0,<67,0>,<67,0>))
at sun.reflect.NativeMethodAccessorImpl.invoke0(|file:///NativeMethodAccessorImpl.java|(0,0,<0,0>,<0,0>))
at setEnvironmentOptions(|rascal://lang::java::jdt::m3::Core|(762,7,<28,76>,<28,83>))
at $shell$(|stdin:///|(10,45,<1,10>,<1,55>))

I hope one of you can help me.

Was it helpful?

Solution

Make sure the project you are trying to analyse is an actual Java project (not a generic eclipse project), and that it compiles (no red crosses in the project).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top