Skip to content

Removal of redundant content for interface members #170

@satyamgupta11692

Description

@satyamgupta11692

Part 1:

Since we know all the unimplemented interface methods are public and abstract by default. Could we please update the below method definition in below interface web page:

Current interface definition:

public interface AbstractZoneTimeClient extends TimeClient { public ZonedDateTime getZonedDateTime(String zoneString); }
Updated interface definition:

public interface AbstractZoneTimeClient extends TimeClient { ZonedDateTime getZonedDateTime(String zoneString); }

Part 2:

As mentioned in oracle docs, all method declarations in an interface, including default methods, are implicitly public, so you can omit the public modifier. Could we remove the public from below interface definition default method:

Current interface definition:

public interface HandleInvalidTimeZoneClient extends TimeClient { default public ZonedDateTime getZonedDateTime(String zoneString) { try { return ZonedDateTime.of(getLocalDateTime(),ZoneId.of(zoneString)); } catch (DateTimeException e) { System.err.println("Invalid zone ID: " + zoneString + "; using the default time zone instead."); return ZonedDateTime.of(getLocalDateTime(),ZoneId.systemDefault()); } } }
Updated interface definition:

public interface HandleInvalidTimeZoneClient extends TimeClient { default ZonedDateTime getZonedDateTime(String zoneString) { try { return ZonedDateTime.of(getLocalDateTime(),ZoneId.of(zoneString)); } catch (DateTimeException e) { System.err.println("Invalid zone ID: " + zoneString + "; using the default time zone instead."); return ZonedDateTime.of(getLocalDateTime(),ZoneId.systemDefault()); } } }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions