Project

General

Profile

Compiling with OpenJDK 17

Added by Michał Błaszak 8 months ago

Hello,

I'm trying to compile jwt-4.7.0 on OpenJDK 17.

This is what I get:

C:\jwt-4.7.0>java --version
openjdk 17.0.2 2022-01-18
OpenJDK Runtime Environment (build 17.0.2+8-86)
OpenJDK 64-Bit Server VM (build 17.0.2+8-86, mixed mode, sharing)
C:\jwt-4.7.0>ant build
Buildfile: C:\jwt-4.7.0\build.xml

run:

build:
    [javac] C:\jwt-4.7.0\build.xml:65: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
    [javac] Compiling 600 source files to C:\jwt-4.7.0\build
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 8
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\PluralExpression.java:27: error: cannot find symbol
    [javac]     private static final class Visitor extends PluralExpressionBaseVisitor<Long> {
    [javac]                                                ^
    [javac]   symbol:   class PluralExpressionBaseVisitor
    [javac]   location: class PluralExpression
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\PluralExpression.java:33: error: package PluralExpressionParser does not exist
    [javac]         public Long visitStatement(PluralExpressionParser.StatementContext ctx) {
    [javac]                                                          ^
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\PluralExpression.java:38: error: package PluralExpressionParser does not exist
    [javac]         public Long visitExpression(PluralExpressionParser.ExpressionContext ctx) {
    [javac]                                                           ^
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\PluralExpression.java:52: error: package PluralExpressionParser does not exist
    [javac]         public Long visitOrExpression(PluralExpressionParser.OrExpressionContext ctx) {
    [javac]                                                             ^
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\PluralExpression.java:63: error: package PluralExpressionParser does not exist
    [javac]         public Long visitAndExpression(PluralExpressionParser.AndExpressionContext ctx) {
    [javac]                                                              ^
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\PluralExpression.java:74: error: package PluralExpressionParser does not exist
    [javac]         public Long visitEqExpression(PluralExpressionParser.EqExpressionContext ctx) {
    [javac]                                                             ^
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\PluralExpression.java:87: error: package PluralExpressionParser does not exist
    [javac]         public Long visitRelationalExpression(PluralExpressionParser.RelationalExpressionContext ctx) {
    [javac]                                                                     ^
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\PluralExpression.java:104: error: package PluralExpressionParser does not exist
    [javac]         public Long visitAdditiveExpression(PluralExpressionParser.AdditiveExpressionContext ctx) {
    [javac]                                                                   ^
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\PluralExpression.java:117: error: package PluralExpressionParser does not exist
    [javac]         public Long visitTerm(PluralExpressionParser.TermContext ctx) {
    [javac]                                                     ^
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\PluralExpression.java:132: error: package PluralExpressionParser does not exist
    [javac]         public Long visitGroup(PluralExpressionParser.GroupContext ctx) {
    [javac]                                                      ^
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\PluralExpression.java:137: error: package PluralExpressionParser does not exist
    [javac]         public Long visitLiteral(PluralExpressionParser.LiteralContext ctx) {
    [javac]                                                        ^
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\PluralExpression.java:142: error: package PluralExpressionParser does not exist
    [javac]         public Long visitVariable(PluralExpressionParser.VariableContext ctx) {
    [javac]                                                         ^
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\render\CssParser.java:22: error: cannot find symbol
    [javac]     static final class Listener extends Css22BaseListener {
    [javac]                                         ^
    [javac]   symbol:   class Css22BaseListener
    [javac]   location: class CssParser
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\render\CssParser.java:36: error: package Css22Parser does not exist
    [javac]             public void exitSelector(Css22Parser.SelectorContext ctx) {
    [javac]                                                 ^
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\render\CssParser.java:42: error: package Css22Parser does not exist
    [javac]             public void exitSimpleSelector(Css22Parser.SimpleSelectorContext ctx) {
    [javac]                                                       ^
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\render\CssParser.java:48: error: package Css22Parser does not exist
    [javac]             public void exitElementName(Css22Parser.ElementNameContext ctx) {
    [javac]                                                    ^
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\render\CssParser.java:53: error: package Css22Parser does not exist
    [javac]             public void exitClassName(Css22Parser.ClassNameContext ctx) {
    [javac]                                                  ^
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\render\CssParser.java:58: error: package Css22Parser does not exist
    [javac]             public void exitId(Css22Parser.IdContext ctx) {
    [javac]                                           ^
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\render\CssParser.java:65: error: package Css22Parser does not exist
    [javac]             public void exitDeclarationBlock(Css22Parser.DeclarationBlockContext ctx) {
    [javac]                                                         ^
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\PluralExpression.java:32: error: method does not override or implement a method from a supertype
    [javac]         @Override
    [javac]         ^
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\PluralExpression.java:37: error: method does not override or implement a method from a supertype
    [javac]         @Override
    [javac]         ^
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\PluralExpression.java:51: error: method does not override or implement a method from a supertype
    [javac]         @Override
    [javac]         ^
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\PluralExpression.java:57: error: invalid method reference
    [javac]                     .map(this::visit)
    [javac]                          ^
    [javac]   cannot find symbol
    [javac]     symbol:   method visit()
    [javac]     location: class Visitor
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\PluralExpression.java:62: error: method does not override or implement a method from a supertype
    [javac]         @Override
    [javac]         ^
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\PluralExpression.java:68: error: invalid method reference
    [javac]                     .map(this::visit)
    [javac]                          ^
    [javac]   cannot find symbol
    [javac]     symbol:   method visit()
    [javac]     location: class Visitor
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\PluralExpression.java:73: error: method does not override or implement a method from a supertype
    [javac]         @Override
    [javac]         ^
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\PluralExpression.java:86: error: method does not override or implement a method from a supertype
    [javac]         @Override
    [javac]         ^
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\PluralExpression.java:103: error: method does not override or implement a method from a supertype
    [javac]         @Override
    [javac]         ^
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\PluralExpression.java:116: error: method does not override or implement a method from a supertype
    [javac]         @Override
    [javac]         ^
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\PluralExpression.java:131: error: method does not override or implement a method from a supertype
    [javac]         @Override
    [javac]         ^
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\PluralExpression.java:136: error: method does not override or implement a method from a supertype
    [javac]         @Override
    [javac]         ^
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\PluralExpression.java:141: error: method does not override or implement a method from a supertype
    [javac]         @Override
    [javac]         ^
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\PluralExpression.java:156: error: cannot find symbol
    [javac]         PluralExpressionLexer lex = new PluralExpressionLexer(stream);
    [javac]         ^
    [javac]   symbol:   class PluralExpressionLexer
    [javac]   location: class PluralExpression
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\PluralExpression.java:156: error: cannot find symbol
    [javac]         PluralExpressionLexer lex = new PluralExpressionLexer(stream);
    [javac]                                         ^
    [javac]   symbol:   class PluralExpressionLexer
    [javac]   location: class PluralExpression
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\PluralExpression.java:161: error: cannot find symbol
    [javac]         PluralExpressionParser parser = new PluralExpressionParser(tokens);
    [javac]         ^
    [javac]   symbol:   class PluralExpressionParser
    [javac]   location: class PluralExpression
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\PluralExpression.java:161: error: cannot find symbol
    [javac]         PluralExpressionParser parser = new PluralExpressionParser(tokens);
    [javac]                                             ^
    [javac]   symbol:   class PluralExpressionParser
    [javac]   location: class PluralExpression
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\render\CssParser.java:35: error: method does not override or implement a method from a supertype
    [javac]             @Override
    [javac]             ^
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\render\CssParser.java:41: error: method does not override or implement a method from a supertype
    [javac]             @Override
    [javac]             ^
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\render\CssParser.java:47: error: method does not override or implement a method from a supertype
    [javac]             @Override
    [javac]             ^
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\render\CssParser.java:52: error: method does not override or implement a method from a supertype
    [javac]             @Override
    [javac]             ^
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\render\CssParser.java:57: error: method does not override or implement a method from a supertype
    [javac]             @Override
    [javac]             ^
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\render\CssParser.java:64: error: method does not override or implement a method from a supertype
    [javac]             @Override
    [javac]             ^
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\render\CssParser.java:130: error: cannot find symbol
    [javac]             Css22Lexer lex = new Css22Lexer(stream);
    [javac]             ^
    [javac]   symbol:   class Css22Lexer
    [javac]   location: class CssParser
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\render\CssParser.java:130: error: cannot find symbol
    [javac]             Css22Lexer lex = new Css22Lexer(stream);
    [javac]                                  ^
    [javac]   symbol:   class Css22Lexer
    [javac]   location: class CssParser
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\render\CssParser.java:135: error: cannot find symbol
    [javac]             Css22Parser parser = new Css22Parser(tokens);
    [javac]             ^
    [javac]   symbol:   class Css22Parser
    [javac]   location: class CssParser
    [javac] C:\jwt-4.7.0\src\eu\webtoolkit\jwt\render\CssParser.java:135: error: cannot find symbol
    [javac]             Css22Parser parser = new Css22Parser(tokens);
    [javac]                                      ^
    [javac]   symbol:   class Css22Parser
    [javac]   location: class CssParser
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 46 errors
    [javac] 1 warning

BUILD FAILED
C:\jwt-4.7.0\build.xml:65: Compile failed; see the compiler error output for details.

Total time: 32 seconds

Changing "source" and "target" in build.xml caused the warning to disappear. The rest of errors remained.
Is there anything missing in my configuration? Any PATH? or CLASSPATH?


Replies (3)

RE: Compiling with OpenJDK 17 - Added by Michał Błaszak 8 months ago

As a result some files are created in the JWT ROOT directory:

There are many files, these two are just exmaples. I suppose they should be created somewhere in src directory.

Css22BaseListener.java
PluralExpressionBaseVisitor.java

RE: Compiling with OpenJDK 17 - Added by Wim Dumon 8 months ago

Hey,

Weirdly enough antlr seems to generate files in a different location on Windows as what we see on Linux. We build Jwt on Linux. This fixes the generation of the files:

  <target name="run">
    <java jar="lib/antlr-4.7.2-complete.jar" fork="true">
      <arg line="-no-listener -visitor -package eu.webtoolkit.jwt -o src/eu/webtoolkit/jwt src/eu/webtoolkit/jwt/PluralExpression.g4" />
    </java>
    <java jar="lib/antlr-4.7.2-complete.jar" fork="true">
      <arg line="-listener -no-visitor -package eu.webtoolkit.jwt.render -o src/eu/webtoolkit/jwt/render src/eu/webtoolkit/jwt/render/Css22.g4" />
    </java>
  </target>

Wim.

    (1-3/3)