admin管理员组

文章数量:1419228

I am using Proleap Cobol Parser and at run time it is automatically taking antlr runtime 13 which is not able to deserialize the Adaptive Transition Network (java.io.InvalidClassException: .antlr.v4.runtime.atn.ATN; Could not deserialize ATN with version 3 (expected 4).)

The version of Proleap Cobol Parser is 4.7.2 that is currently available at . But when I am using the below dependency management to downgrade my antlr4-runtime version to 4.7.2, some of the methods just simply become unreachable, i.e. not supported.

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>.antlr</groupId>
                <artifactId>antlr4-runtime</artifactId>
                <version>4.7.2</version> <!-- Force the correct version -->
                <scope>runtime</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>`

I just want the correct the version combo of antlr4-runtime and Proleap Cobol Parser.

I am using Proleap Cobol Parser and at run time it is automatically taking antlr runtime 13 which is not able to deserialize the Adaptive Transition Network (java.io.InvalidClassException: .antlr.v4.runtime.atn.ATN; Could not deserialize ATN with version 3 (expected 4).)

The version of Proleap Cobol Parser is 4.7.2 that is currently available at https://github/uwol/proleap-cobol-parser. But when I am using the below dependency management to downgrade my antlr4-runtime version to 4.7.2, some of the methods just simply become unreachable, i.e. not supported.

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>.antlr</groupId>
                <artifactId>antlr4-runtime</artifactId>
                <version>4.7.2</version> <!-- Force the correct version -->
                <scope>runtime</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>`

I just want the correct the version combo of antlr4-runtime and Proleap Cobol Parser.

Share Improve this question edited Jan 29 at 14:32 Simon Sobisch 7,3821 gold badge20 silver badges40 bronze badges asked Jan 29 at 11:32 Ashish GuptaAshish Gupta 1 3
  • Either downgrade your own code, or fork the Proleap Cobol Parser and upgrade it. – Bart Kiers Commented Jan 29 at 18:04
  • "I am using the below dependency management to downgrade my antlr4-runtime version to 4.7.2" What version of ANTLR is your code actually using? It seems that you are showing only a part of the problem. Does your application build requires a newer version of ANTLR? Share a full minimal reproducible example. – aled Commented Jan 31 at 12:46
  • Also, what is ANTLR runtime 13? That doesn't look like a valid version for ANTLR. – aled Commented Jan 31 at 12:50
Add a comment  | 

1 Answer 1

Reset to default 0

What worked for me,

  • cloned the proleap repository

  • having java and ANTRL4 runtime jar in path

  • moved to path ...\src\main\antlr4\io\proleap\cobol
    e.g. directory containing the two grammers

  • in this directory executed
    java .antlr.v4.Tool -package io.proleap.cobol -visitor Cobol.g4
    java .antlr.v4.Tool -package io.proleap.cobol -visitor CobolPreprocessor.g4
    This generates listeners and vistors and adds package needed.

  • copied all generated files but the two grammers to
    ...\src\main\java\io\proleap\cobol

  • used Java 21 (selected in IntelliJ)

  • used latest ANTLR4 by setting in pom.xml
    <antlr.version>4.13.2<antlr.version>

  • project compiled error free

本文标签: javaWhich version of Proleap COBOL Parser is compatible with antlr4runtime version 13Stack Overflow