public boolean isImmutable ( Class < ? > clazz ) { if ( clazz . isPrimitive ( ) || clazz . isEnum ( ) ) { return false ; } if ( clazz . isArray ( ) ) { return false ; } final IsImmutable isImmutable ; if ( DETECTED_IMMUTABLE_CLASSES . containsKey ( clazz ) ) { isImmutable = DETECTED_IMMUTABLE_CLASSES . get ( clazz ) ; } else { Dotted dottedClassName = Dotted . fromClass ( clazz ) ; isImmutable = ANALYSIS_SESSION . get ( ) . resultFor ( dottedClassName ) . isImmutable ; DETECTED_IMMUTABLE_CLASSES . put ( clazz , isImmutable ) ; } if ( isImmutable . equals ( IsImmutable . IMMUTABLE ) || isImmutable . equals ( IsImmutable . EFFECTIVELY_IMMUTABLE ) ) { return true ; } else { return false ; } }
Return true if immutable or effectively immutable