Skip to content
This repository was archived by the owner on Aug 10, 2023. It is now read-only.
This repository was archived by the owner on Aug 10, 2023. It is now read-only.

Clarify behaviour of reusing JsonObjectBuilder#build() #84

@glassfishrobot

Description

@glassfishrobot

In short: is the JsonObjectBuilder#build() method meant to be reusable?

And if I reuse it, does it's internal data gets cleaned when build() is invoked?

final JsonObjectBuilder builder = Json.createObjectBuilder();
builder.add("a", "b");
JsonObject jsonObject = builder.build();
assertEquals("{\"a\":\"b\"}", jsonObject.toString());

builder.add("c", "d");
JsonObject bigQuestionmark = builder.build();

What does the bigQuestionmark JsonObject contain?

{"c":"d"}

or

{"a":"b","c":"d"}

or does it blow up?

Affected Versions

[1.0-pr]

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions