Skip to content

Commit 65fe3ad

Browse files
cleanup and remove deprecation warnings.
1 parent 34cc766 commit 65fe3ad

File tree

2 files changed

+6
-38
lines changed

2 files changed

+6
-38
lines changed

core-api/src/main/java/com/optimizely/ab/Optimizely.java

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -373,9 +373,7 @@ public void track(@Nonnull String eventName,
373373
* False if the feature is disabled.
374374
* False if the feature is not found.
375375
*
376-
* @deprecated use __decide__ API instead. Refer to [the migration guide] (https://docs.developers.optimizely.com/full-stack/v4.0/docs/migrate-from-older-versions-java)
377376
*/
378-
@Deprecated
379377
@Nonnull
380378
public Boolean isFeatureEnabled(@Nonnull String featureKey,
381379
@Nonnull String userId) {
@@ -393,9 +391,7 @@ public Boolean isFeatureEnabled(@Nonnull String featureKey,
393391
* False if the feature is disabled.
394392
* False if the feature is not found.
395393
*
396-
* @deprecated use __decide__ API instead. Refer to [the migration guide] (https://docs.developers.optimizely.com/full-stack/v4.0/docs/migrate-from-older-versions-java)
397394
*/
398-
@Deprecated
399395
@Nonnull
400396
public Boolean isFeatureEnabled(@Nonnull String featureKey,
401397
@Nonnull String userId,
@@ -409,11 +405,6 @@ public Boolean isFeatureEnabled(@Nonnull String featureKey,
409405
return isFeatureEnabled(projectConfig, featureKey, userId, attributes);
410406
}
411407

412-
/**
413-
*
414-
* @deprecated use __decide__ API instead. Refer to [the migration guide] (https://docs.developers.optimizely.com/full-stack/v4.0/docs/migrate-from-older-versions-java)
415-
*/
416-
@Deprecated
417408
@Nonnull
418409
private Boolean isFeatureEnabled(@Nonnull ProjectConfig projectConfig,
419410
@Nonnull String featureKey,
@@ -508,9 +499,7 @@ public Boolean getFeatureVariableBoolean(@Nonnull String featureKey,
508499
*
509500
*
510501
*
511-
* @deprecated use __decide__ API instead. Refer to [the migration guide] (https://docs.developers.optimizely.com/full-stack/v4.0/docs/migrate-from-older-versions-java)
512502
*/
513-
@Deprecated
514503
@Nullable
515504
public Boolean getFeatureVariableBoolean(@Nonnull String featureKey,
516505
@Nonnull String variableKey,
@@ -535,9 +524,7 @@ public Boolean getFeatureVariableBoolean(@Nonnull String featureKey,
535524
* @return The Double value of the double single variable feature.
536525
* Null if the feature or variable could not be found.
537526
*
538-
* @deprecated use __decide__ API instead. Refer to [the migration guide] (https://docs.developers.optimizely.com/full-stack/v4.0/docs/migrate-from-older-versions-java)
539527
*/
540-
@Deprecated
541528
@Nullable
542529
public Double getFeatureVariableDouble(@Nonnull String featureKey,
543530
@Nonnull String variableKey,
@@ -555,9 +542,7 @@ public Double getFeatureVariableDouble(@Nonnull String featureKey,
555542
* @return The Double value of the double single variable feature.
556543
* Null if the feature or variable could not be found.
557544
*
558-
* @deprecated use __decide__ API instead. Refer to [the migration guide] (https://docs.developers.optimizely.com/full-stack/v4.0/docs/migrate-from-older-versions-java)
559545
*/
560-
@Deprecated
561546
@Nullable
562547
public Double getFeatureVariableDouble(@Nonnull String featureKey,
563548
@Nonnull String variableKey,
@@ -590,9 +575,7 @@ public Double getFeatureVariableDouble(@Nonnull String featureKey,
590575
* @return The Integer value of the integer single variable feature.
591576
* Null if the feature or variable could not be found.
592577
*
593-
* @deprecated use __decide__ API instead. Refer to [the migration guide] (https://docs.developers.optimizely.com/full-stack/v4.0/docs/migrate-from-older-versions-java)
594578
*/
595-
@Deprecated
596579
@Nullable
597580
public Integer getFeatureVariableInteger(@Nonnull String featureKey,
598581
@Nonnull String variableKey,
@@ -610,9 +593,7 @@ public Integer getFeatureVariableInteger(@Nonnull String featureKey,
610593
* @return The Integer value of the integer single variable feature.
611594
* Null if the feature or variable could not be found.
612595
*
613-
* @deprecated use __decide__ API instead. Refer to [the migration guide] (https://docs.developers.optimizely.com/full-stack/v4.0/docs/migrate-from-older-versions-java)
614596
*/
615-
@Deprecated
616597
@Nullable
617598
public Integer getFeatureVariableInteger(@Nonnull String featureKey,
618599
@Nonnull String variableKey,
@@ -646,9 +627,7 @@ public Integer getFeatureVariableInteger(@Nonnull String featureKey,
646627
* @return The String value of the string single variable feature.
647628
* Null if the feature or variable could not be found.
648629
*
649-
* @deprecated use __decide__ API instead. Refer to [the migration guide] (https://docs.developers.optimizely.com/full-stack/v4.0/docs/migrate-from-older-versions-java)
650630
*/
651-
@Deprecated
652631
@Nullable
653632
public String getFeatureVariableString(@Nonnull String featureKey,
654633
@Nonnull String variableKey,
@@ -666,9 +645,7 @@ public String getFeatureVariableString(@Nonnull String featureKey,
666645
* @return The String value of the string single variable feature.
667646
* Null if the feature or variable could not be found.
668647
*
669-
* @deprecated use __decide__ API instead. Refer to [the migration guide] (https://docs.developers.optimizely.com/full-stack/v4.0/docs/migrate-from-older-versions-java)
670648
*/
671-
@Deprecated
672649
@Nullable
673650
public String getFeatureVariableString(@Nonnull String featureKey,
674651
@Nonnull String variableKey,
@@ -692,9 +669,7 @@ public String getFeatureVariableString(@Nonnull String featureKey,
692669
* @return An OptimizelyJSON instance for the JSON variable value.
693670
* Null if the feature or variable could not be found.
694671
*
695-
* @deprecated use __decide__ API instead. Refer to [the migration guide] (https://docs.developers.optimizely.com/full-stack/v4.0/docs/migrate-from-older-versions-java)
696672
*/
697-
@Deprecated
698673
@Nullable
699674
public OptimizelyJSON getFeatureVariableJSON(@Nonnull String featureKey,
700675
@Nonnull String variableKey,
@@ -712,9 +687,7 @@ public OptimizelyJSON getFeatureVariableJSON(@Nonnull String featureKey,
712687
* @return An OptimizelyJSON instance for the JSON variable value.
713688
* Null if the feature or variable could not be found.
714689
*
715-
* @deprecated use __decide__ API instead. Refer to [the migration guide] (https://docs.developers.optimizely.com/full-stack/v4.0/docs/migrate-from-older-versions-java)
716690
*/
717-
@Deprecated
718691
@Nullable
719692
public OptimizelyJSON getFeatureVariableJSON(@Nonnull String featureKey,
720693
@Nonnull String variableKey,
@@ -865,9 +838,7 @@ Object convertStringToType(String variableValue, String type) {
865838
* @return An OptimizelyJSON instance for all variable values.
866839
* Null if the feature could not be found.
867840
*
868-
* @deprecated use __decide__ API instead. Refer to [the migration guide] (https://docs.developers.optimizely.com/full-stack/v4.0/docs/migrate-from-older-versions-java)
869841
*/
870-
@Deprecated
871842
@Nullable
872843
public OptimizelyJSON getAllFeatureVariables(@Nonnull String featureKey,
873844
@Nonnull String userId) {
@@ -883,9 +854,7 @@ public OptimizelyJSON getAllFeatureVariables(@Nonnull String featureKey,
883854
* @return An OptimizelyJSON instance for all variable values.
884855
* Null if the feature could not be found.
885856
*
886-
* @deprecated use __decide__ API instead. Refer to [the migration guide] (https://docs.developers.optimizely.com/full-stack/v4.0/docs/migrate-from-older-versions-java)
887857
*/
888-
@Deprecated
889858
@Nullable
890859
public OptimizelyJSON getAllFeatureVariables(@Nonnull String featureKey,
891860
@Nonnull String userId,
@@ -969,9 +938,7 @@ public OptimizelyJSON getAllFeatureVariables(@Nonnull String featureKey,
969938
* @return List of the feature keys that are enabled for the user if the userId is empty it will
970939
* return Empty List.
971940
*
972-
* @deprecated use __decide__ API instead. Refer to [the migration guide] (https://docs.developers.optimizely.com/full-stack/v4.0/docs/migrate-from-older-versions-java)
973941
*/
974-
@Deprecated
975942
public List<String> getEnabledFeatures(@Nonnull String userId, @Nonnull Map<String, ?> attributes) {
976943
List<String> enabledFeaturesList = new ArrayList();
977944
if (!validateUserId(userId)) {

core-api/src/main/java/com/optimizely/ab/OptimizelyUserContext.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -311,11 +311,13 @@ public boolean removeForcedDecision(@Nonnull String flagKey, String ruleKey) {
311311
}
312312
if (ruleKey != null) {
313313
try {
314-
forcedDecisionsMap.get(flagKey).remove(ruleKey);
315-
if (forcedDecisionsMap.get(flagKey).size() == 0) {
316-
forcedDecisionsMap.remove(flagKey);
314+
ForcedDecision result = forcedDecisionsMap.get(flagKey).remove(ruleKey);
315+
if (result != null) {
316+
if (forcedDecisionsMap.get(flagKey).size() == 0) {
317+
forcedDecisionsMap.remove(flagKey);
318+
}
319+
return true;
317320
}
318-
return true;
319321
} catch (Exception e) {
320322
logger.error("Forced Decision does not exist to remove - " + e);
321323
}
@@ -368,7 +370,6 @@ public DecisionResponse<Variation> findValidatedForcedDecision(@Nonnull String f
368370
*/
369371
public DecisionResponse<Variation> findValidatedForcedDecision(@Nonnull String flagKey, String ruleKey) {
370372
DecisionReasons reasons = DefaultDecisionReasons.newInstance();
371-
// TODO - Move all info strings to a single class to be called rather than hardcoded in functions
372373
String variationKey = findForcedDecision(flagKey, ruleKey);
373374
if (variationKey != null) {
374375
Variation variation = optimizely.getFlagVariationByKey(flagKey, variationKey);

0 commit comments

Comments
 (0)