Skip to content

Commit 092b642

Browse files
committed
replace annonymous inner class with lambdas
1 parent b9ae981 commit 092b642

File tree

3 files changed

+8
-19
lines changed

3 files changed

+8
-19
lines changed

src/main/java/org/apache/ibatis/executor/loader/ResultLoaderMap.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -234,15 +234,12 @@ private Configuration getConfiguration() {
234234
}
235235

236236
if (!factoryMethod.isAccessible()) {
237-
configurationObject = AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
238-
@Override
239-
public Object run() throws Exception {
240-
try {
241-
factoryMethod.setAccessible(true);
242-
return factoryMethod.invoke(null);
243-
} finally {
244-
factoryMethod.setAccessible(false);
245-
}
237+
configurationObject = AccessController.doPrivileged((PrivilegedExceptionAction<Object>) () -> {
238+
try {
239+
factoryMethod.setAccessible(true);
240+
return factoryMethod.invoke(null);
241+
} finally {
242+
factoryMethod.setAccessible(false);
246243
}
247244
});
248245
} else {

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,7 @@ void shouldFailedLoadXMLMapperFile() throws Exception {
174174
String resource = "org/apache/ibatis/builder/ProblemMapper.xml";
175175
try (InputStream inputStream = Resources.getResourceAsStream(resource)) {
176176
XMLMapperBuilder builder = new XMLMapperBuilder(inputStream, configuration, resource, configuration.getSqlFragments());
177-
Exception exception = Assertions.assertThrows(BuilderException.class, () -> {
178-
builder.parse();
179-
});
177+
Exception exception = Assertions.assertThrows(BuilderException.class, builder::parse);
180178
Assertions.assertTrue(exception.getMessage().contains("Error parsing Mapper XML. The XML location is 'org/apache/ibatis/builder/ProblemMapper.xml'"));
181179
}
182180
}

src/test/java/org/apache/ibatis/submitted/blocking_cache/BlockingCacheTest.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,7 @@ void testBlockingCache() {
5252
long init = System.currentTimeMillis();
5353

5454
for (int i = 0; i < 2; i++) {
55-
defaultThreadPool.execute(new Runnable() {
56-
57-
@Override
58-
public void run() {
59-
accessDB();
60-
}
61-
});
55+
defaultThreadPool.execute(this::accessDB);
6256
}
6357

6458
defaultThreadPool.shutdown();

0 commit comments

Comments
 (0)