Suspicious 'noOuterThisPath' variable in

Andrey Turbanov turbanoff at
Wed Aug 18 07:50:25 UTC 2021


During investigation of results of IDEA inspections I found suspicious
code in a method ''

Env<AttrContext> symEnv = env;
boolean noOuterThisPath = false;
if (env.enclClass.sym.owner.kind != PCK && // we are in an inner class
    sym.kind.matches(KindSelector.VAL_MTH) &&
    sym.owner.kind == TYP && != names._this && != names._super) {

    // Find environment in which identifier is defined.
    while (symEnv.outer != null &&
           !sym.isMemberOf(symEnv.enclClass.sym, types)) {
        if ((symEnv.enclClass.sym.flags() & NOOUTERTHIS) != 0)
            noOuterThisPath = false;
        symEnv = symEnv.outer;

Variable 'noOuterThisPath' has initially assigned a 'false' value.
And then in cycle it again can be set to 'false'.
There are only 2 places where noOuterThisPath is assigned.
It seems it should be set to 'true' in one of the places.

Andrey Turbanov

More information about the compiler-dev mailing list