Skip to content

Commit 775cffc

Browse files
author
Mike Davis
authored
Replace method reference to lambdas. (#321)
1 parent d19cdcf commit 775cffc

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

core-api/src/main/java/com/optimizely/ab/config/parser/DefaultConfigParser.java

+7-4
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,13 @@ public static ConfigParser getInstance() {
4040
//======== Helper methods ========//
4141

4242
public enum ConfigParserSupplier {
43-
GSON_CONFIG_PARSER("com.google.gson.Gson", GsonConfigParser::new),
44-
JACKSON_CONFIG_PARSER("com.fasterxml.jackson.databind.ObjectMapper", JacksonConfigParser::new),
45-
JSON_CONFIG_PARSER("org.json.JSONObject", JsonConfigParser::new),
46-
JSON_SIMPLE_CONFIG_PARSER("org.json.simple.JSONObject", JsonSimpleConfigParser::new);
43+
// WARNING THESE MUST REMAIN LAMBDAS!!!
44+
// SWITCHING TO METHOD REFERENCES REQUIRES REQUIRES
45+
// ALL PARSERS IN THE CLASSPATH.
46+
GSON_CONFIG_PARSER("com.google.gson.Gson", () -> { return new GsonConfigParser(); }),
47+
JACKSON_CONFIG_PARSER("com.fasterxml.jackson.databind.ObjectMapper", () -> { return new JacksonConfigParser(); }),
48+
JSON_CONFIG_PARSER("org.json.JSONObject", () -> { return new JsonConfigParser(); }),
49+
JSON_SIMPLE_CONFIG_PARSER("org.json.simple.JSONObject", () -> { return new JsonSimpleConfigParser(); });
4750

4851
private final String className;
4952
private final Supplier<ConfigParser> supplier;

0 commit comments

Comments
 (0)