Class ImmutableTypes

java.lang.Object
org.plumelib.util.ImmutableTypes

public class ImmutableTypes extends Object
Records all the immutable types in the JDK, and can be queried.
  • Field Details

    • immutableTypeNames

      public static Set<String> immutableTypeNames
      The names of the immutable types. This is public so that clients can extend it with bug fixes or application-specific types. (Or, make a pull request to add more types to this file.)

      The set generally does not contain interfaces, because types that implement an interface may be mutable even if the interface provides no mutating methods.

  • Method Details

    • isImmutable

      public static boolean isImmutable(String typeName)
      Returns true iff the class of the given name is immutable.
      Parameters:
      typeName - the fully-qualified name of the type
      Returns:
      true iff the class of the given name is immutable