@@ -85,13 +85,13 @@ public void testNetworks() throws IOException, InvalidDatabaseException, Invalid
8585 File file = getFile ("MaxMind-DB-test-ipv" + ipVersion + "-" + recordSize + ".mmdb" );
8686
8787 Reader reader = new Reader (file );
88- Networks networks = reader .networks (false , Map .class );
88+ var networks = reader .networks (false , Map .class );
8989
9090 while (networks .hasNext ()) {
91- DatabaseRecord < Map < String , String >> iteration = networks .next ();
92- Map <String , String > data = iteration .getData ();
91+ var iteration = networks .next ();
92+ var data = ( Map <?, ?>) iteration .getData ();
9393
94- InetAddress actualIPInData = InetAddress .getByName (data .get ("ip" ));
94+ InetAddress actualIPInData = InetAddress .getByName (( String ) data .get ("ip" ));
9595
9696 assertEquals (
9797 iteration .getNetwork ().getNetworkAddress (),
@@ -110,11 +110,11 @@ public void testNetworksWithInvalidSearchTree() throws IOException, InvalidNetwo
110110 File file = getFile ("MaxMind-DB-test-broken-search-tree-24.mmdb" );
111111 Reader reader = new Reader (file );
112112
113- Networks networks = reader .networks (false , Map .class );
113+ var networks = reader .networks (false , Map .class );
114114
115115 Exception exception = assertThrows (RuntimeException .class , () -> {
116116 while (networks .hasNext ()){
117- DatabaseRecord iteration = networks .next ();
117+ assertNotNull ( networks .next () );
118118 }
119119 });
120120
@@ -339,11 +339,11 @@ public void testNetworksWithin() throws IOException, InvalidNetworkException{
339339 Network network = new Network (address , test .prefix );
340340
341341 boolean includeAliasedNetworks = !test .skipAliasedNetworks ;
342- Networks networks = reader .networksWithin (network , includeAliasedNetworks , Map .class );
342+ var networks = reader .networksWithin (network , includeAliasedNetworks , Map .class );
343343
344- ArrayList <String > innerIPs = new ArrayList <>();
344+ List <String > innerIPs = new ArrayList <>();
345345 while (networks .hasNext ()){
346- DatabaseRecord < Map < String , String >> iteration = networks .next ();
346+ var iteration = networks .next ();
347347 innerIPs .add (iteration .getNetwork ().toString ());
348348 }
349349
@@ -376,11 +376,11 @@ public void testGeoIPNetworksWithin() throws IOException, InvalidNetworkExceptio
376376 InetAddress address = InetAddress .getByName (test .network );
377377 Network network = new Network (address , test .prefix );
378378
379- Networks networks = reader .networksWithin (network , test .skipAliasedNetworks , Map .class );
379+ var networks = reader .networksWithin (network , test .skipAliasedNetworks , Map .class );
380380
381381 ArrayList <String > innerIPs = new ArrayList <>();
382382 while (networks .hasNext ()){
383- DatabaseRecord < Map < String , String >> iteration = networks .next ();
383+ var iteration = networks .next ();
384384 innerIPs .add (iteration .getNetwork ().toString ());
385385 }
386386
@@ -408,7 +408,7 @@ public void testGetRecord() throws IOException {
408408 };
409409 for (GetRecordTest test : mapTests ) {
410410 try (Reader reader = new Reader (test .db )) {
411- DatabaseRecord record = reader .getRecord (test .ip , Map .class );
411+ DatabaseRecord <?> record = reader .getRecord (test .ip , Map .class );
412412
413413 assertEquals (test .network , record .getNetwork ().toString ());
414414
@@ -432,7 +432,7 @@ public void testGetRecord() throws IOException {
432432 };
433433 for (GetRecordTest test : stringTests ) {
434434 try (Reader reader = new Reader (test .db )) {
435- DatabaseRecord record = reader .getRecord (test .ip , String .class );
435+ var record = reader .getRecord (test .ip , String .class );
436436
437437 assertEquals (test .network , record .getNetwork ().toString ());
438438
@@ -497,7 +497,7 @@ public void testDecodingTypesPointerDecoderFile() throws IOException {
497497 }
498498
499499 private void testDecodingTypes (Reader reader , boolean booleanValue ) throws IOException {
500- Map record = reader .get (InetAddress .getByName ("::1.1.1.0" ), Map .class );
500+ var record = reader .get (InetAddress .getByName ("::1.1.1.0" ), Map .class );
501501
502502 if (booleanValue ) {
503503 assertTrue ((boolean ) record .get ("boolean" ));
@@ -510,21 +510,19 @@ private void testDecodingTypes(Reader reader, boolean booleanValue) throws IOExc
510510
511511 assertEquals ("unicode! ☯ - ♫" , record .get ("utf8_string" ));
512512
513- @ SuppressWarnings ("unchecked" )
514- List <Object > array = (List <Object >) record .get ("array" );
513+ var array = (List <?>) record .get ("array" );
515514 assertEquals (3 , array .size ());
516515 assertEquals (1 , (long ) array .get (0 ));
517516 assertEquals (2 , (long ) array .get (1 ));
518517 assertEquals (3 , (long ) array .get (2 ));
519518
520- Map map = (Map ) record .get ("map" );
519+ var map = (Map <?, ?> ) record .get ("map" );
521520 assertEquals (1 , map .size ());
522521
523- Map mapX = (Map ) map .get ("mapX" );
522+ var mapX = (Map <?, ?> ) map .get ("mapX" );
524523 assertEquals (2 , mapX .size ());
525524
526- @ SuppressWarnings ("unchecked" )
527- List <Object > arrayX = (List <Object >) mapX .get ("arrayX" );
525+ var arrayX = (List <?>) mapX .get ("arrayX" );
528526 assertEquals (3 , arrayX .size ());
529527 assertEquals (7 , (long ) arrayX .get (0 ));
530528 assertEquals (8 , (long ) arrayX .get (1 ));
@@ -816,19 +814,18 @@ public void testZerosStream() throws IOException {
816814 }
817815
818816 private void testZeros (Reader reader ) throws IOException {
819- Map record = reader .get (InetAddress .getByName ("::" ), Map .class );
817+ var record = reader .get (InetAddress .getByName ("::" ), Map .class );
820818
821819 assertFalse ((boolean ) record .get ("boolean" ));
822820
823821 assertArrayEquals (new byte [0 ], (byte []) record .get ("bytes" ));
824822
825823 assertEquals ("" , record .get ("utf8_string" ));
826824
827- @ SuppressWarnings ("unchecked" )
828- List <Object > array = (List <Object >) record .get ("array" );
825+ var array = (List <?>) record .get ("array" );
829826 assertEquals (0 , array .size ());
830827
831- Map map = (Map ) record .get ("map" );
828+ var map = (Map <?, ?> ) record .get ("map" );
832829 assertEquals (0 , map .size ());
833830
834831 assertEquals (0 , (double ) record .get ("double" ), 0.000000001 );
@@ -1009,16 +1006,14 @@ public TestDataTypeMismatchInModel(
10091006 public void testDecodeConcurrentHashMap () throws IOException {
10101007 this .testReader = new Reader (getFile ("GeoIP2-City-Test.mmdb" ));
10111008
1012- @ SuppressWarnings ("unchecked" )
1013- ConcurrentHashMap <String , Object > m = this .testReader .get (
1009+ var m = this .testReader .get (
10141010 InetAddress .getByName ("2.125.160.216" ),
10151011 ConcurrentHashMap .class
10161012 );
10171013
1018- @ SuppressWarnings ("unchecked" )
1019- List <Map <String , Object >> subdivisions = (List ) m .get ("subdivisions" );
1014+ var subdivisions = (List <?>) m .get ("subdivisions" );
10201015
1021- Map <String , Object > eng = subdivisions .get (0 );
1016+ var eng = ( Map <?, ?>) subdivisions .get (0 );
10221017
10231018 String isoCode = (String ) eng .get ("iso_code" );
10241019 assertEquals ("ENG" , isoCode );
@@ -1100,17 +1095,17 @@ public TestModelB(
11001095 public void testCacheKey () {
11011096 Class <TestModelCacheKey > cls = TestModelCacheKey .class ;
11021097
1103- CacheKey a = new CacheKey (1 , cls , getType (cls , 0 ));
1104- CacheKey b = new CacheKey (1 , cls , getType (cls , 0 ));
1098+ CacheKey < TestModelCacheKey > a = new CacheKey <> (1 , cls , getType (cls , 0 ));
1099+ CacheKey < TestModelCacheKey > b = new CacheKey <> (1 , cls , getType (cls , 0 ));
11051100 assertEquals (a , b );
11061101
1107- CacheKey c = new CacheKey (2 , cls , getType (cls , 0 ));
1102+ CacheKey < TestModelCacheKey > c = new CacheKey <> (2 , cls , getType (cls , 0 ));
11081103 assertNotEquals (a , c );
11091104
1110- CacheKey d = new CacheKey (1 , String .class , getType (cls , 0 ));
1105+ CacheKey < String > d = new CacheKey <> (1 , String .class , getType (cls , 0 ));
11111106 assertNotEquals (a , d );
11121107
1113- CacheKey e = new CacheKey (1 , cls , getType (cls , 1 ));
1108+ CacheKey < TestModelCacheKey > e = new CacheKey <> (1 , cls , getType (cls , 1 ));
11141109 assertNotEquals (a , e );
11151110 }
11161111
0 commit comments