Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClassFormatException when running 1.1.7 on Java8 #86

Open
oxygenecore opened this issue Apr 1, 2015 · 6 comments
Open

ClassFormatException when running 1.1.7 on Java8 #86

oxygenecore opened this issue Apr 1, 2015 · 6 comments

Comments

@oxygenecore
Copy link

Exception while trying to instantiate parser using Parboiled.createParser()
Java version: 1.8.0_25

Error creating extended parser class: Could not load class '<mypackage>.ElExpression$AnalyzerParser$$parboiled'
    at org.parboiled.Parboiled.createParser(Parboiled.java:58) ~[parboiled-java-1.1.7.jar:1.1.7]
    at <mypackage>.ElExpression$AnalyzerParser.<clinit>(ElExpression.java:109) ~[platform-blocks-impl-1.0-SNAPSHOT.jar:na]
    ... 123 common frames omitted
Caused by: java.lang.RuntimeException: Could not load class '<mypackage>.ElExpression$AnalyzerParser$$parboiled'
    at org.parboiled.transform.AsmUtils.loadClass(AsmUtils.java:247) ~[parboiled-java-1.1.7.jar:1.1.7]
    at org.parboiled.transform.ParserTransformer.defineExtendedParserClass(ParserTransformer.java:100) ~[parboiled-java-1.1.7.jar:1.1.7]
    at org.parboiled.transform.ParserTransformer.extendParserClass(ParserTransformer.java:47) ~[parboiled-java-1.1.7.jar:1.1.7]
    at org.parboiled.transform.ParserTransformer.transformParser(ParserTransformer.java:38) ~[parboiled-java-1.1.7.jar:1.1.7]
    at org.parboiled.Parboiled.createParser(Parboiled.java:54) ~[parboiled-java-1.1.7.jar:1.1.7]
    ... 124 common frames omitted
Caused by: java.lang.reflect.InvocationTargetException: null
    at sun.reflect.GeneratedMethodAccessor261.invoke(Unknown Source) ~[na:na]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_25]
    at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0_25]
    at org.parboiled.transform.AsmUtils.loadClass(AsmUtils.java:242) ~[parboiled-java-1.1.7.jar:1.1.7]
    ... 128 common frames omitted
Caused by: java.lang.ClassFormatError: Class file version does not support constant tag 15 in class file <mypackagepath>/ElExpression$AnalyzerParser$$parboiled
    at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_25]
    at java.lang.ClassLoader.defineClass(ClassLoader.java:760) ~[na:1.8.0_25]
    at java.lang.ClassLoader.defineClass(ClassLoader.java:642) ~[na:1.8.0_25]
    ... 132 common frames omitted
@oxygenecore
Copy link
Author

Parser class is defined as static inner class of another class, and it also uses sibling static inner classes.

@oxygenecore
Copy link
Author

Ok, I've figured out that this error arises if I use new Action<X>(){ ... } in rule declarations.

@alexec
Copy link

alexec commented Mar 26, 2016

+1, but seems to be a quite rare scenario?

@wenerme
Copy link

wenerme commented Feb 22, 2017

Just want to simplify the action, but got this error

 // helper function
 public static <V> Action<V> run(Consumer<Context<V>> func) {
        return v -> {
            func.accept(v);
            return true;
        };
    }


// use in rule
return Sequence(..., Parsers.run((c) -> node.setName(match())), ...);

@bvkatwijk
Copy link

bvkatwijk commented Jun 21, 2018

+1 Any known fix/workaround ? I didn't use any Actions in my project. I have a slightly different error cause:

Caused by: java.lang.ClassFormatError: Class file version does not support constant tag 15 in class file [package]/Action$A3bkRxscB4Cqcexh

@AngryCarrot789
Copy link

I think it's caused when lambdas are somehow used in an old java class version (e.g 1.6). If i replace list#forEach(lambda) with a for() loop, then it works fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants