Skip to content

Commit 2abef3a

Browse files
committed
spring-projects#31 - Move away from deprecated assertion methods in Spring 5.
We now consistently use Assert.notNull(…) et al that take an error message as the overload without a message have been deprecated in Spring 5. Added build profile for Spring 5 releases and snapshots.
1 parent 66eaf45 commit 2abef3a

File tree

4 files changed

+44
-14
lines changed

4 files changed

+44
-14
lines changed

core/src/main/java/org/springframework/plugin/core/PluginRegistrySupport.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public abstract class PluginRegistrySupport<T extends Plugin<S>, S> implements P
4040
@SuppressWarnings("unchecked")
4141
public PluginRegistrySupport(List<? extends T> plugins) {
4242

43-
Assert.notNull(plugins);
43+
Assert.notNull(plugins, "Plugins must not be null!");
4444

4545
this.plugins = plugins == null ? new ArrayList<T>() : (List<T>) plugins;
4646
this.initialized = false;
@@ -72,7 +72,7 @@ public List<T> getPlugins() {
7272
*/
7373
protected synchronized List<T> initialize(List<T> plugins) {
7474

75-
Assert.notNull(plugins);
75+
Assert.notNull(plugins, "Plugins must not be null!");
7676
List<T> result = new ArrayList<T>();
7777

7878
for (T plugin : this.plugins) {

core/src/main/java/org/springframework/plugin/core/support/AbstractTypeAwareSupport.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
*
3939
* @author Oliver Gierke
4040
*/
41-
public abstract class AbstractTypeAwareSupport<T> implements ApplicationContextAware,
42-
ApplicationListener<ContextRefreshedEvent>, InitializingBean {
41+
public abstract class AbstractTypeAwareSupport<T>
42+
implements ApplicationContextAware, ApplicationListener<ContextRefreshedEvent>, InitializingBean {
4343

4444
private ApplicationContext context;
4545
private Class<T> type;
@@ -132,8 +132,8 @@ static class BeansOfTypeTargetSource implements TargetSource {
132132
public BeansOfTypeTargetSource(ListableBeanFactory context, Class<?> type, boolean eagerInit,
133133
Collection<Class<?>> exclusions) {
134134

135-
Assert.notNull(context);
136-
Assert.notNull(type);
135+
Assert.notNull(context, "ListableBeanFactory must not be null!");
136+
Assert.notNull(type, "Type must not be null!");
137137

138138
this.context = context;
139139
this.type = type;

core/src/test/java/org/springframework/plugin/core/support/BeanListFactoryBeanUnitTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ public class BeanListFactoryBeanUnitTest {
3939

4040
BeanListFactoryBean<Ordered> factory;
4141

42-
@Mock
43-
ApplicationContext context;
42+
@Mock ApplicationContext context;
4443

4544
@Before
4645
public void setUp() {
@@ -52,6 +51,7 @@ public void setUp() {
5251
}
5352

5453
@Test
54+
@SuppressWarnings({ "rawtypes", "unchecked" })
5555
public void regardsOrderOfBeans() throws Exception {
5656

5757
// They shall be switched in the result.

pom.xml

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<name>Pivotal Software, Inc.</name>
1313
<url>http://www.spring.io</url>
1414
</organization>
15-
<inceptionYear>2008-2016</inceptionYear>
15+
<inceptionYear>2008-2017</inceptionYear>
1616
<url>https://github.com/spring-projects/spring-plugin</url>
1717

1818
<licenses>
@@ -44,8 +44,8 @@
4444
</modules>
4545

4646
<properties>
47-
<spring.version>4.3.3.BUILD-SNAPSHOT</spring.version>
48-
<slf4j.version>1.7.21</slf4j.version>
47+
<spring.version>4.3.6.RELEASE</spring.version>
48+
<slf4j.version>1.7.22</slf4j.version>
4949
</properties>
5050

5151
<developers>
@@ -62,6 +62,36 @@
6262
</developer>
6363
</developers>
6464

65+
<profiles>
66+
<profile>
67+
<id>spring5</id>
68+
<properties>
69+
<spring.version>5.0.0.M3</spring.version>
70+
</properties>
71+
<repositories>
72+
<repository>
73+
<id>spring-libs-milestone</id>
74+
<url>https://repo.spring.io/libs-milestone</url>
75+
<snapshots>
76+
<enabled>false</enabled>
77+
</snapshots>
78+
</repository>
79+
</repositories>
80+
</profile>
81+
<profile>
82+
<id>spring5-next</id>
83+
<properties>
84+
<spring.version>5.0.0.BUILD-SNAPSHOT</spring.version>
85+
</properties>
86+
<repositories>
87+
<repository>
88+
<id>spring-libs-snapshot</id>
89+
<url>https://repo.spring.io/libs-snapshot</url>
90+
</repository>
91+
</repositories>
92+
</profile>
93+
</profiles>
94+
6595
<dependencies>
6696

6797
<!-- Common test dependencies -->
@@ -197,10 +227,10 @@
197227

198228
<repositories>
199229
<repository>
200-
<id>spring-libs-snapshot</id>
201-
<url>https://repo.spring.io/libs-snapshot</url>
230+
<id>spring-libs-release</id>
231+
<url>https://repo.spring.io/libs-release</url>
202232
<snapshots>
203-
<enabled>true</enabled>
233+
<enabled>false</enabled>
204234
</snapshots>
205235
</repository>
206236
</repositories>

0 commit comments

Comments
 (0)