idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
1,000
void showClass ( String className ) { PrintWriter pw = log . getWriter ( WriterKind . NOTICE ) ; pw . println ( "javac: show class: " + className ) ; URL url = getClass ( ) . getResource ( '/' + className . replace ( '.' , '/' ) + ".class" ) ; if ( url != null ) { pw . println ( " " + url ) ; } try ( InputStream in = ...
Display the location and checksum of a class .
1,001
protected void addPackageList ( Content contentTree ) throws IOException { Content caption = getTableCaption ( configuration . getResource ( "doclet.ClassUse_Packages.that.use.0" , getLink ( new LinkInfoImpl ( configuration , LinkInfoImpl . Kind . CLASS_USE_HEADER , classdoc ) ) ) ) ; Content table = ( configuration . ...
Add the packages list that use the given class .
1,002
protected void addPackageAnnotationList ( Content contentTree ) throws IOException { if ( ( ! classdoc . isAnnotationType ( ) ) || pkgToPackageAnnotations == null || pkgToPackageAnnotations . isEmpty ( ) ) { return ; } Content caption = getTableCaption ( configuration . getResource ( "doclet.ClassUse_PackageAnnotation"...
Add the package annotation list .
1,003
protected HtmlTree getClassUseHeader ( ) { String cltype = configuration . getText ( classdoc . isInterface ( ) ? "doclet.Interface" : "doclet.Class" ) ; String clname = classdoc . qualifiedName ( ) ; String title = configuration . getText ( "doclet.Window_ClassUse_Header" , cltype , clname ) ; HtmlTree bodyTree = getB...
Get the header for the class use Listing .
1,004
protected Content getNavLinkPackage ( ) { Content linkContent = getHyperLink ( DocPath . parent . resolve ( DocPaths . PACKAGE_SUMMARY ) , packageLabel ) ; Content li = HtmlTree . LI ( linkContent ) ; return li ; }
Get this package link .
1,005
protected Content getNavLinkClass ( ) { Content linkContent = getLink ( new LinkInfoImpl ( configuration , LinkInfoImpl . Kind . CLASS_USE_HEADER , classdoc ) . label ( configuration . getText ( "doclet.Class" ) ) ) ; Content li = HtmlTree . LI ( linkContent ) ; return li ; }
Get class page link .
1,006
public static ClassBuilder getInstance ( Context context , TypeElement typeElement , ClassWriter writer ) { return new ClassBuilder ( context , typeElement , writer ) ; }
Constructs a new ClassBuilder .
1,007
private void copyDocFiles ( ) throws DocFileIOException { PackageElement containingPackage = utils . containingPackage ( typeElement ) ; if ( ( configuration . packages == null || ! configuration . packages . contains ( containingPackage ) ) && ! containingPackagesSeen . contains ( containingPackage ) ) { utils . copyD...
Copy the doc files .
1,008
static String parms ( String types ) { int [ ] pos = new int [ ] { 0 } ; StringBuilder sb = new StringBuilder ( ) ; boolean first = true ; String t ; while ( ( t = desc ( types , pos ) ) != null ) { if ( first ) { first = false ; } else { sb . append ( ',' ) ; } sb . append ( t ) ; } return sb . toString ( ) ; }
Converts a series of type descriptors into a comma - separated readable string . This is used for the parameter types of a method descriptor .
1,009
public static String print ( DeprData dd ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( depr ( dd . since , dd . forRemoval ) ) . append ( ' ' ) ; switch ( dd . kind ) { case ANNOTATION_TYPE : sb . append ( "@interface " ) ; sb . append ( unslashify ( dd . typeName ) ) ; break ; case CLASS : sb . append (...
Pretty - prints the data contained in the given DeprData object .
1,010
String show ( boolean isRetained ) { String cmd = "/set start " + ( isRetained ? "-retain " : "" ) ; if ( isDefault ( ) ) { return cmd + "-default\n" ; } else if ( isEmpty ( ) ) { return cmd + "-none\n" ; } else { return entries . stream ( ) . map ( sue -> sue . name ) . collect ( joining ( " " , cmd , "\n" ) ) ; } }
show commands to re - create
1,011
private static StartupEntry readFile ( String filename , String context , MessageHandler mh ) { if ( filename != null ) { try { byte [ ] encoded = Files . readAllBytes ( toPathResolvingUserHome ( filename ) ) ; return new StartupEntry ( false , filename , new String ( encoded ) , LocalDateTime . now ( ) . format ( Date...
Read a external file or a resource .
1,012
public static boolean isConstructor ( JCTree tree ) { if ( tree . hasTag ( METHODDEF ) ) { Name name = ( ( JCMethodDecl ) tree ) . name ; return name == name . table . names . init ; } else { return false ; } }
Is tree a constructor declaration?
1,013
public static boolean hasConstructors ( List < JCTree > trees ) { for ( List < JCTree > l = trees ; l . nonEmpty ( ) ; l = l . tail ) if ( isConstructor ( l . head ) ) return true ; return false ; }
Is there a constructor declaration in the given list of trees?
1,014
public static boolean isSyntheticInit ( JCTree stat ) { if ( stat . hasTag ( EXEC ) ) { JCExpressionStatement exec = ( JCExpressionStatement ) stat ; if ( exec . expr . hasTag ( ASSIGN ) ) { JCAssign assign = ( JCAssign ) exec . expr ; if ( assign . lhs . hasTag ( SELECT ) ) { JCFieldAccess select = ( JCFieldAccess ) a...
Is statement an initializer for a synthetic field?
1,015
public static Name calledMethodName ( JCTree tree ) { if ( tree . hasTag ( EXEC ) ) { JCExpressionStatement exec = ( JCExpressionStatement ) tree ; if ( exec . expr . hasTag ( APPLY ) ) { Name mname = TreeInfo . name ( ( ( JCMethodInvocation ) exec . expr ) . meth ) ; return mname ; } } return null ; }
If the expression is a method call return the method name null otherwise .
1,016
public static boolean isSelfCall ( JCTree tree ) { Name name = calledMethodName ( tree ) ; if ( name != null ) { Names names = name . table . names ; return name == names . _this || name == names . _super ; } else { return false ; } }
Is this a call to this or super?
1,017
public static boolean isSuperCall ( JCTree tree ) { Name name = calledMethodName ( tree ) ; if ( name != null ) { Names names = name . table . names ; return name == names . _super ; } else { return false ; } }
Is this a call to super?
1,018
public static JCMethodInvocation firstConstructorCall ( JCTree tree ) { if ( ! tree . hasTag ( METHODDEF ) ) return null ; JCMethodDecl md = ( JCMethodDecl ) tree ; Names names = md . name . table . names ; if ( md . name != names . init ) return null ; if ( md . body == null ) return null ; List < JCStatement > stats ...
Return the first call in a constructor definition .
1,019
public static boolean isDiamond ( JCTree tree ) { switch ( tree . getTag ( ) ) { case TYPEAPPLY : return ( ( JCTypeApply ) tree ) . getTypeArguments ( ) . isEmpty ( ) ; case NEWCLASS : return isDiamond ( ( ( JCNewClass ) tree ) . clazz ) ; case ANNOTATED_TYPE : return isDiamond ( ( ( JCAnnotatedType ) tree ) . underlyi...
Return true if a tree represents a diamond new expr .
1,020
public static boolean isAnonymousDiamond ( JCTree tree ) { switch ( tree . getTag ( ) ) { case NEWCLASS : { JCNewClass nc = ( JCNewClass ) tree ; return nc . def != null && isDiamond ( nc . clazz ) ; } case ANNOTATED_TYPE : return isAnonymousDiamond ( ( ( JCAnnotatedType ) tree ) . underlyingType ) ; default : return f...
Return true if the given tree represents a type elided anonymous class instance creation .
1,021
public static void setPolyKind ( JCTree tree , PolyKind pkind ) { switch ( tree . getTag ( ) ) { case APPLY : ( ( JCMethodInvocation ) tree ) . polyKind = pkind ; break ; case NEWCLASS : ( ( JCNewClass ) tree ) . polyKind = pkind ; break ; case REFERENCE : ( ( JCMemberReference ) tree ) . refPolyKind = pkind ; break ; ...
set polyKind on given tree
1,022
public static void setVarargsElement ( JCTree tree , Type varargsElement ) { switch ( tree . getTag ( ) ) { case APPLY : ( ( JCMethodInvocation ) tree ) . varargsElement = varargsElement ; break ; case NEWCLASS : ( ( JCNewClass ) tree ) . varargsElement = varargsElement ; break ; case REFERENCE : ( ( JCMemberReference ...
set varargsElement on given tree
1,023
public static boolean isExpressionStatement ( JCExpression tree ) { switch ( tree . getTag ( ) ) { case PREINC : case PREDEC : case POSTINC : case POSTDEC : case ASSIGN : case BITOR_ASG : case BITXOR_ASG : case BITAND_ASG : case SL_ASG : case SR_ASG : case USR_ASG : case PLUS_ASG : case MINUS_ASG : case MUL_ASG : case ...
Return true if the tree corresponds to an expression statement
1,024
public static boolean isStatement ( JCTree tree ) { return ( tree instanceof JCStatement ) && ! tree . hasTag ( CLASSDEF ) && ! tree . hasTag ( Tag . BLOCK ) && ! tree . hasTag ( METHODDEF ) ; }
Return true if the tree corresponds to a statement
1,025
public static boolean isStaticSelector ( JCTree base , Names names ) { if ( base == null ) return false ; switch ( base . getTag ( ) ) { case IDENT : JCIdent id = ( JCIdent ) base ; return id . name != names . _this && id . name != names . _super && isStaticSym ( base ) ; case SELECT : return isStaticSym ( base ) && is...
Return true if the AST corresponds to a static select of the kind A . B
1,026
public static boolean isNull ( JCTree tree ) { if ( ! tree . hasTag ( LITERAL ) ) return false ; JCLiteral lit = ( JCLiteral ) tree ; return ( lit . typetag == BOT ) ; }
Return true if a tree represents the null literal .
1,027
public static boolean isInAnnotation ( Env < ? > env , JCTree tree ) { TreePath tp = TreePath . getPath ( env . toplevel , tree ) ; if ( tp != null ) { for ( Tree t : tp ) { if ( t . getKind ( ) == Tree . Kind . ANNOTATION ) return true ; } } return false ; }
Return true iff this tree is a child of some annotation .
1,028
public static int firstStatPos ( JCTree tree ) { if ( tree . hasTag ( BLOCK ) && ( ( JCBlock ) tree ) . stats . nonEmpty ( ) ) return ( ( JCBlock ) tree ) . stats . head . pos ; else return tree . pos ; }
The position of the first statement in a block or the position of the block itself if it is empty .
1,029
public static int endPos ( JCTree tree ) { if ( tree . hasTag ( BLOCK ) && ( ( JCBlock ) tree ) . endpos != Position . NOPOS ) return ( ( JCBlock ) tree ) . endpos ; else if ( tree . hasTag ( SYNCHRONIZED ) ) return endPos ( ( ( JCSynchronized ) tree ) . body ) ; else if ( tree . hasTag ( TRY ) ) { JCTry t = ( JCTry ) ...
The end position of given tree if it is a block with defined endpos .
1,030
public static DiagnosticPosition diagEndPos ( final JCTree tree ) { final int endPos = TreeInfo . endPos ( tree ) ; return new DiagnosticPosition ( ) { public JCTree getTree ( ) { return tree ; } public int getStartPosition ( ) { return TreeInfo . getStartPos ( tree ) ; } public int getPreferredPosition ( ) { return en...
A DiagnosticPosition with the preferred position set to the end position of given tree if it is a block with defined endpos .
1,031
public static JCTree referencedStatement ( JCLabeledStatement tree ) { JCTree t = tree ; do t = ( ( JCLabeledStatement ) t ) . body ; while ( t . hasTag ( LABELLED ) ) ; switch ( t . getTag ( ) ) { case DOLOOP : case WHILELOOP : case FORLOOP : case FOREACHLOOP : case SWITCH : return t ; default : return tree ; } }
Return the statement referenced by a label . If the label refers to a loop or switch return that switch otherwise return the labelled statement itself
1,032
public static Name name ( JCTree tree ) { switch ( tree . getTag ( ) ) { case IDENT : return ( ( JCIdent ) tree ) . name ; case SELECT : return ( ( JCFieldAccess ) tree ) . name ; case TYPEAPPLY : return name ( ( ( JCTypeApply ) tree ) . clazz ) ; default : return null ; } }
If this tree is an identifier or a field or a parameterized type return its name otherwise return null .
1,033
public static Name fullName ( JCTree tree ) { tree = skipParens ( tree ) ; switch ( tree . getTag ( ) ) { case IDENT : return ( ( JCIdent ) tree ) . name ; case SELECT : Name sname = fullName ( ( ( JCFieldAccess ) tree ) . selected ) ; return sname == null ? null : sname . append ( '.' , name ( tree ) ) ; default : ret...
If this tree is a qualified identifier its return fully qualified name otherwise return null .
1,034
public static Symbol symbol ( JCTree tree ) { tree = skipParens ( tree ) ; switch ( tree . getTag ( ) ) { case IDENT : return ( ( JCIdent ) tree ) . sym ; case SELECT : return ( ( JCFieldAccess ) tree ) . sym ; case TYPEAPPLY : return symbol ( ( ( JCTypeApply ) tree ) . clazz ) ; case ANNOTATED_TYPE : return symbol ( (...
If this tree is an identifier or a field return its symbol otherwise return null .
1,035
public static boolean nonstaticSelect ( JCTree tree ) { tree = skipParens ( tree ) ; if ( ! tree . hasTag ( SELECT ) ) return false ; JCFieldAccess s = ( JCFieldAccess ) tree ; Symbol e = symbol ( s . selected ) ; return e == null || ( e . kind != PCK && e . kind != TYP ) ; }
Return true if this is a nonstatic selection .
1,036
public static void setSymbol ( JCTree tree , Symbol sym ) { tree = skipParens ( tree ) ; switch ( tree . getTag ( ) ) { case IDENT : ( ( JCIdent ) tree ) . sym = sym ; break ; case SELECT : ( ( JCFieldAccess ) tree ) . sym = sym ; break ; default : } }
If this tree is an identifier or a field set its symbol otherwise skip .
1,037
public static long flags ( JCTree tree ) { switch ( tree . getTag ( ) ) { case VARDEF : return ( ( JCVariableDecl ) tree ) . mods . flags ; case METHODDEF : return ( ( JCMethodDecl ) tree ) . mods . flags ; case CLASSDEF : return ( ( JCClassDecl ) tree ) . mods . flags ; case BLOCK : return ( ( JCBlock ) tree ) . flags...
If this tree is a declaration or a block return its flags field otherwise return 0 .
1,038
public static int opPrec ( JCTree . Tag op ) { switch ( op ) { case POS : case NEG : case NOT : case COMPL : case PREINC : case PREDEC : return prefixPrec ; case POSTINC : case POSTDEC : case NULLCHK : return postfixPrec ; case ASSIGN : return assignPrec ; case BITOR_ASG : case BITXOR_ASG : case BITAND_ASG : case SL_AS...
Map operators to their precedence levels .
1,039
public static JCExpression typeIn ( JCExpression tree ) { switch ( tree . getTag ( ) ) { case ANNOTATED_TYPE : return ( ( JCAnnotatedType ) tree ) . underlyingType ; case IDENT : case TYPEIDENT : case SELECT : case TYPEARRAY : case WILDCARD : case TYPEPARAMETER : case TYPEAPPLY : case ERRONEOUS : return tree ; default ...
Returns the underlying type of the tree if it is an annotated type or the tree itself otherwise .
1,040
private String [ ] tokenize ( String s , char separator , int maxTokens ) { List < String > tokens = new ArrayList < > ( ) ; StringBuilder token = new StringBuilder ( ) ; boolean prevIsEscapeChar = false ; for ( int i = 0 ; i < s . length ( ) ; i += Character . charCount ( i ) ) { int currentChar = s . codePointAt ( i ...
Given a string return an array of tokens . The separator can be escaped with the \ character . The \ character may also be escaped by the \ character .
1,041
public static String addTrailingFileSep ( String path ) { String fs = System . getProperty ( "file.separator" ) ; String dblfs = fs + fs ; int indexDblfs ; while ( ( indexDblfs = path . indexOf ( dblfs , 1 ) ) >= 0 ) { path = path . substring ( 0 , indexDblfs ) + path . substring ( indexDblfs + fs . length ( ) ) ; } if...
Add a trailing file separator if not found . Remove superfluous file separators if any . Preserve the front double file separator for UNC paths .
1,042
private boolean checkOutputFileEncoding ( String docencoding , DocErrorReporter reporter ) { OutputStream ost = new ByteArrayOutputStream ( ) ; OutputStreamWriter osw = null ; try { osw = new OutputStreamWriter ( ost , docencoding ) ; } catch ( UnsupportedEncodingException exc ) { reporter . printError ( getText ( "doc...
Check the validity of the given Source or Output File encoding on this platform .
1,043
public boolean shouldExcludeQualifier ( String qualifier ) { if ( excludedQualifiers . contains ( "all" ) || excludedQualifiers . contains ( qualifier ) || excludedQualifiers . contains ( qualifier + ".*" ) ) { return true ; } else { int index = - 1 ; while ( ( index = qualifier . indexOf ( "." , index + 1 ) ) != - 1 )...
Return true if the given qualifier should be excluded and false otherwise .
1,044
public boolean isGeneratedDoc ( ClassDoc cd ) { if ( ! nodeprecated ) { return true ; } return ! ( utils . isDeprecated ( cd ) || utils . isDeprecated ( cd . containingPackage ( ) ) ) ; }
Return true if the ClassDoc element is getting documented depending upon - nodeprecated option and the deprecation information . Return true if - nodeprecated is not used . Return false if - nodeprecated is used and if either ClassDoc element is deprecated or the containing package is deprecated .
1,045
public InputStream getBuilderXML ( ) throws IOException { return builderXMLPath == null ? Configuration . class . getResourceAsStream ( DEFAULT_BUILDER_XML ) : DocFile . createFileForInput ( this , builderXMLPath ) . openInputStream ( ) ; }
Return the input stream to the builder XML .
1,046
public static JavaCompiler instance ( Context context ) { JavaCompiler instance = context . get ( compilerKey ) ; if ( instance == null ) instance = new JavaCompiler ( context ) ; return instance ; }
Get the JavaCompiler instance for this context .
1,047
public CharSequence readSource ( JavaFileObject filename ) { try { inputFiles . add ( filename ) ; return filename . getCharContent ( false ) ; } catch ( IOException e ) { log . error ( "error.reading.file" , filename , JavacFileManager . getMessage ( e ) ) ; return null ; } }
Try to open input stream with given name . Report an error if this fails .
1,048
protected JCCompilationUnit parse ( JavaFileObject filename , CharSequence content ) { long msec = now ( ) ; JCCompilationUnit tree = make . TopLevel ( List . nil ( ) ) ; if ( content != null ) { if ( verbose ) { log . printVerbose ( "parsing.started" , filename ) ; } if ( ! taskListener . isEmpty ( ) ) { TaskEvent e =...
Parse contents of input stream .
1,049
JavaFileObject genCode ( Env < AttrContext > env , JCClassDecl cdef ) throws IOException { try { if ( gen . genClass ( env , cdef ) && ( errorCount ( ) == 0 ) ) return writer . writeClass ( cdef . sym ) ; } catch ( ClassWriter . PoolOverflow ex ) { log . error ( cdef . pos ( ) , "limit.pool" ) ; } catch ( ClassWriter ....
Generate code and emit a class file for a given class
1,050
public void readSourceFile ( JCCompilationUnit tree , ClassSymbol c ) throws CompletionFailure { if ( completionFailureName == c . fullname ) { throw new CompletionFailure ( c , "user-selected completion failure by class name" ) ; } JavaFileObject filename = c . classfile ; JavaFileObject prev = log . useSource ( filen...
Compile a ClassSymbol from source optionally using the given compilation unit as the source tree .
1,051
public List < JCCompilationUnit > parseFiles ( Iterable < JavaFileObject > fileObjects ) { if ( shouldStop ( CompileState . PARSE ) ) return List . nil ( ) ; ListBuffer < JCCompilationUnit > trees = new ListBuffer < > ( ) ; Set < JavaFileObject > filesSoFar = new HashSet < > ( ) ; for ( JavaFileObject fileObject : file...
Parses a list of files .
1,052
public void initProcessAnnotations ( Iterable < ? extends Processor > processors , Collection < ? extends JavaFileObject > initialFiles , Collection < String > initialClassNames ) { if ( options . isSet ( PROC , "none" ) ) { processAnnotations = false ; } else if ( procEnvImpl == null ) { procEnvImpl = JavacProcessingE...
Check if we should process annotations . If so and if no scanner is yet registered then set up the DocCommentScanner to catch doc comments and set keepComments so the parser records them in the compilation unit .
1,053
public void processAnnotations ( List < JCCompilationUnit > roots , Collection < String > classnames ) { if ( shouldStop ( CompileState . PROCESS ) ) { if ( unrecoverableError ( ) ) { deferredDiagnosticHandler . reportDeferredDiagnostics ( ) ; log . popDiagnosticHandler ( deferredDiagnosticHandler ) ; return ; } } if (...
or determined to be transient and therefore suppressed .
1,054
public Queue < Env < AttrContext > > attribute ( Queue < Env < AttrContext > > envs ) { ListBuffer < Env < AttrContext > > results = new ListBuffer < > ( ) ; while ( ! envs . isEmpty ( ) ) results . append ( attribute ( envs . remove ( ) ) ) ; return stopIfError ( CompileState . ATTR , results ) ; }
Attribute a list of parse trees such as found on the todo list . Note that attributing classes may cause additional files to be parsed and entered via the SourceCompleter . Attribution of the entries in the list does not stop if any errors occur .
1,055
public Env < AttrContext > attribute ( Env < AttrContext > env ) { if ( compileStates . isDone ( env , CompileState . ATTR ) ) return env ; if ( verboseCompilePolicy ) printNote ( "[attribute " + env . enclClass . sym + "]" ) ; if ( verbose ) log . printVerbose ( "checking.attribution" , env . enclClass . sym ) ; if ( ...
Attribute a parse tree .
1,056
public Queue < Env < AttrContext > > flow ( Queue < Env < AttrContext > > envs ) { ListBuffer < Env < AttrContext > > results = new ListBuffer < > ( ) ; for ( Env < AttrContext > env : envs ) { flow ( env , results ) ; } return stopIfError ( CompileState . FLOW , results ) ; }
Perform dataflow checks on attributed parse trees . These include checks for definite assignment and unreachable statements . If any errors occur an empty list will be returned .
1,057
public void generate ( Queue < Pair < Env < AttrContext > , JCClassDecl > > queue ) { generate ( queue , null ) ; }
Generates the source or class file for a list of classes . The decision to generate a source file or a class file is based upon the compiler s options . Generation stops if an error occurs while writing files .
1,058
public void printCount ( String kind , int count ) { if ( count != 0 ) { String key ; if ( count == 1 ) key = "count." + kind ; else key = "count." + kind + ".plural" ; log . printLines ( WriterKind . ERROR , key , String . valueOf ( count ) ) ; log . flush ( Log . WriterKind . ERROR ) ; } }
Print numbers of errors and warnings .
1,059
protected void buildModulePackagesIndexFile ( String title , boolean includeScript , ModuleElement mdle ) throws DocFileIOException { String windowOverview = configuration . getText ( title ) ; Content body = getBody ( includeScript , getWindowTitle ( windowOverview ) ) ; addNavigationBarHeader ( body ) ; addOverviewHe...
Generate and prints the contents in the module packages index file . Call appropriate methods from the sub - class in order to generate Frame or Non Frame format .
1,060
protected void addIndex ( Content body ) { addIndexContents ( configuration . modules , "doclet.Module_Summary" , configuration . getText ( "doclet.Member_Table_Summary" , configuration . getText ( "doclet.Module_Summary" ) , configuration . getText ( "doclet.modules" ) ) , body ) ; }
Adds the frame or non - frame module index to the documentation tree .
1,061
protected void addModulePackagesIndex ( Content body , ModuleElement mdle ) { addModulePackagesIndexContents ( "doclet.Module_Summary" , configuration . getText ( "doclet.Member_Table_Summary" , configuration . getText ( "doclet.Module_Summary" ) , configuration . getText ( "doclet.modules" ) ) , body , mdle ) ; }
Adds the frame or non - frame module packages index to the documentation tree .
1,062
protected void addIndexContents ( Collection < ModuleElement > modules , String text , String tableSummary , Content body ) { HtmlTree htmlTree = ( configuration . allowTag ( HtmlTag . NAV ) ) ? HtmlTree . NAV ( ) : new HtmlTree ( HtmlTag . DIV ) ; htmlTree . addStyle ( HtmlStyle . indexNav ) ; HtmlTree ul = new HtmlTr...
Adds module index contents . Call appropriate methods from the sub - classes . Adds it to the body HtmlTree
1,063
protected void addModulePackagesIndexContents ( String text , String tableSummary , Content body , ModuleElement mdle ) { HtmlTree htmlTree = ( configuration . allowTag ( HtmlTag . NAV ) ) ? HtmlTree . NAV ( ) : new HtmlTree ( HtmlTag . DIV ) ; htmlTree . addStyle ( HtmlStyle . indexNav ) ; HtmlTree ul = new HtmlTree (...
Adds module packages index contents . Call appropriate methods from the sub - classes . Adds it to the body HtmlTree
1,064
public String getEnclosingPackageName ( TypeElement te ) { PackageElement encl = configuration . utils . containingPackage ( te ) ; return ( encl . isUnnamed ( ) ) ? "" : ( encl . getQualifiedName ( ) + "." ) ; }
Get the enclosed name of the package
1,065
public static void generate ( ConfigurationImpl configuration ) throws DocFileIOException { DocPath filename = DocPaths . MODULE_OVERVIEW_FRAME ; ModuleIndexFrameWriter modulegen = new ModuleIndexFrameWriter ( configuration , filename ) ; modulegen . buildModuleIndexFile ( "doclet.Window_Overview" , false ) ; }
Generate the module index file named module - overview - frame . html .
1,066
protected Content getModuleLink ( ModuleElement mdle ) { Content moduleLinkContent ; Content mdlLabel = new StringContent ( mdle . getQualifiedName ( ) ) ; moduleLinkContent = getModuleFramesHyperLink ( mdle , mdlLabel , "packageListFrame" ) ; Content li = HtmlTree . LI ( moduleLinkContent ) ; return li ; }
Returns each module name as a separate link .
1,067
public SortedSet < Element > members ( VisibleMemberMap . Kind kind ) { TreeSet < Element > out = new TreeSet < > ( comparator ) ; out . addAll ( getVisibleMemberMap ( kind ) . getLeafMembers ( ) ) ; return out ; }
Returns a list of methods that will be documented for the given class . This information can be used for doclet specific documentation generation .
1,068
public Object constantValue ( ) { Object result = sym . getConstValue ( ) ; if ( result != null && sym . type . hasTag ( BOOLEAN ) ) result = Boolean . valueOf ( ( ( Integer ) result ) . intValue ( ) != 0 ) ; return result ; }
Get the value of a constant field .
1,069
static String constantValueExpression ( Object cb ) { if ( cb == null ) return null ; if ( cb instanceof Character ) return sourceForm ( ( ( Character ) cb ) . charValue ( ) ) ; if ( cb instanceof Byte ) return sourceForm ( ( ( Byte ) cb ) . byteValue ( ) ) ; if ( cb instanceof String ) return sourceForm ( ( String ) c...
A static version of the above .
1,070
private static boolean parse ( Class < ? > service , URL u ) throws ServiceConfigurationError { InputStream in = null ; BufferedReader r = null ; try { in = u . openStream ( ) ; r = new BufferedReader ( new InputStreamReader ( in , "utf-8" ) ) ; int lc = 1 ; String ln ; while ( ( ln = r . readLine ( ) ) != null ) { int...
Parse the content of the given URL as a provider - configuration file .
1,071
public static boolean hasService ( Class < ? > service , URL [ ] urls ) throws ServiceConfigurationError { for ( URL url : urls ) { try { String fullName = prefix + service . getName ( ) ; URL u = new URL ( url , fullName ) ; boolean found = parse ( service , u ) ; if ( found ) return true ; } catch ( MalformedURLExcep...
Return true if a description for at least one service is found in the service configuration files in the given URLs .
1,072
public String formatDiagnostic ( JCDiagnostic d , Locale l ) { try { StringBuilder buf = new StringBuilder ( ) ; if ( d . getPosition ( ) != Position . NOPOS ) { buf . append ( formatSource ( d , false , null ) ) ; buf . append ( ':' ) ; buf . append ( formatPosition ( d , LINE , null ) ) ; buf . append ( ':' ) ; buf ....
provide common default formats
1,073
public static int zero ( int tc ) { switch ( tc ) { case INTcode : case BYTEcode : case SHORTcode : case CHARcode : return iconst_0 ; case LONGcode : return lconst_0 ; case FLOATcode : return fconst_0 ; case DOUBLEcode : return dconst_0 ; default : throw new AssertionError ( "zero" ) ; } }
The opcode that loads a zero constant of a given type code .
1,074
int makeRef ( DiagnosticPosition pos , Type type ) { checkDimension ( pos , type ) ; if ( type . isAnnotated ( ) ) { return pool . put ( ( Object ) type ) ; } else { return pool . put ( type . hasTag ( CLASS ) ? ( Object ) type . tsym : ( Object ) type ) ; } }
Insert a reference to given type in the constant pool checking for an array with too many dimensions ; return the reference s index .
1,075
private void checkDimension ( DiagnosticPosition pos , Type t ) { switch ( t . getTag ( ) ) { case METHOD : checkDimension ( pos , t . getReturnType ( ) ) ; for ( List < Type > args = t . getParameterTypes ( ) ; args . nonEmpty ( ) ; args = args . tail ) checkDimension ( pos , args . head ) ; break ; case ARRAY : if ( ...
Check if the given type is an array with too many dimensions .
1,076
LocalItem makeTemp ( Type type ) { VarSymbol v = new VarSymbol ( Flags . SYNTHETIC , names . empty , type , env . enclMethod . sym ) ; code . newLocal ( v ) ; return items . makeLocalItem ( v ) ; }
Create a tempory variable .
1,077
void callMethod ( DiagnosticPosition pos , Type site , Name name , List < Type > argtypes , boolean isStatic ) { Symbol msym = rs . resolveInternalMethod ( pos , attrEnv , site , name , argtypes , null ) ; if ( isStatic ) items . makeStaticItem ( msym ) . invoke ( ) ; else items . makeMemberItem ( msym , name == names ...
Generate code to call a non - private method or constructor .
1,078
private boolean isAccessSuper ( JCMethodDecl enclMethod ) { return ( enclMethod . mods . flags & SYNTHETIC ) != 0 && isOddAccessName ( enclMethod . name ) ; }
Is the given method definition an access method resulting from a qualified super? This is signified by an odd access code .
1,079
void genFinalizer ( Env < GenContext > env ) { if ( code . isAlive ( ) && env . info . finalize != null ) env . info . finalize . gen ( ) ; }
Generate code to invoke the finalizer associated with given environment . Any calls to finalizers are appended to the environments cont chain . Mark beginning of gap in catch all range for finalizer .
1,080
Env < GenContext > unwind ( JCTree target , Env < GenContext > env ) { Env < GenContext > env1 = env ; while ( true ) { genFinalizer ( env1 ) ; if ( env1 . tree == target ) break ; env1 = env1 . next ; } return env1 ; }
Generate code to call all finalizers of structures aborted by a non - local exit . Return target environment of the non - local exit .
1,081
void endFinalizerGap ( Env < GenContext > env ) { if ( env . info . gaps != null && env . info . gaps . length ( ) % 2 == 1 ) env . info . gaps . append ( code . curCP ( ) ) ; }
Mark end of gap in catch - all range for finalizer .
1,082
void endFinalizerGaps ( Env < GenContext > from , Env < GenContext > to ) { Env < GenContext > last = null ; while ( last != to ) { endFinalizerGap ( from ) ; last = from ; from = from . next ; } }
Mark end of all gaps in catch - all ranges for finalizers of environments lying between and including to two environments .
1,083
boolean hasFinally ( JCTree target , Env < GenContext > env ) { while ( env . tree != target ) { if ( env . tree . hasTag ( TRY ) && env . info . finalize . hasFinalizer ( ) ) return true ; env = env . next ; } return false ; }
Do any of the structures aborted by a non - local exit have finalizers that require an empty stack?
1,084
private void checkStringConstant ( DiagnosticPosition pos , Object constValue ) { if ( nerrs != 0 || constValue == null || ! ( constValue instanceof String ) || ( ( String ) constValue ) . length ( ) < Pool . MAX_STRING_LENGTH ) return ; log . error ( pos , "limit.string" ) ; nerrs ++ ; }
Check a constant value and report if it is a string that is too large .
1,085
void genMethod ( JCMethodDecl tree , Env < GenContext > env , boolean fatcode ) { MethodSymbol meth = tree . sym ; int extras = 0 ; if ( meth . isConstructor ( ) ) { extras ++ ; if ( meth . enclClass ( ) . isInner ( ) && ! meth . enclClass ( ) . isStatic ( ) ) { extras ++ ; } } else if ( ( tree . mods . flags & STATIC ...
Generate code for a method .
1,086
private void genLoop ( JCStatement loop , JCStatement body , JCExpression cond , List < JCExpressionStatement > step , boolean testFirst ) { Env < GenContext > loopEnv = env . dup ( loop , new GenContext ( ) ) ; int startpc = code . entryPoint ( ) ; if ( testFirst ) { CondItem c ; if ( cond != null ) { code . statBegin...
Generate code for a loop .
1,087
Item makeNewArray ( DiagnosticPosition pos , Type type , int ndims ) { Type elemtype = types . elemtype ( type ) ; if ( types . dimensions ( type ) > ClassFile . MAX_DIMENSIONS ) { log . error ( pos , "limit.dimensions" ) ; nerrs ++ ; } int elemcode = Code . arraycode ( elemtype ) ; if ( elemcode == 0 || ( elemcode == ...
Generate code to create an array with given element type and number of dimensions .
1,088
Item completeBinop ( JCTree lhs , JCTree rhs , OperatorSymbol operator ) { MethodType optype = ( MethodType ) operator . type ; int opcode = operator . opcode ; if ( opcode >= if_icmpeq && opcode <= if_icmple && rhs . type . constValue ( ) instanceof Number && ( ( Number ) rhs . type . constValue ( ) ) . intValue ( ) =...
Complete generating code for operation with left operand already on stack .
1,089
public boolean genClass ( Env < AttrContext > env , JCClassDecl cdef ) { try { attrEnv = env ; ClassSymbol c = cdef . sym ; this . toplevel = env . toplevel ; this . endPosTable = toplevel . endPositions ; c . pool = pool ; pool . reset ( ) ; cdef . defs = normalizeDefs ( cdef . defs , c ) ; generateReferencesToPrunedT...
Generate code for a class definition .
1,090
public static Trees instance ( CompilationTask task ) { String taskClassName = task . getClass ( ) . getName ( ) ; if ( ! taskClassName . equals ( "com.sun.tools.javac.api.JavacTaskImpl" ) && ! taskClassName . equals ( "com.sun.tools.javac.api.BasicJavacTask" ) ) throw new IllegalArgumentException ( ) ; return getJavac...
Returns a Trees object for a given CompilationTask .
1,091
private VirtualMachine listenTarget ( int port , List < String > remoteVMOptions ) { ListeningConnector listener = ( ListeningConnector ) connector ; File crashErrorFile = createTempFile ( "error" ) ; File crashOutputFile = createTempFile ( "output" ) ; try { String addr = listener . startListening ( connectorArgs ) ; ...
Directly launch the remote agent and connect JDI to it with a ListeningConnector .
1,092
private Map < String , String > launchArgs ( int port , String remoteVMOptions ) { Map < String , String > argumentName2Value = new HashMap < > ( ) ; argumentName2Value . put ( "main" , remoteAgent + " " + port ) ; argumentName2Value . put ( "options" , remoteVMOptions ) ; return argumentName2Value ; }
The JShell specific Connector args for the LaunchingConnector .
1,093
boolean doClassNames ( Collection < String > classNames ) throws IOException { if ( verbose ) { out . println ( "List of classes to process:" ) ; classNames . forEach ( out :: println ) ; out . println ( "End of class list." ) ; } if ( fm instanceof JavacFileManager ) { ( ( JavacFileManager ) fm ) . setSymbolFileEnable...
Processes a collection of class names . Names should fully qualified names in the form pkg . pkg . pkg . classname .
1,094
boolean processDirectory ( String dirname , Collection < String > classNames ) throws IOException { if ( ! Files . isDirectory ( Paths . get ( dirname ) ) ) { err . printf ( "%s: not a directory%n" , dirname ) ; return false ; } classPath . add ( 0 , new File ( dirname ) ) ; if ( classNames . isEmpty ( ) ) { Path base ...
Processes named class files in the given directory . The directory should be the root of a package hierarchy . If classNames is empty walks the directory hierarchy to find all classes .
1,095
boolean doJarFile ( String jarname ) throws IOException { try ( JarFile jf = new JarFile ( jarname ) ) { Stream < String > files = jf . stream ( ) . map ( JarEntry :: getName ) ; return doFileNames ( files ) ; } }
Processes all class files in the given jar file .
1,096
boolean processJarFile ( String jarname , Collection < String > classNames ) throws IOException { classPath . add ( 0 , new File ( jarname ) ) ; if ( classNames . isEmpty ( ) ) { return doJarFile ( jarname ) ; } else { return doClassNames ( classNames ) ; } }
Processes named class files from the given jar file or all classes if classNames is empty .
1,097
boolean processOldJdk ( String jdkHome , Collection < String > classNames ) throws IOException { String RTJAR = jdkHome + "/jre/lib/rt.jar" ; String CSJAR = jdkHome + "/jre/lib/charsets.jar" ; bootClassPath . add ( 0 , new File ( RTJAR ) ) ; bootClassPath . add ( 1 , new File ( CSJAR ) ) ; options . add ( "-source" ) ;...
Processes named class files from rt . jar of a JDK version 7 or 8 . If classNames is empty processes all classes .
1,098
boolean processJdk9 ( String jdkHome , Collection < String > classes ) throws IOException { systemModules . add ( new File ( jdkHome ) ) ; return doClassNames ( classes ) ; }
Processes listed classes given a JDK 9 home .
1,099
boolean processRelease ( String release , Collection < String > classes ) throws IOException { options . addAll ( List . of ( "--release" , release ) ) ; if ( release . equals ( "9" ) ) { List < String > rootMods = List . of ( "java.se" , "java.se.ee" ) ; TraverseProc proc = new TraverseProc ( rootMods ) ; JavaCompiler...
Process classes from a particular JDK release using only information in this JDK .