Skip to content

Commit

Permalink
Added setup files to support using from Bazel
Browse files Browse the repository at this point in the history
Includes simple warning suppression annotations, with an issue filed for
followup.

A MODULE.bazel is included, but incomplete, as j2cl and elemental2 do
not use this format yet.
  • Loading branch information
niloc132 committed May 27, 2024
1 parent 7c35f2c commit 6e102b1
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Enable Java 11
build --java_language_version=11

# Enable Java 11 for J2CL compiler itself
build --tool_java_language_version=11
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5.4.1
10 changes: 10 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
load("@com_google_j2cl//build_defs:rules.bzl", "j2cl_library")

j2cl_library(
name = 'gwt-nio',
srcs = glob(["src/main/java/**/*.java"]),
deps = [
"@com_google_j2cl//:jsinterop-annotations-j2cl",
"@com_google_elemental2//:elemental2-core-j2cl",
],
)
4 changes: 4 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module(
name = "gwt-nio",
repo_name = "com_vertispan_nio",
)
30 changes: 30 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
workspace(name = "com_vertispan_nio")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# Load j2cl repository
http_archive(
name = "com_google_j2cl",
strip_prefix = "j2cl-20230718",
url = "https://github.com/google/j2cl/archive/refs/tags/v20230718.zip",
)

load("@com_google_j2cl//build_defs:repository.bzl", "load_j2cl_repo_deps")
load_j2cl_repo_deps()

load("@com_google_j2cl//build_defs:workspace.bzl", "setup_j2cl_workspace")
setup_j2cl_workspace()

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "com_google_elemental2",
strip_prefix = "elemental2-1.2.1",
url = "https://github.com/google/elemental2/archive/1.2.1.zip",
)

load("@com_google_elemental2//build_defs:repository.bzl", "load_elemental2_repo_deps")
load_elemental2_repo_deps()

load("@com_google_elemental2//build_defs:workspace.bzl", "setup_elemental2_workspace")
setup_elemental2_workspace()
3 changes: 3 additions & 0 deletions src/main/java/java/nio/DoubleBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public abstract class DoubleBuffer extends Buffer implements Comparable<DoubleBu
* other}; a positive value if this is greater than {@code other}.
* @exception ClassCastException if {@code other} is not a double buffer.
*/
@SuppressWarnings("IdentityBinaryExpression")
public int compareTo (DoubleBuffer otherBuffer) {
int compareRemaining = (remaining() < otherBuffer.remaining()) ?
remaining() : otherBuffer.remaining();
Expand Down Expand Up @@ -122,6 +123,8 @@ public int compareTo (DoubleBuffer otherBuffer) {
* @param other the object to compare with this double buffer.
* @return {@code true} if this double buffer is equal to {@code other}, {@code false} otherwise.
*/
@SuppressWarnings({"EqualsHashCode", "IdentityBinaryExpression"})

public boolean equals (Object other) {
if (!(other instanceof DoubleBuffer)) {
return false;
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/java/nio/FloatBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public FloatBuffer compact () {
* {@code otherBuffer}; a positive value if this is greater than {@code otherBuffer}.
* @exception ClassCastException if {@code otherBuffer} is not a float buffer.
*/
@SuppressWarnings("IdentityBinaryExpression")
public int compareTo (FloatBuffer otherBuffer) {
int compareRemaining = (remaining() < otherBuffer.remaining()) ?
remaining() : otherBuffer.remaining();
Expand Down Expand Up @@ -137,6 +138,7 @@ public FloatBuffer duplicate () {
* @param other the object to compare with this float buffer.
* @return {@code true} if this float buffer is equal to {@code other}, {@code false} otherwise.
*/
@SuppressWarnings({"EqualsHashCode", "IdentityBinaryExpression"})
public boolean equals (Object other) {
if (!(other instanceof FloatBuffer)) {
return false;
Expand Down

0 comments on commit 6e102b1

Please sign in to comment.