GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Make Name properly immutable · Issue #160 · dnsjava/dnsjava

Make Name properly immutable #160

New issue
Copy link
New issue
Copy link
Open
Open
Make Name properly immutable#160
Copy link
Labels
volunteer wanted

Description

@nresare
nresare
opened on Feb 5, 2021
Issue body actions

The public API of Name is immutable, meaning that there are no methods that can be used to change the state of a Name instance once constructed. However, as an implementation detail of how the public constructors populate the fields of the class, they end up calling private api that modifies state repeatedly.

Having only final fields in immutable objects is good house keeping, but unfortunately test coverage is not very high for Name so it is a bit scary to do refactoring work. Getting to, or close to 100% unit test coverage and then update the implementation to allow for using the final modifier with all fields would be a neat contribution in my opinion.

Activity

  1. nresare
    added
    volunteer wanted
    on Feb 5, 2021
  2. ibauersachs commented on Aug 14, 2021

    @ibauersachs
    ibauersachs
    on Aug 14, 2021
    Member
    More actions

    I made significant changes to Name in fecf898, among others a Name derived from another no longer shares the same data.

    While full immutability would be a nice to have, I don't think it'd be wort the effort and trade-offs. All methods called from the constructor would need to be static, require intermediate objects for the to-be-final fields (due to the lack of multiple return or out-values in Java).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    volunteer wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.