Polish 'Use exclamation character for the document separator prefix'

See gh-32521
This commit is contained in:
Phillip Webb 2022-10-18 17:06:36 -07:00
parent 33e379c4a2
commit 2c7114fa17

View File

@ -42,6 +42,7 @@ import org.springframework.util.Assert;
* @author Madhura Bhave * @author Madhura Bhave
* @author Phillip Webb * @author Phillip Webb
* @author Thiago Hirata * @author Thiago Hirata
* @author Guirong Hu
*/ */
class OriginTrackedPropertiesLoader { class OriginTrackedPropertiesLoader {
@ -90,12 +91,12 @@ class OriginTrackedPropertiesLoader {
if (document.isEmpty() && !documents.isEmpty()) { if (document.isEmpty() && !documents.isEmpty()) {
document = documents.remove(documents.size() - 1); document = documents.remove(documents.size() - 1);
} }
reader.setLastLineCommentPrefix(commentPrefixCharacter); reader.setLastLineCommentPrefixCharacter(commentPrefixCharacter);
reader.skipComment(); reader.skipComment();
} }
} }
else { else {
reader.setLastLineCommentPrefix(-1); reader.setLastLineCommentPrefixCharacter(-1);
loadKeyAndValue(expandLists, document, reader, buffer); loadKeyAndValue(expandLists, document, reader, buffer);
} }
} }
@ -197,7 +198,7 @@ class OriginTrackedPropertiesLoader {
private int character; private int character;
private int lastLineCommentPrefix; private int lastLineCommentPrefixCharacter;
CharacterReader(Resource resource) throws IOException { CharacterReader(Resource resource) throws IOException {
this.reader = new LineNumberReader( this.reader = new LineNumberReader(
@ -233,8 +234,8 @@ class OriginTrackedPropertiesLoader {
} }
} }
private void setLastLineCommentPrefix(int lastLineCommentPrefix) { private void setLastLineCommentPrefixCharacter(int lastLineCommentPrefixCharacter) {
this.lastLineCommentPrefix = lastLineCommentPrefix; this.lastLineCommentPrefixCharacter = lastLineCommentPrefixCharacter;
} }
private void skipComment() throws IOException { private void skipComment() throws IOException {
@ -307,7 +308,7 @@ class OriginTrackedPropertiesLoader {
} }
boolean isSameLastLineCommentPrefix() { boolean isSameLastLineCommentPrefix() {
return this.lastLineCommentPrefix == this.character; return this.lastLineCommentPrefixCharacter == this.character;
} }
boolean isCommentPrefixCharacter() { boolean isCommentPrefixCharacter() {