-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good couple of remarks before 🚢
} | ||
|
||
private static Gson getGsonInstance() { | ||
return gson = gson != null ? gson : new Gson(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the need for lazy initialising? Think we can directly initialise it in the field without too much overhead.
String string = (String) object; | ||
if (string.length() > 1 && | ||
string.charAt(0) == '\"' && string.charAt(string.length() - 1) == '\"') { | ||
object = string.substring(1, string.length() - 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
above code in separate method?
@@ -3452,6 +3456,9 @@ private Object toValue(ExpressionLiteral expressionValue) { | |||
|
|||
/** | |||
* Returns a string representation of the object that matches the definition set in the style specification. | |||
* <p> | |||
* If this expression contains a coma (,) delimited literal, like 'rgba(r, g, b, a)`, | |||
* it will be enclosed with double quotes ("). | |||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to close </p>
javadoc paragraph
stop("layer1", 2), | ||
stop("layer2", 2.7)); | ||
assertEquals("expressions should match", expected, raw(expected.toString())); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extract tests into separate tests methods to explain intent / track down test faillure
733b89c
to
c9d188c
Compare
if (object instanceof String) { | ||
object = unwrapStringLiteral((String) object); | ||
} else if (object instanceof Number) { | ||
object = ((Number) object).floatValue(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noting, that in order to make serialization/deserialization and testing of raw expressions easier I'm converting every Number
literal to a Float
to keep it consistent since JSON format isn't integer-aware. This forced adjustments in a lot of test cases.
Ready for another round @tobrun. |
Closes #11158.