Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix comparison of feedId #5857

Conversation

habrahamsson-skanetrafiken
Copy link
Contributor

Summary

Change comparison of feedId in Triptimes to use .equals() instead of ==. In practice it doesn't cause any issues currently, but the current code is dangerous since anyone using this method will expect structural comparison.

Discussion:
There was some concern raised that the original code might use == for performance reasons. But for that case there is a method getTripTimes(Trip trip) that uses referential equality and then we could change the performance critical code to use that method instead.

Unit tests

Added a unit test to illustrate the issue.

Bumping the serialization version id

Nope

Copy link

codecov bot commented May 21, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 67.95%. Comparing base (b380134) to head (cef1fd5).

Files Patch % Lines
...main/java/org/opentripplanner/model/Timetable.java 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             dev-2.x    #5857   +/-   ##
==========================================
  Coverage      67.95%   67.95%           
+ Complexity     16607    16606    -1     
==========================================
  Files           1914     1914           
  Lines          72648    72648           
  Branches        7452     7452           
==========================================
  Hits           49369    49369           
+ Misses         20749    20746    -3     
- Partials        2530     2533    +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@vpaturet vpaturet self-requested a review May 23, 2024 14:09
@habrahamsson-skanetrafiken habrahamsson-skanetrafiken merged commit 8d2f1c1 into opentripplanner:dev-2.x May 23, 2024
5 checks passed
optionsome added a commit to HSLdevcom/OpenTripPlanner that referenced this pull request Jun 3, 2024
…metable-feedid-comparison"

This reverts commit 8d2f1c1, reversing
changes made to e2868c6.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants