Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit845da1f

Browse files
authored
add java 11 support (o) (iluwatar#1222)
1 parent751b3b9 commit845da1f

File tree

14 files changed

+57
-57
lines changed

14 files changed

+57
-57
lines changed

‎object-mother/src/main/java/com/iluwatar/objectmother/King.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public boolean isHappy() {
6060
* @param queen Queen which should be flirted.
6161
*/
6262
publicvoidflirt(Queenqueen) {
63-
booleanflirtStatus =queen.getFlirted(this);
63+
varflirtStatus =queen.getFlirted(this);
6464
if (!flirtStatus) {
6565
this.makeUnhappy();
6666
}else {

‎object-mother/src/main/java/com/iluwatar/objectmother/RoyaltyObjectMother.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public static King createSoberUnhappyKing() {
4343
* @return A drunk {@link com.iluwatar.objectmother.King}.
4444
*/
4545
publicstaticKingcreateDrunkKing() {
46-
Kingking =newKing();
46+
varking =newKing();
4747
king.makeDrunk();
4848
returnking;
4949
}
@@ -54,7 +54,7 @@ public static King createDrunkKing() {
5454
* @return A happy {@link com.iluwatar.objectmother.King}.
5555
*/
5656
publicstaticKingcreateHappyKing() {
57-
Kingking =newKing();
57+
varking =newKing();
5858
king.makeHappy();
5959
returnking;
6060
}
@@ -65,7 +65,7 @@ public static King createHappyKing() {
6565
* @return A drunk and happy {@link com.iluwatar.objectmother.King}.
6666
*/
6767
publicstaticKingcreateHappyDrunkKing() {
68-
Kingking =newKing();
68+
varking =newKing();
6969
king.makeHappy();
7070
king.makeDrunk();
7171
returnking;
@@ -77,7 +77,7 @@ public static King createHappyDrunkKing() {
7777
* @return A flirty {@link com.iluwatar.objectmother.Queen}.
7878
*/
7979
publicstaticQueencreateFlirtyQueen() {
80-
Queenqueen =newQueen();
80+
varqueen =newQueen();
8181
queen.setFlirtiness(true);
8282
returnqueen;
8383
}

‎object-mother/src/test/java/com/iluwatar/objectmother/test/RoyaltyObjectMotherTest.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,50 +40,50 @@ public class RoyaltyObjectMotherTest {
4040

4141
@Test
4242
publicvoidunsuccessfulKingFlirt() {
43-
KingsoberUnhappyKing =RoyaltyObjectMother.createSoberUnhappyKing();
44-
QueenflirtyQueen =RoyaltyObjectMother.createFlirtyQueen();
43+
varsoberUnhappyKing =RoyaltyObjectMother.createSoberUnhappyKing();
44+
varflirtyQueen =RoyaltyObjectMother.createFlirtyQueen();
4545
soberUnhappyKing.flirt(flirtyQueen);
4646
assertFalse(soberUnhappyKing.isHappy());
4747
}
4848

4949
@Test
5050
publicvoidqueenIsBlockingFlirtCauseDrunkKing() {
51-
KingdrunkUnhappyKing =RoyaltyObjectMother.createDrunkKing();
52-
QueennotFlirtyQueen =RoyaltyObjectMother.createNotFlirtyQueen();
51+
vardrunkUnhappyKing =RoyaltyObjectMother.createDrunkKing();
52+
varnotFlirtyQueen =RoyaltyObjectMother.createNotFlirtyQueen();
5353
drunkUnhappyKing.flirt(notFlirtyQueen);
5454
assertFalse(drunkUnhappyKing.isHappy());
5555
}
5656

5757
@Test
5858
publicvoidqueenIsBlockingFlirt() {
59-
KingsoberHappyKing =RoyaltyObjectMother.createHappyKing();
60-
QueennotFlirtyQueen =RoyaltyObjectMother.createNotFlirtyQueen();
59+
varsoberHappyKing =RoyaltyObjectMother.createHappyKing();
60+
varnotFlirtyQueen =RoyaltyObjectMother.createNotFlirtyQueen();
6161
soberHappyKing.flirt(notFlirtyQueen);
6262
assertFalse(soberHappyKing.isHappy());
6363
}
6464

6565
@Test
6666
publicvoidsuccessfullKingFlirt() {
67-
KingsoberHappyKing =RoyaltyObjectMother.createHappyKing();
68-
QueenflirtyQueen =RoyaltyObjectMother.createFlirtyQueen();
67+
varsoberHappyKing =RoyaltyObjectMother.createHappyKing();
68+
varflirtyQueen =RoyaltyObjectMother.createFlirtyQueen();
6969
soberHappyKing.flirt(flirtyQueen);
7070
assertTrue(soberHappyKing.isHappy());
7171
}
7272

7373
@Test
7474
publicvoidtestQueenType() {
75-
RoyaltyflirtyQueen =RoyaltyObjectMother.createFlirtyQueen();
76-
RoyaltynotFlirtyQueen =RoyaltyObjectMother.createNotFlirtyQueen();
75+
varflirtyQueen =RoyaltyObjectMother.createFlirtyQueen();
76+
varnotFlirtyQueen =RoyaltyObjectMother.createNotFlirtyQueen();
7777
assertEquals(flirtyQueen.getClass(),Queen.class);
7878
assertEquals(notFlirtyQueen.getClass(),Queen.class);
7979
}
8080

8181
@Test
8282
publicvoidtestKingType() {
83-
RoyaltydrunkKing =RoyaltyObjectMother.createDrunkKing();
84-
RoyaltyhappyDrunkKing =RoyaltyObjectMother.createHappyDrunkKing();
85-
RoyaltyhappyKing =RoyaltyObjectMother.createHappyKing();
86-
RoyaltysoberUnhappyKing =RoyaltyObjectMother.createSoberUnhappyKing();
83+
vardrunkKing =RoyaltyObjectMother.createDrunkKing();
84+
varhappyDrunkKing =RoyaltyObjectMother.createHappyDrunkKing();
85+
varhappyKing =RoyaltyObjectMother.createHappyKing();
86+
varsoberUnhappyKing =RoyaltyObjectMother.createSoberUnhappyKing();
8787
assertEquals(drunkKing.getClass(),King.class);
8888
assertEquals(happyDrunkKing.getClass(),King.class);
8989
assertEquals(happyKing.getClass(),King.class);

‎object-pool/src/main/java/com/iluwatar/object/pool/App.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,24 +54,24 @@ public class App {
5454
* @param args command line args
5555
*/
5656
publicstaticvoidmain(String[]args) {
57-
OliphauntPoolpool =newOliphauntPool();
57+
varpool =newOliphauntPool();
5858
LOGGER.info(pool.toString());
59-
Oliphauntoliphaunt1 =pool.checkOut();
59+
varoliphaunt1 =pool.checkOut();
6060
LOGGER.info("Checked out {}",oliphaunt1);
6161
LOGGER.info(pool.toString());
62-
Oliphauntoliphaunt2 =pool.checkOut();
62+
varoliphaunt2 =pool.checkOut();
6363
LOGGER.info("Checked out {}",oliphaunt2);
64-
Oliphauntoliphaunt3 =pool.checkOut();
64+
varoliphaunt3 =pool.checkOut();
6565
LOGGER.info("Checked out {}",oliphaunt3);
6666
LOGGER.info(pool.toString());
6767
LOGGER.info("Checking in {}",oliphaunt1);
6868
pool.checkIn(oliphaunt1);
6969
LOGGER.info("Checking in {}",oliphaunt2);
7070
pool.checkIn(oliphaunt2);
7171
LOGGER.info(pool.toString());
72-
Oliphauntoliphaunt4 =pool.checkOut();
72+
varoliphaunt4 =pool.checkOut();
7373
LOGGER.info("Checked out {}",oliphaunt4);
74-
Oliphauntoliphaunt5 =pool.checkOut();
74+
varoliphaunt5 =pool.checkOut();
7575
LOGGER.info("Checked out {}",oliphaunt5);
7676
LOGGER.info(pool.toString());
7777
}

‎object-pool/src/main/java/com/iluwatar/object/pool/ObjectPool.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public synchronized T checkOut() {
4545
if (available.isEmpty()) {
4646
available.add(create());
4747
}
48-
Tinstance =available.iterator().next();
48+
varinstance =available.iterator().next();
4949
available.remove(instance);
5050
inUse.add(instance);
5151
returninstance;

‎object-pool/src/test/java/com/iluwatar/object/pool/OliphauntPoolTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,17 @@ public class OliphauntPoolTest {
4444
@Test
4545
publicvoidtestSubsequentCheckinCheckout() {
4646
assertTimeout(ofMillis(5000), () -> {
47-
finalOliphauntPoolpool =newOliphauntPool();
47+
finalvarpool =newOliphauntPool();
4848
assertEquals("Pool available=0 inUse=0",pool.toString());
4949

50-
finalOliphauntexpectedOliphaunt =pool.checkOut();
50+
finalvarexpectedOliphaunt =pool.checkOut();
5151
assertEquals("Pool available=0 inUse=1",pool.toString());
5252

5353
pool.checkIn(expectedOliphaunt);
5454
assertEquals("Pool available=1 inUse=0",pool.toString());
5555

5656
for (inti =0;i <100;i++) {
57-
finalOliphauntoliphaunt =pool.checkOut();
57+
finalvaroliphaunt =pool.checkOut();
5858
assertEquals("Pool available=0 inUse=1",pool.toString());
5959
assertSame(expectedOliphaunt,oliphaunt);
6060
assertEquals(expectedOliphaunt.getId(),oliphaunt.getId());
@@ -73,13 +73,13 @@ public void testSubsequentCheckinCheckout() {
7373
@Test
7474
publicvoidtestConcurrentCheckinCheckout() {
7575
assertTimeout(ofMillis(5000), () -> {
76-
finalOliphauntPoolpool =newOliphauntPool();
76+
finalvarpool =newOliphauntPool();
7777
assertEquals(pool.toString(),"Pool available=0 inUse=0");
7878

79-
finalOliphauntfirstOliphaunt =pool.checkOut();
79+
finalvarfirstOliphaunt =pool.checkOut();
8080
assertEquals(pool.toString(),"Pool available=0 inUse=1");
8181

82-
finalOliphauntsecondOliphaunt =pool.checkOut();
82+
finalvarsecondOliphaunt =pool.checkOut();
8383
assertEquals(pool.toString(),"Pool available=0 inUse=2");
8484

8585
assertNotSame(firstOliphaunt,secondOliphaunt);
@@ -89,15 +89,15 @@ public void testConcurrentCheckinCheckout() {
8989
pool.checkIn(secondOliphaunt);
9090
assertEquals(pool.toString(),"Pool available=1 inUse=1");
9191

92-
finalOliphauntoliphaunt3 =pool.checkOut();
92+
finalvaroliphaunt3 =pool.checkOut();
9393
assertEquals(pool.toString(),"Pool available=0 inUse=2");
9494
assertSame(secondOliphaunt,oliphaunt3);
9595

9696
// ... and the same applies for the first one
9797
pool.checkIn(firstOliphaunt);
9898
assertEquals(pool.toString(),"Pool available=1 inUse=1");
9999

100-
finalOliphauntoliphaunt4 =pool.checkOut();
100+
finalvaroliphaunt4 =pool.checkOut();
101101
assertEquals(pool.toString(),"Pool available=0 inUse=2");
102102
assertSame(firstOliphaunt,oliphaunt4);
103103

@@ -110,7 +110,7 @@ public void testConcurrentCheckinCheckout() {
110110

111111
// The order of the returned instances is not determined, so just put them in a list
112112
// and verify if both expected instances are in there.
113-
finalList<Oliphaunt>oliphaunts =List.of(pool.checkOut(),pool.checkOut());
113+
finalvaroliphaunts =List.of(pool.checkOut(),pool.checkOut());
114114
assertEquals(pool.toString(),"Pool available=0 inUse=2");
115115
assertTrue(oliphaunts.contains(firstOliphaunt));
116116
assertTrue(oliphaunts.contains(secondOliphaunt));

‎observer/src/main/java/com/iluwatar/observer/App.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public class App {
5151
*/
5252
publicstaticvoidmain(String[]args) {
5353

54-
Weatherweather =newWeather();
54+
varweather =newWeather();
5555
weather.addObserver(newOrcs());
5656
weather.addObserver(newHobbits());
5757

@@ -62,7 +62,7 @@ public static void main(String[] args) {
6262

6363
// Generic observer inspired by Java Generics and Collection by Naftalin & Wadler
6464
LOGGER.info("--Running generic version--");
65-
GWeathergenericWeather =newGWeather();
65+
vargenericWeather =newGWeather();
6666
genericWeather.addObserver(newGOrcs());
6767
genericWeather.addObserver(newGHobbits());
6868

‎observer/src/main/java/com/iluwatar/observer/Weather.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ public void removeObserver(WeatherObserver obs) {
5656
* Makes time pass for weather.
5757
*/
5858
publicvoidtimePasses() {
59-
WeatherType[]enumValues =WeatherType.values();
59+
varenumValues =WeatherType.values();
6060
currentWeather =enumValues[(currentWeather.ordinal() +1) %enumValues.length];
6161
LOGGER.info("The weather changed to {}.",currentWeather);
6262
notifyObservers();
6363
}
6464

6565
privatevoidnotifyObservers() {
66-
for (WeatherObserverobs :observers) {
66+
for (varobs :observers) {
6767
obs.update(currentWeather);
6868
}
6969
}

‎observer/src/main/java/com/iluwatar/observer/generic/GWeather.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public GWeather() {
4444
* Makes time pass for weather.
4545
*/
4646
publicvoidtimePasses() {
47-
WeatherType[]enumValues =WeatherType.values();
47+
varenumValues =WeatherType.values();
4848
currentWeather =enumValues[(currentWeather.ordinal() +1) %enumValues.length];
4949
LOGGER.info("The weather changed to {}.",currentWeather);
5050
notifyObservers(currentWeather);

‎observer/src/main/java/com/iluwatar/observer/generic/Observable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public void removeObserver(O observer) {
5454
*/
5555
@SuppressWarnings("unchecked")
5656
publicvoidnotifyObservers(Aargument) {
57-
for (Oobserver :observers) {
57+
for (varobserver :observers) {
5858
observer.update((S)this,argument);
5959
}
6060
}

‎observer/src/test/java/com/iluwatar/observer/WeatherObserverTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public void tearDown() {
8080
@ParameterizedTest
8181
@MethodSource("dataProvider")
8282
publicvoidtestObserver(WeatherTypeweather,Stringresponse) {
83-
finalOobserver =this.factory.get();
83+
finalvarobserver =this.factory.get();
8484
assertEquals(0,appender.getLogSize());
8585

8686
observer.update(weather);

‎observer/src/test/java/com/iluwatar/observer/WeatherTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ public void tearDown() {
6161
*/
6262
@Test
6363
publicvoidtestAddRemoveObserver() {
64-
finalWeatherObserverobserver =mock(WeatherObserver.class);
64+
finalvarobserver =mock(WeatherObserver.class);
6565

66-
finalWeatherweather =newWeather();
66+
finalvarweather =newWeather();
6767
weather.addObserver(observer);
6868
verifyZeroInteractions(observer);
6969

@@ -84,13 +84,13 @@ public void testAddRemoveObserver() {
8484
*/
8585
@Test
8686
publicvoidtestTimePasses() {
87-
finalWeatherObserverobserver =mock(WeatherObserver.class);
88-
finalWeatherweather =newWeather();
87+
finalvarobserver =mock(WeatherObserver.class);
88+
finalvarweather =newWeather();
8989
weather.addObserver(observer);
9090

91-
finalInOrderinOrder =inOrder(observer);
92-
finalWeatherType[]weatherTypes =WeatherType.values();
93-
for (inti =1;i <20;i++) {
91+
finalvarinOrder =inOrder(observer);
92+
finalvarweatherTypes =WeatherType.values();
93+
for (vari =1;i <20;i++) {
9494
weather.timePasses();
9595
inOrder.verify(observer).update(weatherTypes[i %weatherTypes.length]);
9696
}

‎observer/src/test/java/com/iluwatar/observer/generic/GWeatherTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ public void tearDown() {
5959
*/
6060
@Test
6161
publicvoidtestAddRemoveObserver() {
62-
finalRaceobserver =mock(Race.class);
62+
finalvarobserver =mock(Race.class);
6363

64-
finalGWeatherweather =newGWeather();
64+
finalvarweather =newGWeather();
6565
weather.addObserver(observer);
6666
verifyZeroInteractions(observer);
6767

@@ -82,13 +82,13 @@ public void testAddRemoveObserver() {
8282
*/
8383
@Test
8484
publicvoidtestTimePasses() {
85-
finalRaceobserver =mock(Race.class);
86-
finalGWeatherweather =newGWeather();
85+
finalvarobserver =mock(Race.class);
86+
finalvarweather =newGWeather();
8787
weather.addObserver(observer);
8888

89-
finalInOrderinOrder =inOrder(observer);
90-
finalWeatherType[]weatherTypes =WeatherType.values();
91-
for (inti =1;i <20;i++) {
89+
finalvarinOrder =inOrder(observer);
90+
finalvarweatherTypes =WeatherType.values();
91+
for (vari =1;i <20;i++) {
9292
weather.timePasses();
9393
inOrder.verify(observer).update(weather,weatherTypes[i %weatherTypes.length]);
9494
}

‎observer/src/test/java/com/iluwatar/observer/generic/ObserverTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public void tearDown() {
7979
@ParameterizedTest
8080
@MethodSource("dataProvider")
8181
publicvoidtestObserver(WeatherTypeweather,Stringresponse) {
82-
finalOobserver =this.factory.get();
82+
finalvarobserver =this.factory.get();
8383
assertEquals(0,appender.getLogSize());
8484

8585
observer.update(null,weather);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp