Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ private static String deepToString(Object obj) {
if (obj.getClass().isArray()) {
return String.format(
"(%s[]) %s",
obj.getClass().getComponentType().getName(), Arrays.deepToString((Object[]) obj));
obj.getClass().getComponentType().getTypeName(), Arrays.deepToString((Object[]) obj));
}
return obj.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ private void recordSeedForFuzzing(List<Object> arguments, ExtensionContext exten
String argumentTypes =
arguments.stream()
.filter(Objects::nonNull)
.map(obj -> obj.getClass().getName())
.map(obj -> obj.getClass().getTypeName())
.collect(Collectors.joining(","));
String argumentValues =
arguments.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ static Message getDefaultInstance(WithDefaultInstance withDefaultInstance) {
+ " subtype of %s, got %s",
withDefaultInstance.value(),
Message.class.getName(),
method.getReturnType().getName()));
method.getReturnType().getTypeName()));
}

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,20 @@ private static void ensureDeepAppliesTo(Annotation annotation, Class<?> clazz) {

String helpText = "";
if (appliesTo.value().length != 0) {
helpText = stream(appliesTo.value()).map(Class::getName).collect(joining(", "));
helpText = stream(appliesTo.value()).map(Class::getTypeName).collect(joining(", "));
}
if (appliesTo.subClassesOf().length != 0) {
if (!helpText.isEmpty()) {
helpText += " as well as ";
}
helpText += "subclasses of ";
helpText += stream(appliesTo.subClassesOf()).map(Class::getName).collect(joining(", "));
helpText += stream(appliesTo.subClassesOf()).map(Class::getTypeName).collect(joining(", "));
}
// Use the simple name as our annotations live in a single package.
throw new IllegalArgumentException(
format(
"@%s does not apply to %s, only applies to %s",
annotation.annotationType().getSimpleName(), clazz.getName(), helpText));
annotation.annotationType().getSimpleName(), clazz.getTypeName(), helpText));
}

private static void ensureMinLessThanOrEqualsMax(Annotation annotation) {
Expand Down
2 changes: 1 addition & 1 deletion tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,7 @@ java_fuzz_target_test(
srcs = ["src/test/java/com/example/InvalidMutatorTest.java"],
expect_crash = False,
expect_non_crash_exit_code = 1,
expected_warning_or_error = "ERROR: @UrlSegment does not apply to java.lang.Integer, only applies to java.lang.String",
expected_warning_or_error = "ERROR: @UrlSegment does not apply to java.lang.Integer\\[\\], only applies to java.lang.String",
target_class = "com.example.InvalidMutatorTest",
target_method = "invalidAnnotation",
runtime_deps = [
Expand Down
2 changes: 1 addition & 1 deletion tests/src/test/java/com/example/InvalidMutatorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void invalidParameter(System ignored) {
}

@FuzzTest
public void invalidAnnotation(@UrlSegment Integer ignored) {
public void invalidAnnotation(Integer @UrlSegment [] ignored) {
throw new IllegalStateException("This method should not be executed");
}
}