Skip to content

Commit

Permalink
Allow building on Java 11 (Jigsaw modules)
Browse files Browse the repository at this point in the history
Ports PR #2812 over to 2.x as a single commit.
  • Loading branch information
abyrd committed Sep 11, 2019
1 parent de536f6 commit 6788a0d
Show file tree
Hide file tree
Showing 55 changed files with 231 additions and 109 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
@@ -1,7 +1,7 @@
language: java
# OpenTripPlanner requires Java 8
jdk:
- openjdk8
- openjdk11

# Replace Travis's default Maven installation step with a no-op.
# This avoids redundantly pre-running 'mvn install -DskipTests' every time.
Expand Down
9 changes: 9 additions & 0 deletions docs/Changelog.md
Expand Up @@ -8,6 +8,15 @@
- NeTEx import support (#2769).

## Ported over from the 1.x
- Make OTP run on Java 11 (#2812)
- Fixes surefire test failure during build (#2816)

## 1.5.0 (in progress)
- Add Way Property Set for the UK (#2818)

## 1.4 (2019-07-30)

>>>>>>> cc975ebbc... Java 11 build.
- Remove Open Traffic prototype code (#2698)
- Docs: improve configuration documentation
- Update onebusaway-gtfs to latest version from OBA project (#2636)
Expand Down
38 changes: 28 additions & 10 deletions pom.xml
Expand Up @@ -79,7 +79,7 @@

<properties>
<!-- Lib versions - keep list sorted on property name -->
<geotools.version>20.1</geotools.version>
<geotools.version>21.2</geotools.version>
<geotools.wfs.version>16.5</geotools.wfs.version>
<jackson.version>2.9.7</jackson.version>
<jersey.version>2.18</jersey.version>
Expand Down Expand Up @@ -184,8 +184,7 @@
<version>3.8.1</version>
<configuration>
<!-- Target Java versions -->
<source>1.8</source>
<target>1.8</target>
<release>11</release>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -300,11 +299,25 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
<version>2.19.1</version>
<configuration>
<argLine>-Xmx2G</argLine>
<argLine>-Dfile.encoding=UTF-8</argLine>
<argLine>--illegal-access=permit</argLine>
<!-- we have to fork the JVM during tests so that the argLine is passed along -->
<forkCount>3</forkCount>
<!-- enable the restricted reflection under Java 11 so that the ObjectDiffer works -->
<argLine>
-Xmx2G
-Dfile.encoding=UTF-8
--illegal-access=permit
--add-opens java.base/java.lang.module=ALL-UNNAMED
--add-opens java.base/jdk.internal.reflect=ALL-UNNAMED
--add-opens java.base/jdk.internal.misc=ALL-UNNAMED
--add-opens java.base/jdk.internal.loader=ALL-UNNAMED
--add-opens java.base/jdk.internal.ref=ALL-UNNAMED
--add-opens java.base/jdk.internal.util=ALL-UNNAMED
--add-opens java.base/jdk.internal.util.jar=ALL-UNNAMED
--add-opens java.base/jdk.internal.module=ALL-UNNAMED
--add-opens java.base/java.lang=ALL-UNNAMED
</argLine>
<!-- Jenkins needs XML test reports to determine whether the build is stable. -->
<disableXmlReport>false</disableXmlReport>
</configuration>
Expand Down Expand Up @@ -464,6 +477,11 @@
<name>Open Source Geospatial Foundation Repository</name>
<url>https://download.osgeo.org/webdav/geotools/</url>
</repository>
<repository>
<id>geosolutions</id>
<name>GeoSolutions Repository</name>
<url>http://maven.geo-solutions.it</url>
</repository>
<repository>
<id>axis</id>
<name>axis</name>
Expand Down Expand Up @@ -503,17 +521,17 @@
<!-- GEOTOOLS includes JTS as a transitive dependency. -->
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-geojson</artifactId>
<artifactId>gt-main</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-referencing</artifactId>
<artifactId>gt-geojson</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-referencing3D</artifactId>
<artifactId>gt-referencing</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
Expand Down
@@ -1,6 +1,5 @@
package org.opentripplanner.ext.examples.updater;


import com.fasterxml.jackson.databind.JsonNode;
import org.opentripplanner.routing.graph.Graph;
import org.opentripplanner.updater.GraphUpdater;
Expand Down Expand Up @@ -29,6 +28,7 @@
* </pre>
*
* @see ExamplePollingGraphUpdater
* @see org.opentripplanner.updater.GraphUpdaterConfigurator
*/
public class ExampleGraphUpdater implements GraphUpdater {

Expand Down
81 changes: 81 additions & 0 deletions src/main/java/module-info.java
@@ -0,0 +1,81 @@
module otp {
opens java.lang.module;

requires org.geotools.referencing;
requires org.geotools.metadata;
requires org.geotools.opengis;
requires org.geotools.coverage;
requires org.geotools.geojson;
requires org.geotools.geotiff;
requires org.geotools.shapefile;
requires org.geotools.main;
requires gt.wfs;

requires slf4j.api;
requires jul.to.slf4j;
requires com.google.common;
requires org.locationtech.jts;
requires joda.time;
requires protobuf.java;
requires com.fasterxml.jackson.core;
requires com.fasterxml.jackson.databind;
requires com.fasterxml.jackson.dataformat.xml;
requires com.fasterxml.jackson.jaxrs.json;
requires com.fasterxml.jackson.jaxrs.xml;
requires com.fasterxml.jackson.module.jaxb;
requires jackson.annotations;
requires geojson.jackson;
requires trove4j;
requires jcommander;
requires org.apache.commons.io;
requires org.apache.commons.codec;
requires org.apache.commons.compress;
requires commons.math3;
requires kryo;
requires kryo.tools;
requires kryo.serializers;
requires logback.core;
requires logback.classic;
requires graphql.java;
requires lucene.core;
requires lucene.queries;
requires lucene.queryparser;
requires lucene.analyzers.common;
requires core;
requires javacsv;
requires onebusaway.csv.entities;
requires onebusaway.gtfs;
requires javassist;
requires objenesis;
requires httpclient;
requires grizzly.http;
requires grizzly.http.server;
requires grizzly.framework;
requires jersey.container.grizzly2.http;
requires pngj;
requires async.http.client;
requires commons.httpclient;
requires json.simple;
requires jets3t;
requires bsf;
requires jersey.common;
requires jersey.guava;
requires jersey.media.multipart;
requires jersey.server;
requires osmpbf;
requires axis;
requires flexjson;
requires hk2.api;
requires httpcore;

requires java.logging;
requires java.desktop;
requires java.prefs;
requires java.xml;
requires java.rmi;
requires java.naming;
requires java.xml.bind;
requires javax.ws.rs.api;
requires javax.annotation.api;
requires jai.core;
}
Expand Up @@ -35,7 +35,7 @@ public DoubleComparator(Map<QuadEdge,Double> map) {
* @param qeB
* quad edge to compare
* @return
* 1 if double value associated to qeA < double
* 1 if double value associated to qeA less than double
* value associated to qeB,
* 0 if values are equals,
* -1 otherwise
Expand Down
36 changes: 18 additions & 18 deletions src/main/java/org/opentripplanner/api/model/WalkStep.java
Expand Up @@ -21,28 +21,28 @@
/**
* Represents one instruction in walking directions. Three examples from New York City:
* <p>
* Turn onto Broadway from W 57th St (coming from 7th Ave): <br/>
* distance = 100 (say) <br/>
* walkDirection = RIGHT <br/>
* streetName = Broadway <br/>
* everything else null/false <br/>
* Turn onto Broadway from W 57th St (coming from 7th Ave): <br>
* distance = 100 (say) <br>
* walkDirection = RIGHT <br>
* streetName = Broadway <br>
* everything else null/false <br>
* </p>
* <p>
* Now, turn from Broadway onto Central Park S via Columbus Circle <br/>
* distance = 200 (say) <br/>
* walkDirection = CIRCLE_COUNTERCLOCKWISE <br/>
* streetName = Central Park S <br/>
* exit = 1 (first exit) <br/>
* immediately everything else false <br/>
* Now, turn from Broadway onto Central Park S via Columbus Circle <br>
* distance = 200 (say) <br>
* walkDirection = CIRCLE_COUNTERCLOCKWISE <br>
* streetName = Central Park S <br>
* exit = 1 (first exit) <br>
* immediately everything else false <br>
* </p>
* <p>
* Instead, go through the circle to continue on Broadway <br/>
* distance = 100 (say) <br/>
* walkDirection = CIRCLE_COUNTERCLOCKWISE <br/>
* streetName = Broadway <br/>
* exit = 3 <br/>
* stayOn = true <br/>
* everything else false <br/>
* Instead, go through the circle to continue on Broadway <br>
* distance = 100 (say) <br>
* walkDirection = CIRCLE_COUNTERCLOCKWISE <br>
* streetName = Broadway <br>
* exit = 3 <br>
* stayOn = true <br>
* everything else false <br>
* </p>
* */
public class WalkStep {
Expand Down
Expand Up @@ -42,7 +42,7 @@
* Tile rendering goes through TileRendererManager which select the appropriate renderer for the
* given layer.
*
* @see TileRendererManager
* @see org.opentripplanner.inspector.TileRendererManager
* @see TileRenderer
*
* @author laurent
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/opentripplanner/api/resource/Routers.java
Expand Up @@ -61,7 +61,7 @@
* For example:
*
* GET http://localhost/otp-rest-servlet/ws/routers
* will retrieve a list of all registered routerId -> Graph mappings and their geographic bounds.
* will retrieve a list of all registered routerId Graph mappings and their geographic bounds.
*
* GET http://localhost/otp-rest-servlet/ws/routers/london
* will return status code 200 and a brief description of the 'london' graph including geographic
Expand Down Expand Up @@ -117,7 +117,7 @@ public RouterList getRouterIds() {

/**
* Returns the bounds for a specific routerId, or verifies whether it is registered.
* @returns status code 200 if the routerId is registered, otherwise a 404.
* @return status code 200 if the routerId is registered, otherwise a 404.
*/
@GET @Path("{routerId}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML + Q, MediaType.TEXT_XML + Q })
Expand Down
Expand Up @@ -5,7 +5,7 @@
import java.util.TimeZone;

/**
* Represents a repeating time period, used for opening hours &c.
* Represents a repeating time period, used for opening hours etc.
* For instance: Monday - Friday 8AM to 8PM, Satuday 10AM to 5PM, Sunday closed.
* For now it is week-based so doesn't handle every possible case, but since it is encapsulated
* that could conceivably be changed.
Expand Down
Expand Up @@ -42,7 +42,7 @@ public final class CompactElevationProfile implements Serializable {
* at regular intervals according to the distanceBetweenSamplesM field. The last x-value is given
* by the length of the geometry.
*
* @param profile The elevation profile to compact
* @param elevation The elevation profile to compact
* @return The compacted format
*/
public static byte[] compactElevationProfileWithRegularSamples(CoordinateSequence elevation) {
Expand Down
Expand Up @@ -152,6 +152,8 @@ public static LineString uncompactLineString(double xa, double ya, double xb, do
/**
* Wrapper for the above method in the case where there are no start/end coordinates provided.
* 0-coordinates are added and then removed in order for the delta encoding to work correctly.
* Same as the other version, but in a var-len int packed form (Dlugosz coding).
* @return
*/
public static LineString uncompactLineString(byte[] packedCoords, boolean reverse) {
LineString lineString = uncompactLineString(0.0, 0.0, 0.0, 0.0, packedCoords, reverse);
Expand Down
Expand Up @@ -338,7 +338,7 @@ public static class Float extends PackedCoordinateSequence {
float[] coords;

/**
* Constructs a packed coordinate sequence from an array of <code>float<code>s
* Constructs a packed coordinate sequence from an array of {@code float}s
*
* @param coords
* @param dimensions
Expand All @@ -356,7 +356,7 @@ public Float(float[] coords, int dimensions) {
}

/**
* Constructs a packed coordinate sequence from an array of <code>double<code>s
* Constructs a packed coordinate sequence from an array of ${@code double}s
*/
public Float(double[] coordinates, int dimensions) {
this.coords = new float[coordinates.length];
Expand Down
Expand Up @@ -48,14 +48,16 @@ public Builder id(String id) {

/**
* Extracts a feed_id from the passed source for a GTFS feed.
* <p/>
* <p>
* This will try to fetch the experimental feed_id field from the feed_info.txt file.
* <p/>
* </p>
* <p>
* If the feed does not contain a feed_info.txt or a feed_id field a default GtfsFeedId will be created.
* </p>
*
* @param source the input source
* @return A GtfsFeedId
* @throws IOException
* @throws RuntimeException
* @see <a href="http://developer.trimet.org/gtfs_ext.shtml">http://developer.trimet.org/gtfs_ext.shtml</a>
*/
public Builder fromGtfsFeed(CsvInputSource source) {
Expand Down
Expand Up @@ -23,8 +23,8 @@
* Uses the shapes from GTFS to determine which streets buses drive on. This is used to improve the quality of
* the stop-to-street linkage. It encourages the linker to link to streets where transit actually travels.
*
* GTFS provides a mapping from trips->shapes. This module provides a mapping from stops->trips and shapes->edges.
* Then transitively we get a mapping from stop->edges.
* GTFS provides a mapping from tripsshapes. This module provides a mapping from stopstrips and shapesedges.
* Then transitively we get a mapping from stopedges.
* The edges that "belong" to a stop are favored when linking that stop to the street network.
*/
public class BusRouteStreetMatcher implements GraphBuilderModule {
Expand Down
Expand Up @@ -120,7 +120,7 @@ public void next() {
/**
* Checks whether the iterator cursor is pointing to the endpoint of a linestring.
*
* @return <code>true</true> if the iterator is at an endpoint
* @return <code>true</code> if the iterator is at an endpoint
*/
public boolean isEndOfLine() {
if (componentIndex >= numLines)
Expand Down
@@ -1,7 +1,7 @@
package org.opentripplanner.graph_builder.module.ned;

import org.geotools.coverage.grid.GridCoverage2D;
import org.geotools.factory.Hints;
import org.geotools.util.factory.Hints;
import org.geotools.gce.geotiff.GeoTiffFormat;
import org.geotools.gce.geotiff.GeoTiffReader;
import org.opentripplanner.graph_builder.services.ned.ElevationGridCoverageFactory;
Expand Down

0 comments on commit 6788a0d

Please sign in to comment.