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

prepare 1.1.0 release #3

Merged
merged 55 commits into from
Apr 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
db568d4
initial implementation of Java common SDK code (#1)
eli-darkly Mar 20, 2020
374e08e
stick with Java 7 for Android compatibility (#2)
eli-darkly Apr 15, 2020
f1b9cb4
add getters to EvaluationReason and hide its subclasses
eli-darkly Apr 20, 2020
e86ced3
completely remove EvaluationReason subclasses
eli-darkly Apr 20, 2020
a8d1a91
Merge pull request #3 from launchdarkly/eb/ch74282/hide-reason-subcla…
eli-darkly Apr 20, 2020
0ff060b
Merge pull request #4 from launchdarkly/eb/ch74282/remove-reason-subc…
eli-darkly Apr 20, 2020
d440fd0
add JSON helpers, better serialization logic, and Gson adapter
eli-darkly Apr 20, 2020
04eaf1a
javadoc fixes
eli-darkly Apr 21, 2020
433a1e7
remove @since tags, misc doc fixes, add note about changelogging
eli-darkly Apr 21, 2020
55e3c1b
Merge branch 'eb/ch74370/javadoc-since' into eb/ch73994/gson-interop
eli-darkly Apr 21, 2020
fe6f0eb
fix sample code
eli-darkly Apr 22, 2020
97a8fa3
rename Gson adapter, use factory method
eli-darkly Apr 22, 2020
2c5cc2b
Merge pull request #5 from launchdarkly/eb/ch74370/javadoc-since
eli-darkly Apr 22, 2020
511c9e2
improve and rigorously test equals() for all immutable types
eli-darkly Apr 24, 2020
525daa6
simplifying
eli-darkly Apr 24, 2020
3e222c3
simplifying
eli-darkly Apr 24, 2020
d003179
make EvaluationDetail non-nullable + use boolean singletons
eli-darkly Apr 24, 2020
b810cd7
hide Gson in pom
eli-darkly Apr 24, 2020
129d5b6
doc additions
eli-darkly Apr 24, 2020
0ab6d7c
Merge pull request #8 from launchdarkly/eb/ch74915/non-null-index
eli-darkly Apr 27, 2020
36d3fba
Merge pull request #6 from launchdarkly/eb/ch73994/gson-interop
eli-darkly Apr 27, 2020
939b879
Merge branch 'master' into eb/ch68094/test-equals
eli-darkly Apr 27, 2020
6136698
javadoc fixes
eli-darkly Apr 27, 2020
fa2dd6c
Merge branch 'master' into eb/ch68094/test-equals
eli-darkly Apr 27, 2020
9bd6dbb
Merge pull request #7 from launchdarkly/eb/ch68094/test-equals
eli-darkly Apr 28, 2020
5458738
add Jackson adapter (#9)
eli-darkly Apr 28, 2020
5635a1d
more predictable exception behavior for LDValue.parse()
eli-darkly Apr 28, 2020
4ac7396
Merge pull request #11 from launchdarkly/eb/ch73994/parse-exception
eli-darkly Apr 28, 2020
21e9167
fix the JSON behavior of EvaluationDetail (#10)
eli-darkly Apr 28, 2020
7c29e7b
maximize and enforce test coverage (#12)
eli-darkly Apr 28, 2020
7a2aa77
build and test in Android! (#13)
eli-darkly Apr 29, 2020
aa9f794
Merge branch 'master' of github.com:launchdarkly/java-sdk-common
eli-darkly Apr 29, 2020
d5c3b0d
ensure real nulls can't be stored in an LDValue
eli-darkly May 23, 2020
9e200fb
clean up some unnecessary coverage warnings
eli-darkly May 23, 2020
08f2b21
Merge pull request #15 from launchdarkly/eb/ch77641/null-safety
eli-darkly May 27, 2020
8fbc7a0
more convenient location for coverage reports
eli-darkly May 27, 2020
fbe209b
remove rc1 from changelog
eli-darkly Jun 1, 2020
7f83233
Merge branch 'master' of github.com:launchdarkly/java-sdk-common
eli-darkly Jun 2, 2020
ac4a2cd
Removed the guides link
bwoskow-ld Feb 3, 2021
1cad8c5
Use Android machine image for CircleCI Android tests. (#17)
gwhelanLD Mar 30, 2021
17f0b0b
improve Gson integration using reader/writer delegation + add LDValue…
eli-darkly Mar 30, 2021
96931b3
add LDValue.arrayOf() + misc javadoc fixes
eli-darkly Mar 30, 2021
99c51e9
Merge pull request #19 from launchdarkly/eb/ch104357/array-of
eli-darkly Mar 30, 2021
b468c4e
javadoc fix
eli-darkly Apr 8, 2021
a5abd08
add validation of javadoc build in CI
eli-darkly Apr 8, 2021
1e11684
add another Eclipse metadata exclusion to .gitignore
eli-darkly Apr 8, 2021
bceedef
Merge pull request #21 from launchdarkly/eb/ch105283/check-javadoc
eli-darkly Apr 8, 2021
3a8aa98
partially revert ch103941 fix that doesn't work in the Java SDK
eli-darkly Apr 14, 2021
3f02d6d
Merge pull request #22 from launchdarkly/eb/ch103941/revert-gson-adapter
eli-darkly Apr 14, 2021
36fe80f
unrevert some JSON improvements from previous revert
eli-darkly Apr 16, 2021
cfdece2
Merge pull request #23 from launchdarkly/eb/ch103941/json-partial-unr…
eli-darkly Apr 17, 2021
9d50c7e
improve Gson integration using reader/writer delegation - take 2
eli-darkly Apr 19, 2021
df89903
Merge pull request #24 from launchdarkly/eb/ch103941/gson-adapter-fix
eli-darkly Apr 21, 2021
b8ace9b
better Jackson adapter + misc JSON test improvements (#18)
eli-darkly Apr 21, 2021
cd9525e
omit redundant method call (this commit was mistakenly left out of th…
eli-darkly Apr 21, 2021
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
68 changes: 26 additions & 42 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ version: 2.1

orbs:
win: circleci/windows@1.0.0
android: circleci/android@1.0

workflows:
test:
Expand Down Expand Up @@ -43,6 +44,7 @@ jobs:
- run: java -version
- run: ./gradlew dependencies
- run: ./gradlew jar
- run: ./gradlew javadoc
- run: ./gradlew checkstyleMain
- persist_to_workspace:
root: build
Expand Down Expand Up @@ -121,49 +123,31 @@ jobs:
path: .\junit

build-test-android:
# This is adapted from the CI build for android-client-sdk
macos:
xcode: "10.3.0"
shell: /bin/bash --login -eo pipefail
working_directory: ~/launchdarkly/android-client-sdk-private
environment:
TERM: dumb
QEMU_AUDIO_DRV: none
_JAVA_OPTIONS: "-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -Xms2048m -Xmx4096m"
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
JVM_OPTS: -Xmx3200m
ANDROID_HOME: "/usr/local/share/android-sdk"
ANDROID_SDK_HOME: "/usr/local/share/android-sdk"
ANDROID_SDK_ROOT: "/usr/local/share/android-sdk"
executor:
name: android/android-machine
resource-class: large

steps:
- checkout

# What we want to do here is somewhat unusual: we want Android to run all of our tests from
# src/test/java, but run them in the Android emulator (to prove that we're only using Java
# APIs that our minimum Android API version supports). Normally, only tests in
# src/androidTest/java would be run that way. Also, Android needs a different JUnit test
# runner annotation on all of the test classes. So we can't just run the test code as-is.
#
# This step copies all the code from src/test/java into src/androidTest/java, except for the
# base class BaseTest.java, which is already defined in src/androidTest/java to provide the
# necessary test runner annotation.
- run:
name: Install Android tools
command: ./scripts/install-android-tools.sh
- run:
name: Start Android environment
command: ./scripts/start-android-env.sh
background: true
timeout: 1200
no_output_timeout: 20m
- run:
name: Wait for Android environment
command: ./scripts/started-android-env.sh
- run:
name: Run tests
command: ./scripts/run-android-tests.sh
no_output_timeout: 20m
- run:
name: Save test results
command: |
mkdir -p ~/test-results
cp -r ./build/outputs/androidTest-results/* ~/test-results/
when: always
- run:
name: Stop Android environment
command: ./scripts/stop-android-env.sh
when: always
name: Copy tests
command: rsync -r ./src/test/java/ ./src/androidTest/java/ --exclude='BaseTest.java'

- android/start-emulator-and-run-tests:
system-image: system-images;android-21;default;x86
max-tries: 1
post-emulator-launch-assemble-command: ./gradlew -b build-android.gradle :assembleAndroidTest
test-command: ./gradlew -b build-android.gradle :connectedAndroidTest

- store_test_results:
path: ~/test-results
- store_artifacts:
path: ~/artifacts
path: ./build/outputs/androidTest-results
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Eclipse project files
.classpath
.project

.settings

# Intellij project files
*.iml
*.ipr
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,3 @@ See [Contributing](https://github.com/launchdarkly/dotnet-sdk-common/blob/master
* [docs.launchdarkly.com](https://docs.launchdarkly.com/ "LaunchDarkly Documentation") for our documentation and SDK reference guides
* [apidocs.launchdarkly.com](https://apidocs.launchdarkly.com/ "LaunchDarkly API Documentation") for our API documentation
* [blog.launchdarkly.com](https://blog.launchdarkly.com/ "LaunchDarkly Blog Documentation") for the latest product updates
* [Feature Flagging Guide](https://github.com/launchdarkly/featureflags/ "Feature Flagging Guide") for best practices and strategies
7 changes: 4 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,11 @@ jacocoTestCoverageVerification {
// The key for each of these items is the complete method signature minus the "com.launchdarkly.sdk." prefix.
"EvaluationReason.error(com.launchdarkly.sdk.EvaluationReason.ErrorKind)": 1,
"EvaluationReasonTypeAdapter.parse(com.google.gson.stream.JsonReader)": 1,
"EvaluationDetailTypeAdapterFactory.EvaluationDetailTypeAdapter.read(com.google.gson.stream.JsonReader)": 1,
"LDValue.equals(java.lang.Object)": 1,
"LDValueTypeAdapter.read(com.google.gson.stream.JsonReader)": 3,
"json.JsonSerialization.getDeserializableClasses()": -1
"LDValueTypeAdapter.read(com.google.gson.stream.JsonReader)": 1,
"json.JsonSerialization.getDeserializableClasses()": -1,
"json.LDGson.LDTypeAdapter.write(com.google.gson.stream.JsonWriter, java.lang.Object)": 1,
"json.LDJackson.GsonReaderToJacksonParserAdapter.peekInternal()": 3
]

knownMissedLinesForMethods.each { partialSignature, maxMissedLines ->
Expand Down
21 changes: 0 additions & 21 deletions scripts/circleci/LICENSE

This file was deleted.

88 changes: 0 additions & 88 deletions scripts/circleci/circle-android

This file was deleted.

23 changes: 0 additions & 23 deletions scripts/install-android-tools.sh

This file was deleted.

17 changes: 0 additions & 17 deletions scripts/run-android-tests.sh

This file was deleted.

8 changes: 0 additions & 8 deletions scripts/start-android-env.sh

This file was deleted.

9 changes: 0 additions & 9 deletions scripts/started-android-env.sh

This file was deleted.

5 changes: 0 additions & 5 deletions scripts/stop-android-env.sh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public void write(JsonWriter out, EvaluationDetail<T> value) throws IOException
out.endObject();
}

@SuppressWarnings("unchecked")
@Override
public EvaluationDetail<T> read(JsonReader in) throws IOException {
T value = null;
Expand All @@ -85,8 +86,10 @@ public EvaluationDetail<T> read(JsonReader in) throws IOException {
}
in.endObject();

if (value == null && valueType == LDValue.class) {
value = (T)LDValue.ofNull(); // normalize to get around gson's habit of skipping the TypeAdapter for nulls
}
return EvaluationDetail.fromValue(value, variation, reason);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import java.io.IOException;

import static com.launchdarkly.sdk.Helpers.readNonNullableString;
import static com.launchdarkly.sdk.Helpers.readEnum;
import static com.launchdarkly.sdk.Helpers.readNullableString;

final class EvaluationReasonTypeAdapter extends TypeAdapter<EvaluationReason> {
Expand All @@ -29,7 +29,7 @@ static EvaluationReason parse(JsonReader reader) throws IOException {
String key = reader.nextName();
switch (key) { // COVERAGE: may have spurious "branches missed" warning, see https://stackoverflow.com/questions/28013717/eclemma-branch-coverage-for-switch-7-of-19-missed
case "kind":
kind = Enum.valueOf(EvaluationReason.Kind.class, readNonNullableString(reader));
kind = readEnum(EvaluationReason.Kind.class, reader);
break;
case "ruleIndex":
ruleIndex = reader.nextInt();
Expand All @@ -41,7 +41,7 @@ static EvaluationReason parse(JsonReader reader) throws IOException {
prereqKey = reader.nextString();
break;
case "errorKind":
errorKind = Enum.valueOf(EvaluationReason.ErrorKind.class, readNonNullableString(reader));
errorKind = readEnum(EvaluationReason.ErrorKind.class, reader);
break;
default:
reader.skipValue(); // ignore any unexpected property
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/com/launchdarkly/sdk/Helpers.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,13 @@ static String readNonNullableString(JsonReader reader) throws IOException {
throw new JsonParseException("expected string value");
}
}

static <T extends Enum<T>> T readEnum(Class<T> enumClass, JsonReader reader) throws IOException {
String s = readNonNullableString(reader);
try {
return Enum.valueOf(enumClass, s);
} catch (IllegalArgumentException e) {
throw new JsonParseException(String.format("unsupported value \"%s\" for %s", s, enumClass));
}
}
}
Loading