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

Turbine error: unexpected input: when using Java 21 String Templates in java_library with javacopts = ["--enable-preview"], #21119

Closed
vorburger opened this issue Jan 28, 2024 · 16 comments · Fixed by enola-dev/enola#436
Labels

Comments

@vorburger
Copy link
Contributor

Description of the bug:

#15083 -like, looks like that isn't quite working with Bazel 7.0.0 ?

@cushon FYI

Which category does this issue belong to?

Java Rules

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

$ git clone https://github.com/vorburger/enola.git
$ cd enola
$ git checkout json-viewer-ui-Bazel-Java21-String-Templates-bug
$ bazelisk test --verbose_failures --sandbox_debug //web/ui/...

(...)

INFO: Analyzed 2 targets (0 packages loaded, 0 targets configured).
DEBUG: Sandbox debug output for Turbine //web/ui:ui: 1706451427.355190497: src/main/tools/linux-sandbox.cc:156: calling pipe(2)...
1706451427.355212921: src/main/tools/linux-sandbox.cc:165: Netns is 0
1706451427.355218110: src/main/tools/linux-sandbox.cc:176: calling clone(2)...
1706451427.355373157: src/main/tools/linux-sandbox.cc:185: linux-sandbox-pid1 has PID 333708
1706451427.355419213: src/main/tools/linux-sandbox-pid1.cc:700: Pid1Main started
1706451427.355523533: src/main/tools/linux-sandbox.cc:202: done manipulating pipes
1706451427.355562340: src/main/tools/linux-sandbox-pid1.cc:302: bind mount: /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/execroot -> /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/sandbox/linux-sandbox/683/_hermetic_tmp/bazel-execroot
1706451427.355575141: src/main/tools/linux-sandbox-pid1.cc:302: bind mount: /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/sandbox/linux-sandbox/683/execroot -> /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/sandbox/linux-sandbox/683/_hermetic_tmp/bazel-working-directory
1706451427.355583032: src/main/tools/linux-sandbox-pid1.cc:302: bind mount: /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/external/local_jdk -> /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/sandbox/linux-sandbox/683/_hermetic_tmp/bazel-source-roots/0
1706451427.355590755: src/main/tools/linux-sandbox-pid1.cc:302: bind mount: /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/external/remote_java_tools -> /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/sandbox/linux-sandbox/683/_hermetic_tmp/bazel-source-roots/1
1706451427.355597959: src/main/tools/linux-sandbox-pid1.cc:302: bind mount: /home/vorburger/git/github.com/enola-dev/enola -> /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/sandbox/linux-sandbox/683/_hermetic_tmp/bazel-source-roots/2
1706451427.355606016: src/main/tools/linux-sandbox-pid1.cc:302: bind mount: /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/sandbox/linux-sandbox/683/_hermetic_tmp -> /tmp
1706451427.355616649: src/main/tools/linux-sandbox-pid1.cc:311: writable: /tmp/bazel-execroot/_main
1706451427.355622514: src/main/tools/linux-sandbox-pid1.cc:311: writable: /tmp
1706451427.355631628: src/main/tools/linux-sandbox-pid1.cc:311: writable: /dev/shm
1706451427.355637925: src/main/tools/linux-sandbox-pid1.cc:327: working dir: /tmp/bazel-working-directory/_main
1706451427.355705625: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /
1706451427.355712348: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /dev
1706451427.355717054: src/main/tools/linux-sandbox-pid1.cc:405: remount rw: /dev/shm
1706451427.355721709: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /dev/pts
1706451427.355726313: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /dev/hugepages
1706451427.355730797: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /dev/mqueue
1706451427.355735017: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /sys
1706451427.355739129: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /sys/kernel/security
1706451427.355745639: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /sys/fs/cgroup
1706451427.355750731: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /sys/fs/pstore
1706451427.355755765: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /sys/firmware/efi/efivars
1706451427.355779798: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /sys/fs/bpf
1706451427.355784994: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /sys/kernel/config
1706451427.355790198: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /sys/fs/selinux
1706451427.355824636: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /sys/kernel/debug
1706451427.355831092: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /sys/kernel/tracing
1706451427.355836848: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /sys/fs/fuse/connections
1706451427.355864686: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /proc
1706451427.355870292: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /proc/sys/fs/binfmt_misc
1706451427.355878223: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /run
1706451427.355896051: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /run/user/1000
1706451427.355901470: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /run/user/1000/gvfs
1706451427.355906826: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /run/user/1000/doc
1706451427.355927292: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /home
1706451427.355931887: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /boot
1706451427.355936272: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /boot/efi
1706451427.355941063: src/main/tools/linux-sandbox-pid1.cc:405: remount rw: /tmp
1706451427.355945896: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/sandbox/linux-sandbox/683/_hermetic_tmp/bazel-execroot
1706451427.355952014: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/sandbox/linux-sandbox/683/_hermetic_tmp/bazel-working-directory
1706451427.355966054: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/sandbox/linux-sandbox/683/_hermetic_tmp/bazel-source-roots/0
1706451427.355971710: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/sandbox/linux-sandbox/683/_hermetic_tmp/bazel-source-roots/1
1706451427.355976977: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/sandbox/linux-sandbox/683/_hermetic_tmp/bazel-source-roots/2
1706451427.355982254: src/main/tools/linux-sandbox-pid1.cc:405: remount rw: /tmp
1706451427.355994700: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /tmp/bazel-execroot
1706451427.355999179: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /tmp/bazel-working-directory
1706451427.356003676: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /tmp/bazel-source-roots/0
1706451427.356007952: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /tmp/bazel-source-roots/1
1706451427.356012197: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /tmp/bazel-source-roots/2
1706451427.356025836: src/main/tools/linux-sandbox-pid1.cc:405: remount rw: /tmp/bazel-execroot/_main
1706451427.356030451: src/main/tools/linux-sandbox-pid1.cc:405: remount rw: /tmp
1706451427.356034578: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /tmp/bazel-execroot
1706451427.356038705: src/main/tools/linux-sandbox-pid1.cc:405: remount rw: /tmp/bazel-execroot/_main
1706451427.356042914: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /tmp/bazel-working-directory
1706451427.356046997: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /tmp/bazel-source-roots/0
1706451427.356055761: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /tmp/bazel-source-roots/1
1706451427.356060251: src/main/tools/linux-sandbox-pid1.cc:405: remount ro: /tmp/bazel-source-roots/2
1706451427.356064561: src/main/tools/linux-sandbox-pid1.cc:405: remount rw: /dev/shm
1706451427.356068956: src/main/tools/linux-sandbox-pid1.cc:405: remount rw: /tmp/bazel-working-directory/_main
1706451427.356106039: src/main/tools/linux-sandbox-pid1.cc:496: calling fork...
1706451427.356188674: src/main/tools/linux-sandbox-pid1.cc:533: child started with PID 2
1706451427.544423834: src/main/tools/linux-sandbox-pid1.cc:550: wait returned pid=2, status=0x100
1706451427.544449072: src/main/tools/linux-sandbox-pid1.cc:568: child exited normally with code 1
1706451427.544740414: src/main/tools/linux-sandbox.cc:243: child exited normally with code 1
ERROR: /home/vorburger/git/github.com/enola-dev/enola/web/ui/BUILD:19:13: Compiling Java headers web/ui/libui-hjar.jar (2 source files) failed: (Exit 1): linux-sandbox failed: error executing Turbine command
  (cd /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/sandbox/linux-sandbox/683/execroot/_main && \
  exec env - \
    LC_CTYPE=en_US.UTF-8 \
    PATH=/bin:/usr/bin:/usr/local/bin \
    TMPDIR=/tmp \
  /home/vorburger/.cache/bazel/_bazel_vorburger/install/89a68939cbf63eb54205fdf943a58b15/linux-sandbox -W /tmp/bazel-working-directory/_main -t 15 -w /tmp/bazel-execroot/_main -w /tmp -w /dev/shm -M /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/execroot -m /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/sandbox/linux-sandbox/683/_hermetic_tmp/bazel-execroot -M /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/sandbox/linux-sandbox/683/execroot -m /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/sandbox/linux-sandbox/683/_hermetic_tmp/bazel-working-directory -M /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/external/local_jdk -m /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/sandbox/linux-sandbox/683/_hermetic_tmp/bazel-source-roots/0 -M /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/external/remote_java_tools -m /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/sandbox/linux-sandbox/683/_hermetic_tmp/bazel-source-roots/1 -M /home/vorburger/git/github.com/enola-dev/enola -m /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/sandbox/linux-sandbox/683/_hermetic_tmp/bazel-source-roots/2 -M /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/sandbox/linux-sandbox/683/_hermetic_tmp -m /tmp -S /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/sandbox/linux-sandbox/683/stats.out -D /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/sandbox/linux-sandbox/683/debug.out -- external/local_jdk/bin/java '--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.resources=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED' '--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED' '--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED' '--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED' '--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED' '--add-opens=java.base/java.nio=ALL-UNNAMED' '--add-opens=java.base/java.lang=ALL-UNNAMED' '-Dsun.io.useCanonCaches=false' -XX:-CompactStrings -Xlog:disable '-Xlog:all=warning:stderr:uptime,level,tags' '-Dturbine.ctSymPath=external/local_jdk/lib/ct.sym' -jar external/remote_java_tools/java_tools/turbine_direct_binary_deploy.jar --output bazel-out/k8-fastbuild/bin/web/ui/libui-hjar.jar --output_deps bazel-out/k8-fastbuild/bin/web/ui/libui-hjar.jdeps --bootclasspath bazel-out/k8-fastbuild/bin/external/rules_java_builtin/toolchains/platformclasspath.jar --sources web/ui/src/main/java/dev/enola/web/ui/ThingUI.java web/ui/src/main/java/dev/enola/web/ui/UI.java --javacopts -source 21 -target 21 '-XDskipDuplicateBridges=true' '-XDcompilePolicy=simple' -g -parameters -Xep:ReturnValueIgnored:OFF -Xep:IgnoredPureGetter:OFF -Xep:EmptyTopLevelDeclaration:OFF -Xep:LenientFormatStringValidation:OFF -Xep:ReturnMissingNullable:OFF -Xep:UseCorrectAssertInTests:OFF --enable-preview -- --target_label //web/ui:ui --classpath bazel-out/k8-fastbuild/bin/common/common/libcommon-hjar.jar bazel-out/k8-fastbuild/bin/core/lib/libcore_java_grpc-hjar.jar bazel-out/k8-fastbuild/bin/core/lib/libconnector_proto-speed-hjar.jar bazel-out/k8-fastbuild/bin/core/lib/libcore_proto-speed-hjar.jar bazel-out/k8-fastbuild/bin/core/lib/libmeta_proto-speed-hjar.jar bazel-out/k8-fastbuild/bin/core/lib/libutil_proto-speed-hjar.jar bazel-out/k8-fastbuild/bin/core/lib/liblib_java-hjar.jar bazel-out/k8-fastbuild/bin/web/api/libapi-hjar.jar bazel-out/k8-fastbuild/bin/external/maven/com/google/guava/guava/33.0.0-jre/header_guava-33.0.0-jre.jar bazel-out/k8-fastbuild/bin/external/com_google_protobuf/java/core/libcore-hjar.jar bazel-out/k8-fastbuild/bin/external/com_google_protobuf/java/core/liblite_runtime_only-hjar.jar --reduce_classpath_mode NONE)
<>:1: error: unexpected input: {
<table class="\{cssClass}">
               ^
ERROR: /home/vorburger/git/github.com/enola-dev/enola/web/ui/BUILD:40:11 Building web/ui/src/test/java/dev/enola/web/ui/UiTest-class.jar (1 source file) failed: (Exit 1): linux-sandbox failed: error executing Turbine command
  (cd /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/sandbox/linux-sandbox/683/execroot/_main && \
  exec env - \
    LC_CTYPE=en_US.UTF-8 \
    PATH=/bin:/usr/bin:/usr/local/bin \
    TMPDIR=/tmp \
  /home/vorburger/.cache/bazel/_bazel_vorburger/install/89a68939cbf63eb54205fdf943a58b15/linux-sandbox -W /tmp/bazel-working-directory/_main -t 15 -w /tmp/bazel-execroot/_main -w /tmp -w /dev/shm -M /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/execroot -m /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/sandbox/linux-sandbox/683/_hermetic_tmp/bazel-execroot -M /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/sandbox/linux-sandbox/683/execroot -m /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/sandbox/linux-sandbox/683/_hermetic_tmp/bazel-working-directory -M /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/external/local_jdk -m /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/sandbox/linux-sandbox/683/_hermetic_tmp/bazel-source-roots/0 -M /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/external/remote_java_tools -m /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/sandbox/linux-sandbox/683/_hermetic_tmp/bazel-source-roots/1 -M /home/vorburger/git/github.com/enola-dev/enola -m /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/sandbox/linux-sandbox/683/_hermetic_tmp/bazel-source-roots/2 -M /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/sandbox/linux-sandbox/683/_hermetic_tmp -m /tmp -S /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/sandbox/linux-sandbox/683/stats.out -D /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/sandbox/linux-sandbox/683/debug.out -- external/local_jdk/bin/java '--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.resources=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED' '--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED' '--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED' '--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED' '--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED' '--add-opens=java.base/java.nio=ALL-UNNAMED' '--add-opens=java.base/java.lang=ALL-UNNAMED' '-Dsun.io.useCanonCaches=false' -XX:-CompactStrings -Xlog:disable '-Xlog:all=warning:stderr:uptime,level,tags' '-Dturbine.ctSymPath=external/local_jdk/lib/ct.sym' -jar external/remote_java_tools/java_tools/turbine_direct_binary_deploy.jar --output bazel-out/k8-fastbuild/bin/web/ui/libui-hjar.jar --output_deps bazel-out/k8-fastbuild/bin/web/ui/libui-hjar.jdeps --bootclasspath bazel-out/k8-fastbuild/bin/external/rules_java_builtin/toolchains/platformclasspath.jar --sources web/ui/src/main/java/dev/enola/web/ui/ThingUI.java web/ui/src/main/java/dev/enola/web/ui/UI.java --javacopts -source 21 -target 21 '-XDskipDuplicateBridges=true' '-XDcompilePolicy=simple' -g -parameters -Xep:ReturnValueIgnored:OFF -Xep:IgnoredPureGetter:OFF -Xep:EmptyTopLevelDeclaration:OFF -Xep:LenientFormatStringValidation:OFF -Xep:ReturnMissingNullable:OFF -Xep:UseCorrectAssertInTests:OFF --enable-preview -- --target_label //web/ui:ui --classpath bazel-out/k8-fastbuild/bin/common/common/libcommon-hjar.jar bazel-out/k8-fastbuild/bin/core/lib/libcore_java_grpc-hjar.jar bazel-out/k8-fastbuild/bin/core/lib/libconnector_proto-speed-hjar.jar bazel-out/k8-fastbuild/bin/core/lib/libcore_proto-speed-hjar.jar bazel-out/k8-fastbuild/bin/core/lib/libmeta_proto-speed-hjar.jar bazel-out/k8-fastbuild/bin/core/lib/libutil_proto-speed-hjar.jar bazel-out/k8-fastbuild/bin/core/lib/liblib_java-hjar.jar bazel-out/k8-fastbuild/bin/web/api/libapi-hjar.jar bazel-out/k8-fastbuild/bin/external/maven/com/google/guava/guava/33.0.0-jre/header_guava-33.0.0-jre.jar bazel-out/k8-fastbuild/bin/external/com_google_protobuf/java/core/libcore-hjar.jar bazel-out/k8-fastbuild/bin/external/com_google_protobuf/java/core/liblite_runtime_only-hjar.jar --reduce_classpath_mode NONE)
INFO: Elapsed time: 0.317s, Critical Path: 0.20s
INFO: 2 processes: 2 internal.
ERROR: Build did NOT complete successfully
//web/ui:src/test/java/dev/enola/web/ui/UiTest                  FAILED TO BUILD

Executed 0 out of 1 test: 1 fails to build.

Which operating system are you running Bazel on?

Linux

What is the output of bazel info release?

release 7.0.0

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

N/A

What's the output of git remote get-url origin; git rev-parse HEAD ?

No response

Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

@vorburger
Copy link
Contributor Author

release 7.0.0

FYI 7.0.2 still seems to have this problem as well (change .bazelversion in reproducer project)

@vorburger
Copy link
Contributor Author

Adding this (found in bazelbuild/rules_java#141) to .bazelrc of the reproducer project doesn't seem to help:

build --java_runtime_version=remotejdk_21
build --tool_java_runtime_version=remotejdk_21

I'm now experimenting with using default_java_toolchain to see if that could somehow fix this...

vorburger added a commit to vorburger/enola that referenced this issue Jan 28, 2024
I had hoped this may fix
bazelbuild/bazel#21119,
it unfortunately does not - but I'll still keep it.
vorburger added a commit to vorburger/enola that referenced this issue Jan 28, 2024
I had hoped this may fix
bazelbuild/bazel#21119,
it unfortunately does not - but I'll still keep it.
vorburger added a commit to enola-dev/enola that referenced this issue Jan 28, 2024
I had hoped this may fix
bazelbuild/bazel#21119,
it unfortunately does not - but I'll still keep it.
@vorburger
Copy link
Contributor Author

I'm now experimenting with using default_java_toolchain to see if that could somehow fix this...

done in https://github.com/enola-dev/enola/pull/436/files - but that does not fix this.

With that, I'm out of depth, and moving on for now without using Java String Templates... 😭

@vorburger vorburger reopened this Jan 28, 2024
@vorburger
Copy link
Contributor Author

vorburger commented Jan 28, 2024

Huh, this is fun - with some more trial and error, I was able to see that Java 21 String Templates do work for java_binary, but are clearly broken for java_library (unless one uses --nojava_header_compilation). That's exactly what #15083 from @nresare had reported... it looks like that actually isn't fixed - or must somehow have regressed? (Maybe the new fix should add better test coverage to avoid it from re-occurring again?)

@cushon

@cushon
Copy link
Contributor

cushon commented Jan 28, 2024

Thanks for the report, the underlying problem is that turbine doesn't support string templates yet. I filed google/turbine#303 to track that.

String Templates do work for java_binary, but are clearly broken for java_library (unless one uses --nojava_header_compilation)

That's consistent with any turbine issue, header compilation only happens for targets that are dependencies of other targets. It doesn't run when compiling a top-level target like java_binary.

@vorburger
Copy link
Contributor Author

ACK! FYI https://github.com/vorburger/bazel-multiline-problem created for standalone reproducer, if useful.

@vorburger
Copy link
Contributor Author

what #15083 from @nresare had reported... it looks like that actually isn't fixed - or must somehow have regressed? (

Actuallly it's slightly different - that initial one was just for a multiline string, without variable, this is about with a variable.

@sgowroji sgowroji added the team-Rules-Java Issues for Java rules label Jan 29, 2024
cushon added a commit to cushon/bazel that referenced this issue Jan 29, 2024
https://github.com/google/turbine/releases/tag/v0.4.0

```
REPIN=1 bazel run @unpinned_maven//:pin
bazel mod deps --lockfile_mode=update
```

bazelbuild#21119
@cushon
Copy link
Contributor

cushon commented Jan 29, 2024

Using the latest turbine version from #21128 fixes the original repro for me.

I used the steps in bazelbuild/java_tools#43 (comment) to build a version of the prebuilt tools. Passing --override_repository to use the updated tools fixes the turbine error:

bazelisk test  --override_repository=rules_java~7.3.2~toolchains~remote_java_tools_linux=/tmp/java_tools_linux //web/ui/...

The test subsequently fails because --enable-preview isn't being passed at runtime:

1) testUi(dev.enola.web.ui.UiTest)
java.lang.UnsupportedClassVersionError: Preview features are not enabled for dev/enola/web/ui/ThingUI (class file version 65.65535). Try running with '--enable-preview'

Passing --test_arg=--jvm_flags=--enable-preview allows it to succeed.

cushon added a commit to cushon/bazel that referenced this issue Jan 30, 2024
https://github.com/google/turbine/releases/tag/v0.4.0

```
REPIN=1 bazel run @unpinned_maven//:pin
bazel mod deps --lockfile_mode=update
```

bazelbuild#21119
copybara-service bot pushed a commit that referenced this issue Jan 31, 2024
https://github.com/google/turbine/releases/tag/v0.4.0

```
$ REPIN=1 bazel run @unpinned_maven//:pin
$ bazel mod deps --lockfile_mode=update
```

#21119

Closes #21128.

PiperOrigin-RevId: 602978649
Change-Id: I22d6987bd68ee661e7183dae1396c6426c695ce8
@cushon
Copy link
Contributor

cushon commented Jan 31, 2024

I think it would be good to get this into a rules_java release and an upcoming Bazel release. String templates are 'just' a preview feature, but users on Java 21 may want to experiment with them.

@cushon
Copy link
Contributor

cushon commented Jan 31, 2024

@bazel-io flag

@bazel-io bazel-io added the potential release blocker Flagged by community members using "@bazel-io flag". Should be added to a release blocker milestone label Jan 31, 2024
@fmeum
Copy link
Collaborator

fmeum commented Jan 31, 2024

@bazel-io fork 7.1.0

@bazel-io bazel-io removed the potential release blocker Flagged by community members using "@bazel-io flag". Should be added to a release blocker milestone label Jan 31, 2024
@fmeum
Copy link
Collaborator

fmeum commented Jan 31, 2024

@iancha1992 This will require not just a cherry-pick, but also a java_tools & rules_java release plus an update of rules_java on the 7.1.0 branch.

Since bazelbuild/java_tools#87 (comment) got stuck anyway, retrying it should pick up this change.

cc @hvadehra

@keertk
Copy link
Member

keertk commented Jan 31, 2024

@cushon f697132 is the commit that needs to be cherry-picked, correct?

@fmeum noted, thanks!

@cushon
Copy link
Contributor

cushon commented Jan 31, 2024

Yep, that's the commit. I might be easier to just re-create it against 7.1.0 because of the lockfile changes, I created #21161

cushon added a commit to cushon/bazel that referenced this issue Jan 31, 2024
@keertk
Copy link
Member

keertk commented Jan 31, 2024

Thanks!
rules_java 7.1.0 update tracked here: #21160

cushon added a commit to cushon/bazel that referenced this issue Jan 31, 2024
github-merge-queue bot pushed a commit that referenced this issue Jan 31, 2024
@keertk
Copy link
Member

keertk commented Feb 8, 2024

java_tools & rules_java releases are done.

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

Successfully merging a pull request may close this issue.

8 participants