Commit 02076cd
committed
refactor(library): Port MultiGeometry to Kotlin and update subclasses
This commit refactors the `MultiGeometry` class from Java to Kotlin, improving its design, null safety, and immutability.
The key changes are:
- **Porting `MultiGeometry` to Kotlin**: The class is now a generic, immutable Kotlin class. The constructor enforces non-nullability for the list of geometries, changing the exception for null constructor arguments from `IllegalArgumentException` to `NullPointerException`.
- **Updating Subclasses**: All subclasses of `MultiGeometry` (e.g., `GeoJsonMultiPoint`, `KmlMultiGeometry`) have been updated to align with the new Kotlin base class. They now override the `geometryType` property instead of calling a setter.
- **Modernizing Tests**: The `MultiGeometryTest` has been converted to Kotlin and uses Google Truth. Tests for all affected subclasses have been updated to assert the correct exception types.1 parent 1043a6d commit 02076cd
File tree
11 files changed
+134
-202
lines changed- library/src
- main/java/com/google/maps/android/data
- geojson
- kml
- test/java/com/google/maps/android/data
- geojson
- kml
11 files changed
+134
-202
lines changedLines changed: 22 additions & 69 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
| 16 | + | |
23 | 17 | | |
24 | 18 | | |
25 | 19 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
30 | 25 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
| 26 | + | |
37 | 27 | | |
38 | | - | |
39 | | - | |
40 | | - | |
| 28 | + | |
41 | 29 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
| 30 | + | |
| 31 | + | |
55 | 32 | | |
56 | 33 | | |
57 | 34 | | |
58 | 35 | | |
59 | 36 | | |
60 | 37 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
| 38 | + | |
| 39 | + | |
73 | 40 | | |
74 | 41 | | |
75 | | - | |
| 42 | + | |
76 | 43 | | |
77 | | - | |
| 44 | + | |
78 | 45 | | |
79 | | - | |
80 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
81 | 49 | | |
82 | 50 | | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
101 | 54 | | |
102 | | - | |
| 55 | + | |
Lines changed: 5 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | 34 | | |
36 | 35 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
45 | 39 | | |
46 | 40 | | |
| 41 | + | |
| 42 | + | |
47 | 43 | | |
48 | 44 | | |
49 | 45 | | |
| |||
Lines changed: 5 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | 35 | | |
37 | 36 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
46 | 40 | | |
47 | 41 | | |
| 42 | + | |
| 43 | + | |
48 | 44 | | |
49 | 45 | | |
50 | 46 | | |
| |||
Lines changed: 5 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | 35 | | |
37 | 36 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
46 | 40 | | |
47 | 41 | | |
| 42 | + | |
| 43 | + | |
48 | 44 | | |
49 | 45 | | |
50 | 46 | | |
| |||
Lines changed: 5 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
37 | 36 | | |
38 | 37 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
47 | 41 | | |
48 | 42 | | |
| 43 | + | |
| 44 | + | |
49 | 45 | | |
50 | 46 | | |
51 | 47 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
39 | 44 | | |
40 | 45 | | |
41 | 46 | | |
| |||
0 commit comments