diff --git a/.gitignore b/.gitignore index 6fac28d2178..d67b620f7b1 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,7 @@ o_o_standalone_config_IncludeFileDirectiveTest_part.json .venv/ _site/ build/ +!/application/src/build/ dist/ doc/user/_build/ gen-java/ diff --git a/application/pom.xml b/application/pom.xml index 49c738a251e..80446348801 100644 --- a/application/pom.xml +++ b/application/pom.xml @@ -513,6 +513,29 @@ + + com.github.bohnman + package-info-maven-plugin + 1.1.0 + + + ${project.basedir}/src/main/java + ${project.basedir}/target/generated-sources + + + ** + + + + + + + + generate + + + + diff --git a/application/src/build/templates/package-info-template.java b/application/src/build/templates/package-info-template.java new file mode 100644 index 00000000000..7cbb693f540 --- /dev/null +++ b/application/src/build/templates/package-info-template.java @@ -0,0 +1,4 @@ +@ParametersAreNonnullByDefault +package org.opentripplanner; + +import javax.annotation.ParametersAreNonnullByDefault; diff --git a/application/src/ext/java/org/opentripplanner/ext/datastore/gs/package-info.java b/application/src/ext/java/org/opentripplanner/ext/datastore/gs/package-info.java deleted file mode 100644 index 82ebac6c832..00000000000 --- a/application/src/ext/java/org/opentripplanner/ext/datastore/gs/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Add support for Google Cloud Storage, getting all input files and storing the graph.obj in the - * cloud. - *

- * This implementation will use the existing {@link org.opentripplanner.standalone.config.OtpConfigLoader} - * to load config from the local disk. - */ -package org.opentripplanner.ext.datastore.gs; diff --git a/application/src/ext/java/org/opentripplanner/ext/datastore/gs/package-info.md b/application/src/ext/java/org/opentripplanner/ext/datastore/gs/package-info.md new file mode 100644 index 00000000000..22ae44bb3e3 --- /dev/null +++ b/application/src/ext/java/org/opentripplanner/ext/datastore/gs/package-info.md @@ -0,0 +1,6 @@ +# Google cloud storage integration + +Add support for Google Cloud Storage, getting all input files and storing the graph.obj in the +cloud. + +This implementation will use the existing OtpConfigLoader to load config from the local disk. diff --git a/application/src/ext/java/org/opentripplanner/ext/restapi/resources/package-info.java b/application/src/ext/java/org/opentripplanner/ext/restapi/resources/package-info.java deleted file mode 100644 index 7b66666ee5d..00000000000 --- a/application/src/ext/java/org/opentripplanner/ext/restapi/resources/package-info.java +++ /dev/null @@ -1,5 +0,0 @@ -/** - * This package contains the JAX-RS-annotated REST resource classes for the OpenTripPlanner public - * API, i.e. the Jersey REST endpoints. - */ -package org.opentripplanner.ext.restapi.resources; diff --git a/application/src/ext/java/org/opentripplanner/ext/restapi/resources/package-info.md b/application/src/ext/java/org/opentripplanner/ext/restapi/resources/package-info.md new file mode 100644 index 00000000000..a4bb7eb6f4f --- /dev/null +++ b/application/src/ext/java/org/opentripplanner/ext/restapi/resources/package-info.md @@ -0,0 +1,4 @@ +# JAX-RS-annotated REST resource classes + +This package contains the JAX-RS-annotated REST resource classes for the OpenTripPlanner public +API, i.e. the Jersey REST endpoints. diff --git a/application/src/main/java/org/opentripplanner/api/parameter/package-info.java b/application/src/main/java/org/opentripplanner/api/parameter/package-info.java deleted file mode 100644 index ed9df0c1f61..00000000000 --- a/application/src/main/java/org/opentripplanner/api/parameter/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -/** - * This package contains classes which interpret incoming HTTP query parameters. Query parameters - * arrive as Strings, and Jersey will automatically call constructors with a single String - * argument. - */ -package org.opentripplanner.api.parameter; diff --git a/application/src/main/java/org/opentripplanner/api/parameter/package-info.md b/application/src/main/java/org/opentripplanner/api/parameter/package-info.md new file mode 100644 index 00000000000..75c928773f9 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/api/parameter/package-info.md @@ -0,0 +1,5 @@ +# HTTP query parameters + +This package contains classes which interpret incoming HTTP query parameters. Query parameters +arrive as Strings, and Jersey will automatically call constructors with a single String +argument. diff --git a/application/src/main/java/org/opentripplanner/graph_builder/issues/package-info.java b/application/src/main/java/org/opentripplanner/graph_builder/issues/package-info.java deleted file mode 100644 index db899fdd206..00000000000 --- a/application/src/main/java/org/opentripplanner/graph_builder/issues/package-info.java +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Graph builder data import issues represent errors or exceptional conditions encountered during - * the graph building process. They contain descriptive messages and potentially references to the - * objects in the graph that they annotate which facilitate visualization and cataloging/mapping of - * problems. - */ -package org.opentripplanner.graph_builder.issues; diff --git a/application/src/main/java/org/opentripplanner/graph_builder/issues/package-info.md b/application/src/main/java/org/opentripplanner/graph_builder/issues/package-info.md new file mode 100644 index 00000000000..424605d5240 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/graph_builder/issues/package-info.md @@ -0,0 +1,6 @@ +# Graph building issues + +Graph builder data import issues represent errors or exceptional conditions encountered during +the graph building process. They contain descriptive messages and potentially references to the +objects in the graph that they annotate which facilitate visualization and cataloging/mapping of +problems. diff --git a/application/src/main/java/org/opentripplanner/netex/loader/parser/package-info.java b/application/src/main/java/org/opentripplanner/netex/loader/parser/package-info.java deleted file mode 100644 index a0b9cd00721..00000000000 --- a/application/src/main/java/org/opentripplanner/netex/loader/parser/package-info.java +++ /dev/null @@ -1,2 +0,0 @@ -package org.opentripplanner.netex.loader.parser; -// TODO OTP2 - This package need Unit tests diff --git a/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/package-info.java b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/package-info.java deleted file mode 100644 index 22163201b6e..00000000000 --- a/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Package documentation - */ -package org.opentripplanner.routing.algorithm.transferoptimization; diff --git a/application/src/main/java/org/opentripplanner/transit/model/package.md b/application/src/main/java/org/opentripplanner/transit/model/package.md index 9c10c88828c..26ed7facde3 100644 --- a/application/src/main/java/org/opentripplanner/transit/model/package.md +++ b/application/src/main/java/org/opentripplanner/transit/model/package.md @@ -23,10 +23,9 @@ All transit entities must have an ID. Transit entities ar "root" level are consi roots_. -#### @Nonnull and @Nullable entity fields +#### Non-null and nullable entity fields -All fields getters(except primitive types) should be annotated with `@Nullable` or `@Nonnull`. None -null field should be enforced in the Entity constructor by using `Objects.requireNonNull`, +Non-nullability of fields should be enforced in the Entity constructor by using `Objects.requireNonNull`, `Objects.requireNonNullElse` or `ObjectUtils.ifNotNull`. We should enforce this for all fields required in both GTFS and in the Nordic NeTEx Profile. For enumeration types using a special value like `UNKNOWN` is preferred over making the field optional. diff --git a/application/src/main/java/org/opentripplanner/visualizer/package-info.java b/application/src/main/java/org/opentripplanner/visualizer/package-info.java deleted file mode 100644 index e189c27956f..00000000000 --- a/application/src/main/java/org/opentripplanner/visualizer/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -/** - * This package contains classes used for visualizing OpenTripPlanner graphs. This graph visualizer - * is intended for debugging purposes and may therefore have arcane developer-oriented features and - * grow new UI components as needed. - */ -package org.opentripplanner.visualizer; diff --git a/application/src/main/java/org/opentripplanner/visualizer/package-info.md b/application/src/main/java/org/opentripplanner/visualizer/package-info.md new file mode 100644 index 00000000000..f1b60dde32f --- /dev/null +++ b/application/src/main/java/org/opentripplanner/visualizer/package-info.md @@ -0,0 +1,5 @@ +# Graph visualizer + +This package contains classes used for visualizing OpenTripPlanner graphs. This graph visualizer +is intended for debugging purposes and may therefore have arcane developer-oriented features and +grow new UI components as needed. diff --git a/application/src/test/java/org/opentripplanner/mmri/MMRI Testdocument.pdf b/application/src/test/java/org/opentripplanner/mmri/MMRI_Testdocument.pdf similarity index 100% rename from application/src/test/java/org/opentripplanner/mmri/MMRI Testdocument.pdf rename to application/src/test/java/org/opentripplanner/mmri/MMRI_Testdocument.pdf diff --git a/application/src/test/java/org/opentripplanner/mmri/package-info.java b/application/src/test/java/org/opentripplanner/mmri/package-info.java deleted file mode 100644 index 563a92abdc5..00000000000 --- a/application/src/test/java/org/opentripplanner/mmri/package-info.java +++ /dev/null @@ -1,21 +0,0 @@ -/** - * What is this package doing here? - *

- * In 2013, significant improvements were made to OTP as part of a precommercial procurement project - * in The Netherlands called MMRI ("MultiModale ReisInformatie" => "multimodal travel information"). - * This project is itself part of a larger project called "Better Benutten" => "better utilization". - * Most effort concentrated on the implementation of GTFS-RT updates and related improvements to the - * architecture of OTP. Additionally, a testing module was developed to verify that all the planners - * that were involved in the project (not just OTP) met a minimum set of requirements. OTP was first - * to pass all tests, ahead of two different solutions. Unfortunately, having two sets of tests does - * not make it simpler to continuously verify that OTP still functions correctly, which is why these - * MMRI tests have now been added to OTP's own test suite. These versions are intended to be a close - * approximation of reality, but several minor shortcuts have been taken, like applying trip updates - * directly to the graph instead of going through the thread-safe graph writer framework. Given that - * thread-safety is a technical issue and not a functional one, this is considered to be - * acceptable. - *

- * The test cases are described here. and in - * here - */ -package org.opentripplanner.mmri; diff --git a/application/src/test/java/org/opentripplanner/mmri/package-info.md b/application/src/test/java/org/opentripplanner/mmri/package-info.md new file mode 100644 index 00000000000..5d4f541f1cb --- /dev/null +++ b/application/src/test/java/org/opentripplanner/mmri/package-info.md @@ -0,0 +1,19 @@ +# MMRI ("MultiModale ReisInformatie" => "multimodal travel information") + +What is this package doing here? + +In 2013, significant improvements were made to OTP as part of a precommercial procurement project +in The Netherlands called MMRI ("MultiModale ReisInformatie" => "multimodal travel information"). +This project is itself part of a larger project called "Better Benutten" => "better utilization". +Most effort concentrated on the implementation of GTFS-RT updates and related improvements to the +architecture of OTP. Additionally, a testing module was developed to verify that all the planners +that were involved in the project (not just OTP) met a minimum set of requirements. OTP was first +to pass all tests, ahead of two different solutions. Unfortunately, having two sets of tests does +not make it simpler to continuously verify that OTP still functions correctly, which is why these +MMRI tests have now been added to OTP's own test suite. These versions are intended to be a close +approximation of reality, but several minor shortcuts have been taken, like applying trip updates +directly to the graph instead of going through the thread-safe graph writer framework. Given that +thread-safety is a technical issue and not a functional one, this is considered to be +acceptable. + +The test cases are described [here](https://github.com/plannerstack/testset) and [here](./MMRI_Testdocument.pdf) diff --git a/doc/dev/decisionrecords/Codestyle.md b/doc/dev/decisionrecords/Codestyle.md index 146063bbeef..46e2062f41c 100644 --- a/doc/dev/decisionrecords/Codestyle.md +++ b/doc/dev/decisionrecords/Codestyle.md @@ -157,6 +157,19 @@ context. Please avoid including trivial Javadoc or the empty Javadoc stubs added - Is it immutable or should anything be treated as immutable - Is it a utility class of static methods that should not be instantiated +### Annotations + +- On methods: + - Method should be marked as `@Nullable` if they can return null values + - Method parameters should be marked as `@Nullable` if they can take null values. +- On fields: + - Fields should be marked as `@Nullable` if they are nullable. + +Use of `@Nonnull` annotation is not allowed. It should be assumed methods/parameters/fields +are non-null if they are not marked as `@Nullable`. However, there are places where the +`@Nullable` annotation is missing even if it should have been used. Those can be updated +to use the `@Nullable` annotation. + ## JavaScript As of #206, we