ClassImmutabilityAnalysis contains dead code

Issue #145 resolved
florian_kuebler created an issue

allSubtypes of java.lang.Object always contains all types

       // 2.
        // All classes that do not have complete superclass information are mutable
        // due to the lack of knowledge.
        val typesForWhichItMayBePossibleToComputeTheMutability =
            allSubtypes(ObjectType.Object, reflexive = true)
        val unexpectedRootTypes =
            rootTypes.filter(rt  (rt ne ObjectType.Object) && isInterface(rt).isNo)

        unexpectedRootTypes.flatMap(rt  allSubtypes(rt, reflexive = true)).view.
            // For classes that directly inherit from Object, but which also
            // implement unknown interface types it is possible to compute the class
            // immutability
            filter(ot  !typesForWhichItMayBePossibleToComputeTheMutability.contains(ot)).
            foreach(ot  project.classFile(ot) foreach { cf 
                handleResult(Result(cf, MutableObjectDueToUnknownSupertypes))
            })

Comments (5)

  1. Log in to comment