Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .codegen.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"toolchain": {
"require": ["mvn", "java"],
"setup": ["bash scripts/cleanup-services.sh"],
"post_generate": ["mvn spotless:apply","mvn --errors clean test"]
"post_generate": ["bash scripts/mvn-spotless-apply.sh","mvn --errors clean test"]
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public String getValue() {
return value;
}
}

/**
* Serializes an object into a map of query parameter values compatible with gRPC-transcoding.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,25 @@ public class Request {
private final Map<String, String> headers = new HashMap<>();
private final Map<String, List<String>> query = new TreeMap<>();
private Optional<Boolean> redirectionBehavior = Optional.empty();

/**
* The body of the request for requests with streaming bodies. At most one of {@link #bodyStream}
* and {@link #bodyString} can be non-null.
*/
private final InputStream bodyStream;

/**
* The body of the request for requests with string bodies. At most one of {@link #bodyStream} and
* {@link #bodyString} can be non-null.
*/
private final String bodyString;

/**
* Whether the body of the request is a streaming body. At most one of {@link #isBodyStreaming}
* and {@link #isBodyString} can be true.
*/
private final boolean isBodyStreaming;

/**
* Whether the body of the request is a string body. At most one of {@link #isBodyStreaming} and
* {@link #isBodyString} can be true.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class DataPlaneTokenSource {
private final String host;
private final boolean asyncDisabled;
private final ConcurrentHashMap<TokenSourceKey, CachedTokenSource> sourcesCache;

/**
* Caching key for {@link EndpointTokenSource}, based on endpoint and authorization details. This
* is a value object that uniquely identifies a token source configuration.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,25 @@ public class DatabricksOAuthTokenSource implements TokenSource {

/** OAuth client ID used for token exchange. */
private final String clientId;

/** Databricks host URL. */
private final String host;

/** Databricks account ID, used as audience if provided. */
private final String accountId;

/** OpenID Connect endpoints configuration. */
private final OpenIDConnectEndpoints endpoints;

/** Custom audience value for token exchange. */
private final String audience;

/** Source of ID tokens used in token exchange. */
private final IDTokenSource idTokenSource;

/** HTTP client for making token exchange requests. */
private final HttpClient httpClient;

/** Scopes to request during token exchange. */
private final List<String> scopes;

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,13 @@
<configuration>
<java>
<!-- <cleanthat/> This can be added after we drop java 8 support -->
<googleJavaFormat/>
<googleJavaFormat>
<!-- 1.22.0 is the last GJF release that supports JRE 11 (1.23+ requires JRE 17).
Needed to support newer JDKs (e.g. the code-generator's JDK 25) where the
spotless-bundled default (1.15.0) fails with NoSuchMethodError against
javac internals (Log$DeferredDiagnosticHandler.getDiagnostics). -->
<version>1.22.0</version>
</googleJavaFormat>
<importOrder/>
<removeUnusedImports/>
<formatAnnotations/>
Expand Down
28 changes: 28 additions & 0 deletions scripts/mvn-spotless-apply.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

# Wrapper for `mvn spotless:apply` that exports the javac-internals flags required by
# google-java-format on JDK 16+. Without these, GJF fails on JDK 17+ with either
# IllegalAccessError or NoSuchMethodError when it reaches into com.sun.tools.javac.*.
# On JDK <= 15 the flags are unrecognized and would break Maven startup, so we only
# set them when detected JDK major version is >= 16.

set -euo pipefail

JDK_VERSION_OUTPUT=$(java -version 2>&1 | head -1)
# Matches `"1.8.0_xxx"` (legacy) and `"17.0.1"` / `"25"` (modern) forms.
JDK_MAJOR=$(echo "$JDK_VERSION_OUTPUT" | sed -E 's/.*version "([0-9]+)(\.[0-9]+)?.*/\1/')
if [ "$JDK_MAJOR" = "1" ]; then
JDK_MAJOR=$(echo "$JDK_VERSION_OUTPUT" | sed -E 's/.*version "1\.([0-9]+).*/\1/')
fi

if [ "${JDK_MAJOR:-0}" -ge 16 ]; then
export MAVEN_OPTS="${MAVEN_OPTS:-} \
--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED \
--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED"
fi

exec mvn spotless:apply
Loading