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

java.lang.Throwable could use Collections.emptyList for suppressedException

XMLWordPrintable

    • b89
    • generic
    • generic

        Currently this is used as a default value for suppressedException:

            // Setting this static field introduces an acceptable
            // initialization dependency on a few java.util classes.
            private static final List<Throwable> SUPPRESSED_SENTINEL =
                Collections.unmodifiableList(new ArrayList<Throwable>(0));

        Substituting Collections.unmodifiableList(new ArrayList<Throwable>(0)) with Collections.emptyList() indicate 3 fewer classes are loaded in a hello world program, and thus a very small startup footprint improvement.

        emptyList should be providing the same immutability and identity requirements.

              vtewari Vyom Tewari
              redestad Claes Redestad
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: