public static Output search ( Input input ) { Output output = new Output ( ) ; if ( input . isInheritDocTag ) { //Do nothing because "element" does not have any documentation. //All it has it {@inheritDoc}. } else if ( input . taglet == null ) { //We want overall documentation. output . inlineTags = input . isFirstSentence ? input . element . firstSentenceTags ( ) : input . element . inlineTags ( ) ; output . holder = input . element ; } else { input . taglet . inherit ( input , output ) ; } if ( output . inlineTags != null && output . inlineTags . length > 0 ) { return output ; } output . isValidInheritDocTag = false ; Input inheritedSearchInput = input . copy ( ) ; inheritedSearchInput . isInheritDocTag = false ; if ( input . element instanceof MethodDoc ) { MethodDoc overriddenMethod = ( ( MethodDoc ) input . element ) . overriddenMethod ( ) ; if ( overriddenMethod != null ) { inheritedSearchInput . element = overriddenMethod ; output = search ( inheritedSearchInput ) ; output . isValidInheritDocTag = true ; if ( output . inlineTags . length > 0 ) { return output ; } } //NOTE: When we fix the bug where ClassDoc.interfaceTypes() does // not pass all implemented interfaces, we will use the // appropriate element here. MethodDoc [ ] implementedMethods = ( new ImplementedMethods ( ( MethodDoc ) input . element , null ) ) . build ( false ) ; for ( int i = 0 ; i < implementedMethods . length ; i ++ ) { inheritedSearchInput . element = implementedMethods [ i ] ; output = search ( inheritedSearchInput ) ; output . isValidInheritDocTag = true ; if ( output . inlineTags . length > 0 ) { return output ; } } } else if ( input . element instanceof ClassDoc ) { ProgramElementDoc superclass = ( ( ClassDoc ) input . element ) . superclass ( ) ; if ( superclass != null ) { inheritedSearchInput . element = superclass ; output = search ( inheritedSearchInput ) ; output . isValidInheritDocTag = true ; if ( output . inlineTags . length > 0 ) { return output ; } } } return output ; }
Search for the requested comments in the given element . If it does not have comments return documentation from the overriden element if possible . If the overriden element does not exist or does not have documentation to inherit search for documentation to inherit from implemented methods .