Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8249005

Add Name.isEmpty

    XMLWordPrintable

Details

    • CSR
    • Resolution: Withdrawn
    • P4
    • 16
    • core-libs
    • None
    • behavioral
    • minimal
    • Innocuous override of existing default method added to the superinterface.
    • Java API
    • SE

    Description

      Summary

      Provide an method explicitly corresponding to the "empty name" concept mentioned repeated in the javax.lang.model API.

      Problem

      The javax.lang.model API repeatedly uses the concept of an "empty name." With the CharSequence superinterface of Name having an isEmpty default method as of 15, it is helpful to have an innocuous override fo isEmpty is Name to ease references to the empty name concept from other parts of the API.

      Solution

      Add an innocuous override of CharSequence::isEmpty to javax.lang.model.Name.

      Specification

       public interface Name extends CharSequence {
           /**
      +     * Returns {@code true} if this is an empty name with a length of
      +     * zero; returns {@code false} otherwise.
      +     * @return {@code true} for an empty name and {@code false} otherwise.
      +     *
      +     * @implSpec Returns the result of calling {@link
      +     * CharSequence#isEmpty() CharSequence.isEmpty()}.
      +     * @since 16
      +     */
      +    @Override
      +    default boolean isEmpty() {
      +        return CharSequence.super.isEmpty();
      +    }

      Attachments

        Issue Links

          Activity

            People

              darcy Joe Darcy
              darcy Joe Darcy
              Jim Laskey
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: