Skip to content

Removal of Triple, and Quadruple#3529

Merged
wadoon merged 10 commits intomainfrom
weigl/recordsftw
Dec 5, 2024
Merged

Removal of Triple, and Quadruple#3529
wadoon merged 10 commits intomainfrom
weigl/recordsftw

Conversation

@wadoon
Copy link
Member

@wadoon wadoon commented Nov 23, 2024

Refactoring

This PR starts the removal of generic data classes in favor of Java records (aka. named tuples). In this PR, only Triple and Quadruple are removed.

In general, generic parametric data classes (Tuple, Union, ...) lead to unreadable, incomprehensible code, e.g., what does the entity Triple<StatementBlock, URI, Integer> express? Answer: It is the key in a map to find block contracts. Using the record BlockContractKey expresses this better than triple of something.

Therefore, records give you the chance of defining useful variable names, and documentation, and also avoid auto-boxing (hence NPE).

Intended Change

No use of Triple<…> and Quadruple<…>.

Type of pull request

  • X Refactoring (behaviour should not change or only minimally change)
  • X There are changes to the (Java) code

Ensuring quality

  • X by TEST CASES!!! and compiler

@wadoon wadoon changed the title Weigl/recordsftw Removal of Triple, and Quadruple Nov 27, 2024
Copy link
Member

@WolframPfeifer WolframPfeifer left a comment

Choose a reason for hiding this comment

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

Thanks! In my opinion, it is a very good idea to remove these two classes, and use records with good names instead.

I only have some minor remarks:

  • In some comments, "first" and "second" have been replaced too aggressively ...
  • Some uses of var should be removed in my opinion.
  • Some record parameters could use better names instead of "first", "second", ...

@wadoon wadoon requested a review from WolframPfeifer December 3, 2024 22:53
Copy link
Member

@WolframPfeifer WolframPfeifer left a comment

Choose a reason for hiding this comment

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

Thanks! Apart from the spotless formatting, I think it is fine now.

@wadoon wadoon enabled auto-merge December 5, 2024 17:27
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 5, 2024

@wadoon wadoon added this pull request to the merge queue Dec 5, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 5, 2024
@wadoon wadoon added this pull request to the merge queue Dec 5, 2024
Merged via the queue into main with commit 0ae2058 Dec 5, 2024
@wadoon wadoon deleted the weigl/recordsftw branch December 5, 2024 21:08
@wadoon wadoon self-assigned this Nov 23, 2025
@wadoon wadoon added this to the v2.13.0 milestone Nov 23, 2025
@wadoon wadoon removed this from the NextMinor milestone Mar 18, 2026
@wadoon wadoon added this to the v3.0.0 milestone Mar 18, 2026
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.

2 participants