Skip to content

Commit

Permalink
fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
luca992 committed Aug 18, 2023
1 parent a22c655 commit ecc6c74
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -335,41 +335,41 @@ class Phonemetadata private constructor() {
return nationalNumberPattern == other.nationalNumberPattern && possibleLength_ == other.possibleLength_ && possibleLengthLocalOnly_ == other.possibleLengthLocalOnly_ && exampleNumber == other.exampleNumber
}

override fun writeExternal(objectOutput: ObjectOutput) {
objectOutput.writeBoolean(hasNationalNumberPattern)
override fun writeExternal(out: ObjectOutput) {
out.writeBoolean(hasNationalNumberPattern)
if (hasNationalNumberPattern) {
objectOutput.writeUTF(nationalNumberPattern)
out.writeUTF(nationalNumberPattern)
}
val possibleLengthSize = possibleLengthCount
objectOutput.writeInt(possibleLengthSize)
out.writeInt(possibleLengthSize)
for (i in 0 until possibleLengthSize) {
objectOutput.writeInt(possibleLength_[i])
out.writeInt(possibleLength_[i])
}
val possibleLengthLocalOnlySize = possibleLengthLocalOnlyCount
objectOutput.writeInt(possibleLengthLocalOnlySize)
out.writeInt(possibleLengthLocalOnlySize)
for (i in 0 until possibleLengthLocalOnlySize) {
objectOutput.writeInt(possibleLengthLocalOnly_[i])
out.writeInt(possibleLengthLocalOnly_[i])
}
objectOutput.writeBoolean(hasExampleNumber)
out.writeBoolean(hasExampleNumber)
if (hasExampleNumber) {
objectOutput.writeUTF(exampleNumber)
out.writeUTF(exampleNumber)
}
}

override fun readExternal(objectInput: ObjectInput) {
if (objectInput.readBoolean()) {
setNationalNumberPattern(objectInput.readUTF())
override fun readExternal(input: ObjectInput) {
if (input.readBoolean()) {
setNationalNumberPattern(input.readUTF())
}
val possibleLengthSize = objectInput.readInt()
val possibleLengthSize = input.readInt()
for (i in 0 until possibleLengthSize) {
possibleLength_.add(objectInput.readInt())
possibleLength_.add(input.readInt())
}
val possibleLengthLocalOnlySize = objectInput.readInt()
val possibleLengthLocalOnlySize = input.readInt()
for (i in 0 until possibleLengthLocalOnlySize) {
possibleLengthLocalOnly_.add(objectInput.readInt())
possibleLengthLocalOnly_.add(input.readInt())
}
if (objectInput.readBoolean()) {
setExampleNumber(objectInput.readUTF())
if (input.readBoolean()) {
setExampleNumber(input.readUTF())
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class RegexBasedMatcher private constructor() : MatcherApi {
val nationalNumberPattern = numberDesc.nationalNumberPattern
// We don't want to consider it a prefix match when matching non-empty input against an empty
// pattern.
return if (nationalNumberPattern.length == 0) {
return if (nationalNumberPattern.isEmpty()) {
false
} else match(number, regexCache.getRegexForPattern(nationalNumberPattern), allowPrefixMatch);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class MatcherTest {
// set.
private fun createDesc(nationalNumberPattern: String): PhoneNumberDesc {
val desc = newBuilder()
if (nationalNumberPattern.length > 0) {
if (nationalNumberPattern.isNotEmpty()) {
desc.setNationalNumberPattern(nationalNumberPattern)
}
return desc.build()
Expand Down

0 comments on commit ecc6c74

Please sign in to comment.