Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Commit 22cf075

Browse files
prepare 1.2.2 release (#8)
1 parent 7d3306f commit 22cf075

File tree

12 files changed

+34
-32
lines changed

12 files changed

+34
-32
lines changed

.circleci/config.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,20 @@ workflows:
1616
- test-linux:
1717
name: Java 11 - Linux - OpenJDK
1818
docker-image: cimg/openjdk:11.0
19+
requires:
20+
- build-linux
21+
- test-linux:
22+
name: Java 17 - Linux - OpenJDK
23+
docker-image: cimg/openjdk:17.0
1924
with-coverage: true
2025
requires:
2126
- build-linux
2227
- build-test-windows:
2328
name: Java 11 - Windows - OpenJDK
29+
openjdk-version: 11.0.2.01
30+
- build-test-windows:
31+
name: Java 17 - Windows - OpenJDK
32+
openjdk-version: 17.0.1
2433
- build-test-android:
2534
name: Android
2635

@@ -86,17 +95,20 @@ jobs:
8695
path: coverage
8796

8897
build-test-windows:
98+
parameters:
99+
openjdk-version:
100+
type: string
89101
executor:
90102
name: win/vs2019
91103
shell: powershell.exe
92104
steps:
93105
- checkout
106+
- run:
107+
name: uninstall previous openjdk
108+
command: choco uninstall openjdk
94109
- run:
95110
name: install OpenJDK
96-
command: |
97-
$ProgressPreference = "SilentlyContinue" # prevents console errors from CircleCI host
98-
iwr -outf openjdk.msi https://developers.redhat.com/download-manager/file/java-11-openjdk-11.0.5.10-2.windows.redhat.x86_64.msi
99-
Start-Process msiexec.exe -Wait -ArgumentList '/I openjdk.msi /quiet'
111+
command: choco install openjdk --version <<parameters.openjdk-version>>
100112
- run:
101113
name: build and test
102114
command: |

build-android.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ buildscript {
66
mavenCentral()
77
mavenLocal()
88
google()
9-
jcenter()
109
}
1110
dependencies {
1211
classpath 'com.android.tools.build:gradle:4.2.0'

buildSrc/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ plugins {
1616
}
1717

1818
repositories {
19-
jcenter()
19+
gradlePluginPortal()
2020
}

gradle/wrapper/gradle-wrapper.jar

508 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

gradlew

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ esac
8282

8383
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
8484

85+
8586
# Determine the Java command to use to start the JVM.
8687
if [ -n "$JAVA_HOME" ] ; then
8788
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@@ -129,6 +130,7 @@ fi
129130
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
130131
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
131132
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133+
132134
JAVACMD=`cygpath --unix "$JAVACMD"`
133135

134136
# We build the pattern for arguments to be converted via cygpath

gradlew.bat

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
4040

4141
set JAVA_EXE=java.exe
4242
%JAVA_EXE% -version >NUL 2>&1
43-
if "%ERRORLEVEL%" == "0" goto init
43+
if "%ERRORLEVEL%" == "0" goto execute
4444

4545
echo.
4646
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -54,7 +54,7 @@ goto fail
5454
set JAVA_HOME=%JAVA_HOME:"=%
5555
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
5656

57-
if exist "%JAVA_EXE%" goto init
57+
if exist "%JAVA_EXE%" goto execute
5858

5959
echo.
6060
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -64,28 +64,14 @@ echo location of your Java installation.
6464

6565
goto fail
6666

67-
:init
68-
@rem Get command-line arguments, handling Windows variants
69-
70-
if not "%OS%" == "Windows_NT" goto win9xME_args
71-
72-
:win9xME_args
73-
@rem Slurp the command line arguments.
74-
set CMD_LINE_ARGS=
75-
set _SKIP=2
76-
77-
:win9xME_args_slurp
78-
if "x%~1" == "x" goto execute
79-
80-
set CMD_LINE_ARGS=%*
81-
8267
:execute
8368
@rem Setup the command line
8469

8570
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
8671

72+
8773
@rem Execute Gradle
88-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
74+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
8975

9076
:end
9177
@rem End local scope for the variables with windows NT shell

src/main/java/com/launchdarkly/sdk/LDValue.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@
4545
*/
4646
@JsonAdapter(LDValueTypeAdapter.class)
4747
public abstract class LDValue implements JsonSerializable {
48-
static final Gson gson = new Gson();
49-
5048
/**
5149
* Returns the same value if non-null, or {@link #ofNull()} if null.
5250
*
@@ -393,7 +391,7 @@ public LDValue get(String name) {
393391
* @return a JSON string
394392
*/
395393
public String toJsonString() {
396-
return gson.toJson(this);
394+
return JsonSerialization.serialize(this);
397395
}
398396

399397
abstract void write(JsonWriter writer) throws IOException;

src/main/java/com/launchdarkly/sdk/json/JsonSerialization.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.launchdarkly.sdk.json;
22

33
import com.google.gson.Gson;
4+
import com.google.gson.GsonBuilder;
45
import com.launchdarkly.sdk.EvaluationDetail;
56
import com.launchdarkly.sdk.EvaluationReason;
67
import com.launchdarkly.sdk.LDUser;
@@ -35,7 +36,10 @@ private JsonSerialization() {}
3536

3637
static final List<Class<? extends JsonSerializable>> knownDeserializableClasses = new ArrayList<>();
3738

38-
private static final Gson gson = new Gson();
39+
// This Gson instance has serializeNulls enabled because we want the decision of whether to include
40+
// a null property value to be left up to our own serializers. The default behavior would mean that
41+
// the GsonWriter would not allow us to write a null property value ever.
42+
private static final Gson gson = new GsonBuilder().serializeNulls().create();
3943

4044
/**
4145
* Converts an object to its JSON representation.

src/test/java/com/launchdarkly/sdk/json/JsonTestHelpers.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
@SuppressWarnings("javadoc")
1717
public abstract class JsonTestHelpers extends BaseTest {
18-
static final Gson gson = new Gson();
18+
static final Gson gson = new GsonBuilder().serializeNulls().create();
1919

2020
// Note that when we verify the behavior of Gson with LDGson in this project's unit tests, that
2121
// is not an adequate test for whether the adapters will work in the Java SDK where there is the
@@ -24,7 +24,7 @@ public abstract class JsonTestHelpers extends BaseTest {
2424
// that the adapters work correctly if Gson actually uses them.
2525

2626
public static Gson configureGson() {
27-
return new GsonBuilder().registerTypeAdapterFactory(LDGson.typeAdapters()).create();
27+
return new GsonBuilder().serializeNulls().registerTypeAdapterFactory(LDGson.typeAdapters()).create();
2828
}
2929

3030
public static ObjectMapper configureJacksonMapper() {

0 commit comments

Comments
 (0)