idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
500
public SortedSet < TypeElement > getVisibleClasses ( ) { SortedSet < TypeElement > vClasses = new TreeSet < > ( comparator ) ; vClasses . addAll ( visibleClasses ) ; return vClasses ; }
Return the list of visible classes in this map .
501
public List < Element > getLeafMembers ( ) { List < Element > result = new ArrayList < > ( ) ; result . addAll ( classMap . get ( typeElement ) . members ) ; result . addAll ( getInheritedPackagePrivateMethods ( ) ) ; return result ; }
Returns a list of visible enclosed members of the type being mapped . This list may also contain appended members inherited by inaccessible super types . These members are documented in the subtype when the super type is not documented .
502
public void resolve ( DatabindContext context , URIHandler handler ) { for ( ReferenceEntry entry : entries ( ) ) { entry . resolve ( context , handler ) ; } mapOfObjects . clear ( ) ; }
Resolves all reference entries that have been collected during deserialization .
503
private String englishLanguageFirstSentence ( String s ) { if ( s == null ) { return null ; } int len = s . length ( ) ; boolean period = false ; for ( int i = 0 ; i < len ; i ++ ) { switch ( s . charAt ( i ) ) { case '.' : period = true ; break ; case ' ' : case '\t' : case '\n' : case '\r' : case '\f' : if ( period )...
Return the first sentence of a string where a sentence ends with a period followed be white space .
504
public boolean begin ( Class < ? > docletClass , Iterable < String > options , Iterable < ? extends JavaFileObject > fileObjects ) { this . docletClass = docletClass ; List < String > opts = new ArrayList < > ( ) ; for ( String opt : options ) opts . add ( opt ) ; return begin ( opts , fileObjects ) . isOK ( ) ; }
Called by 199 API .
505
private void checkOneArg ( List < String > args , int index ) throws OptionException { if ( ( index + 1 ) >= args . size ( ) || args . get ( index + 1 ) . startsWith ( "-d" ) ) { String text = messager . getText ( "main.requires_argument" , args . get ( index ) ) ; throw new OptionException ( CMDERR , this :: usage , t...
Check the one arg option . Error and exit if one argument is not provided .
506
public ClassDoc exception ( ) { ClassDocImpl exceptionClass ; if ( ! ( holder instanceof ExecutableMemberDoc ) ) { exceptionClass = null ; } else { ExecutableMemberDocImpl emd = ( ExecutableMemberDocImpl ) holder ; ClassDocImpl con = ( ClassDocImpl ) emd . containingClass ( ) ; exceptionClass = ( ClassDocImpl ) con . f...
Return the exception as a ClassDocImpl .
507
public String varValue ( VarSnippet snippet ) throws IllegalStateException { checkIfAlive ( ) ; checkValidSnippet ( snippet ) ; if ( snippet . status ( ) != Status . VALID ) { throw new IllegalArgumentException ( messageFormat ( "jshell.exc.var.not.valid" , snippet , snippet . status ( ) ) ) ; } String value ; try { va...
Get the current value of a variable .
508
private Snippet checkValidSnippet ( Snippet sn ) { if ( sn == null ) { throw new NullPointerException ( messageFormat ( "jshell.exc.null" ) ) ; } else { if ( sn . key ( ) . state ( ) != this ) { throw new IllegalArgumentException ( messageFormat ( "jshell.exc.alien" ) ) ; } return sn ; } }
Check a Snippet parameter coming from the API user
509
public Graph < Module > reduced ( ) { Graph < Module > graph = build ( ) ; Graph < Module > newGraph = buildGraph ( graph . edges ( ) ) . reduce ( ) ; if ( DEBUG ) { PrintWriter log = new PrintWriter ( System . err ) ; System . err . println ( "before transitive reduction: " ) ; graph . printGraph ( log ) ; System . er...
Apply transitive reduction on the resulting graph
510
private Graph < Module > buildGraph ( Map < Module , Set < Module > > edges ) { Graph . Builder < Module > builder = new Graph . Builder < > ( ) ; Set < Module > visited = new HashSet < > ( ) ; Deque < Module > deque = new LinkedList < > ( ) ; edges . entrySet ( ) . stream ( ) . forEach ( e -> { Module m = e . getKey (...
Build a graph of module from the given dependences .
511
public int lookup ( Object key , int hash ) { Object node ; int hash1 = hash ^ ( hash >>> 15 ) ; int hash2 = ( hash ^ ( hash << 6 ) ) | 1 ; int deleted = - 1 ; for ( int i = hash1 & mask ; ; i = ( i + hash2 ) & mask ) { node = objs [ i ] ; if ( node == key ) return i ; if ( node == null ) return deleted >= 0 ? deleted ...
Find either the index of a key s value or the index of an available space .
512
public int getFromIndex ( int index ) { Object node = objs [ index ] ; return node == null || node == DELETED ? - 1 : ints [ index ] ; }
Return the value stored at the specified index in the table .
513
public int putAtIndex ( Object key , int value , int index ) { Object old = objs [ index ] ; if ( old == null || old == DELETED ) { objs [ index ] = key ; ints [ index ] = value ; if ( old != DELETED ) num_bindings ++ ; if ( 3 * num_bindings >= 2 * objs . length ) rehash ( ) ; return - 1 ; } else { int oldValue = ints ...
Associates the specified key with the specified value in this map .
514
protected void rehash ( ) { Object [ ] oldObjsTable = objs ; int [ ] oldIntsTable = ints ; int oldCapacity = oldObjsTable . length ; int newCapacity = oldCapacity << 1 ; Object [ ] newObjTable = new Object [ newCapacity ] ; int [ ] newIntTable = new int [ newCapacity ] ; int newMask = newCapacity - 1 ; objs = newObjTab...
Expand the hash table when it exceeds the load factor .
515
public static Todo instance ( Context context ) { Todo instance = context . get ( todoKey ) ; if ( instance == null ) instance = new Todo ( context ) ; return instance ; }
Get the Todo instance for this context .
516
public void retainFiles ( Collection < ? extends JavaFileObject > sourceFiles ) { for ( Iterator < Env < AttrContext > > it = contents . iterator ( ) ; it . hasNext ( ) ; ) { Env < AttrContext > env = it . next ( ) ; if ( ! sourceFiles . contains ( env . toplevel . sourcefile ) ) { if ( contentsByFile != null ) removeB...
Removes all unattributed classes except those belonging to the given collection of files .
517
protected void putChar ( char ch , boolean scan ) { sbuf = ArrayUtils . ensureCapacity ( sbuf , sp ) ; sbuf [ sp ++ ] = ch ; if ( scan ) scanChar ( ) ; }
Append a character to sbuf .
518
protected int peekSurrogates ( ) { if ( surrogatesSupported && Character . isHighSurrogate ( ch ) ) { char high = ch ; int prevBP = bp ; scanChar ( ) ; char low = ch ; ch = high ; bp = prevBP ; if ( Character . isLowSurrogate ( low ) ) { return Character . toCodePoint ( high , low ) ; } } return - 1 ; }
Scan surrogate pairs . If ch is a high surrogate and the next character is a low surrogate returns the code point constructed from these surrogates . Otherwise returns - 1 . This method will not consume any of the characters .
519
protected Content getHead ( Element member ) { Content memberContent = new StringContent ( name ( member ) ) ; Content heading = HtmlTree . HEADING ( HtmlConstants . MEMBER_HEADING , memberContent ) ; return heading ; }
Get the header for the section .
520
public boolean showTabs ( ) { int value ; for ( MethodTypes type : EnumSet . allOf ( MethodTypes . class ) ) { value = type . tableTabs ( ) . value ( ) ; if ( ( value & methodTypesOr ) == value ) { methodTypes . add ( type ) ; } } boolean showTabs = methodTypes . size ( ) > 1 ; if ( showTabs ) { methodTypes . add ( Met...
Generate the method types set and return true if the method summary table needs to show tabs .
521
public void setSummaryColumnStyleAndScope ( HtmlTree thTree ) { thTree . addStyle ( HtmlStyle . colSecond ) ; thTree . addAttr ( HtmlAttr . SCOPE , "row" ) ; }
Set the style and scope attribute for the summary column .
522
static String [ ] removeArgsNotAffectingState ( String [ ] args ) { String [ ] out = new String [ args . length ] ; int j = 0 ; for ( int i = 0 ; i < args . length ; ++ i ) { if ( args [ i ] . equals ( "-j" ) ) { i ++ ; } else if ( args [ i ] . startsWith ( "--server:" ) ) { } else if ( args [ i ] . startsWith ( "--log...
Remove args not affecting the state .
523
public void findAllArtifacts ( ) { binArtifacts = findAllFiles ( binDir ) ; gensrcArtifacts = findAllFiles ( gensrcDir ) ; headerArtifacts = findAllFiles ( headerDir ) ; }
Find all artifacts that exists on disk .
524
private Map < String , File > fetchPrevArtifacts ( String pkg ) { Package p = prev . packages ( ) . get ( pkg ) ; if ( p != null ) { return p . artifacts ( ) ; } return new HashMap < > ( ) ; }
Lookup the artifacts generated for this package in the previous build .
525
public void deleteClassArtifactsInTaintedPackages ( ) { for ( String pkg : taintedPackages ) { Map < String , File > arts = fetchPrevArtifacts ( pkg ) ; for ( File f : arts . values ( ) ) { if ( f . exists ( ) && f . getName ( ) . endsWith ( ".class" ) ) { f . delete ( ) ; } } } }
Delete all prev artifacts in the currently tainted packages .
526
public void taintPackage ( String name , String because ) { if ( ! taintedPackages . contains ( name ) ) { if ( because != null ) Log . debug ( "Tainting " + Util . justPackageName ( name ) + " because " + because ) ; taintedPackages . add ( name ) ; needsSaving ( ) ; Package nowp = now . packages ( ) . get ( name ) ; ...
Mark a java package as tainted ie it needs recompilation .
527
public void checkSourceStatus ( boolean check_gensrc ) { removedSources = calculateRemovedSources ( ) ; for ( Source s : removedSources ) { if ( ! s . isGenerated ( ) || check_gensrc ) { taintPackage ( s . pkg ( ) . name ( ) , "source " + s . name ( ) + " was removed" ) ; } } addedSources = calculateAddedSources ( ) ; ...
Go through all sources and check which have been removed added or modified and taint the corresponding packages .
528
public Map < String , Transformer > getJavaSuffixRule ( ) { Map < String , Transformer > sr = new HashMap < > ( ) ; sr . put ( ".java" , compileJavaPackages ) ; return sr ; }
Acquire the compile_java_packages suffix rule for . java files .
529
public void taintPackagesThatMissArtifacts ( ) { for ( Package pkg : prev . packages ( ) . values ( ) ) { for ( File f : pkg . artifacts ( ) . values ( ) ) { if ( ! f . exists ( ) ) { taintPackage ( pkg . name ( ) , "" + f + " is missing." ) ; } } } }
If artifacts have gone missing force a recompile of the packages they belong to .
530
public void taintPackagesDependingOnChangedClasspathPackages ( ) throws IOException { Set < String > fqDependencies = new HashSet < > ( ) ; for ( Package pkg : prev . packages ( ) . values ( ) ) { if ( pkg . sources ( ) . isEmpty ( ) ) continue ; pkg . typeClasspathDependencies ( ) . values ( ) . forEach ( fqDependenci...
Compare the javac_state recorded public apis of packages on the classpath with the actual public apis on the classpath .
531
public void removeSuperfluousArtifacts ( Set < String > recentlyCompiled ) { if ( recentlyCompiled . size ( ) == 0 ) return ; for ( String pkg : now . packages ( ) . keySet ( ) ) { if ( ! recentlyCompiled . contains ( pkg ) ) continue ; Collection < File > arts = now . artifacts ( ) . values ( ) ; for ( File f : fetchP...
Remove artifacts that are no longer produced when compiling!
532
private Set < Source > calculateRemovedSources ( ) { Set < Source > removed = new HashSet < > ( ) ; for ( String src : prev . sources ( ) . keySet ( ) ) { if ( now . sources ( ) . get ( src ) == null ) { removed . add ( prev . sources ( ) . get ( src ) ) ; } } return removed ; }
Return those files belonging to prev but not now .
533
private Set < Source > calculateAddedSources ( ) { Set < Source > added = new HashSet < > ( ) ; for ( String src : now . sources ( ) . keySet ( ) ) { if ( prev . sources ( ) . get ( src ) == null ) { added . add ( now . sources ( ) . get ( src ) ) ; } } return added ; }
Return those files belonging to now but not prev .
534
private Set < Source > calculateModifiedSources ( ) { Set < Source > modified = new HashSet < > ( ) ; for ( String src : now . sources ( ) . keySet ( ) ) { Source n = now . sources ( ) . get ( src ) ; Source t = prev . sources ( ) . get ( src ) ; if ( prev . sources ( ) . get ( src ) != null ) { if ( t != null ) { if (...
Return those files where the timestamp is newer . If a source file timestamp suddenly is older than what is known about it in javac_state then consider it modified but print a warning!
535
private static Set < File > findAllFiles ( File dir ) { Set < File > foundFiles = new HashSet < > ( ) ; if ( dir == null ) { return foundFiles ; } recurse ( dir , foundFiles ) ; return foundFiles ; }
Utility method to recursively find all files below a directory .
536
public void compareWithMakefileList ( File makefileSourceList ) throws ProblemException { boolean mightNeedRewriting = File . pathSeparatorChar == ';' ; if ( makefileSourceList == null ) return ; Set < String > calculatedSources = new HashSet < > ( ) ; Set < String > listedSources = new HashSet < > ( ) ; for ( Source s...
Compare the calculate source list with an explicit list usually supplied from the makefile . Used to detect bugs where the makefile and sjavac have different opinions on which files should be compiled .
537
List < SnippetEvent > eval ( String userSource ) throws IllegalStateException { List < SnippetEvent > allEvents = new ArrayList < > ( ) ; for ( Snippet snip : sourceToSnippets ( userSource ) ) { if ( snip . kind ( ) == Kind . ERRONEOUS ) { state . maps . installSnippet ( snip ) ; allEvents . add ( new SnippetEvent ( sn...
Evaluates a snippet of source .
538
public JavaFileObject useSource ( JavaFileObject file ) { JavaFileObject prev = ( source == null ? null : source . getFile ( ) ) ; source = getSource ( file ) ; return prev ; }
Re - assign source returning previous setting .
539
public void mandatoryWarning ( LintCategory lc , DiagnosticPosition pos , Warning warningKey ) { report ( diags . mandatoryWarning ( lc , source , pos , warningKey ) ) ; }
Report a warning .
540
public ProgramElementDoc [ ] toProgramElementDocArray ( List < ProgramElementDoc > list ) { ProgramElementDoc [ ] pgmarr = new ProgramElementDoc [ list . size ( ) ] ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { pgmarr [ i ] = list . get ( i ) ; } return pgmarr ; }
Return the list of ProgramElementDoc objects as Array .
541
public String getPackageName ( PackageDoc packageDoc ) { return packageDoc == null || packageDoc . name ( ) . length ( ) == 0 ? DocletConstants . DEFAULT_PACKAGE_NAME : packageDoc . name ( ) ; }
Given a package return its name .
542
public String getPackageFileHeadName ( PackageDoc packageDoc ) { return packageDoc == null || packageDoc . name ( ) . length ( ) == 0 ? DocletConstants . DEFAULT_PACKAGE_FILE_NAME : packageDoc . name ( ) ; }
Given a package return its file name without the extension .
543
public String replaceTabs ( Configuration configuration , String text ) { if ( ! text . contains ( "\t" ) ) return text ; final int tabLength = configuration . sourcetab ; final String whitespace = configuration . tabSpaces ; final int textLength = text . length ( ) ; StringBuilder result = new StringBuilder ( textLeng...
Replace all tabs in a string with the appropriate number of spaces . The string may be a multi - line string .
544
public Content getSerializableMethods ( String heading , Content serializableMethodContent ) { Content headingContent = new StringContent ( heading ) ; Content serialHeading = HtmlTree . HEADING ( HtmlConstants . SERIALIZED_MEMBER_HEADING , headingContent ) ; Content li = HtmlTree . LI ( HtmlStyle . blockList , serialH...
Add serializable methods .
545
public boolean isExternal ( ProgramElementDoc doc ) { if ( packageToItemMap == null ) { return false ; } return packageToItemMap . get ( doc . containingPackage ( ) . name ( ) ) != null ; }
Determine if a doc item is externally documented .
546
public String typeName ( ) { return ( type instanceof ClassDoc || type instanceof TypeVariable ) ? type . typeName ( ) : type . toString ( ) ; }
Get type name of this parameter . For example if parameter is the short index returns short .
547
public AnnotationDesc [ ] annotations ( ) { AnnotationDesc res [ ] = new AnnotationDesc [ sym . getRawAttributes ( ) . length ( ) ] ; int i = 0 ; for ( Attribute . Compound a : sym . getRawAttributes ( ) ) { res [ i ++ ] = new AnnotationDescImpl ( env , a ) ; } return res ; }
Get the annotations of this parameter . Return an empty array if there are none .
548
protected static boolean isStatic ( Env < AttrContext > env ) { return env . outer != null && env . info . staticLevel > env . outer . info . staticLevel ; }
An environment is static if its static level is greater than the one of its outer environment
549
static boolean isInitializer ( Env < AttrContext > env ) { Symbol owner = env . info . scope . owner ; return owner . isConstructor ( ) || owner . owner . kind == TYP && ( owner . kind == VAR || owner . kind == MTH && ( owner . flags ( ) & BLOCK ) != 0 ) && ( owner . flags ( ) & STATIC ) == 0 ; }
An environment is an initializer if it is a constructor or an instance initializer .
550
public boolean isAccessible ( Env < AttrContext > env , TypeSymbol c ) { return isAccessible ( env , c , false ) ; }
Is class accessible in given evironment?
551
private boolean isInnerSubClass ( ClassSymbol c , Symbol base ) { while ( c != null && ! c . isSubClass ( base , types ) ) { c = c . owner . enclClass ( ) ; } return c != null ; }
Is given class a subclass of given base class or an inner class of a subclass? Return null if no such class exists .
552
public boolean isAccessible ( Env < AttrContext > env , Type site , Symbol sym ) { return isAccessible ( env , site , sym , false ) ; }
Is symbol accessible as a member of given type in given environment?
553
private boolean isProtectedAccessible ( Symbol sym , ClassSymbol c , Type site ) { Type newSite = site . hasTag ( TYPEVAR ) ? site . getUpperBound ( ) : site ; while ( c != null && ! ( c . isSubClass ( sym . owner , types ) && ( c . flags ( ) & INTERFACE ) == 0 && ( ( sym . flags ( ) & STATIC ) != 0 || sym . kind == TY...
Is given protected symbol accessible if it is selected from given site and the selection takes place in given class?
554
void checkAccessibleType ( Env < AttrContext > env , Type t ) { accessibilityChecker . visit ( t , env ) ; }
Performs a recursive scan of a type looking for accessibility problems from current attribution environment
555
Type instantiate ( Env < AttrContext > env , Type site , Symbol m , ResultInfo resultInfo , List < Type > argtypes , List < Type > typeargtypes , boolean allowBoxing , boolean useVarargs , Warner warn ) { try { return rawInstantiate ( env , site , m , resultInfo , argtypes , typeargtypes , allowBoxing , useVarargs , wa...
Same but returns null instead throwing a NoInstanceException
556
Symbol findField ( Env < AttrContext > env , Type site , Name name , TypeSymbol c ) { while ( c . type . hasTag ( TYPEVAR ) ) c = c . type . getUpperBound ( ) . tsym ; Symbol bestSoFar = varNotFound ; Symbol sym ; for ( Symbol s : c . members ( ) . getSymbolsByName ( name ) ) { if ( s . kind == VAR && ( s . flags_field...
Find field . Synthetic fields are always skipped .
557
public VarSymbol resolveInternalField ( DiagnosticPosition pos , Env < AttrContext > env , Type site , Name name ) { Symbol sym = findField ( env , site , name , site . tsym ) ; if ( sym . kind == VAR ) return ( VarSymbol ) sym ; else throw new FatalError ( diags . fragment ( "fatal.err.cant.locate.field" , name ) ) ; ...
Resolve a field identifier throw a fatal error if not found .
558
Symbol findVar ( Env < AttrContext > env , Name name ) { Symbol bestSoFar = varNotFound ; Env < AttrContext > env1 = env ; boolean staticOnly = false ; while ( env1 . outer != null ) { Symbol sym = null ; if ( isStatic ( env1 ) ) staticOnly = true ; for ( Symbol s : env1 . info . scope . getSymbolsByName ( name ) ) { i...
Find unqualified variable or field with given name . Synthetic fields always skipped .
559
Symbol findInheritedMemberType ( Env < AttrContext > env , Type site , Name name , TypeSymbol c ) { Symbol bestSoFar = typeNotFound ; Symbol sym ; Type st = types . supertype ( c . type ) ; if ( st != null && st . hasTag ( CLASS ) ) { sym = findMemberType ( env , site , name , st . tsym ) ; bestSoFar = bestOf ( bestSoF...
Find a member type inherited from a superclass or interface .
560
Symbol findMemberType ( Env < AttrContext > env , Type site , Name name , TypeSymbol c ) { Symbol sym = findImmediateMemberType ( env , site , name , c ) ; if ( sym != typeNotFound ) return sym ; return findInheritedMemberType ( env , site , name , c ) ; }
Find qualified member type .
561
Symbol findType ( Env < AttrContext > env , Name name ) { if ( name == names . empty ) return typeNotFound ; Symbol bestSoFar = typeNotFound ; Symbol sym ; boolean staticOnly = false ; for ( Env < AttrContext > env1 = env ; env1 . outer != null ; env1 = env1 . outer ) { if ( isStatic ( env1 ) ) staticOnly = true ; fina...
Find an unqualified type symbol .
562
Symbol accessMethod ( Symbol sym , DiagnosticPosition pos , Symbol location , Type site , Name name , boolean qualified , List < Type > argtypes , List < Type > typeargtypes ) { return accessInternal ( sym , pos , location , site , name , qualified , argtypes , typeargtypes , methodLogResolveHelper ) ; }
Variant of the generalized access routine to be used for generating method resolution diagnostics
563
Symbol accessBase ( Symbol sym , DiagnosticPosition pos , Symbol location , Type site , Name name , boolean qualified ) { return accessInternal ( sym , pos , location , site , name , qualified , List . nil ( ) , null , basicLogResolveHelper ) ; }
Variant of the generalized access routine to be used for generating variable type resolution diagnostics
564
void checkNonAbstract ( DiagnosticPosition pos , Symbol sym ) { if ( ( sym . flags ( ) & ABSTRACT ) != 0 && ( sym . flags ( ) & DEFAULT ) == 0 ) log . error ( pos , "abstract.cant.be.accessed.directly" , kindName ( sym ) , sym , sym . location ( ) ) ; }
Check that sym is not an abstract method .
565
Symbol resolveQualifiedMethod ( DiagnosticPosition pos , Env < AttrContext > env , Type site , Name name , List < Type > argtypes , List < Type > typeargtypes ) { return resolveQualifiedMethod ( pos , env , site . tsym , site , name , argtypes , typeargtypes ) ; }
Resolve a qualified method identifier
566
public MethodSymbol resolveInternalMethod ( DiagnosticPosition pos , Env < AttrContext > env , Type site , Name name , List < Type > argtypes , List < Type > typeargtypes ) { MethodResolutionContext resolveContext = new MethodResolutionContext ( ) ; resolveContext . internalResolution = true ; Symbol sym = resolveQuali...
Resolve a qualified method identifier throw a fatal error if not found .
567
Symbol resolveConstructor ( DiagnosticPosition pos , Env < AttrContext > env , Type site , List < Type > argtypes , List < Type > typeargtypes ) { return resolveConstructor ( new MethodResolutionContext ( ) , pos , env , site , argtypes , typeargtypes ) ; }
Resolve constructor .
568
public MethodSymbol resolveInternalConstructor ( DiagnosticPosition pos , Env < AttrContext > env , Type site , List < Type > argtypes , List < Type > typeargtypes ) { MethodResolutionContext resolveContext = new MethodResolutionContext ( ) ; resolveContext . internalResolution = true ; Symbol sym = resolveConstructor ...
Resolve a constructor throw a fatal error if not found .
569
Symbol resolveSelf ( DiagnosticPosition pos , Env < AttrContext > env , TypeSymbol c , Name name ) { Env < AttrContext > env1 = env ; boolean staticOnly = false ; while ( env1 . outer != null ) { if ( isStatic ( env1 ) ) staticOnly = true ; if ( env1 . enclClass . sym == c ) { Symbol sym = env1 . info . scope . findFir...
Resolve c . name where name == this or name == super .
570
Symbol resolveSelfContaining ( DiagnosticPosition pos , Env < AttrContext > env , Symbol member , boolean isSuperCall ) { Symbol sym = resolveSelfContainingInternal ( env , member , isSuperCall ) ; if ( sym == null ) { log . error ( pos , "encl.class.required" , member ) ; return syms . errSymbol ; } else { return acce...
Resolve c . this for an enclosing class c that contains the named member .
571
Type resolveImplicitThis ( DiagnosticPosition pos , Env < AttrContext > env , Type t ) { return resolveImplicitThis ( pos , env , t , false ) ; }
Resolve an appropriate implicit this instance for t s container . JLS 8 . 8 . 5 . 1 and 15 . 9 . 2
572
public void logAccessErrorInternal ( Env < AttrContext > env , JCTree tree , Type type ) { AccessError error = new AccessError ( env , env . enclClass . type , type . tsym ) ; logResolveError ( error , tree . pos ( ) , env . enclClass . sym , env . enclClass . type , null , null , null ) ; }
used by TransTypes when checking target type of synthetic cast
573
public List < ProgramElementDoc > getLeafClassMembers ( Configuration configuration ) { List < ProgramElementDoc > result = getMembersFor ( classdoc ) ; result . addAll ( getInheritedPackagePrivateMethods ( configuration ) ) ; return result ; }
Return the visible members of the class being mapped . Also append at the end of the list members that are inherited by inaccessible parents . We document these members in the child because the parent is not documented .
574
public List < ProgramElementDoc > getMembersFor ( ClassDoc cd ) { ClassMembers clmembers = classMap . get ( cd ) ; if ( clmembers == null ) { return new ArrayList < > ( ) ; } return clmembers . getMembers ( ) ; }
Retrn the list of members for the given class .
575
public DocLink getDocLink ( SectionName sectionName , String where ) { return DocLink . fragment ( sectionName . getName ( ) + getName ( where ) ) ; }
Get the link .
576
public String getName ( String name ) { StringBuilder sb = new StringBuilder ( ) ; char ch ; for ( int i = 0 ; i < name . length ( ) ; i ++ ) { ch = name . charAt ( i ) ; switch ( ch ) { case '(' : case ')' : case '<' : case '>' : case ',' : sb . append ( '-' ) ; break ; case ' ' : case '[' : break ; case ']' : sb . ap...
Convert the name to a valid HTML name .
577
public String getPkgName ( ClassDoc cd ) { String pkgName = cd . containingPackage ( ) . name ( ) ; if ( pkgName . length ( ) > 0 ) { pkgName += "." ; return pkgName ; } return "" ; }
Get the name of the package this class is in .
578
public void printFramesDocument ( String title , ConfigurationImpl configuration , HtmlTree body ) throws IOException { Content htmlDocType = configuration . isOutputHtml5 ( ) ? DocType . HTML5 : DocType . TRANSITIONAL ; Content htmlComment = new Comment ( configuration . getText ( "doclet.New_Page" ) ) ; Content head ...
Print the frames version of the Html file header . Called only when generating an HTML frames file .
579
public static RichDiagnosticFormatter instance ( Context context ) { RichDiagnosticFormatter instance = context . get ( RichDiagnosticFormatter . class ) ; if ( instance == null ) instance = new RichDiagnosticFormatter ( context ) ; return instance ; }
Get the DiagnosticFormatter instance for this context .
580
protected List < JCDiagnostic > getWhereClauses ( ) { List < JCDiagnostic > clauses = List . nil ( ) ; for ( WhereClauseKind kind : WhereClauseKind . values ( ) ) { List < JCDiagnostic > lines = List . nil ( ) ; for ( Map . Entry < Type , JCDiagnostic > entry : whereClauses . get ( kind ) . entrySet ( ) ) { lines = lin...
Build a list of multiline diagnostics containing detailed info about type - variables captured types and intersection types
581
protected HtmlTree getTreeHeader ( ) { String title = configuration . getText ( "doclet.Window_Class_Hierarchy" ) ; HtmlTree bodyTree = getBody ( true , getWindowTitle ( title ) ) ; HtmlTree htmlTree = ( configuration . allowTag ( HtmlTag . HEADER ) ) ? HtmlTree . HEADER ( ) : bodyTree ; addTop ( htmlTree ) ; addNavLin...
Get the tree header .
582
public JCCompilationUnit parseCompilationUnit ( ) { Token firstToken = token ; JCModifiers mods = null ; boolean seenImport = false ; boolean seenPackage = false ; ListBuffer < JCTree > defs = new ListBuffer < > ( ) ; if ( token . kind == MONKEYS_AT ) { mods = modifiersOpt ( ) ; } boolean firstTypeDecl = true ; while (...
As faithful a clone of the overridden method as possible while still achieving the goal of allowing the parse of a stand - alone snippet . As a result some variables are assigned and never used tests are always true loops don t etc . This is to allow easy transition as the underlying method changes .
583
protected void addPartialInfo ( ClassDoc cd , Content contentTree ) { addPreQualifiedStrongClassLink ( LinkInfoImpl . Kind . TREE , cd , contentTree ) ; }
Add information about the class kind if it s a class or interface .
584
protected Content getNavLinkTree ( ) { Content li = HtmlTree . LI ( HtmlStyle . navBarCell1Rev , treeLabel ) ; return li ; }
Get the tree label for the navigation bar .
585
private void enterMember ( ClassSymbol c , Symbol sym ) { if ( ( sym . flags_field & ( SYNTHETIC | BRIDGE ) ) != SYNTHETIC || sym . name . startsWith ( names . lambda ) ) c . members_field . enter ( sym ) ; }
Add member to class unless it is synthetic .
586
int getInt ( int bp ) { return ( ( buf [ bp ] & 0xFF ) << 24 ) + ( ( buf [ bp + 1 ] & 0xFF ) << 16 ) + ( ( buf [ bp + 2 ] & 0xFF ) << 8 ) + ( buf [ bp + 3 ] & 0xFF ) ; }
Extract an integer at position bp from buf .
587
long getLong ( int bp ) { DataInputStream bufin = new DataInputStream ( new ByteArrayInputStream ( buf , bp , 8 ) ) ; try { return bufin . readLong ( ) ; } catch ( IOException e ) { throw new AssertionError ( e ) ; } }
Extract a long integer at position bp from buf .
588
float getFloat ( int bp ) { DataInputStream bufin = new DataInputStream ( new ByteArrayInputStream ( buf , bp , 4 ) ) ; try { return bufin . readFloat ( ) ; } catch ( IOException e ) { throw new AssertionError ( e ) ; } }
Extract a float at position bp from buf .
589
double getDouble ( int bp ) { DataInputStream bufin = new DataInputStream ( new ByteArrayInputStream ( buf , bp , 8 ) ) ; try { return bufin . readDouble ( ) ; } catch ( IOException e ) { throw new AssertionError ( e ) ; } }
Extract a double at position bp from buf .
590
Object readPool ( int i ) { Object result = poolObj [ i ] ; if ( result != null ) return result ; int index = poolIdx [ i ] ; if ( index == 0 ) return null ; byte tag = buf [ index ] ; switch ( tag ) { case CONSTANT_Utf8 : poolObj [ i ] = names . fromUtf ( buf , index + 3 , getChar ( index + 1 ) ) ; break ; case CONSTA...
Read constant pool entry at start address i use pool as a cache .
591
Type readType ( int i ) { int index = poolIdx [ i ] ; return sigToType ( buf , index + 3 , getChar ( index + 1 ) ) ; }
Read signature and convert to type .
592
Object readClassOrType ( int i ) { int index = poolIdx [ i ] ; int len = getChar ( index + 1 ) ; int start = index + 3 ; Assert . check ( buf [ start ] == '[' || buf [ start + len - 1 ] != ';' ) ; return ( buf [ start ] == '[' || buf [ start + len - 1 ] == ';' ) ? ( Object ) sigToType ( buf , start , len ) : ( Object )...
If name is an array type or class signature return the corresponding type ; otherwise return a ClassSymbol with given name .
593
List < Type > readTypeParams ( int i ) { int index = poolIdx [ i ] ; return sigToTypeParams ( buf , index + 3 , getChar ( index + 1 ) ) ; }
Read signature and convert to type parameters .
594
ClassSymbol readClassSymbol ( int i ) { Object obj = readPool ( i ) ; if ( obj != null && ! ( obj instanceof ClassSymbol ) ) throw badClassFile ( "bad.const.pool.entry" , currentClassFile . toString ( ) , "CONSTANT_Class_info" , i ) ; return ( ClassSymbol ) obj ; }
Read class entry .
595
Name readName ( int i ) { Object obj = readPool ( i ) ; if ( obj != null && ! ( obj instanceof Name ) ) throw badClassFile ( "bad.const.pool.entry" , currentClassFile . toString ( ) , "CONSTANT_Utf8_info or CONSTANT_String_info" , i ) ; return ( Name ) obj ; }
Read name .
596
NameAndType readNameAndType ( int i ) { Object obj = readPool ( i ) ; if ( obj != null && ! ( obj instanceof NameAndType ) ) throw badClassFile ( "bad.const.pool.entry" , currentClassFile . toString ( ) , "CONSTANT_NameAndType_info" , i ) ; return ( NameAndType ) obj ; }
Read name and type .
597
Set < ModuleFlags > readModuleFlags ( int flags ) { Set < ModuleFlags > set = EnumSet . noneOf ( ModuleFlags . class ) ; for ( ModuleFlags f : ModuleFlags . values ( ) ) { if ( ( flags & f . value ) != 0 ) set . add ( f ) ; } return set ; }
Read module_flags .
598
Set < ModuleResolutionFlags > readModuleResolutionFlags ( int flags ) { Set < ModuleResolutionFlags > set = EnumSet . noneOf ( ModuleResolutionFlags . class ) ; for ( ModuleResolutionFlags f : ModuleResolutionFlags . values ( ) ) { if ( ( flags & f . value ) != 0 ) set . add ( f ) ; } return set ; }
Read resolution_flags .
599
Set < ExportsFlag > readExportsFlags ( int flags ) { Set < ExportsFlag > set = EnumSet . noneOf ( ExportsFlag . class ) ; for ( ExportsFlag f : ExportsFlag . values ( ) ) { if ( ( flags & f . value ) != 0 ) set . add ( f ) ; } return set ; }
Read exports_flags .