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

Upgrade GSON and other optional dependencies #1077

Merged
merged 3 commits into from
Nov 7, 2022
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 bolt-http4k/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>

<properties>
<http4k.version>4.32.2.0</http4k.version>
<http4k.version>4.33.3.0</http4k.version>
</properties>

<artifactId>bolt-http4k</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion bolt-kotlin-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
<version>${logback-slf4j-v2.version}</version>
</dependency>
</dependencies>

Expand Down
2 changes: 1 addition & 1 deletion bolt-ktor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<kotlin.code.style>official</kotlin.code.style>
<ktor.version>2.1.2</ktor.version>
<ktor.version>2.1.3</ktor.version>
</properties>

<pluginRepositories>
Expand Down
4 changes: 2 additions & 2 deletions bolt-micronaut/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
</parent>

<properties>
<micronaut.version>3.7.1</micronaut.version>
<micronaut-test-junit5.version>3.5.0</micronaut-test-junit5.version>
<micronaut.version>3.7.3</micronaut.version>
<micronaut-test-junit5.version>3.7.0</micronaut-test-junit5.version>
<micronaut-rxjava3.version>2.3.0</micronaut-rxjava3.version>
<junit5-jupiter.version>5.9.1</junit5-jupiter.version>
<!-- Note that upgrading this library breaks other dependency resolution -->
Expand Down
7 changes: 6 additions & 1 deletion bolt-quarkus-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
<quarkus.platform.version>2.12.0.Final</quarkus.platform.version>
<quarkus.platform.version>2.13.3.Final</quarkus.platform.version>
<mutiny.version>1.6.0</mutiny.version>
<compiler-plugin.version>3.8.1</compiler-plugin.version>
</properties>
Expand Down Expand Up @@ -74,6 +74,11 @@
<artifactId>quarkus-undertow</artifactId>
<version>${quarkus.platform.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback-slf4j-v2.version}</version>
</dependency>
</dependencies>

<build>
Expand Down
4 changes: 2 additions & 2 deletions bolt-spring-boot-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>

<properties>
<spring-boot.version>2.7.4</spring-boot.version>
<spring-boot.version>2.7.5</spring-boot.version>
</properties>

<artifactId>bolt-spring-boot-examples</artifactId>
Expand Down Expand Up @@ -44,7 +44,7 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
<version>${logback-slf4j-v2.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down
2 changes: 1 addition & 1 deletion docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ sdkLatestVersion: 1.26.1
okhttpVersion: 4.10.0
slf4jApiVersion: 1.7.36
kotlinVersion: 1.7.20
springBootVersion: 2.7.4
springBootVersion: 2.7.5
compatibleMicronautVersion: 3.x
quarkusVersion: 2.12.0.Final
helidonVersion: 2.5.0
Expand Down
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<!-- We don't change the versions of servlet API interface to keep the backward compatibility with older versions of them -->
<jakarta.servlet-api.version>5.0.0</jakarta.servlet-api.version>
<okhttp.version>4.10.0</okhttp.version>
<gson.version>2.9.1</gson.version>
<gson.version>2.10</gson.version>
<kotlin.version>1.7.20</kotlin.version>
<!-- Note that we should not upgrade sfl4j-api to v2 to avoid confusions on the users side.
see also: https://github.com/slackapi/java-slack-sdk/issues/1034
Expand All @@ -68,6 +68,7 @@
<aws.s3.version>[1.12.62,1.13.0)</aws.s3.version>
<junit.version>4.13.2</junit.version>
<logback.version>1.2.11</logback.version>
<logback-slf4j-v2.version>1.4.4</logback-slf4j-v2.version>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This slf4j-api v2 compatible version is supposed to be used only for test code and example projects. See also: #1034

<hamcrest.version>[1.3,2.0)</hamcrest.version>
<mockito-core.version>[4.1.0,5.0.0)</mockito-core.version>
<jetty-for-tests.version>9.2.27.v20190403</jetty-for-tests.version>
Expand Down
2 changes: 1 addition & 1 deletion slack-api-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
-->
<tyrus-standalone-client.version>1.19</tyrus-standalone-client.version>
<java-websocket.version>1.5.3</java-websocket.version>
<jedis.version>4.2.3</jedis.version>
<jedis.version>4.3.1</jedis.version>
<jedis-mock.version>1.0.4</jedis-mock.version>
</properties>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public void updateAndShare_searchable() throws Exception {
boolean found = false;
String query = externalId + ": Seamlessly start a voice call";
long millis = 0;
while (!found && millis < 30 * 1000) {
while (!found && millis < 60 * 1000) {
Thread.sleep(500);
millis += 500;
SearchFilesResponse searchResults = slack.methods(userToken).searchFiles(r -> r.query(query));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,24 @@ public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {

try {
// Get reference to the existing boundFields.
Field f = delegate.getClass().getDeclaredField("boundFields");
f.setAccessible(true);
Map boundFields = (Map) f.get(delegate);
Class<?> adaptorClass = delegate.getClass();
Field boundFieldsField = null;
while (boundFieldsField == null && !adaptorClass.equals(Object.class)) {
try {
boundFieldsField = adaptorClass.getDeclaredField("boundFields");
} catch (NoSuchFieldException _ignore) {
// Since GSON v3.10, the internal class hierarchy has been changed
// 1) com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$FieldReflectionAdapter
// 2) com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter
adaptorClass = adaptorClass.getSuperclass();
}
}
if (boundFieldsField == null) {
String message = "Failed to find bound fields inside GSON";
throw new IllegalStateException(message);
}
boundFieldsField.setAccessible(true);
Map boundFields = (Map) boundFieldsField.get(delegate);
StringBuilder sb = new StringBuilder();
for (Object key : boundFields.keySet()) {
sb.append(key + ", ");
Expand All @@ -53,7 +68,7 @@ public Object get(Object key) {

};
// Finally, push our custom map back using reflection.
f.set(delegate, boundFields);
boundFieldsField.set(delegate, boundFields);

} catch (Exception e) {
// Should never happen if the implementation doesn't change.
Expand Down