Skip to content

Commit

Permalink
requireNonNull
Browse files Browse the repository at this point in the history
  • Loading branch information
nbauma109 committed May 19, 2023
1 parent b19062c commit 761e909
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -449,9 +449,7 @@ private BaseTypeParameter parseTypeParameters(SignatureReader reader) {

TypeParameter firstTypeParameter = parseTypeParameter(reader);

if (firstTypeParameter == null) {
throw new SignatureFormatException(reader.signature);
}
requireNonNull(reader, firstTypeParameter);

TypeParameter nextTypeParameter = parseTypeParameter(reader);
BaseTypeParameter typeParameters;
Expand Down Expand Up @@ -617,9 +615,7 @@ private static void ensureReadCharacter(SignatureReader reader, char closingChar
private BaseTypeArgument parseTypeArguments(SignatureReader reader) {
TypeArgument firstTypeArgument = parseTypeArgument(reader);

if (firstTypeArgument == null) {
throw new SignatureFormatException(reader.signature);
}
requireNonNull(reader, firstTypeArgument);

TypeArgument nextTypeArgument = parseTypeArgument(reader);

Expand All @@ -637,6 +633,12 @@ private BaseTypeArgument parseTypeArguments(SignatureReader reader) {
return typeArguments;
}

private static void requireNonNull(SignatureReader reader, Object o) {
if (o == null) {
throw new SignatureFormatException(reader.signature);
}
}

private Type parseReferenceTypeSignature(String signature) {
return parseReferenceTypeSignature(new SignatureReader(signature));
}
Expand Down Expand Up @@ -1725,7 +1727,8 @@ private static Object[] loadConstants(DataInput reader) throws IOException {
if (count == 0) {
throw new ClassFormatException("Zero-length constant pool");
}
Object[] constants = new Object[count];

Object[] constants = new Object[count];

int tag;
for (int i=1; i<count; i++) {
Expand Down

0 comments on commit 761e909

Please sign in to comment.