Skip to content

[Enhancement] Enhance MessageImpl to allow subclasses to access properties #1057

@bcaw-ofeer

Description

@bcaw-ofeer

Before Creating the Enhancement Request

  • I have confirmed that this should be classified as an enhancement rather than a bug/feature.

Programming Language of the Client

Java

Summary

Enhance MessageImpl to allow subclasses to access properties

Motivation

Currently, MessageImpl.properties is private and getProperties() returns a new HashMap copy. This prevents inheritance-based access to properties and creates unnecessary object allocations. Making properties protected allows subclasses to access the properties map directly, while returning an unmodifiable map prevents external modifications while avoiding object creation overhead.

Describe the Solution You'd Like

  1. Change MessageImpl.properties visibility from private to protected
  2. Modify getProperties() to return Collections.unmodifiableMap(properties) instead of new HashMap<>(properties)

This change enables:

  • Inheritance-based access to properties in subclasses
  • Immutable view of properties to prevent external modifications
  • Better performance by avoiding unnecessary HashMap allocations
  • Maintains backward compatibility while improving extensibility

Describe Alternatives You've Considered

None

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions