You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Thomas Rebele <tr...@tibco.com.INVALID> on 2021/12/16 16:06:18 UTC

Failing task :linq4j:jandexMain when executing CheckerFramework

Hello,

building Calcite has been a somewhat annoying experience. First some
annoying :core:checkstyleTest that interferes with files generated by
Intellij IDEA, with hundreds of error messages similar to the following:

[ant:checkstyle] [ERROR]
~/calcite-intellij/core/build/generated/sources/version/generated/org/apache/calcite/rel/rules/ImmutableFilterDateRangeRuleConfig.java:26:
Line is longer than 100 characters (found 107). [LineLength]
[ant:checkstyle] [ERROR]
~/calcite-intellij/core/build/javacc/javaCCTest/generated_tests/org/apache/calcite/tools/ImmutableMyProjectFilterRuleConfig.java:341:12:
Redundant 'final' modifier. [RedundantModifier]

These are easy to deal with temporarily by deleting the generated folders.
Any hint for a permanent fix is appreciated. Then I try to reproduce the *CI
/ CheckerFramework (JDK 11) (pull_request)* task locally:

$ JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64 ./gradlew clean
...
BUILD SUCCESSFUL in 5s
$ JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64 ./gradlew build -x test
-PenableCheckerframework
...
> Task :linq4j:jandexMain FAILED
...
            Suppressed: com.github.vlsi.jandex.JandexFileParseException:
~/calcite-intellij/linq4j/build/classes/java/main/org/apache/calcite/linq4j/QueryableDefaults$ReplayableQueryable.class
...
            Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 0
out of bounds for length 0
                    at
org.jboss.jandex.Indexer.updateTypeTarget(Indexer.java:898)
                    at
org.jboss.jandex.Indexer.updateTypeTargets(Indexer.java:630)
                    at org.jboss.jandex.Indexer.index(Indexer.java:1698)
                    at
com.github.vlsi.jandex.JandexWork.execute(JandexWork.kt:58)
                    ... 33 more

FAILURE: Build failed with an exception.
...

Is there an easy way to fix the problem? The fallback solution is to rely
on the Github CI, which has passed for the same commit.

Cordialement / Best Regards,
*Thomas Rebele, PhD* | R&D Developer | Germany | www.tibco.com

Re: Failing task :linq4j:jandexMain when executing CheckerFramework

Posted by Thomas Rebele <tr...@tibco.com.INVALID>.
Hello,

thank you, Vladimir Sitnikov, for the hint with the javaccGeneratedPatterns
in build.gradle.kts. I discovered the cause for the generated files. I
forgot that I had activated the option "build and run [tests] using
Intellij IDEA". Exclusion rules to be added by CALCITE-4947
<https://issues.apache.org/jira/browse/CALCITE-4947>.

About the failing :linq4j:jandexMain, I've additionally extended the PATH
env variable, still the same error. Here my java version:

$ PATH="/usr/lib/jvm/java-11-openjdk-amd64/bin/:$PATH"
JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64 java -version
openjdk version "11.0.13" 2021-10-19
OpenJDK Runtime Environment (build 11.0.13+8-post-Debian-1deb11u1)
OpenJDK 64-Bit Server VM (build 11.0.13+8-post-Debian-1deb11u1, mixed mode,
sharing)

Interestingly, there's no problem when executing the failing task on its
own:

$ PATH="/usr/lib/jvm/java-11-openjdk-amd64/bin/:$PATH"
JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64 ./gradlew
:linq4j:jandexMain
> Configure project :
Building Apache Calcite 1.29.0-SNAPSHOT

> Task :linq4j:compileJava
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

BUILD SUCCESSFUL in 13s
32 actionable tasks: 1 executed, 1 from cache, 30 up-to-date
S3 cache 762ms wasted on misses, reads: 1, elapsed: 762ms

But it fails when executed with other tasks:

$ PATH="/usr/lib/jvm/java-11-openjdk-amd64/bin/:$PATH"
JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64 ./gradlew build -x test
-PenableCheckerframework
> Configure project :
Building Apache Calcite 1.29.0-SNAPSHOT

> Task :linq4j:jandexMain FAILED
...

Cordialement / Best Regards,
*Thomas Rebele, PhD* | R&D Developer | Germany | www.tibco.com


On Thu, Dec 16, 2021 at 5:48 PM Vladimir Sitnikov <
sitnikov.vladimir@gmail.com> wrote:

> >First some annoying :core:checkstyleTest that interferes with files
> generated by Intellij IDEA, with hundreds of error messages similar to the
> following:
>
> We exclude generated files from the style checks via the following
> patterns:
>
> https://github.com/apache/calcite/blob/a6293a37dd4166e6fe69ae0c5ef7a89e6677b6ab/build.gradle.kts#L259-L276
>
> Please add the relevant pattern and file the PR.
> However, it is really strange that you get the generated files into
> generated/sources/version/generated and javacc/javaCCTest/generated_tests
> folders.
> I don't understand why IDEA would generate files into those folders.
> It does not sound like your ImmutableMyProjectFilterRuleConfig is connected
> with javaCCTest.
> I would try to understand why do you get files into /javaCCTest/ and
> /version/ folders.
>
> A side note: Kotlin does have the official coding style, so there's a
> formatter that yields nice results and that is consistent with IDEs.
> So moving to Kotlin makes many Checkstyle rules obsolete. No joking.
>
> >Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds
> for length 0
>
> It is very likely you are using an outdated version of javac which produced
> invalid bytecode.
> Please upgrade javac (e.g. to the recent patchset).
> Note: GitHub CI uses recent patchet updates, so you might fail to reproduce
> the issue.
>
> We do know javac versions 1.8 before u202 are extremely buggy, so we fail
> the build for those versions.
> It might be time to add the same verification for 11, and require 11.0.5 or
> later (in case of 11).
>
> >Is there an easy way to fix the problem?
>
> The easy fix is to bump the javac version.
> The funny coincidence is that Kotlin solves this issue as well: null safety
> is integrated into the regular compilation,
> so there's no need for a separate (and time-consuming!) checker framework
> compilation.
>
> Vladimir
>

Re: Failing task :linq4j:jandexMain when executing CheckerFramework

Posted by Vladimir Sitnikov <si...@gmail.com>.
>First some annoying :core:checkstyleTest that interferes with files
generated by Intellij IDEA, with hundreds of error messages similar to the
following:

We exclude generated files from the style checks via the following patterns:
https://github.com/apache/calcite/blob/a6293a37dd4166e6fe69ae0c5ef7a89e6677b6ab/build.gradle.kts#L259-L276

Please add the relevant pattern and file the PR.
However, it is really strange that you get the generated files into
generated/sources/version/generated and javacc/javaCCTest/generated_tests
folders.
I don't understand why IDEA would generate files into those folders.
It does not sound like your ImmutableMyProjectFilterRuleConfig is connected
with javaCCTest.
I would try to understand why do you get files into /javaCCTest/ and
/version/ folders.

A side note: Kotlin does have the official coding style, so there's a
formatter that yields nice results and that is consistent with IDEs.
So moving to Kotlin makes many Checkstyle rules obsolete. No joking.

>Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds
for length 0

It is very likely you are using an outdated version of javac which produced
invalid bytecode.
Please upgrade javac (e.g. to the recent patchset).
Note: GitHub CI uses recent patchet updates, so you might fail to reproduce
the issue.

We do know javac versions 1.8 before u202 are extremely buggy, so we fail
the build for those versions.
It might be time to add the same verification for 11, and require 11.0.5 or
later (in case of 11).

>Is there an easy way to fix the problem?

The easy fix is to bump the javac version.
The funny coincidence is that Kotlin solves this issue as well: null safety
is integrated into the regular compilation,
so there's no need for a separate (and time-consuming!) checker framework
compilation.

Vladimir