Remove redundant static modifiers on records

They are implicit
This commit is contained in:
Zac Sweers
2021-12-20 16:46:39 -05:00
parent 2e15a3fa72
commit 82987854df
2 changed files with 10 additions and 10 deletions

View File

@@ -76,7 +76,7 @@ public final class RecordsTest {
assertThat(deserialized).isEqualTo(instance); assertThat(deserialized).isEqualTo(instance);
} }
public static record SmokeTestType( public record SmokeTestType(
@Json(name = "first_name") String firstName, @Json(name = "first_name") String firstName,
@Json(name = "last_name") String lastName, @Json(name = "last_name") String lastName,
int age, int age,
@@ -150,7 +150,7 @@ public final class RecordsTest {
assertThat(adapter.fromJson("{\"value\":\"Okay!\"}")).isEqualTo(new GenericRecord<>("Okay!")); assertThat(adapter.fromJson("{\"value\":\"Okay!\"}")).isEqualTo(new GenericRecord<>("Okay!"));
} }
public static record GenericRecord<T>(T value) {} public record GenericRecord<T>(T value) {}
@Test @Test
public void genericBoundedRecord() throws IOException { public void genericBoundedRecord() throws IOException {
@@ -172,9 +172,9 @@ public final class RecordsTest {
assertThat(jsonAdapter.fromJson(json)).isEqualTo(value); assertThat(jsonAdapter.fromJson(json)).isEqualTo(value);
} }
public static record IndirectGenerics<T>(T single, List<T> list, Map<String, T> map) {} public record IndirectGenerics<T>(T single, List<T> list, Map<String, T> map) {}
public static record HasIndirectGenerics(IndirectGenerics<Long> value) {} public record HasIndirectGenerics(IndirectGenerics<Long> value) {}
@Test @Test
public void qualifiedValues() throws IOException { public void qualifiedValues() throws IOException {
@@ -183,7 +183,7 @@ public final class RecordsTest {
.isEqualTo(new QualifiedValues(16711680)); .isEqualTo(new QualifiedValues(16711680));
} }
public static record QualifiedValues(@HexColor int value) {} public record QualifiedValues(@HexColor int value) {}
@Retention(RUNTIME) @Retention(RUNTIME)
@JsonQualifier @JsonQualifier
@@ -203,7 +203,7 @@ public final class RecordsTest {
} }
} }
public static record GenericBoundedRecord<T extends Number>(T value) {} public record GenericBoundedRecord<T extends Number>(T value) {}
@Test @Test
public void jsonName() throws IOException { public void jsonName() throws IOException {
@@ -211,7 +211,7 @@ public final class RecordsTest {
assertThat(adapter.fromJson("{\"actualValue\":3}")).isEqualTo(new JsonName(3)); assertThat(adapter.fromJson("{\"actualValue\":3}")).isEqualTo(new JsonName(3));
} }
public static record JsonName(@Json(name = "actualValue") int value) {} public record JsonName(@Json(name = "actualValue") int value) {}
/** /**
* We had a bug where we were incorrectly wrapping exceptions thrown when delegating to the * We had a bug where we were incorrectly wrapping exceptions thrown when delegating to the
@@ -248,7 +248,7 @@ public final class RecordsTest {
} }
} }
public static record BooleanRecord(boolean value) {} public record BooleanRecord(boolean value) {}
@Test @Test
public void absentPrimitiveFails() throws IOException { public void absentPrimitiveFails() throws IOException {
@@ -290,5 +290,5 @@ public final class RecordsTest {
assertThat(adapter.toJson(value)).isEqualTo("{\"i\":5}"); assertThat(adapter.toJson(value)).isEqualTo("{\"i\":5}");
} }
public static record AbsentValues(String s, int i) {} public record AbsentValues(String s, int i) {}
} }

View File

@@ -112,7 +112,7 @@ final class RecordJsonAdapter<T> extends JsonAdapter<T> {
} }
}; };
private static record ComponentBinding<T>( private record ComponentBinding<T>(
String componentName, String jsonName, JsonAdapter<T> adapter, MethodHandle accessor) {} String componentName, String jsonName, JsonAdapter<T> adapter, MethodHandle accessor) {}
private final String targetClass; private final String targetClass;