Question

I have created a parser class for the parboiled framework according to this simple example:

package my.package;

import org.parboiled.BaseParser;
import org.parboiled.annotations.BuildParseTree;

@BuildParseTree
public class QueryParser extends BaseParser<Object> {
    //some rules
}

If I try to create parser as shown in the example

QueryParser parser = Parboiled.createParser(QueryParser.class);

I get an exception at that line:

java.lang.ClassCastException: my.package.QueryParser$$parboiled cannot be cast to org.parboiled.BaseParser
    at org.parboiled.Parboiled.createParser(Parboiled.java:56)
    ...

I'm really not doing anything special that is not done in the example. The only difference is that the parser and and the class calling it are in different projects but I can't imagine why this should matter. The dependencies between the projects (which are Eclipse plugin projects) should be alright.

Can anyone tell what I'm doing wrong or where the mistake could be?

Was it helpful?

Solution

It actually seems to have something to do with the run configurations. I moved all the parboiled relevant code to one project and it works. I think I'll keep it this way because it is better encapsulation anyway.

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