Skip to content

Commit 0f53beb

Browse files
committed
Java 10
1 parent f09f4d6 commit 0f53beb

File tree

6 files changed

+38
-17
lines changed

6 files changed

+38
-17
lines changed

.classpath

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
<classpath>
33
<classpathentry kind="src" path="src/main/java"/>
44
<classpathentry kind="src" path="src/test/java"/>
5-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
5+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-10">
6+
<attributes>
7+
<attribute name="module" value="true"/>
8+
</attributes>
9+
</classpathentry>
610
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
711
<classpathentry kind="output" path="bin"/>
812
</classpath>

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# Release 4.0 (May 26, 2018)
2+
3+
This release ends support for Java 8 and 9. Java 10 is now required, which is why this release has a major version bump despite the fact that the only code changes are on the testing side. Read on...
4+
5+
* Tweaked the JUnit tests after discovering that they fail with Java 9 and 10. [Java 8 introduced a floating point bug](https://bugs.openjdk.java.net/browse/JDK-8039915) which was fixed in Java 9, but the tests were only ever run on Java 8, so I was unaware that different JREs were giving different results for floating point calculations. Although the tests were using an epsilon for floating-point comparisons, it wasn't large enough to account for the floating point change introduced in Java 9, so the tests failed.
6+
* Upgraded Mockito to prevent "[Illegal reflective access](https://github.com/mockito/mockito/issues/1295)" when building on Java 9 and 10.
7+
8+
The reasons for ending support for Java 8 and 9 are:
9+
10+
1. Due to floating point differences, keeping the JUnit tests working from Java 8 to 10 would have required allowing a greater margin of error in calculations
11+
2. The status of the JUnit tests on Java 9 is unknowable because Oracle ended support for Java 9. They pulled the SDK from their site, so I can't install it to test.
12+
13+
If you build this project from source, and you use my [https://github.com/kloverde/BuildScripts](BuildScripts) project to do it, you'll need to pull the latest version. I had to remove findbugs from BuildScripts because it's incompatible with Java 10 - plus, [the project is dead](https://mailman.cs.umd.edu/pipermail/findbugs-discuss/2016-November/004321.html).
14+
15+
116
# Release 3.0.1 (April 22, 2018)
217

318
Only the README has been updated. The README incorrectly stated that the Latitude/Longitude classes are mutable. They are not - this was a relic of prior behavior in v1.3 and earlier.

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
GeographicCoordinate 3.0.1
2-
==========================
1+
GeographicCoordinate 4.0
2+
========================
33

44
See LICENSE for this software's licensing terms.
55

66
GeographicCoordinate is a Java library for representing latitude, longitude and cardinal points of the compass, and calculating distance and bearing between points.
77

8+
Starting with v4.0, Java 10 or later is required. See the v4.0 release notes in CHANGELOG.MD for an explanation of why this is so. For lower JRE versions, use a release prior to v4.0. There are no API or runtime differences between the last 3.x release and 4.0.
9+
810

911
## Features
1012

11-
* Unlike using floating-point primitives to represent latitude and longitude, GeographicCoordinate enforces automatic range checking: objects can never have invalid values.
13+
* Unlike using floating-point primitives to represent latitude and longitude, GeographicCoordinate uses objects that enforce automatic range checking; there's no possibility of having an object with an invalid value.
1214
* Coordinates can be initialized in floating-point form or as degrees, minutes and seconds
1315
* Calculates the distance between two points, or the total travel distance between an unlimited number of points (using the Haversine formula). Supports a wide array of units of distance.
1416
* Calculates initial bearing and back azimuth
@@ -37,7 +39,7 @@ Use this software at your own risk.
3739
You only need to bother with these if you want to build using the same setup I used (see included project and build files).
3840

3941
1. [BuildScripts](https://github.com/kloverde/BuildScripts)
40-
2. The Eclipse Buildship plugin (available on the Eclipse Marketplace)
42+
2. The Eclipse Buildship plugin (available on the Eclipse Marketplace if it wasn't pre-packaged with your version of Eclipse)
4143
3. Gradle
4244

4345

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencies {
66
compile files( "lib/numberutil/numberutil-1.0.jar" )
77

88
testCompile "junit:junit:4.12"
9-
testCompile "org.mockito:mockito-core:1.10.19"
9+
testCompile "org.mockito:mockito-core:2.18.3"
1010
}
1111

1212
task release( type : Zip ) {

gradle.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ buildScriptsDir=../BuildScripts
66
# BuildScripts configuration
77

88
projectName=GeographicCoordinate
9-
releaseVersion=3.0
9+
releaseVersion=4.0
1010
specVersion=3.0
11-
javaSourceCompatibility=1.8
12-
javaTargetCompatibility=1.8
11+
javaSourceCompatibility=1.10
12+
javaTargetCompatibility=1.10
1313
jarName=geographiccoordinate
14-
builtByName=
14+
builtByName=

src/test/java/org/loverde/geographiccoordinate/calculator/DistanceCalculatorTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -169,43 +169,43 @@ public void distance_nullLongitudePoint2() {
169169
@Test
170170
public void distance_feet() {
171171
final double distance = DistanceCalculator.distance( Unit.FEET, point1, point2 );
172-
assertEquals( 1070813.1682906998d, distance, fpDelta );
172+
assertEquals( 1070813.1682907024d, distance, fpDelta );
173173
}
174174

175175
@Test
176176
public void distance_kilometers() {
177177
final double distance = DistanceCalculator.distance( Unit.KILOMETERS, point1, point2 );
178-
assertEquals( 326.3838536950053d, distance, fpDelta );
178+
assertEquals( 326.3838536950061d, distance, fpDelta );
179179
}
180180

181181
@Test
182182
public void distance_meters() {
183183
final double distance = DistanceCalculator.distance( Unit.METERS, point1, point2 );
184-
assertEquals( 326383.8536950053d, distance, fpDelta );
184+
assertEquals( 326383.8536950061d, distance, fpDelta );
185185
}
186186

187187
@Test
188188
public void distance_miles() {
189189
final double distance = DistanceCalculator.distance( Unit.MILES, point1, point2 );
190-
assertEquals( 202.805524297481d, distance, fpDelta );
190+
assertEquals( 202.80552429748153, distance, fpDelta );
191191
}
192192

193193
@Test
194194
public void distance_nauticalMiles() {
195195
final double distance = DistanceCalculator.distance( Unit.NAUTICAL_MILES, point1, point2 );
196-
assertEquals( 176.2331823407156d, distance, fpDelta );
196+
assertEquals( 176.23318234071604d, distance, fpDelta );
197197
}
198198

199199
@Test
200200
public void distance_usSurveyfeet() {
201201
final double distance = DistanceCalculator.distance( Unit.US_SURVEY_FEET, point1, point2 );
202-
assertEquals( 1070811.0266643632d, distance, fpDelta );
202+
assertEquals( 1070811.026664366d, distance, fpDelta );
203203
}
204204

205205
@Test
206206
public void distance_yards() {
207207
final double distance = DistanceCalculator.distance( Unit.YARDS, point1, point2 );
208-
assertEquals( 356937.72276356665d, distance, fpDelta );
208+
assertEquals( 356937.7227635675d, distance, fpDelta );
209209
}
210210

211211
/**

0 commit comments

Comments
 (0)