private boolean processModifiers ( GroovySourceAST t , SimpleGroovyAbstractableElementDoc memberOrClass ) { GroovySourceAST modifiers = t . childOfType ( MODIFIERS ) ; boolean hasNonPublicVisibility = false ; boolean hasPublicVisibility = false ; if ( modifiers != null ) { AST currentModifier = modifiers . getFirstChild ( ) ; while ( currentModifier != null ) { int type = currentModifier . getType ( ) ; switch ( type ) { case LITERAL_public : memberOrClass . setPublic ( true ) ; hasPublicVisibility = true ; break ; case LITERAL_protected : memberOrClass . setProtected ( true ) ; hasNonPublicVisibility = true ; break ; case LITERAL_private : memberOrClass . setPrivate ( true ) ; hasNonPublicVisibility = true ; break ; case LITERAL_static : memberOrClass . setStatic ( true ) ; break ; case FINAL : memberOrClass . setFinal ( true ) ; break ; case ABSTRACT : memberOrClass . setAbstract ( true ) ; break ; } currentModifier = currentModifier . getNextSibling ( ) ; } if ( ! hasNonPublicVisibility && isGroovy && ! ( memberOrClass instanceof GroovyFieldDoc ) ) { // in groovy, methods and classes are assumed public, unless informed otherwise if ( isPackageScope ( modifiers ) ) { memberOrClass . setPackagePrivate ( true ) ; hasNonPublicVisibility = true ; } else { memberOrClass . setPublic ( true ) ; } } else if ( ! hasNonPublicVisibility && ! hasPublicVisibility && ! isGroovy ) { if ( insideInterface ( memberOrClass ) || insideAnnotationDef ( memberOrClass ) ) { memberOrClass . setPublic ( true ) ; } else { memberOrClass . setPackagePrivate ( true ) ; } } if ( memberOrClass instanceof GroovyFieldDoc && isGroovy && ! hasNonPublicVisibility & ! hasPublicVisibility ) { if ( isPackageScope ( modifiers ) ) { memberOrClass . setPackagePrivate ( true ) ; hasNonPublicVisibility = true ; } } if ( memberOrClass instanceof GroovyFieldDoc && ! hasNonPublicVisibility && ! hasPublicVisibility && isGroovy ) return true ; } else if ( isGroovy && ! ( memberOrClass instanceof GroovyFieldDoc ) ) { // in groovy, methods and classes are assumed public, unless informed otherwise memberOrClass . setPublic ( true ) ; } else if ( ! isGroovy ) { if ( insideInterface ( memberOrClass ) || insideAnnotationDef ( memberOrClass ) ) { memberOrClass . setPublic ( true ) ; } else { memberOrClass . setPackagePrivate ( true ) ; } } return memberOrClass instanceof GroovyFieldDoc && isGroovy && ! hasNonPublicVisibility & ! hasPublicVisibility ; }
return true if a property is found