Symbol resolveSelf ( DiagnosticPosition pos , Env < AttrContext > env , TypeSymbol c , Name name ) { Env < AttrContext > env1 = env ; boolean staticOnly = false ; while ( env1 . outer != null ) { if ( isStatic ( env1 ) ) staticOnly = true ; if ( env1 . enclClass . sym == c ) { Symbol sym = env1 . info . scope . findFirst ( name ) ; if ( sym != null ) { if ( staticOnly ) sym = new StaticError ( sym ) ; return accessBase ( sym , pos , env . enclClass . sym . type , name , true ) ; } } if ( ( env1 . enclClass . sym . flags ( ) & STATIC ) != 0 ) staticOnly = true ; env1 = env1 . outer ; } if ( c . isInterface ( ) && name == names . _super && ! isStatic ( env ) && types . isDirectSuperInterface ( c , env . enclClass . sym ) ) { //this might be a default super call if one of the superinterfaces is 'c' for ( Type t : pruneInterfaces ( env . enclClass . type ) ) { if ( t . tsym == c ) { env . info . defaultSuperCallSite = t ; return new VarSymbol ( 0 , names . _super , types . asSuper ( env . enclClass . type , c ) , env . enclClass . sym ) ; } } //find a direct super type that is a subtype of 'c' for ( Type i : types . directSupertypes ( env . enclClass . type ) ) { if ( i . tsym . isSubClass ( c , types ) && i . tsym != c ) { log . error ( pos , "illegal.default.super.call" , c , diags . fragment ( "redundant.supertype" , c , i ) ) ; return syms . errSymbol ; } } Assert . error ( ) ; } log . error ( pos , "not.encl.class" , c ) ; return syms . errSymbol ; }
Resolve c . name where name == this or name == super .