idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
300
public boolean isUnset ( Option option , String value ) { return ( values . get ( option . primaryName + value ) == null ) ; }
Check if the value for a choice option has not been set to a specific value .
301
public Name append ( Name n ) { int len = getByteLength ( ) ; byte [ ] bs = new byte [ len + n . getByteLength ( ) ] ; getBytes ( bs , 0 ) ; n . getBytes ( bs , len ) ; return table . fromUtf ( bs , 0 , bs . length ) ; }
Return the concatenation of this name and name n .
302
public int lastIndexOf ( byte b ) { byte [ ] bytes = getByteArray ( ) ; int offset = getByteOffset ( ) ; int i = getByteLength ( ) - 1 ; while ( i >= 0 && bytes [ offset + i ] != b ) i -- ; return i ; }
Returns last occurrence of byte b in this name - 1 if not found .
303
public Name subName ( int start , int end ) { if ( end < start ) end = start ; return table . fromUtf ( getByteArray ( ) , getByteOffset ( ) + start , end - start ) ; }
Returns the sub - name starting at position start up to and excluding position end .
304
public void getBytes ( byte cs [ ] , int start ) { System . arraycopy ( getByteArray ( ) , getByteOffset ( ) , cs , start , getByteLength ( ) ) ; }
Copy all bytes of this name to buffer cs starting at start .
305
private void findReferenced ( ClassDocImpl containingClass ) { if ( where . length ( ) > 0 ) { if ( containingClass != null ) { referencedClass = containingClass . findClass ( where ) ; } else { referencedClass = docenv ( ) . lookupClass ( where ) ; } if ( referencedClass == null && holder ( ) instanceof ProgramElementDoc ) { referencedClass = docenv ( ) . lookupClass ( ( ( ProgramElementDoc ) holder ( ) ) . containingPackage ( ) . name ( ) + "." + where ) ; } if ( referencedClass == null ) { referencedPackage = docenv ( ) . lookupPackage ( where ) ; return ; } } else { if ( containingClass == null ) { docenv ( ) . warning ( holder , "tag.see.class_not_specified" , name , text ) ; return ; } else { referencedClass = containingClass ; } } where = referencedClass . qualifiedName ( ) ; if ( what == null ) { return ; } else { int paren = what . indexOf ( '(' ) ; String memName = ( paren >= 0 ? what . substring ( 0 , paren ) : what ) ; String [ ] paramarr ; if ( paren > 0 ) { paramarr = new ParameterParseMachine ( what . substring ( paren , what . length ( ) ) ) . parseParameters ( ) ; if ( paramarr != null ) { referencedMember = findExecutableMember ( memName , paramarr , referencedClass ) ; } else { referencedMember = null ; } } else { referencedMember = findExecutableMember ( memName , null , referencedClass ) ; FieldDoc fd = ( ( ClassDocImpl ) referencedClass ) . findField ( memName ) ; if ( referencedMember == null || ( fd != null && fd . containingClass ( ) . subclassOf ( referencedMember . containingClass ( ) ) ) ) { referencedMember = fd ; } } if ( referencedMember == null ) { docenv ( ) . warning ( holder , "tag.see.can_not_find_member" , name , what , where ) ; } } }
Find what is referenced by the see also . If possible sets referencedClass and referencedMember .
306
Option . InvalidValueException newInvalidValueException ( String key , Object ... args ) { return new Option . InvalidValueException ( getLog ( ) . localize ( PrefixKind . JAVAC , key , args ) ) ; }
Returns a new InvalidValueException with a localized detail message .
307
public R visitVariable ( VariableElement e , P p ) { return scan ( e . getEnclosedElements ( ) , p ) ; }
This implementation scans the enclosed elements .
308
public static FSInfo instance ( Context context ) { FSInfo instance = context . get ( FSInfo . class ) ; if ( instance == null ) instance = new FSInfo ( ) ; return instance ; }
Get the FSInfo instance for this context .
309
public R scan ( DocTree tree , P p ) { if ( tree == null ) return null ; DocTreePath prev = path ; path = new DocTreePath ( path , tree ) ; try { return tree . accept ( this , p ) ; } finally { path = prev ; } }
Scans a single node . The current path is updated for the duration of the scan .
310
private static String escapeHtmlChars ( String s ) { for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char ch = s . charAt ( i ) ; switch ( ch ) { case '<' : case '>' : case '&' : StringBuilder sb = new StringBuilder ( s . substring ( 0 , i ) ) ; for ( ; i < s . length ( ) ; i ++ ) { ch = s . charAt ( i ) ; switch ( ch ) { case '<' : sb . append ( "&lt;" ) ; break ; case '>' : sb . append ( "&gt;" ) ; break ; case '&' : sb . append ( "&amp;" ) ; break ; default : sb . append ( ch ) ; break ; } } return sb . toString ( ) ; } } return s ; }
Given a string escape all special html characters and return the result .
311
public static HtmlTree A ( String ref , Content body ) { HtmlTree htmltree = new HtmlTree ( HtmlTag . A , nullCheck ( body ) ) ; htmltree . addAttr ( HtmlAttr . HREF , encodeURL ( ref ) ) ; return htmltree ; }
Generates an HTML anchor tag .
312
public static HtmlTree A ( HtmlVersion htmlVersion , String attr , Content body ) { HtmlTree htmltree = new HtmlTree ( HtmlTag . A ) ; htmltree . addAttr ( ( htmlVersion == HtmlVersion . HTML4 ) ? HtmlAttr . NAME : HtmlAttr . ID , nullCheck ( attr ) ) ; htmltree . addContent ( nullCheck ( body ) ) ; return htmltree ; }
Generates an HTML anchor tag with an id or a name attribute and content .
313
public static HtmlTree A_ID ( String id , Content body ) { HtmlTree htmltree = new HtmlTree ( HtmlTag . A ) ; htmltree . addAttr ( HtmlAttr . ID , nullCheck ( id ) ) ; htmltree . addContent ( nullCheck ( body ) ) ; return htmltree ; }
Generates an HTML anchor tag with id attribute and a body .
314
public static HtmlTree A_ID ( HtmlStyle styleClass , String id , Content body ) { HtmlTree htmltree = A_ID ( id , body ) ; if ( styleClass != null ) htmltree . addStyle ( styleClass ) ; return htmltree ; }
Generates an HTML anchor tag with a style class id attribute and a body .
315
public static HtmlTree CAPTION ( Content body ) { HtmlTree htmltree = new HtmlTree ( HtmlTag . CAPTION , nullCheck ( body ) ) ; return htmltree ; }
Generates a CAPTION tag with some content .
316
public static HtmlTree CODE ( Content body ) { HtmlTree htmltree = new HtmlTree ( HtmlTag . CODE , nullCheck ( body ) ) ; return htmltree ; }
Generates a CODE tag with some content .
317
public static HtmlTree DD ( Content body ) { HtmlTree htmltree = new HtmlTree ( HtmlTag . DD , nullCheck ( body ) ) ; return htmltree ; }
Generates a DD tag with some content .
318
public static HtmlTree DL ( Content body ) { HtmlTree htmltree = new HtmlTree ( HtmlTag . DL , nullCheck ( body ) ) ; return htmltree ; }
Generates a DL tag with some content .
319
public static HtmlTree DT ( Content body ) { HtmlTree htmltree = new HtmlTree ( HtmlTag . DT , nullCheck ( body ) ) ; return htmltree ; }
Generates a DT tag with some content .
320
public static HtmlTree FOOTER ( ) { HtmlTree htmltree = new HtmlTree ( HtmlTag . FOOTER ) ; htmltree . setRole ( Role . CONTENTINFO ) ; return htmltree ; }
Generates a FOOTER tag with role attribute .
321
public static HtmlTree HEADER ( ) { HtmlTree htmltree = new HtmlTree ( HtmlTag . HEADER ) ; htmltree . setRole ( Role . BANNER ) ; return htmltree ; }
Generates a HEADER tag with role attribute .
322
public static HtmlTree HTML ( String lang , Content head , Content body ) { HtmlTree htmltree = new HtmlTree ( HtmlTag . HTML , nullCheck ( head ) , nullCheck ( body ) ) ; htmltree . addAttr ( HtmlAttr . LANG , nullCheck ( lang ) ) ; return htmltree ; }
Generates an HTML tag with lang attribute . It also adds head and body content to the HTML tree .
323
public static HtmlTree IFRAME ( String src , String name , String title ) { HtmlTree htmltree = new HtmlTree ( HtmlTag . IFRAME ) ; htmltree . addAttr ( HtmlAttr . SRC , nullCheck ( src ) ) ; htmltree . addAttr ( HtmlAttr . NAME , nullCheck ( name ) ) ; htmltree . addAttr ( HtmlAttr . TITLE , nullCheck ( title ) ) ; return htmltree ; }
Generates a IFRAME tag .
324
public static HtmlTree INPUT ( String type , String id ) { HtmlTree htmltree = new HtmlTree ( HtmlTag . INPUT ) ; htmltree . addAttr ( HtmlAttr . TYPE , nullCheck ( type ) ) ; htmltree . addAttr ( HtmlAttr . ID , nullCheck ( id ) ) ; htmltree . addAttr ( HtmlAttr . VALUE , " " ) ; htmltree . addAttr ( HtmlAttr . DISABLED , "disabled" ) ; return htmltree ; }
Generates a INPUT tag with some id .
325
public static HtmlTree LINK ( String rel , String type , String href , String title ) { HtmlTree htmltree = new HtmlTree ( HtmlTag . LINK ) ; htmltree . addAttr ( HtmlAttr . REL , nullCheck ( rel ) ) ; htmltree . addAttr ( HtmlAttr . TYPE , nullCheck ( type ) ) ; htmltree . addAttr ( HtmlAttr . HREF , nullCheck ( href ) ) ; htmltree . addAttr ( HtmlAttr . TITLE , nullCheck ( title ) ) ; return htmltree ; }
Generates a LINK tag with the rel type href and title attributes .
326
public static HtmlTree MAIN ( ) { HtmlTree htmltree = new HtmlTree ( HtmlTag . MAIN ) ; htmltree . setRole ( Role . MAIN ) ; return htmltree ; }
Generates a MAIN tag with role attribute .
327
public static HtmlTree MAIN ( Content body ) { HtmlTree htmltree = new HtmlTree ( HtmlTag . MAIN , nullCheck ( body ) ) ; htmltree . setRole ( Role . MAIN ) ; return htmltree ; }
Generates a MAIN tag with role attribute and some content .
328
public static HtmlTree MAIN ( HtmlStyle styleClass , Content body ) { HtmlTree htmltree = HtmlTree . MAIN ( body ) ; if ( styleClass != null ) { htmltree . addStyle ( styleClass ) ; } return htmltree ; }
Generates a MAIN tag with role attribute style attribute and some content .
329
public static HtmlTree META ( String httpEquiv , String content , String charSet ) { HtmlTree htmltree = new HtmlTree ( HtmlTag . META ) ; String contentCharset = content + "; charset=" + charSet ; htmltree . addAttr ( HtmlAttr . HTTP_EQUIV , nullCheck ( httpEquiv ) ) ; htmltree . addAttr ( HtmlAttr . CONTENT , contentCharset ) ; return htmltree ; }
Generates a META tag with the http - equiv content and charset attributes .
330
public static HtmlTree META ( String name , String content ) { HtmlTree htmltree = new HtmlTree ( HtmlTag . META ) ; htmltree . addAttr ( HtmlAttr . NAME , nullCheck ( name ) ) ; htmltree . addAttr ( HtmlAttr . CONTENT , nullCheck ( content ) ) ; return htmltree ; }
Generates a META tag with the name and content attributes .
331
public static HtmlTree NAV ( ) { HtmlTree htmltree = new HtmlTree ( HtmlTag . NAV ) ; htmltree . setRole ( Role . NAVIGATION ) ; return htmltree ; }
Generates a NAV tag with the role attribute .
332
public static HtmlTree NOSCRIPT ( Content body ) { HtmlTree htmltree = new HtmlTree ( HtmlTag . NOSCRIPT , nullCheck ( body ) ) ; return htmltree ; }
Generates a NOSCRIPT tag with some content .
333
public static HtmlTree SCRIPT ( ) { HtmlTree htmltree = new HtmlTree ( HtmlTag . SCRIPT ) ; htmltree . addAttr ( HtmlAttr . TYPE , "text/javascript" ) ; return htmltree ; }
Generates a SCRIPT tag with the type attribute .
334
public static HtmlTree SECTION ( ) { HtmlTree htmltree = new HtmlTree ( HtmlTag . SECTION ) ; htmltree . setRole ( Role . REGION ) ; return htmltree ; }
Generates a SECTION tag with role attribute .
335
public static HtmlTree SECTION ( Content body ) { HtmlTree htmltree = new HtmlTree ( HtmlTag . SECTION , nullCheck ( body ) ) ; htmltree . setRole ( Role . REGION ) ; return htmltree ; }
Generates a SECTION tag with role attribute and some content .
336
public static HtmlTree SMALL ( Content body ) { HtmlTree htmltree = new HtmlTree ( HtmlTag . SMALL , nullCheck ( body ) ) ; return htmltree ; }
Generates a SMALL tag with some content .
337
public static HtmlTree SPAN ( HtmlStyle styleClass , Content body ) { HtmlTree htmltree = new HtmlTree ( HtmlTag . SPAN , nullCheck ( body ) ) ; if ( styleClass != null ) htmltree . addStyle ( styleClass ) ; return htmltree ; }
Generates a SPAN tag with style class attribute and some content .
338
public static HtmlTree SPAN ( String id , HtmlStyle styleClass , Content body ) { HtmlTree htmltree = new HtmlTree ( HtmlTag . SPAN , nullCheck ( body ) ) ; htmltree . addAttr ( HtmlAttr . ID , nullCheck ( id ) ) ; if ( styleClass != null ) htmltree . addStyle ( styleClass ) ; return htmltree ; }
Generates a SPAN tag with id and style class attributes . It also encloses a content .
339
public static HtmlTree TABLE ( HtmlStyle styleClass , String summary , Content body ) { HtmlTree htmltree = new HtmlTree ( HtmlTag . TABLE , nullCheck ( body ) ) ; if ( styleClass != null ) htmltree . addStyle ( styleClass ) ; htmltree . addAttr ( HtmlAttr . SUMMARY , nullCheck ( summary ) ) ; return htmltree ; }
Generates a Table tag with style class and summary attributes and some content .
340
public static HtmlTree TH ( HtmlStyle styleClass , String scope , Content body ) { HtmlTree htmltree = new HtmlTree ( HtmlTag . TH , nullCheck ( body ) ) ; if ( styleClass != null ) htmltree . addStyle ( styleClass ) ; htmltree . addAttr ( HtmlAttr . SCOPE , nullCheck ( scope ) ) ; return htmltree ; }
Generates a TH tag with style class and scope attributes and some content .
341
public static HtmlTree TH ( String scope , Content body ) { return TH ( null , scope , body ) ; }
Generates a TH tag with scope attribute and some content .
342
public static HtmlTree TITLE ( Content body ) { HtmlTree htmltree = new HtmlTree ( HtmlTag . TITLE , nullCheck ( body ) ) ; return htmltree ; }
Generates a TITLE tag with some content .
343
public static HtmlTree TR ( Content body ) { HtmlTree htmltree = new HtmlTree ( HtmlTag . TR , nullCheck ( body ) ) ; return htmltree ; }
Generates a TR tag for an HTML table with some content .
344
public boolean isValid ( ) { switch ( htmlTag ) { case A : return ( hasAttr ( HtmlAttr . NAME ) || hasAttr ( HtmlAttr . ID ) || ( hasAttr ( HtmlAttr . HREF ) && hasContent ( ) ) ) ; case BR : return ( ! hasContent ( ) && ( ! hasAttrs ( ) || hasAttr ( HtmlAttr . CLEAR ) ) ) ; case IFRAME : return ( hasAttr ( HtmlAttr . SRC ) && ! hasContent ( ) ) ; case HR : case INPUT : return ( ! hasContent ( ) ) ; case IMG : return ( hasAttr ( HtmlAttr . SRC ) && hasAttr ( HtmlAttr . ALT ) && ! hasContent ( ) ) ; case LINK : return ( hasAttr ( HtmlAttr . HREF ) && ! hasContent ( ) ) ; case META : return ( hasAttr ( HtmlAttr . CONTENT ) && ! hasContent ( ) ) ; case SCRIPT : return ( ( hasAttr ( HtmlAttr . TYPE ) && hasAttr ( HtmlAttr . SRC ) && ! hasContent ( ) ) || ( hasAttr ( HtmlAttr . TYPE ) && hasContent ( ) ) ) ; default : return hasContent ( ) ; } }
Returns true if the HTML tree is valid . This check is more specific to standard doclet and not exactly similar to W3C specifications . But it ensures HTML validation .
345
private static String stripHtml ( Content body ) { String rawString = body . toString ( ) ; rawString = rawString . replaceAll ( "\\<.*?>" , " " ) ; rawString = rawString . replaceAll ( "\\b\\s{2,}\\b" , " " ) ; return rawString . trim ( ) ; }
Given a Content node strips all html characters and return the result .
346
public Opcode getOpcode ( ) { int b = getUnsignedByte ( 0 ) ; switch ( b ) { case Opcode . NONPRIV : case Opcode . PRIV : case Opcode . WIDE : return Opcode . get ( b , getUnsignedByte ( 1 ) ) ; } return Opcode . get ( b ) ; }
Get the Opcode for this instruction or null if the instruction is unrecognized .
347
public String getMnemonic ( ) { Opcode opcode = getOpcode ( ) ; if ( opcode == null ) return "bytecode " + getUnsignedByte ( 0 ) ; else return opcode . toString ( ) . toLowerCase ( Locale . US ) ; }
Get the mnemonic for this instruction or a default string if the instruction is unrecognized .
348
public int length ( ) { Opcode opcode = getOpcode ( ) ; if ( opcode == null ) return 1 ; switch ( opcode ) { case TABLESWITCH : { int pad = align ( pc + 1 ) - pc ; int low = getInt ( pad + 4 ) ; int high = getInt ( pad + 8 ) ; return pad + 12 + 4 * ( high - low + 1 ) ; } case LOOKUPSWITCH : { int pad = align ( pc + 1 ) - pc ; int npairs = getInt ( pad + 4 ) ; return pad + 8 + 8 * npairs ; } default : return opcode . kind . length ; } }
Get the length in bytes of this instruction including the opcode and all its operands .
349
protected String modifierString ( MemberDoc member ) { int ms = member . modifierSpecifier ( ) ; int no = Modifier . NATIVE | Modifier . SYNCHRONIZED ; return Modifier . toString ( ms & ~ no ) ; }
Return a string describing the access modifier flags . Don t include native or synchronized .
350
protected void addDeprecatedInfo ( ProgramElementDoc member , Content contentTree ) { Content output = ( new DeprecatedTaglet ( ) ) . getTagletOutput ( member , writer . getTagletWriterInstance ( false ) ) ; if ( ! output . isEmpty ( ) ) { Content deprecatedContent = output ; Content div = HtmlTree . DIV ( HtmlStyle . block , deprecatedContent ) ; contentTree . addContent ( div ) ; } }
Add the deprecated information for the given member .
351
public Content getMemberTree ( Content memberTree , boolean isLastContent ) { if ( isLastContent ) return HtmlTree . UL ( HtmlStyle . blockListLast , memberTree ) ; else return HtmlTree . UL ( HtmlStyle . blockList , memberTree ) ; }
Get the member tree to be documented .
352
public static Symtab instance ( Context context ) { Symtab instance = context . get ( symtabKey ) ; if ( instance == null ) instance = new Symtab ( context ) ; return instance ; }
Get the symbol table instance .
353
public boolean packageExists ( ModuleSymbol msym , Name fullname ) { Assert . checkNonNull ( msym ) ; return lookupPackage ( msym , fullname ) . exists ( ) ; }
Check to see if a package exists given its fully qualified name .
354
protected Content getNavLinkClassUse ( ) { Content li = HtmlTree . LI ( HtmlStyle . navBarCell1Rev , useLabel ) ; return li ; }
Get the use link .
355
public JavaFileObject getOverviewPath ( ) { if ( overviewpath != null && getFileManager ( ) instanceof StandardJavaFileManager ) { StandardJavaFileManager fm = ( StandardJavaFileManager ) getFileManager ( ) ; return fm . getJavaFileObjects ( overviewpath ) . iterator ( ) . next ( ) ; } return null ; }
Return the path of the overview file or null if it does not exist .
356
Type unaryPromotion ( Type t ) { Type unboxed = types . unboxedTypeOrType ( t ) ; switch ( unboxed . getTag ( ) ) { case BYTE : case SHORT : case CHAR : return syms . intType ; default : return unboxed ; } }
Perform unary promotion of a type ; this routine implements JLS 5 . 6 . 1 . If the input type is not supported by unary promotion it is returned unaltered .
357
Type binaryPromotion ( Type t1 , Type t2 ) { Type unboxedT1 = types . unboxedTypeOrType ( t1 ) ; Type unboxedT2 = types . unboxedTypeOrType ( t2 ) ; if ( unboxedT1 . isNumeric ( ) && unboxedT2 . isNumeric ( ) ) { if ( unboxedT1 . hasTag ( TypeTag . DOUBLE ) || unboxedT2 . hasTag ( TypeTag . DOUBLE ) ) { return syms . doubleType ; } else if ( unboxedT1 . hasTag ( TypeTag . FLOAT ) || unboxedT2 . hasTag ( TypeTag . FLOAT ) ) { return syms . floatType ; } else if ( unboxedT1 . hasTag ( TypeTag . LONG ) || unboxedT2 . hasTag ( TypeTag . LONG ) ) { return syms . longType ; } else { return syms . intType ; } } else if ( types . isSameType ( unboxedT1 , unboxedT2 ) ) { return unboxedT1 ; } else { return syms . objectType ; } }
Perform binary promotion of a pair of types ; this routine implements JLS 5 . 6 . 2 . If the input types are not supported by unary promotion if such types are identical to a type C then C is returned otherwise Object is returned .
358
OperatorSymbol resolveUnary ( DiagnosticPosition pos , JCTree . Tag tag , Type op ) { return resolve ( tag , unaryOperators , unop -> unop . test ( op ) , unop -> unop . resolve ( op ) , ( ) -> reportErrorIfNeeded ( pos , tag , op ) ) ; }
Entry point for resolving a unary operator given an operator tag and an argument type .
359
OperatorSymbol resolveBinary ( DiagnosticPosition pos , JCTree . Tag tag , Type op1 , Type op2 ) { return resolve ( tag , binaryOperators , binop -> binop . test ( op1 , op2 ) , binop -> binop . resolve ( op1 , op2 ) , ( ) -> reportErrorIfNeeded ( pos , tag , op1 , op2 ) ) ; }
Entry point for resolving a binary operator given an operator tag and a pair of argument types .
360
private OperatorSymbol makeOperator ( Name name , List < OperatorType > formals , OperatorType res , int ... opcodes ) { MethodType opType = new MethodType ( formals . stream ( ) . map ( o -> o . asType ( syms ) ) . collect ( List . collector ( ) ) , res . asType ( syms ) , List . nil ( ) , syms . methodClass ) ; return new OperatorSymbol ( name , opType , mergeOpcodes ( opcodes ) , syms . noSymbol ) ; }
Creates an operator symbol .
361
private OperatorSymbol reportErrorIfNeeded ( DiagnosticPosition pos , Tag tag , Type ... args ) { if ( Stream . of ( args ) . noneMatch ( Type :: isErroneous ) ) { Name opName = operatorName ( tag ) ; JCDiagnostic . Error opError = ( args . length ) == 1 ? Errors . OperatorCantBeApplied ( opName , args [ 0 ] ) : Errors . OperatorCantBeApplied1 ( opName , args [ 0 ] , args [ 1 ] ) ; log . error ( pos , opError ) ; } return noOpSymbol ; }
Report an operator lookup error .
362
private void initUnaryOperators ( ) { initOperators ( unaryOperators , new UnaryNumericOperator ( Tag . POS ) . addUnaryOperator ( DOUBLE , DOUBLE , nop ) . addUnaryOperator ( FLOAT , FLOAT , nop ) . addUnaryOperator ( LONG , LONG , nop ) . addUnaryOperator ( INT , INT , nop ) , new UnaryNumericOperator ( Tag . NEG ) . addUnaryOperator ( DOUBLE , DOUBLE , dneg ) . addUnaryOperator ( FLOAT , FLOAT , fneg ) . addUnaryOperator ( LONG , LONG , lneg ) . addUnaryOperator ( INT , INT , ineg ) , new UnaryNumericOperator ( Tag . COMPL , Type :: isIntegral ) . addUnaryOperator ( LONG , LONG , lxor ) . addUnaryOperator ( INT , INT , ixor ) , new UnaryPrefixPostfixOperator ( Tag . POSTINC ) . addUnaryOperator ( DOUBLE , DOUBLE , dadd ) . addUnaryOperator ( FLOAT , FLOAT , fadd ) . addUnaryOperator ( LONG , LONG , ladd ) . addUnaryOperator ( INT , INT , iadd ) . addUnaryOperator ( CHAR , CHAR , iadd ) . addUnaryOperator ( SHORT , SHORT , iadd ) . addUnaryOperator ( BYTE , BYTE , iadd ) , new UnaryPrefixPostfixOperator ( Tag . POSTDEC ) . addUnaryOperator ( DOUBLE , DOUBLE , dsub ) . addUnaryOperator ( FLOAT , FLOAT , fsub ) . addUnaryOperator ( LONG , LONG , lsub ) . addUnaryOperator ( INT , INT , isub ) . addUnaryOperator ( CHAR , CHAR , isub ) . addUnaryOperator ( SHORT , SHORT , isub ) . addUnaryOperator ( BYTE , BYTE , isub ) , new UnaryBooleanOperator ( Tag . NOT ) . addUnaryOperator ( BOOLEAN , BOOLEAN , bool_not ) , new UnaryReferenceOperator ( Tag . NULLCHK ) . addUnaryOperator ( OBJECT , OBJECT , nullchk ) ) ; }
Initialize all unary operators .
363
private final < O extends OperatorHelper > void initOperators ( Map < Name , List < O > > opsMap , O ... ops ) { for ( O o : ops ) { Name opName = o . name ; List < O > helpers = opsMap . getOrDefault ( opName , List . nil ( ) ) ; opsMap . put ( opName , helpers . prepend ( o ) ) ; } }
Complete the initialization of an operator helper by storing it into the corresponding operator map .
364
private void initOperatorNames ( ) { setOperatorName ( Tag . POS , "+" ) ; setOperatorName ( Tag . NEG , "-" ) ; setOperatorName ( Tag . NOT , "!" ) ; setOperatorName ( Tag . COMPL , "~" ) ; setOperatorName ( Tag . PREINC , "++" ) ; setOperatorName ( Tag . PREDEC , "--" ) ; setOperatorName ( Tag . POSTINC , "++" ) ; setOperatorName ( Tag . POSTDEC , "--" ) ; setOperatorName ( Tag . NULLCHK , "<*nullchk*>" ) ; setOperatorName ( Tag . OR , "||" ) ; setOperatorName ( Tag . AND , "&&" ) ; setOperatorName ( Tag . EQ , "==" ) ; setOperatorName ( Tag . NE , "!=" ) ; setOperatorName ( Tag . LT , "<" ) ; setOperatorName ( Tag . GT , ">" ) ; setOperatorName ( Tag . LE , "<=" ) ; setOperatorName ( Tag . GE , ">=" ) ; setOperatorName ( Tag . BITOR , "|" ) ; setOperatorName ( Tag . BITXOR , "^" ) ; setOperatorName ( Tag . BITAND , "&" ) ; setOperatorName ( Tag . SL , "<<" ) ; setOperatorName ( Tag . SR , ">>" ) ; setOperatorName ( Tag . USR , ">>>" ) ; setOperatorName ( Tag . PLUS , "+" ) ; setOperatorName ( Tag . MINUS , names . hyphen ) ; setOperatorName ( Tag . MUL , names . asterisk ) ; setOperatorName ( Tag . DIV , names . slash ) ; setOperatorName ( Tag . MOD , "%" ) ; }
Initialize operator name array .
365
public void error ( DocTreePath path , String key , Object ... args ) { report ( ERROR , path , resources . getText ( key , args ) ) ; }
Reports an error message to the doclet s reporter .
366
public void notice ( String key , Object ... args ) { if ( ! configuration . quiet ) { report ( NOTE , resources . getText ( key , args ) ) ; } }
Reports an informational notice to the doclet s reporter .
367
private void addAllPackagesFrameTag ( Content contentTree ) { HtmlTree frame = HtmlTree . IFRAME ( DocPaths . OVERVIEW_FRAME . getPath ( ) , "packageListFrame" , configuration . getText ( "doclet.All_Packages" ) ) ; HtmlTree leftTop = HtmlTree . DIV ( HtmlStyle . leftTop , frame ) ; contentTree . addContent ( leftTop ) ; }
Add the IFRAME tag for the frame that lists all packages .
368
private void addAllClassesFrameTag ( Content contentTree ) { HtmlTree frame = HtmlTree . IFRAME ( DocPaths . ALLCLASSES_FRAME . getPath ( ) , "packageFrame" , configuration . getText ( "doclet.All_classes_and_interfaces" ) ) ; HtmlTree leftBottom = HtmlTree . DIV ( HtmlStyle . leftBottom , frame ) ; contentTree . addContent ( leftBottom ) ; }
Add the IFRAME tag for the frame that lists all classes .
369
private void addClassFrameTag ( Content contentTree ) { HtmlTree frame = HtmlTree . IFRAME ( configuration . topFile . getPath ( ) , "classFrame" , configuration . getText ( "doclet.Package_class_and_interface_descriptions" ) ) ; frame . addStyle ( HtmlStyle . rightIframe ) ; contentTree . addContent ( frame ) ; }
Add the IFRAME tag for the frame that describes the class in detail .
370
public boolean checkModifier ( int modifierBits ) { long fmod = ( ( modifierBits & ACCESS_BITS ) == 0 ) ? modifierBits | PACKAGE : modifierBits ; return ( ( oneOf == 0 ) || ( ( oneOf & fmod ) != 0 ) ) && ( ( must & fmod ) == must ) && ( ( cannot & fmod ) == 0 ) ; }
Filter on modifier bits .
371
protected Content getNavLinkModule ( ) { Content linkContent = getModuleLink ( utils . elementUtils . getModuleOf ( annotationType ) , contents . moduleLabel ) ; Content li = HtmlTree . LI ( linkContent ) ; return li ; }
Get the module link .
372
public String asSignatureString ( ) { StringBuilder sb = new StringBuilder ( ) ; if ( typeParams . size ( ) > 0 ) { sb . append ( typeParams . stream ( ) . map ( PubApiTypeParam :: asString ) . collect ( Collectors . joining ( "," , "<" , "> " ) ) ) ; } sb . append ( TypeDesc . encodeAsString ( returnType ) ) ; sb . append ( " " ) ; sb . append ( identifier ) ; sb . append ( "(" ) ; sb . append ( paramTypes . stream ( ) . map ( TypeDesc :: encodeAsString ) . collect ( Collectors . joining ( "," ) ) ) ; sb . append ( ")" ) ; return sb . toString ( ) ; }
the only difference being the upper bound of the return type . )
373
public void buildPackageHeader ( XMLNode node , Content packageSerializedTree ) { packageSerializedTree . addContent ( writer . getPackageHeader ( utils . getPackageName ( currentPackage ) ) ) ; }
Build the package header .
374
public void buildMethodDescription ( XMLNode node , Content methodsContentTree ) { methodWriter . addMemberDescription ( ( MethodDoc ) currentMember , methodsContentTree ) ; }
Build method description .
375
private static boolean serialClassInclude ( ClassDoc cd ) { if ( cd . isEnum ( ) ) { return false ; } try { cd . superclassType ( ) ; } catch ( NullPointerException e ) { return false ; } if ( cd . isSerializable ( ) ) { if ( cd . tags ( "serial" ) . length > 0 ) { return serialDocInclude ( cd ) ; } else if ( cd . isPublic ( ) || cd . isProtected ( ) ) { return true ; } else { return false ; } } return false ; }
Return true if the given ClassDoc should be included in the serialized form .
376
private void buildTree ( Iterable < TypeElement > classes ) { for ( TypeElement aClass : classes ) { if ( configuration . nodeprecated && ( utils . isDeprecated ( aClass ) || utils . isDeprecated ( utils . containingPackage ( aClass ) ) ) ) { continue ; } if ( utils . isHidden ( aClass ) ) { continue ; } if ( utils . isEnum ( aClass ) ) { processType ( aClass , configuration , baseEnums , subEnums ) ; } else if ( utils . isClass ( aClass ) ) { processType ( aClass , configuration , baseClasses , subClasses ) ; } else if ( utils . isInterface ( aClass ) ) { processInterface ( aClass ) ; } else if ( utils . isAnnotationType ( aClass ) ) { processType ( aClass , configuration , baseAnnotationTypes , subAnnotationTypes ) ; } } }
Generate mapping for the sub - classes for every class in this run . Return the sub - class set for java . lang . Object which will be having sub - class listing for itself and also for each sub - class itself will have their own sub - class lists .
377
private void processInterface ( TypeElement typeElement ) { List < ? extends TypeMirror > intfacs = typeElement . getInterfaces ( ) ; if ( ! intfacs . isEmpty ( ) ) { for ( TypeMirror intfac : intfacs ) { if ( ! add ( subInterfaces , utils . asTypeElement ( intfac ) , typeElement ) ) { return ; } else { processInterface ( utils . asTypeElement ( intfac ) ) ; } } } else { if ( ! baseInterfaces . contains ( typeElement ) ) { baseInterfaces . add ( typeElement ) ; } } }
For the interface passed get the interfaces which it extends and then put this interface in the sub - interface set of those interfaces . Do it recursively . If a interface doesn t have super - interface just attach that interface in the set of all the baseInterfaces .
378
private boolean add ( Map < TypeElement , SortedSet < TypeElement > > map , TypeElement superclass , TypeElement typeElement ) { SortedSet < TypeElement > sset = map . computeIfAbsent ( superclass , s -> new TreeSet < > ( comparator ) ) ; if ( sset . contains ( typeElement ) ) { return false ; } else { sset . add ( typeElement ) ; } return true ; }
Adjust the Class Tree . Add the class interface in to it s super classes or super interface s sub - interface set .
379
private SortedSet < TypeElement > get ( Map < TypeElement , SortedSet < TypeElement > > map , TypeElement typeElement ) { return map . computeIfAbsent ( typeElement , t -> new TreeSet < > ( comparator ) ) ; }
From the map return the set of sub - classes or sub - interfaces . If set is null create a new one and return it .
380
public SortedSet < TypeElement > implementingClasses ( TypeElement typeElement ) { SortedSet < TypeElement > result = get ( implementingClasses , typeElement ) ; SortedSet < TypeElement > intfcs = allSubClasses ( typeElement , false ) ; Iterator < TypeElement > subInterfacesIter = intfcs . iterator ( ) ; while ( subInterfacesIter . hasNext ( ) ) { Iterator < TypeElement > implementingClassesIter = implementingClasses ( subInterfacesIter . next ( ) ) . iterator ( ) ; while ( implementingClassesIter . hasNext ( ) ) { TypeElement c = implementingClassesIter . next ( ) ; if ( ! result . contains ( c ) ) { result . add ( c ) ; } } } return result ; }
Return the set of classes which implement the interface passed .
381
public SortedSet < TypeElement > allSubClasses ( TypeElement typeElement , boolean isEnum ) { List < TypeElement > list = new ArrayList < > ( directSubClasses ( typeElement , isEnum ) ) ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { TypeElement te = list . get ( i ) ; SortedSet < TypeElement > tset = directSubClasses0 ( te , isEnum ) ; for ( TypeElement tte : tset ) { if ( ! list . contains ( tte ) ) { list . add ( tte ) ; } } } SortedSet < TypeElement > out = new TreeSet < > ( comparator ) ; out . addAll ( list ) ; return out ; }
Return a set of all direct or indirect sub - classes and subInterfaces of the TypeElement argument .
382
public static AnnotationTypeBuilder getInstance ( Context context , TypeElement annotationTypeDoc , AnnotationTypeWriter writer ) { return new AnnotationTypeBuilder ( context , annotationTypeDoc , writer ) ; }
Construct a new AnnotationTypeBuilder .
383
private void copyDocFiles ( ) throws DocletException { PackageElement containingPackage = utils . containingPackage ( annotationType ) ; if ( ( configuration . packages == null || ! configuration . packages . contains ( containingPackage ) && ! containingPackagesSeen . contains ( containingPackage ) ) ) { utils . copyDocFiles ( containingPackage ) ; containingPackagesSeen . add ( containingPackage ) ; } }
Copy the doc files for the current TypeElement if necessary .
384
public void buildAnnotationTypeInfo ( XMLNode node , Content annotationContentTree ) throws DocletException { Content annotationInfoTree = writer . getAnnotationInfoTreeHeader ( ) ; buildChildren ( node , annotationInfoTree ) ; annotationContentTree . addContent ( writer . getAnnotationInfo ( annotationInfoTree ) ) ; }
Build the annotation information tree documentation .
385
public void buildAnnotationTypeFieldDetails ( XMLNode node , Content memberDetailsTree ) throws DocletException { configuration . getBuilderFactory ( ) . getAnnotationTypeFieldsBuilder ( writer ) . buildChildren ( node , memberDetailsTree ) ; }
Build the annotation type field documentation .
386
public void buildAnnotationTypeOptionalMemberDetails ( XMLNode node , Content memberDetailsTree ) throws DocletException { configuration . getBuilderFactory ( ) . getAnnotationTypeOptionalMemberBuilder ( writer ) . buildChildren ( node , memberDetailsTree ) ; }
Build the annotation type optional member documentation .
387
public void buildAnnotationTypeRequiredMemberDetails ( XMLNode node , Content memberDetailsTree ) throws DocletException { configuration . getBuilderFactory ( ) . getAnnotationTypeRequiredMemberBuilder ( writer ) . buildChildren ( node , memberDetailsTree ) ; }
Build the annotation type required member documentation .
388
public AbstractBuilder getModuleSummaryBuilder ( ModuleElement mdle , ModuleElement prevModule , ModuleElement nextModule ) { return ModuleSummaryBuilder . getInstance ( context , mdle , writerFactory . getModuleSummaryWriter ( mdle , prevModule , nextModule ) ) ; }
Return the builder that builds the module summary .
389
private void setClasses ( DocEnv env , List < JCClassDecl > classes ) { ListBuffer < ClassDocImpl > result = new ListBuffer < > ( ) ; for ( JCClassDecl def : classes ) { if ( env . shouldDocument ( def . sym ) ) { ClassDocImpl cd = env . getClassDoc ( def . sym ) ; if ( cd != null ) { cd . isIncluded = true ; result . append ( cd ) ; } } } cmdLineClasses = result . toList ( ) ; }
Initialize classes information . Those classes are input from command line .
390
private JavaFileObject getOverviewPath ( ) { for ( String [ ] opt : options ) { if ( opt [ 0 ] . equals ( "-overview" ) ) { if ( env . fileManager instanceof StandardJavaFileManager ) { StandardJavaFileManager fm = ( StandardJavaFileManager ) env . fileManager ; return fm . getJavaFileObjects ( opt [ 1 ] ) . iterator ( ) . next ( ) ; } } } return null ; }
Return the path of the overview file and null if it does not exist .
391
public int getColumnNumber ( int pos , boolean expandTabs ) { try { if ( findLine ( pos ) ) { int column = 0 ; for ( int bp = lineStart ; bp < pos ; bp ++ ) { if ( bp >= bufLen ) { return 0 ; } if ( buf [ bp ] == '\t' && expandTabs ) { column = ( column / TabInc * TabInc ) + TabInc ; } else { column ++ ; } } return column + 1 ; } return 0 ; } finally { buf = null ; } }
Return the one - based column number associated with a given pos for the current source file . Zero is returned if no column exists for the given position .
392
public String getLine ( int pos ) { try { if ( ! findLine ( pos ) ) return null ; int lineEnd = lineStart ; while ( lineEnd < bufLen && buf [ lineEnd ] != CR && buf [ lineEnd ] != LF ) lineEnd ++ ; if ( lineEnd - lineStart == 0 ) return null ; return new String ( buf , lineStart , lineEnd - lineStart ) ; } finally { buf = null ; } }
Return the content of the line containing a given pos .
393
protected boolean findLine ( int pos ) { if ( pos == Position . NOPOS ) return false ; try { if ( buf == null && refBuf != null ) buf = refBuf . get ( ) ; if ( buf == null ) { buf = initBuf ( fileObject ) ; lineStart = 0 ; line = 1 ; } else if ( lineStart > pos ) { lineStart = 0 ; line = 1 ; } int bp = lineStart ; while ( bp < bufLen && bp < pos ) { switch ( buf [ bp ++ ] ) { case CR : if ( bp < bufLen && buf [ bp ] == LF ) bp ++ ; line ++ ; lineStart = bp ; break ; case LF : line ++ ; lineStart = bp ; break ; } } return bp <= bufLen ; } catch ( IOException e ) { log . directError ( "source.unavailable" ) ; buf = new char [ 0 ] ; return false ; } }
Find the line in the buffer that contains the current position
394
public String getWindowTitle ( String title ) { if ( configuration . windowtitle . length ( ) > 0 ) { title += " (" + configuration . windowtitle + ")" ; } return title ; }
Get the window title .
395
public Content getUserHeaderFooter ( boolean header ) { String content ; if ( header ) { content = replaceDocRootDir ( configuration . header ) ; } else { if ( configuration . footer . length ( ) != 0 ) { content = replaceDocRootDir ( configuration . footer ) ; } else { content = replaceDocRootDir ( configuration . header ) ; } } Content rawContent = new RawHtml ( content ) ; return rawContent ; }
Get user specified header and the footer .
396
public Content getNavLinkNext ( DocPath next ) { Content li ; if ( next != null ) { li = HtmlTree . LI ( getHyperLink ( next , nextLabel , "" , "" ) ) ; } else li = HtmlTree . LI ( nextLabel ) ; return li ; }
Get link for next file . If next is null just print the label without linking it anywhere .
397
protected Content getNavShowLists ( DocPath link ) { DocLink dl = new DocLink ( link , path . getPath ( ) , null ) ; Content framesContent = getHyperLink ( dl , framesLabel , "" , "_top" ) ; Content li = HtmlTree . LI ( framesContent ) ; return li ; }
Get FRAMES link to switch to the frame version of the output .
398
protected Content getNavLinkMainTree ( String label ) { Content mainTreeContent = getHyperLink ( pathToRoot . resolve ( DocPaths . OVERVIEW_TREE ) , new StringContent ( label ) ) ; Content li = HtmlTree . LI ( mainTreeContent ) ; return li ; }
Get the overview tree link for the main tree .
399
protected Content getNavLinkIndex ( ) { Content linkContent = getHyperLink ( pathToRoot . resolve ( ( configuration . splitindex ? DocPaths . INDEX_FILES . resolve ( DocPaths . indexN ( 1 ) ) : DocPaths . INDEX_ALL ) ) , indexLabel , "" , "" ) ; Content li = HtmlTree . LI ( linkContent ) ; return li ; }
Get link for generated class index .