Skip to content

Commit

Permalink
Fix condition where Attribute#getValue() throws an unsupported operat…
Browse files Browse the repository at this point in the history
…ion exception (#4669)
  • Loading branch information
jkschneider authored Nov 13, 2024
1 parent 9997b5c commit d625680
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,11 @@ public JavaType.Primitive primitive(TypeTag tag) {
.map(attr -> attr.getValue().toString())
.collect(Collectors.toList());
} else {
defaultValues = Collections.singletonList(methodSymbol.getDefaultValue().getValue().toString());
try {
defaultValues = Collections.singletonList(methodSymbol.getDefaultValue().getValue().toString());
} catch(UnsupportedOperationException e) {
// not all Attribute implementations define `getValue()`
}
}
}
JavaType.Method method = new JavaType.Method(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,11 @@ public JavaType.Primitive primitive(TypeTag tag) {
.map(attr -> attr.getValue().toString())
.collect(Collectors.toList());
} else {
defaultValues = Collections.singletonList(methodSymbol.getDefaultValue().getValue().toString());
try {
defaultValues = Collections.singletonList(methodSymbol.getDefaultValue().getValue().toString());
} catch(UnsupportedOperationException e) {
// not all Attribute implementations define `getValue()`
}
}
}
JavaType.Method method = new JavaType.Method(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,11 @@ public JavaType.Primitive primitive(TypeTag tag) {
.map(attr -> attr.getValue().toString())
.collect(Collectors.toList());
} else {
defaultValues = Collections.singletonList(methodSymbol.getDefaultValue().getValue().toString());
try {
defaultValues = Collections.singletonList(methodSymbol.getDefaultValue().getValue().toString());
} catch(UnsupportedOperationException e) {
// not all Attribute implementations define `getValue()`
}
}
}
JavaType.Method method = new JavaType.Method(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,11 @@ public JavaType.Primitive primitive(TypeTag tag) {
.map(attr -> attr.getValue().toString())
.collect(Collectors.toList());
} else {
defaultValues = Collections.singletonList(methodSymbol.getDefaultValue().getValue().toString());
try {
defaultValues = Collections.singletonList(methodSymbol.getDefaultValue().getValue().toString());
} catch(UnsupportedOperationException e) {
// not all Attribute implementations define `getValue()`
}
}
}
JavaType.Method method = new JavaType.Method(
Expand Down

0 comments on commit d625680

Please sign in to comment.