idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
600
Set < OpensFlag > readOpensFlags ( int flags ) { Set < OpensFlag > set = EnumSet . noneOf ( OpensFlag . class ) ; for ( OpensFlag f : OpensFlag . values ( ) ) { if ( ( flags & f . value ) != 0 ) set . add ( f ) ; } return set ; }
Read opens_flags .
601
Set < RequiresFlag > readRequiresFlags ( int flags ) { Set < RequiresFlag > set = EnumSet . noneOf ( RequiresFlag . class ) ; for ( RequiresFlag f : RequiresFlag . values ( ) ) { if ( ( flags & f . value ) != 0 ) set . add ( f ) ; } return set ; }
Read requires_flags .
602
Type sigToType ( byte [ ] sig , int offset , int len ) { signature = sig ; sigp = offset ; siglimit = offset + len ; return sigToType ( ) ; }
Convert signature to type where signature is a byte array segment .
603
Type sigToType ( ) { switch ( ( char ) signature [ sigp ] ) { case 'T' : sigp ++ ; int start = sigp ; while ( signature [ sigp ] != ';' ) sigp ++ ; sigp ++ ; return sigEnterPhase ? Type . noType : findTypeVar ( names . fromUtf ( signature , start , sigp - 1 - start ) ) ; case '+' : { sigp ++ ; Type t = sigToType ( ) ; return new WildcardType ( t , BoundKind . EXTENDS , syms . boundClass ) ; } case '*' : sigp ++ ; return new WildcardType ( syms . objectType , BoundKind . UNBOUND , syms . boundClass ) ; case '-' : { sigp ++ ; Type t = sigToType ( ) ; return new WildcardType ( t , BoundKind . SUPER , syms . boundClass ) ; } case 'B' : sigp ++ ; return syms . byteType ; case 'C' : sigp ++ ; return syms . charType ; case 'D' : sigp ++ ; return syms . doubleType ; case 'F' : sigp ++ ; return syms . floatType ; case 'I' : sigp ++ ; return syms . intType ; case 'J' : sigp ++ ; return syms . longType ; case 'L' : { Type t = classSigToType ( ) ; if ( sigp < siglimit && signature [ sigp ] == '.' ) throw badClassFile ( "deprecated inner class signature syntax " + "(please recompile from source)" ) ; return t ; } case 'S' : sigp ++ ; return syms . shortType ; case 'V' : sigp ++ ; return syms . voidType ; case 'Z' : sigp ++ ; return syms . booleanType ; case '[' : sigp ++ ; return new ArrayType ( sigToType ( ) , syms . arrayClass ) ; case '(' : sigp ++ ; List < Type > argtypes = sigToTypes ( ')' ) ; Type restype = sigToType ( ) ; List < Type > thrown = List . nil ( ) ; while ( signature [ sigp ] == '^' ) { sigp ++ ; thrown = thrown . prepend ( sigToType ( ) ) ; } for ( List < Type > l = thrown ; l . nonEmpty ( ) ; l = l . tail ) { if ( l . head . hasTag ( TYPEVAR ) ) { l . head . tsym . flags_field |= THROWS ; } } return new MethodType ( argtypes , restype , thrown . reverse ( ) , syms . methodClass ) ; case '<' : typevars = typevars . dup ( currentOwner ) ; Type poly = new ForAll ( sigToTypeParams ( ) , sigToType ( ) ) ; typevars = typevars . leave ( ) ; return poly ; default : throw badClassFile ( "bad.signature" , Convert . utf2string ( signature , sigp , 10 ) ) ; } }
Convert signature to type where signature is implicit .
604
List < Type > sigToTypeParams ( byte [ ] sig , int offset , int len ) { signature = sig ; sigp = offset ; siglimit = offset + len ; return sigToTypeParams ( ) ; }
Convert signature to type parameters where signature is a byte array segment .
605
List < Type > sigToTypeParams ( ) { List < Type > tvars = List . nil ( ) ; if ( signature [ sigp ] == '<' ) { sigp ++ ; int start = sigp ; sigEnterPhase = true ; while ( signature [ sigp ] != '>' ) tvars = tvars . prepend ( sigToTypeParam ( ) ) ; sigEnterPhase = false ; sigp = start ; while ( signature [ sigp ] != '>' ) sigToTypeParam ( ) ; sigp ++ ; } return tvars . reverse ( ) ; }
Convert signature to type parameters where signature is implicit .
606
void skipMember ( ) { bp = bp + 6 ; char ac = nextChar ( ) ; for ( int i = 0 ; i < ac ; i ++ ) { bp = bp + 2 ; int attrLen = nextInt ( ) ; bp = bp + attrLen ; } }
Skip a field or method
607
private void readClassBuffer ( ClassSymbol c ) throws IOException { int magic = nextInt ( ) ; if ( magic != JAVA_MAGIC ) throw badClassFile ( "illegal.start.of.class.file" ) ; minorVersion = nextChar ( ) ; majorVersion = nextChar ( ) ; int maxMajor = 53 ; int maxMinor = Version . MAX ( ) . minor ; if ( majorVersion > maxMajor || majorVersion * 1000 + minorVersion < Version . MIN ( ) . major * 1000 + Version . MIN ( ) . minor ) { if ( majorVersion == ( maxMajor + 1 ) ) log . warning ( "big.major.version" , currentClassFile , majorVersion , maxMajor ) ; else throw badClassFile ( "wrong.version" , Integer . toString ( majorVersion ) , Integer . toString ( minorVersion ) , Integer . toString ( maxMajor ) , Integer . toString ( maxMinor ) ) ; } indexPool ( ) ; if ( signatureBuffer . length < bp ) { int ns = Integer . highestOneBit ( bp ) << 1 ; signatureBuffer = new byte [ ns ] ; } readClass ( c ) ; }
Read a class definition from the bytes in buf .
608
public static JavacMessages instance ( Context context ) { JavacMessages instance = context . get ( messagesKey ) ; if ( instance == null ) instance = new JavacMessages ( context ) ; return instance ; }
Get the JavacMessages instance for this context .
609
public String getLocalizedString ( String key , Object ... args ) { return getLocalizedString ( currentLocale , key , args ) ; }
Gets the localized string corresponding to a key formatted with a set of args .
610
static String getDefaultLocalizedString ( String key , Object ... args ) { return getLocalizedString ( List . of ( getDefaultBundle ( ) ) , key , args ) ; }
used to support legacy Log . getLocalizedString
611
protected void generateClassUseFile ( ) throws DocFileIOException { HtmlTree body = getClassUseHeader ( ) ; HtmlTree div = new HtmlTree ( HtmlTag . DIV ) ; div . addStyle ( HtmlStyle . classUseContainer ) ; if ( pkgSet . size ( ) > 0 ) { addClassUse ( div ) ; } else { div . addContent ( contents . getContent ( "doclet.ClassUse_No.usage.of.0" , utils . getFullyQualifiedName ( typeElement ) ) ) ; } if ( configuration . allowTag ( HtmlTag . MAIN ) ) { mainTree . addContent ( div ) ; body . addContent ( mainTree ) ; } else { body . addContent ( div ) ; } HtmlTree htmlTree = ( configuration . allowTag ( HtmlTag . FOOTER ) ) ? HtmlTree . FOOTER ( ) : body ; addNavLinks ( false , htmlTree ) ; addBottom ( htmlTree ) ; if ( configuration . allowTag ( HtmlTag . FOOTER ) ) { body . addContent ( htmlTree ) ; } printHtmlDocument ( null , true , body ) ; }
Generate the class use elements .
612
protected void addPackageList ( Content contentTree ) { Content caption = getTableCaption ( configuration . getContent ( "doclet.ClassUse_Packages.that.use.0" , getLink ( new LinkInfoImpl ( configuration , LinkInfoImpl . Kind . CLASS_USE_HEADER , typeElement ) ) ) ) ; Content table = ( configuration . isOutputHtml5 ( ) ) ? HtmlTree . TABLE ( HtmlStyle . useSummary , caption ) : HtmlTree . TABLE ( HtmlStyle . useSummary , useTableSummary , caption ) ; table . addContent ( getSummaryTableHeader ( packageTableHeader , "col" ) ) ; Content tbody = new HtmlTree ( HtmlTag . TBODY ) ; boolean altColor = true ; for ( PackageElement pkg : pkgSet ) { HtmlTree tr = new HtmlTree ( HtmlTag . TR ) ; tr . addStyle ( altColor ? HtmlStyle . altColor : HtmlStyle . rowColor ) ; altColor = ! altColor ; addPackageUse ( pkg , tr ) ; tbody . addContent ( tr ) ; } table . addContent ( tbody ) ; Content li = HtmlTree . LI ( HtmlStyle . blockList , table ) ; contentTree . addContent ( li ) ; }
Add the packages elements that use the given class .
613
protected void addPackageAnnotationList ( Content contentTree ) { if ( ! utils . isAnnotationType ( typeElement ) || pkgToPackageAnnotations == null || pkgToPackageAnnotations . isEmpty ( ) ) { return ; } Content caption = getTableCaption ( configuration . getContent ( "doclet.ClassUse_PackageAnnotation" , getLink ( new LinkInfoImpl ( configuration , LinkInfoImpl . Kind . CLASS_USE_HEADER , typeElement ) ) ) ) ; Content table = ( configuration . isOutputHtml5 ( ) ) ? HtmlTree . TABLE ( HtmlStyle . useSummary , caption ) : HtmlTree . TABLE ( HtmlStyle . useSummary , useTableSummary , caption ) ; table . addContent ( getSummaryTableHeader ( packageTableHeader , "col" ) ) ; Content tbody = new HtmlTree ( HtmlTag . TBODY ) ; boolean altColor = true ; for ( PackageElement pkg : pkgToPackageAnnotations ) { HtmlTree tr = new HtmlTree ( HtmlTag . TR ) ; tr . addStyle ( altColor ? HtmlStyle . altColor : HtmlStyle . rowColor ) ; altColor = ! altColor ; Content thFirst = HtmlTree . TH_ROW_SCOPE ( HtmlStyle . colFirst , getPackageLink ( pkg ) ) ; tr . addContent ( thFirst ) ; HtmlTree tdLast = new HtmlTree ( HtmlTag . TD ) ; tdLast . addStyle ( HtmlStyle . colLast ) ; addSummaryComment ( pkg , tdLast ) ; tr . addContent ( tdLast ) ; tbody . addContent ( tr ) ; } table . addContent ( tbody ) ; Content li = HtmlTree . LI ( HtmlStyle . blockList , table ) ; contentTree . addContent ( li ) ; }
Add the package annotation elements .
614
private ClassIndex indexForPath ( Path path ) { if ( isJRTMarkerFile ( path ) ) { FileSystem jrtfs = FileSystems . getFileSystem ( URI . create ( "jrt:/" ) ) ; Path modules = jrtfs . getPath ( "modules" ) ; return PATH_TO_INDEX . compute ( path , ( p , index ) -> { try { long lastModified = Files . getLastModifiedTime ( modules ) . toMillis ( ) ; if ( index == null || index . timestamp != lastModified ) { try ( DirectoryStream < Path > stream = Files . newDirectoryStream ( modules ) ) { index = doIndex ( lastModified , path , stream ) ; } } return index ; } catch ( IOException ex ) { proc . debug ( ex , "SourceCodeAnalysisImpl.indexesForPath(" + path . toString ( ) + ")" ) ; return new ClassIndex ( - 1 , path , Collections . emptySet ( ) , Collections . emptyMap ( ) ) ; } } ) ; } else if ( ! Files . isDirectory ( path ) ) { if ( Files . exists ( path ) ) { return PATH_TO_INDEX . compute ( path , ( p , index ) -> { try { long lastModified = Files . getLastModifiedTime ( p ) . toMillis ( ) ; if ( index == null || index . timestamp != lastModified ) { ClassLoader cl = SourceCodeAnalysisImpl . class . getClassLoader ( ) ; try ( FileSystem zip = FileSystems . newFileSystem ( path , cl ) ) { index = doIndex ( lastModified , path , zip . getRootDirectories ( ) ) ; } } return index ; } catch ( IOException ex ) { proc . debug ( ex , "SourceCodeAnalysisImpl.indexesForPath(" + path . toString ( ) + ")" ) ; return new ClassIndex ( - 1 , path , Collections . emptySet ( ) , Collections . emptyMap ( ) ) ; } } ) ; } else { return new ClassIndex ( - 1 , path , Collections . emptySet ( ) , Collections . emptyMap ( ) ) ; } } else { return PATH_TO_INDEX . compute ( path , ( p , index ) -> { if ( index == null ) { index = doIndex ( - 1 , path , Arrays . asList ( p ) ) ; } return index ; } ) ; } }
if an index exists for the given entry the existing index is kept unless the timestamp is modified
615
private ClassIndex doIndex ( long timestamp , Path originalPath , Iterable < ? extends Path > dirs ) { Set < String > packages = new HashSet < > ( ) ; Map < String , Collection < String > > classSimpleName2FQN = new HashMap < > ( ) ; for ( Path d : dirs ) { try { Files . walkFileTree ( d , new FileVisitor < Path > ( ) { int depth ; public FileVisitResult preVisitDirectory ( Path dir , BasicFileAttributes attrs ) throws IOException { waitIndexingNotSuspended ( ) ; if ( depth ++ == 0 ) return FileVisitResult . CONTINUE ; String dirName = dir . getFileName ( ) . toString ( ) ; String sep = dir . getFileSystem ( ) . getSeparator ( ) ; dirName = dirName . endsWith ( sep ) ? dirName . substring ( 0 , dirName . length ( ) - sep . length ( ) ) : dirName ; if ( SourceVersion . isIdentifier ( dirName ) ) return FileVisitResult . CONTINUE ; return FileVisitResult . SKIP_SUBTREE ; } public FileVisitResult visitFile ( Path file , BasicFileAttributes attrs ) throws IOException { waitIndexingNotSuspended ( ) ; if ( file . getFileName ( ) . toString ( ) . endsWith ( ".class" ) ) { String relativePath = d . relativize ( file ) . toString ( ) ; String binaryName = relativePath . substring ( 0 , relativePath . length ( ) - 6 ) . replace ( '/' , '.' ) ; int packageDot = binaryName . lastIndexOf ( '.' ) ; if ( packageDot > ( - 1 ) ) { packages . add ( binaryName . substring ( 0 , packageDot ) ) ; } String typeName = binaryName . replace ( '$' , '.' ) ; addClassName2Map ( classSimpleName2FQN , typeName ) ; } return FileVisitResult . CONTINUE ; } public FileVisitResult visitFileFailed ( Path file , IOException exc ) throws IOException { return FileVisitResult . CONTINUE ; } public FileVisitResult postVisitDirectory ( Path dir , IOException exc ) throws IOException { depth -- ; return FileVisitResult . CONTINUE ; } } ) ; } catch ( IOException ex ) { proc . debug ( ex , "doIndex(" + d . toString ( ) + ")" ) ; } } return new ClassIndex ( timestamp , originalPath , packages , classSimpleName2FQN ) ; }
create an index based on the content of the given dirs ; the original JavaFileManager entry is originalPath .
616
private static String escapeJavaScriptChars ( String s ) { StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char ch = s . charAt ( i ) ; switch ( ch ) { case '\b' : sb . append ( "\\b" ) ; break ; case '\t' : sb . append ( "\\t" ) ; break ; case '\n' : sb . append ( "\\n" ) ; break ; case '\f' : sb . append ( "\\f" ) ; break ; case '\r' : sb . append ( "\\r" ) ; break ; case '"' : sb . append ( "\\\"" ) ; break ; case '\'' : sb . append ( "\\\'" ) ; break ; case '\\' : sb . append ( "\\\\" ) ; break ; default : if ( ch < 32 || ch >= 127 ) { sb . append ( String . format ( "\\u%04X" , ( int ) ch ) ) ; } else { sb . append ( ch ) ; } break ; } } return sb . toString ( ) ; }
Returns a String with escaped special JavaScript characters .
617
public HtmlTree getBody ( boolean includeScript , String title ) { HtmlTree body = new HtmlTree ( HtmlTag . BODY ) ; this . winTitle = title ; if ( includeScript ) { this . script = getWinTitleScript ( ) ; body . addContent ( script ) ; Content noScript = HtmlTree . NOSCRIPT ( HtmlTree . DIV ( configuration . getContent ( "doclet.No_Script_Message" ) ) ) ; body . addContent ( noScript ) ; } return body ; }
Returns an HtmlTree for the BODY tag .
618
public void addStyles ( HtmlStyle style , StringBuilder vars ) { vars . append ( "var " ) . append ( style ) . append ( " = \"" ) . append ( style ) . append ( "\";" ) . append ( DocletConstants . NL ) ; }
Adds javascript style variables to the document .
619
private JdepsFilter dependencyFilter ( JdepsConfiguration config ) { JdepsFilter . Builder builder = new JdepsFilter . Builder ( ) ; builder . includePattern ( options . includePattern ) ; builder . filter ( options . filterSamePackage , options . filterSameArchive ) ; builder . findJDKInternals ( options . findJDKInternals ) ; if ( ! options . requires . isEmpty ( ) ) { options . requires . stream ( ) . forEach ( mn -> { Module m = config . findModule ( mn ) . get ( ) ; builder . requires ( mn , m . packages ( ) ) ; } ) ; } if ( options . regex != null ) builder . regex ( options . regex ) ; if ( ! options . packageNames . isEmpty ( ) ) builder . packages ( options . packageNames ) ; if ( options . filterRegex != null ) builder . filter ( options . filterRegex ) ; return builder . build ( ) ; }
Returns a filter used during dependency analysis
620
private static int read ( DocFile inFile , InputStream input , byte [ ] buf ) throws DocFileIOException { try { return input . read ( buf ) ; } catch ( IOException e ) { throw new DocFileIOException ( inFile , DocFileIOException . Mode . READ , e ) ; } }
Reads from an input stream opened from a given file into a given buffer . If an IOException occurs it is wrapped in a DocFileIOException .
621
private static void write ( DocFile outFile , OutputStream out , byte [ ] buf , int len ) throws DocFileIOException { try { out . write ( buf , 0 , len ) ; } catch ( IOException e ) { throw new DocFileIOException ( outFile , DocFileIOException . Mode . WRITE , e ) ; } }
Writes to an output stream for a given file from a given buffer . If an IOException occurs it is wrapped in a DocFileIOException .
622
private static void write ( DocFile outFile , Writer out , String text ) throws DocFileIOException { try { out . write ( text ) ; } catch ( IOException e ) { throw new DocFileIOException ( outFile , DocFileIOException . Mode . WRITE , e ) ; } }
Writes text to an output stream for a given file from a given buffer . If an IOException occurs it is wrapped in a DocFileIOException .
623
private static int readResource ( DocPath resource , InputStream in , byte [ ] buf ) throws ResourceIOException { try { return in . read ( buf ) ; } catch ( IOException e ) { throw new ResourceIOException ( resource , e ) ; } }
Reads from an input stream opened from a given resource into a given buffer . If an IOException occurs it is wrapped in a ResourceIOException .
624
private static String readResourceLine ( DocPath docPath , BufferedReader in ) throws ResourceIOException { try { return in . readLine ( ) ; } catch ( IOException e ) { throw new ResourceIOException ( docPath , e ) ; } }
Reads a line of characters from an input stream opened from a given resource . If an IOException occurs it is wrapped in a ResourceIOException .
625
public static < A extends Annotation > A generateAnnotation ( Attribute . Compound anno , Class < A > annoType ) { AnnotationProxyMaker apm = new AnnotationProxyMaker ( anno , annoType ) ; return annoType . cast ( apm . generateAnnotation ( ) ) ; }
Returns a dynamic proxy for an annotation mirror .
626
private Map < String , Object > getAllReflectedValues ( ) { Map < String , Object > res = new LinkedHashMap < > ( ) ; for ( Map . Entry < MethodSymbol , Attribute > entry : getAllValues ( ) . entrySet ( ) ) { MethodSymbol meth = entry . getKey ( ) ; Object value = generateValue ( meth , entry . getValue ( ) ) ; if ( value != null ) { res . put ( meth . name . toString ( ) , value ) ; } else { } } return res ; }
Returns a map from element names to their values in dynamic proxy return form . Includes all elements whether explicit or defaulted .
627
private Object generateValue ( MethodSymbol meth , Attribute attr ) { ValueVisitor vv = new ValueVisitor ( meth ) ; return vv . getValue ( attr ) ; }
Converts an element value to its dynamic proxy return form . Returns an exception proxy on some errors but may return null if a useful exception cannot or should not be generated at this point .
628
private void checkTagName ( String name ) { if ( standardTags . contains ( name ) ) { overridenStandardTags . add ( name ) ; } else { if ( name . indexOf ( '.' ) == - 1 ) { potentiallyConflictingTags . add ( name ) ; } unseenCustomTags . add ( name ) ; } }
Given a tag name add it to the set of tags it belongs to .
629
private void initCustomTagletArrays ( ) { Iterator < Taglet > it = customTags . values ( ) . iterator ( ) ; ArrayList < Taglet > pTags = new ArrayList < > ( customTags . size ( ) ) ; ArrayList < Taglet > tTags = new ArrayList < > ( customTags . size ( ) ) ; ArrayList < Taglet > fTags = new ArrayList < > ( customTags . size ( ) ) ; ArrayList < Taglet > cTags = new ArrayList < > ( customTags . size ( ) ) ; ArrayList < Taglet > mTags = new ArrayList < > ( customTags . size ( ) ) ; ArrayList < Taglet > iTags = new ArrayList < > ( customTags . size ( ) ) ; ArrayList < Taglet > oTags = new ArrayList < > ( customTags . size ( ) ) ; ArrayList < Taglet > sTags = new ArrayList < > ( ) ; Taglet current ; while ( it . hasNext ( ) ) { current = it . next ( ) ; if ( current . inPackage ( ) && ! current . isInlineTag ( ) ) { pTags . add ( current ) ; } if ( current . inType ( ) && ! current . isInlineTag ( ) ) { tTags . add ( current ) ; } if ( current . inField ( ) && ! current . isInlineTag ( ) ) { fTags . add ( current ) ; } if ( current . inConstructor ( ) && ! current . isInlineTag ( ) ) { cTags . add ( current ) ; } if ( current . inMethod ( ) && ! current . isInlineTag ( ) ) { mTags . add ( current ) ; } if ( current . isInlineTag ( ) ) { iTags . add ( current ) ; } if ( current . inOverview ( ) && ! current . isInlineTag ( ) ) { oTags . add ( current ) ; } } packageTags = pTags . toArray ( new Taglet [ ] { } ) ; typeTags = tTags . toArray ( new Taglet [ ] { } ) ; fieldTags = fTags . toArray ( new Taglet [ ] { } ) ; constructorTags = cTags . toArray ( new Taglet [ ] { } ) ; methodTags = mTags . toArray ( new Taglet [ ] { } ) ; overviewTags = oTags . toArray ( new Taglet [ ] { } ) ; inlineTags = iTags . toArray ( new Taglet [ ] { } ) ; sTags . add ( customTags . get ( "serialData" ) ) ; sTags . add ( customTags . get ( "throws" ) ) ; if ( ! nosince ) sTags . add ( customTags . get ( "since" ) ) ; sTags . add ( customTags . get ( "see" ) ) ; serializedFormTags = sTags . toArray ( new Taglet [ ] { } ) ; }
Initialize the custom tag arrays .
630
private void initJavaFXTaglets ( ) { addStandardTaglet ( new PropertyGetterTaglet ( ) ) ; addStandardTaglet ( new PropertySetterTaglet ( ) ) ; addStandardTaglet ( new SimpleTaglet ( "propertyDescription" , message . getText ( "doclet.PropertyDescription" ) , SimpleTaglet . FIELD + SimpleTaglet . METHOD ) ) ; addStandardTaglet ( new SimpleTaglet ( "defaultValue" , message . getText ( "doclet.DefaultValue" ) , SimpleTaglet . FIELD + SimpleTaglet . METHOD ) ) ; addStandardTaglet ( new SimpleTaglet ( "treatAsPrivate" , null , SimpleTaglet . FIELD + SimpleTaglet . METHOD + SimpleTaglet . TYPE ) ) ; }
Initialize JavaFX - related tags .
631
public Taglet getTaglet ( String name ) { if ( name . indexOf ( "@" ) == 0 ) { return customTags . get ( name . substring ( 1 ) ) ; } else { return customTags . get ( name ) ; } }
Given the name of a tag return the corresponding taglet . Return null if the tag is unknown .
632
public Content getFieldsContentHeader ( boolean isLastContent ) { HtmlTree li = new HtmlTree ( HtmlTag . LI ) ; if ( isLastContent ) li . addStyle ( HtmlStyle . blockListLast ) ; else li . addStyle ( HtmlStyle . blockList ) ; return li ; }
Return the header for serializable fields content section .
633
public Content getSerializableFields ( String heading , Content serializableFieldsTree ) { HtmlTree li = new HtmlTree ( HtmlTag . LI ) ; li . addStyle ( HtmlStyle . blockList ) ; if ( serializableFieldsTree . isValid ( ) ) { Content headingContent = new StringContent ( heading ) ; Content serialHeading = HtmlTree . HEADING ( HtmlConstants . SERIALIZED_MEMBER_HEADING , headingContent ) ; li . addContent ( serialHeading ) ; li . addContent ( serializableFieldsTree ) ; } return li ; }
Add serializable fields .
634
public Set < SourceVersion > getSourceVersions ( ) { return Collections . unmodifiableSet ( EnumSet . range ( SourceVersion . RELEASE_9 , SourceVersion . latest ( ) ) ) ; }
Returns the source versions of the jshell tool .
635
public com . sun . javadoc . Type [ ] bounds ( ) { return TypeMaker . getTypes ( env , getBounds ( ( TypeVar ) type , env ) ) ; }
Return the bounds of this type variable .
636
static String typeVarToString ( DocEnv env , TypeVar v , boolean full ) { StringBuilder s = new StringBuilder ( v . toString ( ) ) ; List < Type > bounds = getBounds ( v , env ) ; if ( bounds . nonEmpty ( ) ) { boolean first = true ; for ( Type b : bounds ) { s . append ( first ? " extends " : " & " ) ; s . append ( TypeMaker . getTypeString ( env , b , full ) ) ; first = false ; } } return s . toString ( ) ; }
Return the string form of a type variable along with any extends clause . Class names are qualified if full is true .
637
private static List < Type > getBounds ( TypeVar v , DocEnv env ) { final Type upperBound = v . getUpperBound ( ) ; Name boundname = upperBound . tsym . getQualifiedName ( ) ; if ( boundname == boundname . table . names . java_lang_Object && ! upperBound . isAnnotated ( ) ) { return List . nil ( ) ; } else { return env . types . getBounds ( v ) ; } }
Get the bounds of a type variable as listed in the extends clause .
638
private Iterable < Path > getPathEntries ( String searchPath , Path emptyPathDefault ) { ListBuffer < Path > entries = new ListBuffer < > ( ) ; for ( String s : searchPath . split ( Pattern . quote ( File . pathSeparator ) , - 1 ) ) { if ( s . isEmpty ( ) ) { if ( emptyPathDefault != null ) { entries . add ( emptyPathDefault ) ; } } else { try { entries . add ( getPath ( s ) ) ; } catch ( IllegalArgumentException e ) { if ( warn ) { log . warning ( LintCategory . PATH , "invalid.path" , s ) ; } } } } return entries ; }
Split a search path into its elements . If emptyPathDefault is not null all empty elements in the path including empty elements at either end of the path will be replaced with the value of emptyPathDefault .
639
private boolean isArchive ( Path file ) { String n = StringUtils . toLowerCase ( file . getFileName ( ) . toString ( ) ) ; return fsInfo . isFile ( file ) && ( n . endsWith ( ".jar" ) || n . endsWith ( ".zip" ) ) ; }
Is this the name of an archive file?
640
public void addDir ( String dirName ) { Path dir = Paths . get ( dirName ) ; if ( Files . isDirectory ( dir ) ) { list . add ( new DirPathEntry ( dir ) ) ; } }
Adds a directory to this finder s search path ignoring errors .
641
public void addJar ( String jarName ) { try { list . add ( new JarPathEntry ( new JarFile ( jarName ) ) ) ; } catch ( IOException ignore ) { } }
Adds a jar file to this finder s search path ignoring errors .
642
public ClassFile find ( String className ) { for ( PathEntry pe : list ) { ClassFile cf = pe . find ( className ) ; if ( cf != null ) { return cf ; } } return null ; }
Searches the class path for a class with the given name returning a ClassFile for it . Returns null if not found .
643
String next ( ) { while ( true ) { nextToken ( ) ; if ( sval != null && ! isQuoted ( ) && sval . startsWith ( "-" ) ) { String opt = sval . startsWith ( "--" ) ? sval . substring ( 1 ) : sval ; foundOption ( opt ) ; } else { break ; } } return sval ; }
Return the next non - option argument . Encountered options are stored .
644
void allowedOptions ( String ... opts ) { for ( String opt : opts ) { options . putIfAbsent ( opt , false ) ; } }
Set the allowed options . Must be called before any options would be read and before calling any of the option functionality below .
645
boolean hasOption ( String opt ) { Boolean has = options . get ( opt ) ; if ( has == null ) { throw new InternalError ( "hasOption called before allowedOptions or on bad option" ) ; } return has ; }
Has the specified option been encountered .
646
String remainder ( ) { List < String > rem = new ArrayList < > ( ) ; while ( next ( ) != null ) { rem . add ( sval ) ; } return String . join ( " " , rem ) ; }
Consume the remainder of the input . This is useful to sure all options have been encountered and to check to unexpected additional non - option input .
647
public void nextToken ( ) { byte ct [ ] = ctype ; int c ; int lctype ; sval = null ; isQuoted = false ; do { c = read ( ) ; if ( c < 0 ) { return ; } lctype = ( c < 256 ) ? ct [ c ] : unicode2ctype ( c ) ; } while ( lctype == CT_WHITESPACE ) ; if ( lctype == CT_ALPHA ) { int i = 0 ; do { if ( i >= buf . length ) { buf = Arrays . copyOf ( buf , buf . length * 2 ) ; } buf [ i ++ ] = ( char ) c ; c = read ( ) ; lctype = c < 0 ? CT_WHITESPACE : ( c < 256 ) ? ct [ c ] : unicode2ctype ( c ) ; } while ( lctype == CT_ALPHA ) ; if ( c >= 0 ) -- next ; sval = String . copyValueOf ( buf , 0 , i ) ; return ; } if ( lctype == CT_QUOTE ) { int quote = c ; int i = 0 ; int d = read ( ) ; while ( d >= 0 && d != quote ) { if ( d == '\\' ) { c = read ( ) ; int first = c ; if ( c >= '0' && c <= '7' ) { c = c - '0' ; int c2 = read ( ) ; if ( '0' <= c2 && c2 <= '7' ) { c = ( c << 3 ) + ( c2 - '0' ) ; c2 = read ( ) ; if ( '0' <= c2 && c2 <= '7' && first <= '3' ) { c = ( c << 3 ) + ( c2 - '0' ) ; d = read ( ) ; } else d = c2 ; } else d = c2 ; } else { switch ( c ) { case 'a' : c = 0x7 ; break ; case 'b' : c = '\b' ; break ; case 'f' : c = 0xC ; break ; case 'n' : c = '\n' ; break ; case 'r' : c = '\r' ; break ; case 't' : c = '\t' ; break ; case 'v' : c = 0xB ; break ; } d = read ( ) ; } } else { c = d ; d = read ( ) ; } if ( i >= buf . length ) { buf = Arrays . copyOf ( buf , buf . length * 2 ) ; } buf [ i ++ ] = ( char ) c ; } if ( d == quote ) { isQuoted = true ; } sval = String . copyValueOf ( buf , 0 , i ) ; } }
Parses the next token of this tokenizer .
648
public static Printer createStandardPrinter ( final Messages messages ) { return new Printer ( ) { protected String localize ( Locale locale , String key , Object ... args ) { return messages . getLocalizedString ( locale , key , args ) ; } protected String capturedVarId ( CapturedType t , Locale locale ) { return ( t . hashCode ( ) & 0xFFFFFFFFL ) % PRIME + "" ; } } ; }
Create a printer with default i18n support provided by Messages . By default captured types ids are generated using hashcode .
649
public String visitTypes ( List < Type > ts , Locale locale ) { ListBuffer < String > sbuf = new ListBuffer < > ( ) ; for ( Type t : ts ) { sbuf . append ( visit ( t , locale ) ) ; } return sbuf . toList ( ) . toString ( ) ; }
Get a localized string representation for all the types in the input list .
650
protected String printMethodArgs ( List < Type > args , boolean varArgs , Locale locale ) { if ( ! varArgs ) { return visitTypes ( args , locale ) ; } else { StringBuilder buf = new StringBuilder ( ) ; while ( args . tail . nonEmpty ( ) ) { buf . append ( visit ( args . head , locale ) ) ; args = args . tail ; buf . append ( ',' ) ; } if ( args . head . hasTag ( TypeTag . ARRAY ) ) { buf . append ( visit ( ( ( ArrayType ) args . head ) . elemtype , locale ) ) ; if ( args . head . getAnnotationMirrors ( ) . nonEmpty ( ) ) { buf . append ( ' ' ) ; buf . append ( args . head . getAnnotationMirrors ( ) ) ; buf . append ( ' ' ) ; } buf . append ( "..." ) ; } else { buf . append ( visit ( args . head , locale ) ) ; } return buf . toString ( ) ; } }
Converts a set of method argument types into their corresponding localized string representation .
651
String encode ( ) { List < String > el = new ArrayList < > ( ) ; el . add ( name ) ; el . add ( String . valueOf ( commandFluff ) ) ; el . add ( prompt ) ; el . add ( continuationPrompt ) ; for ( Entry < String , List < Setting > > es : cases . entrySet ( ) ) { el . add ( es . getKey ( ) ) ; el . add ( "(" ) ; for ( Setting ing : es . getValue ( ) ) { el . add ( String . valueOf ( ing . enumBits ) ) ; el . add ( ing . format ) ; } el . add ( ")" ) ; } el . add ( "***" ) ; return String . join ( RECORD_SEPARATOR , el ) ; }
Encodes the mode into a String so it can be saved in Preferences .
652
String format ( String field , long bits ) { List < Setting > settings = cases . get ( field ) ; if ( settings == null ) { return "" ; } String format = null ; for ( int i = settings . size ( ) - 1 ; i >= 0 ; -- i ) { Setting ing = settings . get ( i ) ; long mask = ing . enumBits ; if ( ( bits & mask ) == bits ) { format = ing . format ; break ; } } if ( format == null || format . isEmpty ( ) ) { return "" ; } Matcher m = FIELD_PATTERN . matcher ( format ) ; StringBuffer sb = new StringBuffer ( format . length ( ) ) ; while ( m . find ( ) ) { String fieldName = m . group ( 1 ) ; String sub = format ( fieldName , bits ) ; m . appendReplacement ( sb , Matcher . quoteReplacement ( sub ) ) ; } m . appendTail ( sb ) ; return sb . toString ( ) ; }
Lookup format Replace fields with context specific formats .
653
public ModuleMode getModuleMode ( ) { switch ( accessFilter . getAccessValue ( ElementKind . MODULE ) ) { case PACKAGE : case PRIVATE : return DocletEnvironment . ModuleMode . ALL ; default : return DocletEnvironment . ModuleMode . API ; } }
Returns the module documentation level mode .
654
public Set < ? extends Element > getSpecifiedElements ( ) { if ( specifiedElements == null ) { Set < Element > result = new LinkedHashSet < > ( ) ; result . addAll ( specifiedModuleElements ) ; result . addAll ( specifiedPackageElements ) ; result . addAll ( specifiedTypeElements ) ; specifiedElements = Collections . unmodifiableSet ( result ) ; } return specifiedElements ; }
Returns a set of elements specified on the command line including any inner classes .
655
void analyze ( ) throws ToolException { computeSpecifiedModules ( ) ; computeSpecifiedPackages ( ) ; computeSpecifiedTypes ( ) ; Set < PackageElement > expandedModulePackages = computeModulePackages ( ) ; initializeIncludedSets ( expandedModulePackages ) ; }
Performs the final computation and freezes the collections . This is a terminal operation thus no further modifications are allowed to the specified data sets .
656
public List < String > getMetaKeywordsForModule ( ModuleElement mdle ) { if ( config . keywords ) { return Arrays . asList ( mdle . getQualifiedName ( ) + " " + "module" ) ; } else { return Collections . emptyList ( ) ; } }
Get the module keywords .
657
public Iterable < ? extends Completion > getCompletions ( Element element , AnnotationMirror annotation , ExecutableElement member , String userText ) { return Collections . emptyList ( ) ; }
Returns an empty iterable of completions .
658
private void addAllModulesFrameTag ( Content contentTree ) { HtmlTree frame = HtmlTree . IFRAME ( DocPaths . MODULE_OVERVIEW_FRAME . getPath ( ) , "packageListFrame" , configuration . getText ( "doclet.All_Modules" ) ) ; HtmlTree leftTop = HtmlTree . DIV ( HtmlStyle . leftTop , frame ) ; contentTree . addContent ( leftTop ) ; }
Add the IFRAME tag for the frame that lists all modules .
659
protected void lexError ( int pos , String key , Object ... args ) { log . error ( pos , key , args ) ; tk = TokenKind . ERROR ; errPos = pos ; }
Report an error at the given position using the provided arguments .
660
private void scanLitChar ( int pos ) { if ( reader . ch == '\\' ) { if ( reader . peekChar ( ) == '\\' && ! reader . isUnicode ( ) ) { reader . skipChar ( ) ; reader . putChar ( '\\' , true ) ; } else { reader . scanChar ( ) ; switch ( reader . ch ) { case '0' : case '1' : case '2' : case '3' : case '4' : case '5' : case '6' : case '7' : char leadch = reader . ch ; int oct = reader . digit ( pos , 8 ) ; reader . scanChar ( ) ; if ( '0' <= reader . ch && reader . ch <= '7' ) { oct = oct * 8 + reader . digit ( pos , 8 ) ; reader . scanChar ( ) ; if ( leadch <= '3' && '0' <= reader . ch && reader . ch <= '7' ) { oct = oct * 8 + reader . digit ( pos , 8 ) ; reader . scanChar ( ) ; } } reader . putChar ( ( char ) oct ) ; break ; case 'b' : reader . putChar ( '\b' , true ) ; break ; case 't' : reader . putChar ( '\t' , true ) ; break ; case 'n' : reader . putChar ( '\n' , true ) ; break ; case 'f' : reader . putChar ( '\f' , true ) ; break ; case 'r' : reader . putChar ( '\r' , true ) ; break ; case '\'' : reader . putChar ( '\'' , true ) ; break ; case '\"' : reader . putChar ( '\"' , true ) ; break ; case '\\' : reader . putChar ( '\\' , true ) ; break ; default : lexError ( reader . bp , "illegal.esc.char" ) ; } } } else if ( reader . bp != reader . buflen ) { reader . putChar ( true ) ; } }
Read next character in character or string literal and copy into sbuf .
661
private void scanIdent ( ) { boolean isJavaIdentifierPart ; char high ; reader . putChar ( true ) ; do { switch ( reader . ch ) { case 'A' : case 'B' : case 'C' : case 'D' : case 'E' : case 'F' : case 'G' : case 'H' : case 'I' : case 'J' : case 'K' : case 'L' : case 'M' : case 'N' : case 'O' : case 'P' : case 'Q' : case 'R' : case 'S' : case 'T' : case 'U' : case 'V' : case 'W' : case 'X' : case 'Y' : case 'Z' : case 'a' : case 'b' : case 'c' : case 'd' : case 'e' : case 'f' : case 'g' : case 'h' : case 'i' : case 'j' : case 'k' : case 'l' : case 'm' : case 'n' : case 'o' : case 'p' : case 'q' : case 'r' : case 's' : case 't' : case 'u' : case 'v' : case 'w' : case 'x' : case 'y' : case 'z' : case '$' : case '_' : case '0' : case '1' : case '2' : case '3' : case '4' : case '5' : case '6' : case '7' : case '8' : case '9' : break ; case '\u0000' : case '\u0001' : case '\u0002' : case '\u0003' : case '\u0004' : case '\u0005' : case '\u0006' : case '\u0007' : case '\u0008' : case '\u000E' : case '\u000F' : case '\u0010' : case '\u0011' : case '\u0012' : case '\u0013' : case '\u0014' : case '\u0015' : case '\u0016' : case '\u0017' : case '\u0018' : case '\u0019' : case '\u001B' : case '\u007F' : reader . scanChar ( ) ; continue ; case '\u001A' : if ( reader . bp >= reader . buflen ) { name = reader . name ( ) ; tk = tokens . lookupKind ( name ) ; return ; } reader . scanChar ( ) ; continue ; default : if ( reader . ch < '\u0080' ) { isJavaIdentifierPart = false ; } else { if ( Character . isIdentifierIgnorable ( reader . ch ) ) { reader . scanChar ( ) ; continue ; } else { int codePoint = reader . peekSurrogates ( ) ; if ( codePoint >= 0 ) { if ( isJavaIdentifierPart = Character . isJavaIdentifierPart ( codePoint ) ) { reader . putChar ( true ) ; } } else { isJavaIdentifierPart = Character . isJavaIdentifierPart ( reader . ch ) ; } } } if ( ! isJavaIdentifierPart ) { name = reader . name ( ) ; tk = tokens . lookupKind ( name ) ; return ; } } reader . putChar ( true ) ; } while ( true ) ; }
Read an identifier .
662
private void scanOperator ( ) { while ( true ) { reader . putChar ( false ) ; Name newname = reader . name ( ) ; TokenKind tk1 = tokens . lookupKind ( newname ) ; if ( tk1 == TokenKind . IDENTIFIER ) { reader . sp -- ; break ; } tk = tk1 ; reader . scanChar ( ) ; if ( ! isSpecial ( reader . ch ) ) break ; } }
Read longest possible sequence of special characters and convert to token .
663
protected void processWhiteSpace ( int pos , int endPos ) { if ( scannerDebug ) System . out . println ( "processWhitespace(" + pos + "," + endPos + ")=|" + new String ( reader . getRawCharacters ( pos , endPos ) ) + "|" ) ; }
Called when a complete whitespace run has been scanned . pos and endPos will mark the whitespace boundary .
664
public Position . LineMap getLineMap ( ) { return Position . makeLineMap ( reader . getRawCharacters ( ) , reader . buflen , false ) ; }
Build a map for translating between line numbers and positions in the input .
665
public static com . sun . javadoc . Type [ ] getTypes ( DocEnv env , List < Type > ts ) { return getTypes ( env , ts , new com . sun . javadoc . Type [ ts . length ( ) ] ) ; }
Convert a list of javac types into an array of javadoc types .
666
public static com . sun . javadoc . Type [ ] getTypes ( DocEnv env , List < Type > ts , com . sun . javadoc . Type res [ ] ) { int i = 0 ; for ( Type t : ts ) { res [ i ++ ] = getType ( env , t ) ; } return res ; }
Like the above version but use and return the array given .
667
static String typeParametersString ( DocEnv env , Symbol sym , boolean full ) { if ( env . legacyDoclet || sym . type . getTypeArguments ( ) . isEmpty ( ) ) { return "" ; } StringBuilder s = new StringBuilder ( ) ; for ( Type t : sym . type . getTypeArguments ( ) ) { s . append ( s . length ( ) == 0 ? "<" : ", " ) ; s . append ( TypeVariableImpl . typeVarToString ( env , ( TypeVar ) t , full ) ) ; } s . append ( ">" ) ; return s . toString ( ) ; }
Return the formal type parameters of a class or method as an angle - bracketed string . Each parameter is a type variable with optional bounds . Class names are qualified if full is true . Return if there are no type parameters or we re hiding generics .
668
static String typeArgumentsString ( DocEnv env , ClassType cl , boolean full ) { if ( env . legacyDoclet || cl . getTypeArguments ( ) . isEmpty ( ) ) { return "" ; } StringBuilder s = new StringBuilder ( ) ; for ( Type t : cl . getTypeArguments ( ) ) { s . append ( s . length ( ) == 0 ? "<" : ", " ) ; s . append ( getTypeString ( env , t , full ) ) ; } s . append ( ">" ) ; return s . toString ( ) ; }
Return the actual type arguments of a parameterized type as an angle - bracketed string . Class name are qualified if full is true . Return if there are no type arguments or we re hiding generics .
669
public void buildClassInfo ( XMLNode node , Content classContentTree ) { Content classInfoTree = writer . getClassInfoTreeHeader ( ) ; buildChildren ( node , classInfoTree ) ; classContentTree . addContent ( writer . getClassInfo ( classInfoTree ) ) ; }
Build the class information tree documentation .
670
public void buildMemberSummary ( XMLNode node , Content classContentTree ) throws Exception { Content memberSummaryTree = writer . getMemberTreeHeader ( ) ; configuration . getBuilderFactory ( ) . getMemberSummaryBuilder ( writer ) . buildChildren ( node , memberSummaryTree ) ; classContentTree . addContent ( writer . getMemberSummaryTree ( memberSummaryTree ) ) ; }
Build the member summary contents of the page .
671
public void buildEnumConstantsDetails ( XMLNode node , Content memberDetailsTree ) throws Exception { configuration . getBuilderFactory ( ) . getEnumConstantsBuilder ( writer ) . buildChildren ( node , memberDetailsTree ) ; }
Build the enum constants documentation .
672
private Collection < ClassDoc > subinterfaces ( ClassDoc cd ) { Collection < ClassDoc > ret = classToSubinterface . get ( cd . qualifiedName ( ) ) ; if ( ret == null ) { ret = new TreeSet < > ( utils . makeComparatorForClassUse ( ) ) ; SortedSet < ClassDoc > subs = classtree . subinterfaces ( cd ) ; if ( subs != null ) { ret . addAll ( subs ) ; for ( ClassDoc sub : subs ) { ret . addAll ( subinterfaces ( sub ) ) ; } } addAll ( classToSubinterface , cd , ret ) ; } return ret ; }
Return all subinterfaces of an interface AND fill - in classToSubinterface map .
673
public static ScannerFactory instance ( Context context ) { ScannerFactory instance = context . get ( scannerFactoryKey ) ; if ( instance == null ) instance = new ScannerFactory ( context ) ; return instance ; }
Get the Factory instance for this context .
674
public Content getTableCaption ( Set < MethodTypes > methodTypes ) { Content tabbedCaption = new HtmlTree ( HtmlTag . CAPTION ) ; for ( MethodTypes type : methodTypes ) { Content captionSpan ; Content span ; if ( type . tableTabs ( ) . isDefaultTab ( ) ) { captionSpan = HtmlTree . SPAN ( configuration . getContent ( type . tableTabs ( ) . resourceKey ( ) ) ) ; span = HtmlTree . SPAN ( type . tableTabs ( ) . tabId ( ) , HtmlStyle . activeTableTab , captionSpan ) ; } else { captionSpan = HtmlTree . SPAN ( getMethodTypeLinks ( type ) ) ; span = HtmlTree . SPAN ( type . tableTabs ( ) . tabId ( ) , HtmlStyle . tableTab , captionSpan ) ; } Content tabSpan = HtmlTree . SPAN ( HtmlStyle . tabEnd , Contents . SPACE ) ; span . addContent ( tabSpan ) ; tabbedCaption . addContent ( span ) ; } return tabbedCaption ; }
Get the summary table caption .
675
public Content getMethodTypeLinks ( MethodTypes methodType ) { String jsShow = "javascript:show(" + methodType . tableTabs ( ) . value ( ) + ");" ; HtmlTree link = HtmlTree . A ( jsShow , configuration . getContent ( methodType . tableTabs ( ) . resourceKey ( ) ) ) ; return link ; }
Get the method type links for the table caption .
676
void generateIndexFile ( ) throws DocFileIOException { Content htmlDocType = configuration . isOutputHtml5 ( ) ? DocType . HTML5 : DocType . TRANSITIONAL ; Content htmlComment = new Comment ( configuration . getText ( "doclet.New_Page" ) ) ; Content head = new HtmlTree ( HtmlTag . HEAD ) ; head . addContent ( getGeneratedBy ( ! configuration . notimestamp ) ) ; String title = ( configuration . windowtitle . length ( ) > 0 ) ? configuration . windowtitle : configuration . getText ( "doclet.Generated_Docs_Untitled" ) ; Content windowTitle = HtmlTree . TITLE ( new StringContent ( title ) ) ; head . addContent ( windowTitle ) ; Content metaContentType = HtmlTree . META ( "Content" , CONTENT_TYPE , ( configuration . charset . length ( ) > 0 ) ? configuration . charset : HtmlConstants . HTML_DEFAULT_CHARSET ) ; head . addContent ( metaContentType ) ; String topFilePath = configuration . topFile . getPath ( ) ; String javaScriptRefresh = "window.location.replace('" + topFilePath + "')" ; HtmlTree scriptTree = HtmlTree . SCRIPT ( ) ; scriptTree . addContent ( javaScriptRefresh ) ; head . addContent ( scriptTree ) ; HtmlTree metaRefresh = new HtmlTree ( HtmlTag . META ) ; metaRefresh . addAttr ( HtmlAttr . HTTP_EQUIV , "Refresh" ) ; metaRefresh . addAttr ( HtmlAttr . CONTENT , "0;" + topFilePath ) ; if ( configuration . isOutputHtml5 ( ) ) { head . addContent ( HtmlTree . NOSCRIPT ( metaRefresh ) ) ; } else { head . addContent ( metaRefresh ) ; } head . addContent ( getStyleSheetProperties ( configuration ) ) ; ContentBuilder bodyContent = new ContentBuilder ( ) ; bodyContent . addContent ( HtmlTree . NOSCRIPT ( HtmlTree . P ( configuration . getContent ( "doclet.No_Script_Message" ) ) ) ) ; bodyContent . addContent ( HtmlTree . P ( HtmlTree . A ( topFilePath , new StringContent ( topFilePath ) ) ) ) ; Content body = new HtmlTree ( HtmlTag . BODY ) ; if ( configuration . allowTag ( HtmlTag . MAIN ) ) { HtmlTree main = HtmlTree . MAIN ( bodyContent ) ; body . addContent ( main ) ; } else { body . addContent ( bodyContent ) ; } Content htmlTree = HtmlTree . HTML ( configuration . getLocale ( ) . getLanguage ( ) , head , body ) ; Content htmlDocument = new HtmlDocument ( htmlDocType , htmlComment , htmlTree ) ; write ( htmlDocument ) ; }
Generate an index file that redirects to an alternate file .
677
protected void build ( XMLNode node , Content contentTree ) throws DocletException { String component = node . name ; try { String methodName = "build" + component ; if ( DEBUG ) { configuration . reporter . print ( ERROR , "DEBUG: " + getClass ( ) . getName ( ) + "." + methodName ) ; } Method method = getClass ( ) . getMethod ( methodName , XMLNode . class , Content . class ) ; method . invoke ( this , node , contentTree ) ; } catch ( NoSuchMethodException e ) { String message = resources . getText ( "doclet.builder.unknown.component" , component ) ; throw new SimpleDocletException ( message , e ) ; } catch ( InvocationTargetException e ) { Throwable cause = e . getCause ( ) ; if ( cause instanceof DocletException ) { throw ( DocletException ) cause ; } else if ( cause instanceof UncheckedDocletException ) { throw ( DocletException ) cause . getCause ( ) ; } else { String message = resources . getText ( "doclet.builder.exception.in.component" , component , e . getCause ( ) ) ; throw new InternalException ( message , e . getCause ( ) ) ; } } catch ( ReflectiveOperationException e ) { String message = resources . getText ( "doclet.builder.exception.in.component" , component , e ) ; throw new SimpleDocletException ( message , e . getCause ( ) ) ; } }
Build the documentation as specified by the given XML element .
678
protected void buildChildren ( XMLNode node , Content contentTree ) throws DocletException { for ( XMLNode child : node . children ) build ( child , contentTree ) ; }
Build the documentation as specified by the children of the given XML element .
679
Type fold ( int opcode , List < Type > argtypes ) { int argCount = argtypes . length ( ) ; if ( argCount == 1 ) return fold1 ( opcode , argtypes . head ) ; else if ( argCount == 2 ) return fold2 ( opcode , argtypes . head , argtypes . tail . head ) ; else throw new AssertionError ( ) ; }
Fold binary or unary operation returning constant type reflecting the operations result . Return null if fold failed due to an arithmetic exception .
680
Type coerce ( Type etype , Type ttype ) { if ( etype . tsym . type == ttype . tsym . type ) return etype ; if ( etype . isNumeric ( ) ) { Object n = etype . constValue ( ) ; switch ( ttype . getTag ( ) ) { case BYTE : return syms . byteType . constType ( 0 + ( byte ) intValue ( n ) ) ; case CHAR : return syms . charType . constType ( 0 + ( char ) intValue ( n ) ) ; case SHORT : return syms . shortType . constType ( 0 + ( short ) intValue ( n ) ) ; case INT : return syms . intType . constType ( intValue ( n ) ) ; case LONG : return syms . longType . constType ( longValue ( n ) ) ; case FLOAT : return syms . floatType . constType ( floatValue ( n ) ) ; case DOUBLE : return syms . doubleType . constType ( doubleValue ( n ) ) ; } } return ttype ; }
Coerce constant type to target type .
681
protected void print ( Object s ) throws IOException { out . write ( Convert . escapeUnicode ( s . toString ( ) ) ) ; }
Print string replacing all non - ascii character with unicode escapes .
682
public void print ( List < ? extends DocTree > list ) throws IOException { for ( DocTree t : list ) { print ( t ) ; } }
Print list .
683
protected void print ( List < ? extends DocTree > list , String sep ) throws IOException { if ( list . isEmpty ( ) ) return ; boolean first = true ; for ( DocTree t : list ) { if ( ! first ) print ( sep ) ; print ( t ) ; first = false ; } }
Print list . with separators
684
public static Lint instance ( Context context ) { Lint instance = context . get ( lintKey ) ; if ( instance == null ) instance = new Lint ( context ) ; return instance ; }
Get the root Lint instance .
685
public Lint augment ( Symbol sym ) { Lint l = augmentor . augment ( this , sym . getDeclarationAttributes ( ) ) ; if ( sym . isDeprecated ( ) ) { if ( l == this ) l = new Lint ( this ) ; l . values . remove ( LintCategory . DEPRECATION ) ; l . suppressedValues . add ( LintCategory . DEPRECATION ) ; } return l ; }
Returns the result of combining the values in this object with the metadata on the given symbol .
686
public Lint suppress ( LintCategory ... lc ) { Lint l = new Lint ( this ) ; l . values . removeAll ( Arrays . asList ( lc ) ) ; l . suppressedValues . addAll ( Arrays . asList ( lc ) ) ; return l ; }
Returns a new Lint that has the given LintCategorys suppressed .
687
public Content getModuleHeader ( String heading ) { HtmlTree bodyTree = getBody ( true , getWindowTitle ( mdle . getQualifiedName ( ) . toString ( ) ) ) ; HtmlTree htmlTree = ( configuration . allowTag ( HtmlTag . HEADER ) ) ? HtmlTree . HEADER ( ) : bodyTree ; addTop ( htmlTree ) ; addNavLinks ( true , htmlTree ) ; if ( configuration . allowTag ( HtmlTag . HEADER ) ) { bodyTree . addContent ( htmlTree ) ; } HtmlTree div = new HtmlTree ( HtmlTag . DIV ) ; div . addStyle ( HtmlStyle . header ) ; Content annotationContent = new HtmlTree ( HtmlTag . P ) ; addAnnotationInfo ( mdle , annotationContent ) ; div . addContent ( annotationContent ) ; Content label = mdle . isOpen ( ) && ( configuration . docEnv . getModuleMode ( ) == ModuleMode . ALL ) ? contents . openModuleLabel : contents . moduleLabel ; Content tHeading = HtmlTree . HEADING ( HtmlConstants . TITLE_HEADING , true , HtmlStyle . title , label ) ; tHeading . addContent ( Contents . SPACE ) ; Content moduleHead = new RawHtml ( heading ) ; tHeading . addContent ( moduleHead ) ; div . addContent ( tHeading ) ; if ( configuration . allowTag ( HtmlTag . MAIN ) ) { mainTree . addContent ( div ) ; } else { bodyTree . addContent ( div ) ; } return bodyTree ; }
Get the module header .
688
public Content getSummaryTree ( Content summaryContentTree ) { HtmlTree ul = HtmlTree . UL ( HtmlStyle . blockList , summaryContentTree ) ; return ul ; }
Get the summary tree .
689
public Module toNormalModule ( Map < String , Boolean > requires ) { if ( ! isAutomatic ( ) ) { throw new IllegalArgumentException ( name ( ) + " not an automatic module" ) ; } return new NormalModule ( this , requires ) ; }
Converts this module to a normal module with the given dependences
690
public boolean isExported ( String pn ) { return exports . containsKey ( pn ) && exports . get ( pn ) . isEmpty ( ) ; }
Tests if the package of the given name is exported .
691
public boolean isExported ( String pn , String target ) { return isExported ( pn ) || exports . containsKey ( pn ) && exports . get ( pn ) . contains ( target ) ; }
Tests if the package of the given name is exported to the target in a qualified fashion .
692
public boolean isOpen ( String pn ) { return opens . containsKey ( pn ) && opens . get ( pn ) . isEmpty ( ) ; }
Tests if the package of the given name is open .
693
public boolean isOpen ( String pn , String target ) { return isOpen ( pn ) || opens . containsKey ( pn ) && opens . get ( pn ) . contains ( target ) ; }
Tests if the package of the given name is open to the target in a qualified fashion .
694
public < Z > Type map ( TypeMapping < Z > mapping , Z arg ) { return mapping . visit ( this , arg ) ; }
map a type function over all immediate descendants of this type
695
public static List < Type > baseTypes ( List < Type > ts ) { if ( ts . nonEmpty ( ) ) { Type t = ts . head . baseType ( ) ; List < Type > baseTypes = baseTypes ( ts . tail ) ; if ( t != ts . head || baseTypes != ts . tail ) return baseTypes . prepend ( t ) ; } return ts ; }
Return the base types of a list of types .
696
public Content getNonBreakResource ( String key ) { String text = configuration . getText ( key ) ; Content c = configuration . newContent ( ) ; int start = 0 ; int p ; while ( ( p = text . indexOf ( " " , start ) ) != - 1 ) { c . addContent ( text . substring ( start , p ) ) ; c . addContent ( RawHtml . nbsp ) ; start = p + 1 ; } c . addContent ( text . substring ( start ) ) ; return c ; }
Get the configuration string as a content replacing spaces with non - breaking spaces .
697
public Attribute . Compound attribute ( Symbol anno ) { for ( Attribute . Compound a : getRawAttributes ( ) ) { if ( a . type . tsym == anno ) return a ; } return null ; }
Fetch a particular annotation from a symbol .
698
public Symbol location ( ) { if ( owner . name == null || ( owner . name . isEmpty ( ) && ( owner . flags ( ) & BLOCK ) == 0 && owner . kind != PCK && owner . kind != TYP ) ) { return null ; } return owner ; }
A Java source description of the location of this symbol ; used for error reporting .
699
public Type erasure ( Types types ) { if ( erasure_field == null ) erasure_field = types . erasure ( type ) ; return erasure_field ; }
The symbol s erased type .