Skip to content

Commit

Permalink
Fix #178. Also fix a few javadoc processor warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jan 11, 2015
1 parent dcff4e9 commit 3dcedd2
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 29 deletions.
12 changes: 9 additions & 3 deletions release-notes/VERSION
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
Project: jackson-core

Contains core streaming reader (`JsonParser`) and writer (`JsonGenerator`) abstractions,
factory for constructing readers/writers (JsonFactory). as well as a minimal set
factory for constructing readers/writers (JsonFactory), as well as a minimal set
of interfaces needed for streaming level to make callbacks and call-throughs,
via `ObjectCodec` and `TreeNode`.

Also includes implementation of abstractsion for JSON,
Also includes implementation of this API for JSON.
Forms the base for other data formats as well, despite naming that suggests
json-specificity (naming due to historical reasons).
JSON-specificity: naming is due to history, as Jackson started out as pure
JSON library.

------------------------------------------------------------------------
=== Releases ===
------------------------------------------------------------------------

2.5.1 (not yet released)

#178: Add `Lf2SpacesIndenter.withLinefeed` back to keep binary-compatibility with 2.4.x
(reported by ansell@github)

2.5.0 (01-Jan-2015)

#148: BytesToNameCanonicalizer can mishandle leading null byte(s).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public final class Base64Variants
* This variant is what most people would think of "the standard"
* Base64 encoding.
*<p>
* See <a href="">wikipedia Base64 entry</a> for details.
* See <a href="http://en.wikipedia.org/wiki/Base64">wikipedia Base64 entry</a> for details.
*<p>
* Note that although this can be thought of as the standard variant,
* it is <b>not</b> the default for Jackson: no-linefeeds alternative
Expand Down
42 changes: 28 additions & 14 deletions src/main/java/com/fasterxml/jackson/core/JsonGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ public Object getOutputTarget() {
* Helper method, usually equivalent to:
*<code>
* getOutputContext().getCurrentValue();
*<code>
*</code>
*
* @since 2.5
*/
Expand All @@ -306,7 +306,7 @@ public Object getCurrentValue() {
* Helper method, usually equivalent to:
*<code>
* getOutputContext().setCurrentValue(v);
*<code>
*</code>
*
* @since 2.5
*/
Expand Down Expand Up @@ -965,69 +965,83 @@ public abstract int writeBinary(Base64Variant bv,
*/

/**
* Method for outputting given value as Json number.
* Method for outputting given value as JSON number.
* Can be called in any context where a value is expected
* (Array value, Object field value, root-level value).
* Additional white space may be added around the value
* if pretty-printing is enabled.
*
* @param v Number value to write
*
* @since 2.2
*/
public void writeNumber(short v) throws IOException { writeNumber((int) v); }

/**
* Method for outputting given value as Json number.
* Method for outputting given value as JSON number.
* Can be called in any context where a value is expected
* (Array value, Object field value, root-level value).
* Additional white space may be added around the value
* if pretty-printing is enabled.
*
* @param v Number value to write
*/
public abstract void writeNumber(int v) throws IOException;

/**
* Method for outputting given value as Json number.
* Method for outputting given value as JSON number.
* Can be called in any context where a value is expected
* (Array value, Object field value, root-level value).
* Additional white space may be added around the value
* if pretty-printing is enabled.
*
* @param v Number value to write
*/
public abstract void writeNumber(long v) throws IOException;

/**
* Method for outputting given value as Json number.
* Method for outputting given value as JSON number.
* Can be called in any context where a value is expected
* (Array value, Object field value, root-level value).
* Additional white space may be added around the value
* if pretty-printing is enabled.
*
* @param v Number value to write
*/
public abstract void writeNumber(BigInteger v) throws IOException;

/**
* Method for outputting indicate Json numeric value.
* Method for outputting indicate JSON numeric value.
* Can be called in any context where a value is expected
* (Array value, Object field value, root-level value).
* Additional white space may be added around the value
* if pretty-printing is enabled.
*
* @param v Number value to write
*/
public abstract void writeNumber(double d) throws IOException;
public abstract void writeNumber(double v) throws IOException;

/**
* Method for outputting indicate Json numeric value.
* Method for outputting indicate JSON numeric value.
* Can be called in any context where a value is expected
* (Array value, Object field value, root-level value).
* Additional white space may be added around the value
* if pretty-printing is enabled.
*
* @param v Number value to write
*/
public abstract void writeNumber(float f) throws IOException;
public abstract void writeNumber(float v) throws IOException;

/**
* Method for outputting indicate Json numeric value.
* Method for outputting indicate JSON numeric value.
* Can be called in any context where a value is expected
* (Array value, Object field value, root-level value).
* Additional white space may be added around the value
* if pretty-printing is enabled.
*
* @param v Number value to write
*/
public abstract void writeNumber(BigDecimal dec) throws IOException;
public abstract void writeNumber(BigDecimal v) throws IOException;

/**
* Write method that can be used for custom numeric types that can
Expand All @@ -1039,9 +1053,9 @@ public abstract int writeBinary(Base64Variant bv,
*<p>
* Note: because of lack of type safety, some generator
* implementations may not be able to implement this
* method. For example, if a binary json format is used,
* method. For example, if a binary JSON format is used,
* it may require type information for encoding; similarly
* for generator-wrappers around Java objects or Json nodes.
* for generator-wrappers around Java objects or JSON nodes.
* If implementation does not implement this method,
* it needs to throw {@link UnsupportedOperationException}.
*
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/com/fasterxml/jackson/core/JsonParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ protected JsonParser() { }
* Helper method, usually equivalent to:
*<code>
* getParsingContext().getCurrentValue();
*<code>
*</code>
*
* @since 2.5
*/
Expand All @@ -294,7 +294,7 @@ public Object getCurrentValue() {
* Helper method, usually equivalent to:
*<code>
* getParsingContext().setCurrentValue(v);
*<code>
*</code>
*
* @since 2.5
*/
Expand Down Expand Up @@ -548,12 +548,13 @@ public JsonParser setFeatureMask(int mask) {
* and returns result of that comparison.
* It is functionally equivalent to:
*<pre>
* return (nextToken() == JsonToken.FIELD_NAME) && str.getValue().equals(getCurrentName());
* return (nextToken() == JsonToken.FIELD_NAME) &amp;&amp; str.getValue().equals(getCurrentName());
*</pre>
* but may be faster for parser to verify, and can therefore be used if caller
* expects to get such a property name from input next.
*
* @param str Property name to compare next token to (if next token is <code>JsonToken.FIELD_NAME<code>)
* @param str Property name to compare next token to (if next token is
* <code>JsonToken.FIELD_NAME</code>)
*/
public boolean nextFieldName(SerializableString str) throws IOException, JsonParseException {
return (nextToken() == JsonToken.FIELD_NAME) && str.getValue().equals(getCurrentName());
Expand Down Expand Up @@ -714,7 +715,7 @@ public Boolean nextBooleanValue() throws IOException, JsonParseException {
* Method that is functionally equivalent to:
*<code>
* return getCurrentTokenId() == id
*<code>
*</code>
* but may be more efficiently implemented.
*<p>
* Note that no traversal or conversion is performed; so in some
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* maps/sets, that hash codes are uniformly distributed. Also, collisions
* are slightly more expensive than with HashMap or HashSet, since hash codes
* are not used in resolving collisions; that is, equals() comparison is
* done with all symbols in same bucket index.<br />
* done with all symbols in same bucket index.<br>
* Finally, rehashing is also more expensive, as hash codes are not
* stored; rehashing requires all entries' hash codes to be recalculated.
* Reason for not storing hash codes is reduced memory usage, hoping
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
* to ensure that a Type argument is indeed given.
*<p>
* Usage is by sub-classing: here is one way to instantiate reference
* to generic type <code>List&lt;Integer></code>:
* to generic type <code>List&lt;Integer&gt;</code>:
*<pre>
* TypeReference ref = new TypeReference&lt;List&lt;Integer>>() { };
* TypeReference ref = new TypeReference&lt;List&lt;Integer&gt;&gt;() { };
*</pre>
* which can be passed to methods that accept TypeReference, or resolved
* using <code>TypeFactory</code> to obtain {@link ResolvedType}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,21 +412,36 @@ public void writeIndentation(JsonGenerator jg, int level)
@Deprecated
public static class Lf2SpacesIndenter extends DefaultIndenter
{
/** @deprecated Use {@link DefaultIndenter#SYSTEM_LINEFEED_INSTANCE} instead */
/** @deprecated Use {@link DefaultIndenter#SYSTEM_LINEFEED_INSTANCE} instead.
*/
@SuppressWarnings("hiding")
@Deprecated
public static final Lf2SpacesIndenter instance = new Lf2SpacesIndenter();

/** @deprecated Use {@code new DefaultIndenter(" ", DefaultIndenter.SYS_LF)} instead */
/** @deprecated Use {@code new DefaultIndenter(" ", DefaultIndenter.SYS_LF)} instead
*/
@Deprecated
public Lf2SpacesIndenter() {
super(" ", DefaultIndenter.SYS_LF);
}

/** @deprecated Use {@code new DefaultIndenter(" ", lf)} instead */
/** @deprecated Use {@code new DefaultIndenter(" ", lf)} instead
*/
@Deprecated
public Lf2SpacesIndenter(String lf) {
super(" ", lf);
}

/**
* Note: method was accidentally missing from 2.5.0; put back for 2.5.1 and
* later 2.5.x versions.
*/
@Override
public Lf2SpacesIndenter withLinefeed(String lf) {
if (lf.equals(getEol())) {
return this;
}
return new Lf2SpacesIndenter(lf);
}
}
}

0 comments on commit 3dcedd2

Please sign in to comment.