Skip to content

Conversation

@lbkulinski
Copy link
Owner

No description provided.

Copilot AI review requested due to automatic review settings January 2, 2026 17:04
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds JSpecify nullability annotations to the public API of the CTA4J Java SDK to improve type safety and establish clearer nullability contracts. The version is bumped from 3.0.4 to 3.0.5 with the addition of the org.jspecify:jspecify:1.0.0 dependency.

  • Added @NonNull annotations to return types of public API methods in TrainClient, BusClient, and their implementations
  • Reorganized field declarations in implementation classes to group constants together
  • Updated version and changelog to reflect the changes

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 22 comments.

Show a summary per file
File Description
pom.xml Bumped version to 3.0.5 and added JSpecify dependency with provided scope
CHANGELOG.md Added release notes for version 3.0.5 documenting the addition of JSpecify annotations
src/main/java/com/cta4j/train/client/TrainClient.java Added @NonNull annotations to method return types and builder methods
src/main/java/com/cta4j/train/client/internal/TrainClientImpl.java Added @NonNull annotations to match interface, reorganized fields to group constants
src/main/java/com/cta4j/bus/client/BusClient.java Added @NonNull annotations to method return types and builder methods
src/main/java/com/cta4j/bus/client/internal/BusClientImpl.java Added @NonNull annotations to match interface, reorganized fields to group constants

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

* @throws NullPointerException if {@code host} is {@code null}
*/
Builder host(String host);
@NonNull Builder host(String host);
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method parameter host should be annotated with @NonNull to establish a complete nullability contract. The method documentation states it throws NullPointerException if the parameter is null, and the implementation validates this with Objects.requireNonNull. JSpecify annotations should be applied to both return types and parameters for consistency and completeness.

Suggested change
@NonNull Builder host(String host);
@NonNull Builder host(@NonNull String host);

Copilot uses AI. Check for mistakes.

@Override
public Builder apiKey(String apiKey) {
public @NonNull Builder apiKey(String apiKey) {
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method parameter apiKey should be annotated with @NonNull to match the interface contract and establish a complete nullability specification. This should be consistent with the interface definition in TrainClient.Builder.

Suggested change
public @NonNull Builder apiKey(String apiKey) {
public @NonNull Builder apiKey(@NonNull String apiKey) {

Copilot uses AI. Check for mistakes.

@Override
public List<StopArrival> getStopArrivals(String routeId, String stopId) {
public @NonNull List<StopArrival> getStopArrivals(String routeId, String stopId) {
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method parameters routeId and stopId should be annotated with @NonNull to match the interface contract and establish a complete nullability specification. This should be consistent with the interface definition in BusClient.

Suggested change
public @NonNull List<StopArrival> getStopArrivals(String routeId, String stopId) {
public @NonNull List<StopArrival> getStopArrivals(@NonNull String routeId, @NonNull String stopId) {

Copilot uses AI. Check for mistakes.

@Override
public Builder host(String host) {
public @NonNull Builder host(String host) {
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method parameter host should be annotated with @NonNull to match the interface contract and establish a complete nullability specification. This should be consistent with the interface definition in BusClient.Builder.

Suggested change
public @NonNull Builder host(String host) {
public @NonNull Builder host(@NonNull String host) {

Copilot uses AI. Check for mistakes.
* @throws Cta4jException if an error occurs while fetching the data
*/
List<String> getDirections(String routeId);
@NonNull List<String> getDirections(String routeId);
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method parameter routeId should be annotated with @NonNull to establish a complete nullability contract. The method documentation states it throws NullPointerException if the parameter is null, and the implementation validates this with Objects.requireNonNull. JSpecify annotations should be applied to both return types and parameters for consistency and completeness.

Copilot uses AI. Check for mistakes.
* @throws Cta4jException if an error occurs while fetching the data
*/
List<Stop> getStops(String routeId, String direction);
@NonNull List<Stop> getStops(String routeId, String direction);
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method parameters routeId and direction should be annotated with @NonNull to establish a complete nullability contract. The method documentation states it throws NullPointerException if these parameters are null, and the implementation validates this with Objects.requireNonNull. JSpecify annotations should be applied to both return types and parameters for consistency and completeness.

Copilot uses AI. Check for mistakes.

@Override
public Builder host(String host) {
public @NonNull Builder host(String host) {
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method parameter host should be annotated with @NonNull to match the interface contract and establish a complete nullability specification. This should be consistent with the interface definition in TrainClient.Builder.

Suggested change
public @NonNull Builder host(String host) {
public @NonNull Builder host(@NonNull String host) {

Copilot uses AI. Check for mistakes.

@Override
public List<Stop> getStops(String routeId, String direction) {
public @NonNull List<Stop> getStops(String routeId, String direction) {
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method parameters routeId and direction should be annotated with @NonNull to match the interface contract and establish a complete nullability specification. This should be consistent with the interface definition in BusClient.

Copilot uses AI. Check for mistakes.

@Override
public Optional<Bus> getBus(String id) {
public @NonNull Optional<Bus> getBus(String id) {
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method parameter id should be annotated with @NonNull to match the interface contract and establish a complete nullability specification. This should be consistent with the interface definition in BusClient.

Suggested change
public @NonNull Optional<Bus> getBus(String id) {
public @NonNull Optional<Bus> getBus(@NonNull String id) {

Copilot uses AI. Check for mistakes.
* @throws Cta4jException if an error occurs while fetching the data
*/
Optional<Bus> getBus(String id);
@NonNull Optional<Bus> getBus(String id);
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method parameter id should be annotated with @NonNull to establish a complete nullability contract. The method documentation states it throws NullPointerException if the parameter is null, and the implementation validates this with Objects.requireNonNull. JSpecify annotations should be applied to both return types and parameters for consistency and completeness.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants