Skip to content

(Java) Implementing AutoClosable on CuredString #36

@caoimhebyrne

Description

@caoimhebyrne

If CuredString implemented AutoClosable, it would allow it to be used with try-with-resources statements to automatically destroy the string once it goes out of scope.

try (final CuredString curedString = new CuredString("vEⓡ𝔂 𝔽𝕌Ňℕy ţ乇𝕏𝓣 wWiIiIIttHh l133t5p3/-\\|<")) {
    // Use `curedString`...
}

// Once the `try` scope is finished, the string will be destroyed.

This means the caller does not have to explicitly call destroy, which is easily forgotten.

Is there a reason why this hasn't been done? If not, I would be open to making a pull request to add this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions