Skip to content

Commit 090013d

Browse files
authored
Merge pull request #1454 from kazuki43zoo/polish
Change to use the diamond operator
2 parents a7af8fb + f3d489f commit 090013d

File tree

58 files changed

+183
-183
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+183
-183
lines changed

src/main/java/org/apache/ibatis/binding/MapperRegistry.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public <T> void addMapper(Class<T> type) {
6464
}
6565
boolean loadCompleted = false;
6666
try {
67-
knownMappers.put(type, new MapperProxyFactory<T>(type));
67+
knownMappers.put(type, new MapperProxyFactory<>(type));
6868
// It's important that the type is added before the parser is run
6969
// otherwise the binding may automatically be attempted by the
7070
// mapper parser. If the type is already known, it won't try.

src/main/java/org/apache/ibatis/builder/MapperBuilderAssistant.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2009-2018 the original author or authors.
2+
* Copyright 2009-2019 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.
@@ -233,7 +233,7 @@ public Discriminator buildDiscriminator(
233233
null,
234234
null,
235235
typeHandler,
236-
new ArrayList<ResultFlag>(),
236+
new ArrayList<>(),
237237
null,
238238
null,
239239
false);
@@ -351,7 +351,7 @@ private List<ResultMap> getStatementResultMaps(
351351
configuration,
352352
statementId + "-Inline",
353353
resultType,
354-
new ArrayList<ResultMapping>(),
354+
new ArrayList<>(),
355355
null).build();
356356
resultMaps.add(inlineResultMap);
357357
}
@@ -382,7 +382,7 @@ public ResultMapping buildResultMapping(
382382
.nestedResultMapId(applyCurrentNamespace(nestedResultMap, true))
383383
.resultSet(resultSet)
384384
.typeHandler(typeHandlerInstance)
385-
.flags(flags == null ? new ArrayList<ResultFlag>() : flags)
385+
.flags(flags == null ? new ArrayList<>() : flags)
386386
.composites(composites)
387387
.notNullColumns(parseMultipleColumnNames(notNullColumn))
388388
.columnPrefix(columnPrefix)

src/main/java/org/apache/ibatis/builder/annotation/ProviderSqlSource.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2009-2018 the original author or authors.
2+
* Copyright 2009-2019 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.
@@ -126,7 +126,7 @@ private SqlSource createSqlSource(Object parameterObject) {
126126
+ " using a specifying parameterObject. In this case, please specify a 'java.util.Map' object.");
127127
}
128128
Class<?> parameterType = parameterObject == null ? Object.class : parameterObject.getClass();
129-
return sqlSourceParser.parse(replacePlaceholder(sql), parameterType, new HashMap<String, Object>());
129+
return sqlSourceParser.parse(replacePlaceholder(sql), parameterType, new HashMap<>());
130130
} catch (BuilderException e) {
131131
throw e;
132132
} catch (Exception e) {

src/main/java/org/apache/ibatis/scripting/defaults/RawSqlSource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public RawSqlSource(Configuration configuration, SqlNode rootSqlNode, Class<?> p
4343
public RawSqlSource(Configuration configuration, String sql, Class<?> parameterType) {
4444
SqlSourceBuilder sqlSourceParser = new SqlSourceBuilder(configuration);
4545
Class<?> clazz = parameterType == null ? Object.class : parameterType;
46-
sqlSource = sqlSourceParser.parse(sql, clazz, new HashMap<String, Object>());
46+
sqlSource = sqlSourceParser.parse(sql, clazz, new HashMap<>());
4747
}
4848

4949
private static String getSql(Configuration configuration, SqlNode rootSqlNode) {

src/test/java/org/apache/ibatis/binding/FlushTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2009-2018 the original author or authors.
2+
* Copyright 2009-2019 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 @@ public void invokeFlushStatementsViaMapper() {
5656

5757
BoundAuthorMapper mapper = session.getMapper(BoundAuthorMapper.class);
5858
Author author = new Author(-1, "cbegin", "******", "[email protected]", "N/A", Section.NEWS);
59-
List<Integer> ids = new ArrayList<Integer>();
59+
List<Integer> ids = new ArrayList<>();
6060
mapper.insertAuthor(author);
6161
ids.add(author.getId());
6262
mapper.insertAuthor(author);

src/test/java/org/apache/ibatis/binding/MapperMethodParamTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2009-2018 the original author or authors.
2+
* Copyright 2009-2019 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.
@@ -61,7 +61,7 @@ public void parameterNameIsSizeAndTypeIsLong() {
6161
@Test
6262
public void parameterNameIsSizeUsingHashMap() {
6363
try (SqlSession session = sqlSessionFactory.openSession()) {
64-
HashMap<String, Object> params = new HashMap<String, Object>();
64+
HashMap<String, Object> params = new HashMap<>();
6565
params.put("id", "foo");
6666
params.put("size", Long.MAX_VALUE);
6767
Mapper mapper = session.getMapper(Mapper.class);

src/test/java/org/apache/ibatis/builder/XmlConfigBuilderTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public void shouldSuccessfullyLoadMinimalXMLConfigFile() throws Exception {
9191
assertThat(config.isSafeRowBoundsEnabled()).isFalse();
9292
assertThat(config.getLocalCacheScope()).isEqualTo(LocalCacheScope.SESSION);
9393
assertThat(config.getJdbcTypeForNull()).isEqualTo(JdbcType.OTHER);
94-
assertThat(config.getLazyLoadTriggerMethods()).isEqualTo((Set<String>) new HashSet<String>(Arrays.asList("equals", "clone", "hashCode", "toString")));
94+
assertThat(config.getLazyLoadTriggerMethods()).isEqualTo(new HashSet<>(Arrays.asList("equals", "clone", "hashCode", "toString")));
9595
assertThat(config.isSafeResultHandlerEnabled()).isTrue();
9696
assertThat(config.getDefaultScriptingLanuageInstance()).isInstanceOf(XMLLanguageDriver.class);
9797
assertThat(config.isCallSettersOnNulls()).isFalse();
@@ -184,7 +184,7 @@ public void shouldSuccessfullyLoadXMLConfigFile() throws Exception {
184184
assertThat(config.isSafeRowBoundsEnabled()).isTrue();
185185
assertThat(config.getLocalCacheScope()).isEqualTo(LocalCacheScope.STATEMENT);
186186
assertThat(config.getJdbcTypeForNull()).isEqualTo(JdbcType.NULL);
187-
assertThat(config.getLazyLoadTriggerMethods()).isEqualTo((Set<String>) new HashSet<String>(Arrays.asList("equals", "clone", "hashCode", "toString", "xxx")));
187+
assertThat(config.getLazyLoadTriggerMethods()).isEqualTo(new HashSet<>(Arrays.asList("equals", "clone", "hashCode", "toString", "xxx")));
188188
assertThat(config.isSafeResultHandlerEnabled()).isFalse();
189189
assertThat(config.getDefaultScriptingLanuageInstance()).isInstanceOf(RawLanguageDriver.class);
190190
assertThat(config.isCallSettersOnNulls()).isTrue();

src/test/java/org/apache/ibatis/builder/xml/dynamic/DynamicSqlSourceTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2009-2018 the original author or authors.
2+
* Copyright 2009-2019 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.
@@ -356,10 +356,10 @@ public void shouldSkipForEachWhenCollectionIsEmpty() throws Exception {
356356

357357
@Test
358358
public void shouldPerformStrictMatchOnForEachVariableSubstitution() throws Exception {
359-
final Map<String, Object> param = new HashMap<String, Object>();
360-
final Map<String, String> uuu = new HashMap<String, String>();
359+
final Map<String, Object> param = new HashMap<>();
360+
final Map<String, String> uuu = new HashMap<>();
361361
uuu.put("u", "xyz");
362-
List<Bean> uuuu = new ArrayList<Bean>();
362+
List<Bean> uuuu = new ArrayList<>();
363363
uuuu.add(new Bean("bean id"));
364364
param.put("uuu", uuu);
365365
param.put("uuuu", uuuu);

src/test/java/org/apache/ibatis/builder/xsd/XmlConfigBuilderTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public void shouldSuccessfullyLoadMinimalXMLConfigFile() throws Exception {
7878
assertFalse(config.isSafeRowBoundsEnabled());
7979
assertEquals(LocalCacheScope.SESSION, config.getLocalCacheScope());
8080
assertEquals(JdbcType.OTHER, config.getJdbcTypeForNull());
81-
assertEquals((Set<String>) new HashSet<String>(Arrays.asList("equals", "clone", "hashCode", "toString")), config.getLazyLoadTriggerMethods());
81+
assertEquals(new HashSet<>(Arrays.asList("equals", "clone", "hashCode", "toString")), config.getLazyLoadTriggerMethods());
8282
assertTrue(config.isSafeResultHandlerEnabled());
8383
assertTrue(config.getDefaultScriptingLanguageInstance() instanceof XMLLanguageDriver);
8484
assertFalse(config.isCallSettersOnNulls());
@@ -114,7 +114,7 @@ public void shouldSuccessfullyLoadXMLConfigFitle() throws Exception {
114114
assertTrue(config.isSafeRowBoundsEnabled());
115115
assertEquals(LocalCacheScope.STATEMENT, config.getLocalCacheScope());
116116
assertEquals(JdbcType.NULL, config.getJdbcTypeForNull());
117-
assertEquals((Set<String>) new HashSet<String>(Arrays.asList("equals", "clone", "hashCode", "toString", "xxx")), config.getLazyLoadTriggerMethods());
117+
assertEquals(new HashSet<>(Arrays.asList("equals", "clone", "hashCode", "toString", "xxx")), config.getLazyLoadTriggerMethods());
118118
assertFalse(config.isSafeResultHandlerEnabled());
119119
assertTrue(config.getDefaultScriptingLanguageInstance() instanceof RawLanguageDriver);
120120
assertTrue(config.isCallSettersOnNulls());

src/test/java/org/apache/ibatis/cache/BaseCacheTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public void shouldDemonstrateEqualsAndHashCodeForVariousCacheTypes() {
4343
assertEquals(cache.hashCode(), new LoggingCache(cache).hashCode());
4444
assertEquals(cache.hashCode(), new ScheduledCache(cache).hashCode());
4545

46-
Set<Cache> caches = new HashSet<Cache>();
46+
Set<Cache> caches = new HashSet<>();
4747
caches.add(cache);
4848
caches.add(new SynchronizedCache(cache));
4949
caches.add(new SerializedCache(cache));

0 commit comments

Comments
 (0)