HPInc / jipp

A Java-compatible implementation of IPP
MIT License
153 stars 42 forks source link

Collections fail to accept new data after printing #97

Closed GladeDiviney closed 4 years ago

GladeDiviney commented 4 years ago

Given:

        MediaCol col = new MediaCol();
        col.setMediaType(new KeywordOrName("envelope"));
        System.out.println(col);
        col.setMediaType(new KeywordOrName("label"));
        System.out.println(col);

Expected:

MediaCol(media-type=envelope)
MediaCol(media-type=label)

Received:

MediaCol(media-type=envelope)
MediaCol(media-type=envelope)

Why:

The first println causes access to a lazy constructed list which freezes the internal values. Shouldn't do this.