Skip to content

Commit 73560eb

Browse files
committed
Fix ByteBuffer#position incompatibility in Metadata JAR.
PiperOrigin-RevId: 387494574
1 parent 5cf147c commit 73560eb

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"""Configures how Java libraries should be built in TFLite Support."""
2+
3+
# Forked from TF Java build_defs.bzl, but add more options for TFLS.
4+
5+
load(
6+
"@org_tensorflow//tensorflow/java:build_defs.bzl",
7+
TF_EP_ENABLED_WARNINGS = "EP_ENABLED_WARNINGS",
8+
TF_JAVA_VERSION_OPTS = "JAVA_VERSION_OPTS",
9+
TF_XLINT_OPTS = "XLINT_OPTS",
10+
)
11+
12+
# We need "release 7" to resolve ByteBuffer incompatibility in Java versions.
13+
# https://www.morling.dev/blog/bytebuffer-and-the-dreaded-nosuchmethoderror/
14+
15+
JAVA_VERSION_OPTS = TF_JAVA_VERSION_OPTS + ["--release 7"]
16+
17+
JAVACOPTS = TF_JAVA_VERSION_OPTS + TF_XLINT_OPTS + TF_EP_ENABLED_WARNINGS

tensorflow_lite_support/metadata/java/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# TensorFlow Lite Support API in Java for metadata.
33

44
load("@build_bazel_rules_android//android:rules.bzl", "android_library")
5-
load("@org_tensorflow//tensorflow/java:build_defs.bzl", "JAVACOPTS")
5+
load("//tensorflow_lite_support/java:build_defs.bzl", "JAVACOPTS")
66

77
package(
88
default_visibility = ["//visibility:public"],

0 commit comments

Comments
 (0)