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

Commit

Permalink
prepare 1.2.2 release (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
LaunchDarklyReleaseBot authored Jan 25, 2022
1 parent 7d3306f commit 22cf075
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 32 deletions.
20 changes: 16 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,20 @@ workflows:
- test-linux:
name: Java 11 - Linux - OpenJDK
docker-image: cimg/openjdk:11.0
requires:
- build-linux
- test-linux:
name: Java 17 - Linux - OpenJDK
docker-image: cimg/openjdk:17.0
with-coverage: true
requires:
- build-linux
- build-test-windows:
name: Java 11 - Windows - OpenJDK
openjdk-version: 11.0.2.01
- build-test-windows:
name: Java 17 - Windows - OpenJDK
openjdk-version: 17.0.1
- build-test-android:
name: Android

Expand Down Expand Up @@ -86,17 +95,20 @@ jobs:
path: coverage

build-test-windows:
parameters:
openjdk-version:
type: string
executor:
name: win/vs2019
shell: powershell.exe
steps:
- checkout
- run:
name: uninstall previous openjdk
command: choco uninstall openjdk
- run:
name: install OpenJDK
command: |
$ProgressPreference = "SilentlyContinue" # prevents console errors from CircleCI host
iwr -outf openjdk.msi https://developers.redhat.com/download-manager/file/java-11-openjdk-11.0.5.10-2.windows.redhat.x86_64.msi
Start-Process msiexec.exe -Wait -ArgumentList '/I openjdk.msi /quiet'
command: choco install openjdk --version <<parameters.openjdk-version>>
- run:
name: build and test
command: |
Expand Down
1 change: 0 additions & 1 deletion build-android.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ buildscript {
mavenCentral()
mavenLocal()
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0'
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ plugins {
}

repositories {
jcenter()
gradlePluginPortal()
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 2 additions & 0 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ esac

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


# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
Expand Down Expand Up @@ -129,6 +130,7 @@ fi
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`

JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
Expand Down
22 changes: 4 additions & 18 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

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

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

if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute

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

goto fail

:init
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*

:execute
@rem Setup the command line

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


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

:end
@rem End local scope for the variables with windows NT shell
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/com/launchdarkly/sdk/LDValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@
*/
@JsonAdapter(LDValueTypeAdapter.class)
public abstract class LDValue implements JsonSerializable {
static final Gson gson = new Gson();

/**
* Returns the same value if non-null, or {@link #ofNull()} if null.
*
Expand Down Expand Up @@ -393,7 +391,7 @@ public LDValue get(String name) {
* @return a JSON string
*/
public String toJsonString() {
return gson.toJson(this);
return JsonSerialization.serialize(this);
}

abstract void write(JsonWriter writer) throws IOException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.launchdarkly.sdk.json;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.launchdarkly.sdk.EvaluationDetail;
import com.launchdarkly.sdk.EvaluationReason;
import com.launchdarkly.sdk.LDUser;
Expand Down Expand Up @@ -35,7 +36,10 @@ private JsonSerialization() {}

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

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

/**
* Converts an object to its JSON representation.
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/com/launchdarkly/sdk/json/JsonTestHelpers.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

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

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

public static Gson configureGson() {
return new GsonBuilder().registerTypeAdapterFactory(LDGson.typeAdapters()).create();
return new GsonBuilder().serializeNulls().registerTypeAdapterFactory(LDGson.typeAdapters()).create();
}

public static ObjectMapper configureJacksonMapper() {
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/launchdarkly/sdk/json/LDGsonTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void valueMapToJsonElementMap() {
public void complexObjectToJsonTree() {
LDUser user = new LDUser.Builder("userkey").name("name")
.custom("attr1", LDValue.ofNull())
.custom("atrt2", LDValue.of(true))
.custom("attr2", LDValue.of(true))
.custom("attr3", LDValue.of(false))
.custom("attr4", LDValue.of(0))
.custom("attr5", LDValue.of(1))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public void jsonEncodingForNonNullValues() throws Exception {
verifyValueSerialization(LDValue.of(2.5d), "2.5");
verifyValueSerialization(JsonTestHelpers.basicArrayValue(), "[2,\"x\"]");
verifyValueSerialization(JsonTestHelpers.basicObjectValue(), "{\"x\":2}");
verifyValueSerialization(LDValue.buildObject().put("x", LDValue.ofNull()).build(), "{\"x\":null}");
verifyDeserializeInvalidJson(LDValue.class, "]");
}

Expand Down

0 comments on commit 22cf075

Please sign in to comment.