Skip to content

Replace Java records with pre-record final classes#2

Draft
nikita-volkov with Copilot wants to merge 2 commits into
masterfrom
copilot/downgrade-java-version
Draft

Replace Java records with pre-record final classes#2
nikita-volkov with Copilot wants to merge 2 commits into
masterfrom
copilot/downgrade-java-version

Conversation

Copilot AI commented Feb 22, 2026

Copy link
Copy Markdown
Contributor

Records (finalized in Java 16) are removed in favor of explicit final class equivalents, making the codebase compatible with Java 15 and earlier.

Changes

  • types/RecordingInforecordfinal class with private final fields, public constructor, accessors, and explicit equals/hashCode/toString
  • statements/InsertAlbum — outer record + inner Output record converted
  • statements/SelectAlbumByFormat — outer record + inner OutputRow record converted
  • statements/SelectGenreByArtist — outer record + inner OutputRow record converted
  • statements/UpdateAlbumRecordingReturning — outer record + inner OutputRow record converted
  • statements/UpdateAlbumReleased — outer record converted

All accessor names are preserved (e.g. name(), id(), recording()), so call sites are unaffected.

Example

Before:

public record InsertAlbum(String name, LocalDate released, AlbumFormat format, RecordingInfo recording)
        implements Statement<InsertAlbum.Output> {
    public record Output(long id) {}
}

After:

public final class InsertAlbum implements Statement<InsertAlbum.Output> {
    private final String name;
    // ...
    public InsertAlbum(String name, LocalDate released, AlbumFormat format, RecordingInfo recording) { ... }
    public String name() { return name; }
    // equals / hashCode / toString ...

    public static final class Output {
        private final long id;
        Output(long id) { this.id = id; }
        public long id() { return id; }
        // equals / hashCode / toString ...
    }
}

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: nikita-volkov <1560937+nikita-volkov@users.noreply.github.com>
Copilot AI changed the title [WIP] Downgrade to older Java version before records Replace Java records with pre-record final classes Feb 22, 2026
Copilot AI requested a review from nikita-volkov February 22, 2026 21:00
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