equal
deleted
inserted
replaced
126 * @return the replacement object, which may be {@code this}. |
126 * @return the replacement object, which may be {@code this}. |
127 * |
127 * |
128 * @throws InvalidObjectException if the read object has invalid fields. |
128 * @throws InvalidObjectException if the read object has invalid fields. |
129 */ |
129 */ |
130 private Object readResolve() throws InvalidObjectException { |
130 private Object readResolve() throws InvalidObjectException { |
131 if (names.length == 0 && getClass() == ImmutableDescriptor.class) |
|
132 return EMPTY_DESCRIPTOR; |
|
133 |
131 |
134 boolean bad = false; |
132 boolean bad = false; |
135 if (names == null || values == null || names.length != values.length) |
133 if (names == null || values == null || names.length != values.length) |
136 bad = true; |
134 bad = true; |
137 if (!bad) { |
135 if (!bad) { |
|
136 if (names.length == 0 && getClass() == ImmutableDescriptor.class) |
|
137 return EMPTY_DESCRIPTOR; |
138 final Comparator<String> compare = String.CASE_INSENSITIVE_ORDER; |
138 final Comparator<String> compare = String.CASE_INSENSITIVE_ORDER; |
139 String lastName = ""; // also catches illegal null name |
139 String lastName = ""; // also catches illegal null name |
140 for (int i = 0; i < names.length; i++) { |
140 for (int i = 0; i < names.length; i++) { |
141 if (names[i] == null || |
141 if (names[i] == null || |
142 compare.compare(lastName, names[i]) >= 0) { |
142 compare.compare(lastName, names[i]) >= 0) { |