Remove superfluous static declaration for enum, annotation, & interface

This commit is contained in:
Sam Brannen
2022-07-09 15:45:30 +02:00
parent aa8b06b622
commit d274e893a6
40 changed files with 138 additions and 177 deletions

View File

@@ -1345,7 +1345,7 @@ class AnnotatedElementUtilsTests {
}
@Transactional
static interface InterfaceWithInheritedAnnotation {
interface InterfaceWithInheritedAnnotation {
@Order
void handleFromInterface();

View File

@@ -97,7 +97,7 @@ class AnnotationBackCompatibiltyTests {
}
static enum TestEnum {
enum TestEnum {
ONE,

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,7 +33,6 @@ public class AnnotationEnclosingClassSample {
@EnclosedThree
public static class EnclosedStaticStatic {
}
}
@@ -43,24 +42,20 @@ public class AnnotationEnclosingClassSample {
@EnclosedThree
public class EnclosedInnerInner {
}
}
@Retention(RetentionPolicy.RUNTIME)
public static @interface EnclosedOne {
@interface EnclosedOne {
}
@Retention(RetentionPolicy.RUNTIME)
public static @interface EnclosedTwo {
@interface EnclosedTwo {
}
@Retention(RetentionPolicy.RUNTIME)
public static @interface EnclosedThree {
@interface EnclosedThree {
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -128,7 +128,7 @@ class MergedAnnotationClassLoaderTests {
}
@Retention(RetentionPolicy.RUNTIME)
static @interface TestMetaAnnotation {
@interface TestMetaAnnotation {
@AliasFor("d")
String c() default "";
@@ -144,7 +144,7 @@ class MergedAnnotationClassLoaderTests {
@TestMetaAnnotation(classValue = TestReference.class, enumValue = TestEnum.TWO)
@Retention(RetentionPolicy.RUNTIME)
static @interface TestAnnotation {
@interface TestAnnotation {
@AliasFor("b")
String a() default "";
@@ -156,16 +156,13 @@ class MergedAnnotationClassLoaderTests {
@TestAnnotation
static class WithTestAnnotation {
}
static class TestReference {
}
static enum TestEnum {
enum TestEnum {
ONE, TWO, THREE
}
}

View File

@@ -2175,7 +2175,7 @@ class MergedAnnotationsTests {
}
}
static interface NonAnnotatedInterface {
interface NonAnnotatedInterface {
}
@TransactionalComponent
@@ -2539,7 +2539,7 @@ class MergedAnnotationsTests {
}
@Transactional
static interface InterfaceWithInheritedAnnotation {
interface InterfaceWithInheritedAnnotation {
@Order
void handleFromInterface();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -206,79 +206,67 @@ class RepeatableContainersTests {
}
@Retention(RetentionPolicy.RUNTIME)
static @interface NonRepeatable {
@interface NonRepeatable {
String value() default "";
}
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(StandardContainer.class)
static @interface StandardRepeatable {
@interface StandardRepeatable {
String value() default "";
}
@Retention(RetentionPolicy.RUNTIME)
static @interface StandardContainer {
@interface StandardContainer {
StandardRepeatable[] value();
}
@Retention(RetentionPolicy.RUNTIME)
static @interface ExplicitRepeatable {
@interface ExplicitRepeatable {
String value() default "";
}
@Retention(RetentionPolicy.RUNTIME)
static @interface ExplicitContainer {
@interface ExplicitContainer {
ExplicitRepeatable[] value();
}
@Retention(RetentionPolicy.RUNTIME)
static @interface InvalidNoValue {
@interface InvalidNoValue {
}
@Retention(RetentionPolicy.RUNTIME)
static @interface InvalidNotArray {
@interface InvalidNotArray {
int value();
}
@Retention(RetentionPolicy.RUNTIME)
static @interface InvalidWrongArrayType {
@interface InvalidWrongArrayType {
StandardRepeatable[] value();
}
@NonRepeatable("a")
static class WithNonRepeatable {
}
@StandardRepeatable("a")
static class WithSingleStandardRepeatable {
}
@StandardRepeatable("a")
@StandardRepeatable("b")
static class WithStandardRepeatables {
}
@ExplicitContainer({ @ExplicitRepeatable("a"), @ExplicitRepeatable("b") })
static class WithExplicitRepeatables {
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -132,8 +132,7 @@ class TypeMappedAnnotationTests {
private AnnotationTypeMapping getMapping(Annotation annotation,
Class<? extends Annotation> mappedAnnotationType) {
AnnotationTypeMappings mappings = AnnotationTypeMappings.forAnnotationType(
annotation.annotationType());
AnnotationTypeMappings mappings = AnnotationTypeMappings.forAnnotationType(annotation.annotationType());
for (int i = 0; i < mappings.size(); i++) {
AnnotationTypeMapping candidate = mappings.get(i);
if (candidate.getAnnotationType().equals(mappedAnnotationType)) {
@@ -145,75 +144,66 @@ class TypeMappedAnnotationTests {
}
@Retention(RetentionPolicy.RUNTIME)
static @interface ExplicitMirror {
@interface ExplicitMirror {
@AliasFor("b")
String a() default "";
@AliasFor("a")
String b() default "";
}
@ExplicitMirror(a = "test")
static class WithExplicitMirrorA {
}
@ExplicitMirror(b = "test")
static class WithExplicitMirrorB {
}
@Retention(RetentionPolicy.RUNTIME)
@ExplicitAliasMetaAnnotationTarget(nonAliased = "nonAliased")
static @interface ExplicitAliasToMetaAnnotation {
@interface ExplicitAliasToMetaAnnotation {
@AliasFor(annotation = ExplicitAliasMetaAnnotationTarget.class)
String aliased() default "";
}
@Retention(RetentionPolicy.RUNTIME)
static @interface ExplicitAliasMetaAnnotationTarget {
@interface ExplicitAliasMetaAnnotationTarget {
String aliased() default "";
String nonAliased() default "";
}
@ExplicitAliasToMetaAnnotation(aliased = "aliased")
private static class WithExplicitAliasToMetaAnnotation {
}
@Retention(RetentionPolicy.RUNTIME)
@ConventionAliasMetaAnnotationTarget
static @interface ConventionAliasToMetaAnnotation {
@interface ConventionAliasToMetaAnnotation {
String value() default "";
String convention() default "";
}
@Retention(RetentionPolicy.RUNTIME)
static @interface ConventionAliasMetaAnnotationTarget {
@interface ConventionAliasMetaAnnotationTarget {
String value() default "";
String convention() default "";
}
@ConventionAliasToMetaAnnotation(value = "value", convention = "convention")
private static class WithConventionAliasToMetaAnnotation {
}
@Retention(RetentionPolicy.RUNTIME)
static @interface ArrayTypes {
@interface ArrayTypes {
String[] stringValue();
@@ -238,32 +228,30 @@ class TypeMappedAnnotationTests {
ExplicitMirror[] annotationValue();
ExampleEnum[] enumValue();
}
enum ExampleEnum {ONE,TWO,THREE}
enum ExampleEnum {
ONE, TWO, THREE
}
@Retention(RetentionPolicy.RUNTIME)
static @interface NestedContainer {
@interface NestedContainer {
Nested value();
}
@Retention(RetentionPolicy.RUNTIME)
static @interface Nested {
@interface Nested {
String value() default "";
}
@Retention(RetentionPolicy.RUNTIME)
static @interface ClassAttributes {
@interface ClassAttributes {
Class<?> classValue();
Class<?>[] classArrayValue();
}
}

View File

@@ -748,7 +748,7 @@ class GenericConversionServiceTests {
}
}
private static interface MyEnumBaseInterface {
private interface MyEnumBaseInterface {
String getBaseCode();
}

View File

@@ -307,10 +307,10 @@ public abstract class AbstractAnnotationMetadataTests {
public static class TestClass {
}
public static interface TestInterface {
public interface TestInterface {
}
public static interface TestSubInterface extends TestInterface {
public interface TestSubInterface extends TestInterface {
}
public @interface TestAnnotation {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -181,9 +181,8 @@ public abstract class AbstractMethodMetadataTests {
@Test
public void getAllAnnotationAttributesReturnsAllAttributes() {
MultiValueMap<String, Object> attributes = getTagged(
WithMetaAnnotationAttributes.class).getAllAnnotationAttributes(
AnnotationAttributes.class.getName());
MultiValueMap<String, Object> attributes = getTagged(WithMetaAnnotationAttributes.class)
.getAllAnnotationAttributes(AnnotationAttributes.class.getName());
assertThat(attributes).containsOnlyKeys("name", "size");
assertThat(attributes.get("name")).containsExactlyInAnyOrder("m1", "m2");
assertThat(attributes.get("size")).containsExactlyInAnyOrder(1, 2);
@@ -206,8 +205,7 @@ public abstract class AbstractMethodMetadataTests {
protected abstract AnnotationMetadata get(Class<?> source);
@Retention(RetentionPolicy.RUNTIME)
public static @interface Tag {
@interface Tag {
}
public static class WithMethod {
@@ -288,14 +286,13 @@ public abstract class AbstractMethodMetadataTests {
}
@Retention(RetentionPolicy.RUNTIME)
public static @interface DirectAnnotation {
// Must be public. See AnnotationAttributesReadingVisitor.recursivelyCollectMetaAnnotations().
public @interface DirectAnnotation {
}
@DirectAnnotation
@Retention(RetentionPolicy.RUNTIME)
public static @interface MetaAnnotation {
@interface MetaAnnotation {
}
public static abstract class WithAnnotationAttributes {
@@ -317,18 +314,17 @@ public abstract class AbstractMethodMetadataTests {
@Retention(RetentionPolicy.RUNTIME)
@AnnotationAttributes(name = "m1", size = 1)
public static @interface MetaAnnotationAttributes1 {
@interface MetaAnnotationAttributes1 {
}
@Retention(RetentionPolicy.RUNTIME)
@AnnotationAttributes(name = "m2", size = 2)
public static @interface MetaAnnotationAttributes2 {
@interface MetaAnnotationAttributes2 {
}
@Retention(RetentionPolicy.RUNTIME)
public static @interface AnnotationAttributes {
// Must be public. See AnnotationAttributesReadingVisitor.recursivelyCollectMetaAnnotations().
public @interface AnnotationAttributes {
String name();

View File

@@ -407,7 +407,7 @@ class AnnotationMetadataTests {
// -------------------------------------------------------------------------
public static enum SomeEnum {
public enum SomeEnum {
LABEL1, LABEL2, DEFAULT
}

View File

@@ -69,11 +69,11 @@ class InstanceComparatorTests {
assertThat(comparator.compare(c4, null)).isEqualTo(0);
}
private static interface I1 {
private interface I1 {
}
private static interface I2 {
private interface I2 {
}