Skip to content

Commit 9af12d2

Browse files
committed
Polishing
1 parent 5025c61 commit 9af12d2

File tree

34 files changed

+231
-262
lines changed

34 files changed

+231
-262
lines changed

spring-context/src/main/java/org/springframework/scheduling/annotation/Async.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -56,7 +56,7 @@
5656
* bean definition.
5757
* <p>When specified on a class level {@code @Async} annotation, indicates that the
5858
* given executor should be used for all methods within the class. Method level use
59-
* of {@link Async#value} always overrides any value set at the class level.
59+
* of {@code Async#value} always overrides any value set at the class level.
6060
* @since 3.1.2
6161
*/
6262
String value() default "";

spring-context/src/test/java/org/springframework/scripting/groovy/GroovyScriptFactoryTests.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -445,8 +445,7 @@ public void testRefreshableFromTag() throws Exception {
445445
assertTrue(ctx.getBeansOfType(Messenger.class).values().contains(messenger));
446446
}
447447

448-
@Test
449-
// Test for SPR-6268
448+
@Test // SPR-6268
450449
public void testRefreshableFromTagProxyTargetClass() throws Exception {
451450
ApplicationContext ctx = new ClassPathXmlApplicationContext("groovy-with-xsd-proxy-target-class.xml",
452451
getClass());
@@ -464,8 +463,7 @@ public void testRefreshableFromTagProxyTargetClass() throws Exception {
464463
assertNotNull(AnnotationUtils.findAnnotation(messenger.getClass(), Component.class));
465464
}
466465

467-
@Test
468-
// Test for SPR-6268
466+
@Test // SPR-6268
469467
public void testProxyTargetClassNotAllowedIfNotGroovy() throws Exception {
470468
try {
471469
new ClassPathXmlApplicationContext("jruby-with-xsd-proxy-target-class.xml", getClass());

spring-core/src/main/java/org/springframework/core/annotation/AnnotationAwareOrderComparator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
import java.util.Collections;
2323
import java.util.List;
2424

25-
import org.springframework.core.OrderComparator;
2625
import org.springframework.core.DecoratingProxy;
26+
import org.springframework.core.OrderComparator;
2727

2828
/**
2929
* {@code AnnotationAwareOrderComparator} is an extension of

spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@
7171
* <em>meta-present</em> on the other annotation.
7272
*
7373
* <h3>Meta-annotation Support</h3>
74-
* <p>Most {@code find*()} methods and some {@code get*()} methods in this
75-
* class provide support for finding annotations used as meta-annotations.
76-
* Consult the Javadoc for each method in this class for details. For support
77-
* for meta-annotations with <em>attribute overrides</em> in
78-
* <em>composed annotations</em>, use {@link AnnotatedElementUtils} instead.
74+
* <p>Most {@code find*()} methods and some {@code get*()} methods in this class
75+
* provide support for finding annotations used as meta-annotations. Consult the
76+
* javadoc for each method in this class for details. For fine-grained support for
77+
* meta-annotations with <em>attribute overrides</em> in <em>composed annotations</em>,
78+
* consider using {@link AnnotatedElementUtils}'s more specific methods instead.
7979
*
8080
* <h3>Attribute Aliases</h3>
8181
* <p>All public methods in this class that return annotations, arrays of

spring-test/src/main/java/org/springframework/test/annotation/Commit.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@
1717
package org.springframework.test.annotation;
1818

1919
import java.lang.annotation.Documented;
20+
import java.lang.annotation.ElementType;
2021
import java.lang.annotation.Retention;
22+
import java.lang.annotation.RetentionPolicy;
2123
import java.lang.annotation.Target;
2224

23-
import static java.lang.annotation.ElementType.*;
24-
import static java.lang.annotation.RetentionPolicy.*;
25-
2625
/**
2726
* {@code @Commit} is a test annotation that is used to indicate that a
2827
* <em>test-managed transaction</em> should be <em>committed</em> after
@@ -49,9 +48,9 @@
4948
* @see Rollback
5049
* @see org.springframework.test.context.transaction.TransactionalTestExecutionListener
5150
*/
51+
@Target({ElementType.TYPE, ElementType.METHOD})
52+
@Retention(RetentionPolicy.RUNTIME)
5253
@Documented
53-
@Retention(RUNTIME)
54-
@Target({ TYPE, METHOD })
5554
@Rollback(false)
5655
public @interface Commit {
5756
}

spring-test/src/main/java/org/springframework/test/annotation/DirtiesContext.java

Lines changed: 38 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -76,19 +76,48 @@
7676
* @see org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener
7777
* @see org.springframework.test.context.support.DirtiesContextTestExecutionListener
7878
*/
79+
@Target({ElementType.TYPE, ElementType.METHOD})
80+
@Retention(RetentionPolicy.RUNTIME)
7981
@Documented
8082
@Inherited
81-
@Retention(RetentionPolicy.RUNTIME)
82-
@Target({ ElementType.TYPE, ElementType.METHOD })
8383
public @interface DirtiesContext {
8484

85+
/**
86+
* The <i>mode</i> to use when a test method is annotated with
87+
* {@code @DirtiesContext}.
88+
* <p>Defaults to {@link MethodMode#AFTER_METHOD AFTER_METHOD}.
89+
* <p>Setting the method mode on an annotated test class has no meaning.
90+
* For class-level control, use {@link #classMode} instead.
91+
* @since 4.2
92+
*/
93+
MethodMode methodMode() default MethodMode.AFTER_METHOD;
94+
95+
/**
96+
* The <i>mode</i> to use when a test class is annotated with
97+
* {@code @DirtiesContext}.
98+
* <p>Defaults to {@link ClassMode#AFTER_CLASS AFTER_CLASS}.
99+
* <p>Setting the class mode on an annotated test method has no meaning.
100+
* For method-level control, use {@link #methodMode} instead.
101+
* @since 3.0
102+
*/
103+
ClassMode classMode() default ClassMode.AFTER_CLASS;
104+
105+
/**
106+
* The context cache clearing <em>mode</em> to use when a context is
107+
* configured as part of a hierarchy via
108+
* {@link org.springframework.test.context.ContextHierarchy @ContextHierarchy}.
109+
* <p>Defaults to {@link HierarchyMode#EXHAUSTIVE EXHAUSTIVE}.
110+
* @since 3.2.2
111+
*/
112+
HierarchyMode hierarchyMode() default HierarchyMode.EXHAUSTIVE;
113+
114+
85115
/**
86116
* Defines <i>modes</i> which determine how {@code @DirtiesContext} is
87117
* interpreted when used to annotate a test method.
88-
*
89118
* @since 4.2
90119
*/
91-
static enum MethodMode {
120+
enum MethodMode {
92121

93122
/**
94123
* The associated {@code ApplicationContext} will be marked as
@@ -103,13 +132,13 @@ static enum MethodMode {
103132
AFTER_METHOD;
104133
}
105134

135+
106136
/**
107137
* Defines <i>modes</i> which determine how {@code @DirtiesContext} is
108138
* interpreted when used to annotate a test class.
109-
*
110139
* @since 3.0
111140
*/
112-
static enum ClassMode {
141+
enum ClassMode {
113142

114143
/**
115144
* The associated {@code ApplicationContext} will be marked as
@@ -140,15 +169,15 @@ static enum ClassMode {
140169
AFTER_CLASS;
141170
}
142171

172+
143173
/**
144174
* Defines <i>modes</i> which determine how the context cache is cleared
145175
* when {@code @DirtiesContext} is used in a test whose context is
146176
* configured as part of a hierarchy via
147177
* {@link org.springframework.test.context.ContextHierarchy @ContextHierarchy}.
148-
*
149178
* @since 3.2.2
150179
*/
151-
static enum HierarchyMode {
180+
enum HierarchyMode {
152181

153182
/**
154183
* The context cache will be cleared using an <em>exhaustive</em> algorithm
@@ -174,37 +203,4 @@ static enum HierarchyMode {
174203
CURRENT_LEVEL;
175204
}
176205

177-
178-
/**
179-
* The <i>mode</i> to use when a test method is annotated with
180-
* {@code @DirtiesContext}.
181-
* <p>Defaults to {@link MethodMode#AFTER_METHOD AFTER_METHOD}.
182-
* <p>Setting the method mode on an annotated test class has no meaning.
183-
* For class-level control, use {@link #classMode} instead.
184-
*
185-
* @since 4.2
186-
*/
187-
MethodMode methodMode() default MethodMode.AFTER_METHOD;
188-
189-
/**
190-
* The <i>mode</i> to use when a test class is annotated with
191-
* {@code @DirtiesContext}.
192-
* <p>Defaults to {@link ClassMode#AFTER_CLASS AFTER_CLASS}.
193-
* <p>Setting the class mode on an annotated test method has no meaning.
194-
* For method-level control, use {@link #methodMode} instead.
195-
*
196-
* @since 3.0
197-
*/
198-
ClassMode classMode() default ClassMode.AFTER_CLASS;
199-
200-
/**
201-
* The context cache clearing <em>mode</em> to use when a context is
202-
* configured as part of a hierarchy via
203-
* {@link org.springframework.test.context.ContextHierarchy @ContextHierarchy}.
204-
* <p>Defaults to {@link HierarchyMode#EXHAUSTIVE EXHAUSTIVE}.
205-
*
206-
* @since 3.2.2
207-
*/
208-
HierarchyMode hierarchyMode() default HierarchyMode.EXHAUSTIVE;
209-
210206
}

spring-test/src/main/java/org/springframework/test/annotation/IfProfileValue.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -95,10 +95,10 @@
9595
* @see org.springframework.context.annotation.Profile
9696
* @see org.springframework.test.context.ActiveProfiles
9797
*/
98+
@Target({ElementType.TYPE, ElementType.METHOD})
99+
@Retention(RetentionPolicy.RUNTIME)
98100
@Documented
99101
@Inherited
100-
@Retention(RetentionPolicy.RUNTIME)
101-
@Target({ ElementType.TYPE, ElementType.METHOD })
102102
public @interface IfProfileValue {
103103

104104
/**
@@ -109,7 +109,6 @@
109109
/**
110110
* A single, permissible {@code value} of the <em>profile value</em>
111111
* for the given {@link #name}.
112-
*
113112
* <p>Note: Assigning values to both {@link #value} and {@link #values}
114113
* will lead to a configuration conflict.
115114
*/
@@ -118,7 +117,6 @@
118117
/**
119118
* A list of all permissible {@code values} of the <em>profile value</em>
120119
* for the given {@link #name}.
121-
*
122120
* <p>Note: Assigning values to both {@link #value} and {@link #values}
123121
* will lead to a configuration conflict.
124122
*/

spring-test/src/main/java/org/springframework/test/annotation/Repeat.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -17,12 +17,11 @@
1717
package org.springframework.test.annotation;
1818

1919
import java.lang.annotation.Documented;
20+
import java.lang.annotation.ElementType;
2021
import java.lang.annotation.Retention;
22+
import java.lang.annotation.RetentionPolicy;
2123
import java.lang.annotation.Target;
2224

23-
import static java.lang.annotation.ElementType.*;
24-
import static java.lang.annotation.RetentionPolicy.*;
25-
2625
/**
2726
* Test annotation to indicate that a test method should be invoked repeatedly.
2827
*
@@ -41,9 +40,9 @@
4140
* @see org.springframework.test.context.junit4.rules.SpringMethodRule
4241
* @see org.springframework.test.context.junit4.statements.SpringRepeat
4342
*/
43+
@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
44+
@Retention(RetentionPolicy.RUNTIME)
4445
@Documented
45-
@Retention(RUNTIME)
46-
@Target({ METHOD, ANNOTATION_TYPE })
4746
public @interface Repeat {
4847

4948
/**

spring-test/src/main/java/org/springframework/test/annotation/Rollback.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -17,12 +17,11 @@
1717
package org.springframework.test.annotation;
1818

1919
import java.lang.annotation.Documented;
20+
import java.lang.annotation.ElementType;
2021
import java.lang.annotation.Retention;
22+
import java.lang.annotation.RetentionPolicy;
2123
import java.lang.annotation.Target;
2224

23-
import static java.lang.annotation.ElementType.*;
24-
import static java.lang.annotation.RetentionPolicy.*;
25-
2625
/**
2726
* {@code @Rollback} is a test annotation that is used to indicate whether
2827
* a <em>test-managed transaction</em> should be <em>rolled back</em> after
@@ -54,9 +53,9 @@
5453
* @see Commit
5554
* @see org.springframework.test.context.transaction.TransactionalTestExecutionListener
5655
*/
56+
@Target({ElementType.TYPE, ElementType.METHOD})
57+
@Retention(RetentionPolicy.RUNTIME)
5758
@Documented
58-
@Retention(RUNTIME)
59-
@Target({ TYPE, METHOD })
6059
public @interface Rollback {
6160

6261
/**

spring-test/src/main/java/org/springframework/test/annotation/Timed.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -17,12 +17,11 @@
1717
package org.springframework.test.annotation;
1818

1919
import java.lang.annotation.Documented;
20+
import java.lang.annotation.ElementType;
2021
import java.lang.annotation.Retention;
22+
import java.lang.annotation.RetentionPolicy;
2123
import java.lang.annotation.Target;
2224

23-
import static java.lang.annotation.ElementType.*;
24-
import static java.lang.annotation.RetentionPolicy.*;
25-
2625
/**
2726
* Test-specific annotation to indicate that a test method has to finish
2827
* execution in a {@linkplain #millis() specified time period}.
@@ -45,9 +44,9 @@
4544
* @see org.springframework.test.context.junit4.rules.SpringMethodRule
4645
* @see org.springframework.test.context.junit4.statements.SpringFailOnTimeout
4746
*/
47+
@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
48+
@Retention(RetentionPolicy.RUNTIME)
4849
@Documented
49-
@Retention(RUNTIME)
50-
@Target({ METHOD, ANNOTATION_TYPE })
5150
public @interface Timed {
5251

5352
/**

0 commit comments

Comments
 (0)