public static Symbol . ClassSymbol getOutermostClassSymbol ( Symbol symbol ) { // get the symbol for the outermost enclosing class. this handles // the case of anonymous classes Symbol . ClassSymbol outermostClassSymbol = ASTHelpers . enclosingClass ( symbol ) ; while ( outermostClassSymbol . getNestingKind ( ) . isNested ( ) ) { Symbol . ClassSymbol enclosingSymbol = ASTHelpers . enclosingClass ( outermostClassSymbol . owner ) ; if ( enclosingSymbol != null ) { outermostClassSymbol = enclosingSymbol ; } else { // enclosingSymbol can be null in weird cases like for array methods break ; } } return outermostClassSymbol ; }
finds the symbol for the top - level class containing the given symbol