idx
int64 0
41.2k
| question
stringlengths 74
4.21k
| target
stringlengths 5
888
|
---|---|---|
400 | protected Content getNavLinkHelp ( ) { String helpfile = configuration . helpfile ; DocPath helpfilenm ; if ( helpfile . isEmpty ( ) ) { helpfilenm = DocPaths . HELP_DOC ; } else { DocFile file = DocFile . createFileForInput ( configuration , helpfile ) ; helpfilenm = DocPath . create ( file . getName ( ) ) ; } Content linkContent = getHyperLink ( pathToRoot . resolve ( helpfilenm ) , helpLabel , "" , "" ) ; Content li = HtmlTree . LI ( linkContent ) ; return li ; } | Get help file link . If user has provided a help file then generate a link to the user given file which is already copied to current or destination directory . |
401 | protected DocPath pathString ( ClassDoc cd , DocPath name ) { return pathString ( cd . containingPackage ( ) , name ) ; } | Return the path to the class page for a classdoc . |
402 | public Content getLink ( LinkInfoImpl linkInfo ) { LinkFactoryImpl factory = new LinkFactoryImpl ( this ) ; return factory . getLink ( linkInfo ) ; } | Return the link to the given class . |
403 | public Content getTypeParameterLinks ( LinkInfoImpl linkInfo ) { LinkFactoryImpl factory = new LinkFactoryImpl ( this ) ; return factory . getTypeParameterLinks ( linkInfo , false ) ; } | Return the type parameters for the given class . |
404 | public void addStyleSheetProperties ( Content head ) { String stylesheetfile = configuration . stylesheetfile ; DocPath stylesheet ; if ( stylesheetfile . isEmpty ( ) ) { stylesheet = DocPaths . STYLESHEET ; } else { DocFile file = DocFile . createFileForInput ( configuration , stylesheetfile ) ; stylesheet = DocPath . create ( file . getName ( ) ) ; } HtmlTree link = HtmlTree . LINK ( "stylesheet" , "text/css" , pathToRoot . resolve ( stylesheet ) . getPath ( ) , "Style" ) ; head . addContent ( link ) ; if ( configuration . createindex ) { HtmlTree jq_link = HtmlTree . LINK ( "stylesheet" , "text/css" , pathToRoot . resolve ( DocPaths . JQUERY_FILES . resolve ( DocPaths . JQUERY_STYLESHEET_FILE ) ) . getPath ( ) , "Style" ) ; head . addContent ( jq_link ) ; } } | Add a link to the stylesheet file . |
405 | private void addJQueryFile ( Content head , DocPath filePath ) { HtmlTree jqyeryScriptFile = HtmlTree . SCRIPT ( pathToRoot . resolve ( DocPaths . JQUERY_FILES . resolve ( filePath ) ) . getPath ( ) ) ; head . addContent ( jqyeryScriptFile ) ; } | Add a link to the JQuery javascript file . |
406 | public void addAnnotationInfo ( PackageDoc packageDoc , Content htmltree ) { addAnnotationInfo ( packageDoc , packageDoc . annotations ( ) , htmltree ) ; } | Adds the annotatation types for the given packageDoc . |
407 | public boolean addAnnotationInfo ( int indent , Doc doc , Parameter param , Content tree ) { return addAnnotationInfo ( indent , doc , param . annotations ( ) , false , tree ) ; } | Add the annotatation types for the given doc and parameter . |
408 | public R scan ( Iterable < ? extends Tree > nodes , P p ) { R r = null ; if ( nodes != null ) { boolean first = true ; for ( Tree node : nodes ) { r = ( first ? scan ( node , p ) : scanAndReduce ( node , p , r ) ) ; first = false ; } } return r ; } | Scans a sequence of nodes . |
409 | public static void write ( PrintStream out , Object ... objs ) { out . println ( Arrays . stream ( objs ) . map ( Object :: toString ) . map ( CSV :: quote ) . collect ( Collectors . joining ( "," ) ) ) ; } | Writes the objects string representations to the output as a line of CSV . The objects are converted to String quoted if necessary joined with commas and are written to the output followed by the line separator string . |
410 | public static List < String > split ( String input ) { List < String > result = new ArrayList < > ( ) ; StringBuilder cur = new StringBuilder ( ) ; State state = State . START_FIELD ; for ( int i = 0 ; i < input . length ( ) ; i ++ ) { char ch = input . charAt ( i ) ; switch ( ch ) { case ',' : switch ( state ) { case IN_QFIELD : cur . append ( ',' ) ; break ; default : result . add ( cur . toString ( ) ) ; cur . setLength ( 0 ) ; state = State . START_FIELD ; break ; } break ; case '"' : switch ( state ) { case START_FIELD : state = State . IN_QFIELD ; break ; case IN_QFIELD : state = State . END_QFIELD ; break ; case IN_FIELD : throw new CSVParseException ( "unexpected quote" , input , i ) ; case END_QFIELD : cur . append ( '"' ) ; state = State . IN_QFIELD ; break ; } break ; default : switch ( state ) { case START_FIELD : state = State . IN_FIELD ; break ; case IN_FIELD : case IN_QFIELD : break ; case END_QFIELD : throw new CSVParseException ( "extra character after quoted string" , input , i ) ; } cur . append ( ch ) ; break ; } } if ( state == State . IN_QFIELD ) { throw new CSVParseException ( "unclosed quote" , input , input . length ( ) ) ; } result . add ( cur . toString ( ) ) ; return result ; } | Splits an input line into a list of strings handling quoting . |
411 | void doIncorporation ( InferenceContext inferenceContext , Warner warn ) throws InferenceException { try { boolean progress = true ; int round = 0 ; while ( progress && round < MAX_INCORPORATION_STEPS ) { progress = false ; for ( Type t : inferenceContext . undetvars ) { UndetVar uv = ( UndetVar ) t ; if ( ! uv . incorporationActions . isEmpty ( ) ) { progress = true ; uv . incorporationActions . removeFirst ( ) . apply ( inferenceContext , warn ) ; } } round ++ ; } } finally { incorporationCache . clear ( ) ; } } | Check bounds and perform incorporation . |
412 | public boolean isExternal ( Element element ) { if ( packageToItemMap == null ) { return false ; } PackageElement pe = configuration . utils . containingPackage ( element ) ; if ( pe . isUnnamed ( ) ) { return false ; } return packageToItemMap . get ( configuration . utils . getPackageName ( pe ) ) != null ; } | Determine if a element item is externally documented . |
413 | public DocLink getExternalLink ( String pkgName , DocPath relativepath , String filename ) { return getExternalLink ( pkgName , relativepath , filename , null ) ; } | Convert a link to be an external link if appropriate . |
414 | private Item findPackageItem ( String pkgName ) { if ( packageToItemMap == null ) { return null ; } return packageToItemMap . get ( pkgName ) ; } | Get the Extern Item object associated with this package name . |
415 | private void readPackageListFromURL ( String urlpath , URL pkglisturlpath ) throws Fault { try { URL link = pkglisturlpath . toURI ( ) . resolve ( DocPaths . PACKAGE_LIST . getPath ( ) ) . toURL ( ) ; readPackageList ( link . openStream ( ) , urlpath , false ) ; } catch ( URISyntaxException | MalformedURLException exc ) { throw new Fault ( configuration . getText ( "doclet.MalformedURL" , pkglisturlpath . toString ( ) ) , exc ) ; } catch ( IOException exc ) { throw new Fault ( configuration . getText ( "doclet.URL_error" , pkglisturlpath . toString ( ) ) , exc ) ; } } | Fetch the URL and read the package - list file . |
416 | private void readPackageList ( InputStream input , String path , boolean relative ) throws IOException { try ( BufferedReader in = new BufferedReader ( new InputStreamReader ( input ) ) ) { StringBuilder strbuf = new StringBuilder ( ) ; int c ; while ( ( c = in . read ( ) ) >= 0 ) { char ch = ( char ) c ; if ( ch == '\n' || ch == '\r' ) { if ( strbuf . length ( ) > 0 ) { String packname = strbuf . toString ( ) ; String packpath = path + packname . replace ( '.' , '/' ) + '/' ; Item ignore = new Item ( packname , packpath , relative ) ; strbuf . setLength ( 0 ) ; } } else { strbuf . append ( ch ) ; } } } } | Read the file package - list and for each package name found create Extern object and associate it with the package name in the map . |
417 | public void complete ( Symbol sym ) throws CompletionFailure { if ( ! completionEnabled ) { Assert . check ( ( sym . flags ( ) & Flags . COMPOUND ) == 0 ) ; sym . completer = this ; return ; } try { annotate . blockAnnotations ( ) ; sym . flags_field |= UNATTRIBUTED ; List < Env < AttrContext > > queue ; dependencies . push ( ( ClassSymbol ) sym , CompletionCause . MEMBER_ENTER ) ; try { queue = completeClass . completeEnvs ( List . of ( typeEnvs . get ( ( ClassSymbol ) sym ) ) ) ; } finally { dependencies . pop ( ) ; } if ( ! queue . isEmpty ( ) ) { Set < JCCompilationUnit > seen = new HashSet < > ( ) ; for ( Env < AttrContext > env : queue ) { if ( env . toplevel . defs . contains ( env . enclClass ) && seen . add ( env . toplevel ) ) { finishImports ( env . toplevel , ( ) -> { } ) ; } } } } finally { annotate . unblockAnnotations ( ) ; } } | Complete entering a class . |
418 | public void markDeprecated ( Symbol sym , List < JCAnnotation > annotations , Env < AttrContext > env ) { attr . attribAnnotationTypes ( annotations , env ) ; handleDeprecatedAnnotations ( annotations , sym ) ; } | Mark sym deprecated if annotations contain |
419 | private void handleDeprecatedAnnotations ( List < JCAnnotation > annotations , Symbol sym ) { for ( List < JCAnnotation > al = annotations ; ! al . isEmpty ( ) ; al = al . tail ) { JCAnnotation a = al . head ; if ( a . annotationType . type == syms . deprecatedType ) { sym . flags_field |= ( Flags . DEPRECATED | Flags . DEPRECATED_ANNOTATION ) ; a . args . stream ( ) . filter ( e -> e . hasTag ( ASSIGN ) ) . map ( e -> ( JCAssign ) e ) . filter ( assign -> TreeInfo . name ( assign . lhs ) == names . forRemoval ) . findFirst ( ) . ifPresent ( assign -> { JCExpression rhs = TreeInfo . skipParens ( assign . rhs ) ; if ( rhs . hasTag ( LITERAL ) && Boolean . TRUE . equals ( ( ( JCLiteral ) rhs ) . getValue ( ) ) ) { sym . flags_field |= DEPRECATED_REMOVAL ; } } ) ; } } } | If a list of annotations contains a reference to java . lang . Deprecated set the DEPRECATED flag . If the annotation is marked forRemoval = true also set DEPRECATED_REMOVAL . |
420 | public static ClassFileReader newInstance ( FileSystem fs , Path path ) throws IOException { return new DirectoryReader ( fs , path ) ; } | Returns a ClassFileReader instance of a given FileSystem and path . |
421 | public Set < String > entries ( ) { Set < String > es = this . entries ; if ( es == null ) { this . entries = scan ( ) ; } return this . entries ; } | Returns all entries in this archive . |
422 | public ClassFile getClassFile ( String name ) throws IOException { if ( name . indexOf ( '.' ) > 0 ) { int i = name . lastIndexOf ( '.' ) ; String pathname = name . replace ( '.' , File . separatorChar ) + ".class" ; if ( baseFileName . equals ( pathname ) || baseFileName . equals ( pathname . substring ( 0 , i ) + "$" + pathname . substring ( i + 1 , pathname . length ( ) ) ) ) { return readClassFile ( path ) ; } } else { if ( baseFileName . equals ( name . replace ( '/' , File . separatorChar ) + ".class" ) ) { return readClassFile ( path ) ; } } return null ; } | Returns the ClassFile matching the given binary name or a fully - qualified class name . |
423 | public boolean matches ( String cn ) { if ( includePattern == null ) return true ; if ( includePattern != null ) return includePattern . matcher ( cn ) . matches ( ) ; return false ; } | Tests if the given class matches the pattern given in the - include option |
424 | public boolean matches ( Archive source ) { if ( includePattern != null ) { return source . reader ( ) . entries ( ) . stream ( ) . map ( name -> name . replace ( '/' , '.' ) ) . filter ( name -> ! name . equals ( "module-info.class" ) ) . anyMatch ( this :: matches ) ; } return hasTargetFilter ( ) ; } | Tests if the given source includes classes specified in - include option |
425 | public boolean accepts ( Location origin , Archive originArchive , Location target , Archive targetArchive ) { if ( findJDKInternals ) { Module module = targetArchive . getModule ( ) ; return originArchive != targetArchive && isJDKInternalPackage ( module , target . getPackageName ( ) ) ; } else if ( filterSameArchive ) { return originArchive != targetArchive ; } return true ; } | Filter depending on the containing archive or module |
426 | public boolean isJDKInternalPackage ( Module module , String pn ) { if ( module . isJDKUnsupported ( ) ) { return true ; } return module . isJDK ( ) && ! module . isExported ( pn ) ; } | Tests if the package is an internal package of the given module . |
427 | public boolean run ( boolean compileTimeView , int maxDepth ) throws IOException { try { if ( apiOnly ) { finder . parseExportedAPIs ( rootArchives . stream ( ) ) ; } else { finder . parse ( rootArchives . stream ( ) ) ; } archives . addAll ( rootArchives ) ; int depth = maxDepth > 0 ? maxDepth : Integer . MAX_VALUE ; if ( depth > 1 ) { if ( compileTimeView ) transitiveArchiveDeps ( depth - 1 ) ; else transitiveDeps ( depth - 1 ) ; } Set < Archive > archives = archives ( ) ; analyzer . run ( archives , finder . locationToArchive ( ) ) ; if ( writer != null ) { writer . generateOutput ( archives , analyzer ) ; } } finally { finder . shutdown ( ) ; } return true ; } | Perform compile - time view or run - time view dependency analysis . |
428 | Set < Archive > archives ( ) { if ( filter . requiresFilter ( ) . isEmpty ( ) ) { return archives . stream ( ) . filter ( this :: include ) . filter ( Archive :: hasDependences ) . collect ( Collectors . toSet ( ) ) ; } else { return archives . stream ( ) . filter ( this :: include ) . filter ( source -> ! filter . requiresFilter ( ) . contains ( source . getName ( ) ) ) . filter ( source -> source . getDependencies ( ) . map ( finder :: locationToArchive ) . anyMatch ( a -> a != source ) ) . collect ( Collectors . toSet ( ) ) ; } } | Returns the archives for reporting that has matching dependences . |
429 | Set < String > dependences ( ) { return analyzer . archives ( ) . stream ( ) . map ( analyzer :: dependences ) . flatMap ( Set :: stream ) . collect ( Collectors . toSet ( ) ) ; } | Returns the dependences either class name or package name as specified in the given verbose level . |
430 | private Set < Archive > unresolvedArchives ( Stream < Location > locations ) { return locations . filter ( l -> ! finder . isParsed ( l ) ) . distinct ( ) . map ( configuration :: findClass ) . flatMap ( Optional :: stream ) . collect ( toSet ( ) ) ; } | Returns the archives that contains the given locations and not parsed and analyzed . |
431 | public Graph < Node > moduleGraph ( ) { Graph . Builder < Node > builder = new Graph . Builder < > ( ) ; archives ( ) . stream ( ) . forEach ( m -> { Node u = new Node ( m . getName ( ) , Info . REQUIRES ) ; builder . addNode ( u ) ; analyzer . requires ( m ) . map ( req -> new Node ( req . getName ( ) , Info . REQUIRES ) ) . forEach ( v -> builder . addEdge ( u , v ) ) ; } ) ; return builder . build ( ) ; } | Returns a graph of module dependences . |
432 | public Graph < Node > dependenceGraph ( ) { Graph . Builder < Node > builder = new Graph . Builder < > ( ) ; archives ( ) . stream ( ) . map ( analyzer . results :: get ) . filter ( deps -> ! deps . dependencies ( ) . isEmpty ( ) ) . flatMap ( deps -> deps . dependencies ( ) . stream ( ) ) . forEach ( d -> addEdge ( builder , d ) ) ; return builder . build ( ) ; } | Returns a graph of dependences . |
433 | protected Content getNavLinkClassUse ( ) { Content linkContent = getHyperLink ( DocPaths . CLASS_USE . resolve ( filename ) , useLabel ) ; Content li = HtmlTree . LI ( linkContent ) ; return li ; } | Get the class use link . |
434 | private void buildDeprecatedAPIInfo ( ) { SortedSet < Element > rset = deprecatedMap . get ( DeprElementKind . REMOVAL ) ; SortedSet < ModuleElement > modules = configuration . modules ; SortedSet < Element > mset = deprecatedMap . get ( DeprElementKind . MODULE ) ; for ( Element me : modules ) { if ( utils . isDeprecatedForRemoval ( me ) ) { rset . add ( me ) ; } if ( utils . isDeprecated ( me ) ) { mset . add ( me ) ; } } SortedSet < PackageElement > packages = configuration . packages ; SortedSet < Element > pset = deprecatedMap . get ( DeprElementKind . PACKAGE ) ; for ( Element pe : packages ) { if ( utils . isDeprecatedForRemoval ( pe ) ) { rset . add ( pe ) ; } if ( utils . isDeprecated ( pe ) ) { pset . add ( pe ) ; } } for ( Element e : configuration . getIncludedTypeElements ( ) ) { TypeElement te = ( TypeElement ) e ; SortedSet < Element > eset ; if ( utils . isDeprecatedForRemoval ( e ) ) { rset . add ( e ) ; } if ( utils . isDeprecated ( e ) ) { switch ( e . getKind ( ) ) { case ANNOTATION_TYPE : eset = deprecatedMap . get ( DeprElementKind . ANNOTATION_TYPE ) ; eset . add ( e ) ; break ; case CLASS : if ( utils . isError ( te ) ) { eset = deprecatedMap . get ( DeprElementKind . ERROR ) ; } else if ( utils . isException ( te ) ) { eset = deprecatedMap . get ( DeprElementKind . EXCEPTION ) ; } else { eset = deprecatedMap . get ( DeprElementKind . CLASS ) ; } eset . add ( e ) ; break ; case INTERFACE : eset = deprecatedMap . get ( DeprElementKind . INTERFACE ) ; eset . add ( e ) ; break ; case ENUM : eset = deprecatedMap . get ( DeprElementKind . ENUM ) ; eset . add ( e ) ; break ; } } composeDeprecatedList ( rset , deprecatedMap . get ( DeprElementKind . FIELD ) , utils . getFields ( te ) ) ; composeDeprecatedList ( rset , deprecatedMap . get ( DeprElementKind . METHOD ) , utils . getMethods ( te ) ) ; composeDeprecatedList ( rset , deprecatedMap . get ( DeprElementKind . CONSTRUCTOR ) , utils . getConstructors ( te ) ) ; if ( utils . isEnum ( e ) ) { composeDeprecatedList ( rset , deprecatedMap . get ( DeprElementKind . ENUM_CONSTANT ) , utils . getEnumConstants ( te ) ) ; } if ( utils . isAnnotationType ( e ) ) { composeDeprecatedList ( rset , deprecatedMap . get ( DeprElementKind . ANNOTATION_TYPE_MEMBER ) , utils . getAnnotationMembers ( te ) ) ; } } } | Build the sorted list of all the deprecated APIs in this run . Build separate lists for deprecated modules packages classes constructors methods and fields . |
435 | public Content getNavLinkPrevious ( ) { Content li ; if ( prev != null ) { Content prevLink = getLink ( new LinkInfoImpl ( configuration , LinkInfoImpl . Kind . CLASS , prev ) . label ( prevclassLabel ) . strong ( true ) ) ; li = HtmlTree . LI ( prevLink ) ; } else li = HtmlTree . LI ( prevclassLabel ) ; return li ; } | Get link to previous class . |
436 | public Content getNavLinkNext ( ) { Content li ; if ( next != null ) { Content nextLink = getLink ( new LinkInfoImpl ( configuration , LinkInfoImpl . Kind . CLASS , next ) . label ( nextclassLabel ) . strong ( true ) ) ; li = HtmlTree . LI ( nextLink ) ; } else li = HtmlTree . LI ( nextclassLabel ) ; return li ; } | Get link to next class . |
437 | private Content getClassInheritenceTree ( Type type ) { Type sup ; HtmlTree classTreeUl = new HtmlTree ( HtmlTag . UL ) ; classTreeUl . addStyle ( HtmlStyle . inheritance ) ; Content liTree = null ; do { sup = utils . getFirstVisibleSuperClass ( type instanceof ClassDoc ? ( ClassDoc ) type : type . asClassDoc ( ) , configuration ) ; if ( sup != null ) { HtmlTree ul = new HtmlTree ( HtmlTag . UL ) ; ul . addStyle ( HtmlStyle . inheritance ) ; ul . addContent ( getTreeForClassHelper ( type ) ) ; if ( liTree != null ) ul . addContent ( liTree ) ; Content li = HtmlTree . LI ( ul ) ; liTree = li ; type = sup ; } else classTreeUl . addContent ( getTreeForClassHelper ( type ) ) ; } while ( sup != null ) ; if ( liTree != null ) classTreeUl . addContent ( liTree ) ; return classTreeUl ; } | Get the class hierarchy tree for the given class . |
438 | protected void addIndex ( Content body ) { addIndexContents ( packages , "doclet.Package_Summary" , configuration . getText ( "doclet.Member_Table_Summary" , configuration . getText ( "doclet.Package_Summary" ) , configuration . getText ( "doclet.packages" ) ) , body ) ; } | Adds the frame or non - frame package index to the documentation tree . |
439 | protected void addConfigurationTitle ( Content body ) { if ( configuration . doctitle . length ( ) > 0 ) { Content title = new RawHtml ( configuration . doctitle ) ; Content heading = HtmlTree . HEADING ( HtmlConstants . TITLE_HEADING , HtmlStyle . title , title ) ; Content div = HtmlTree . DIV ( HtmlStyle . header , heading ) ; body . addContent ( div ) ; } } | Adds the doctitle to the documentation tree if it is specified on the command line . |
440 | protected Content getNavLinkContents ( ) { Content li = HtmlTree . LI ( HtmlStyle . navBarCell1Rev , contents . overviewLabel ) ; return li ; } | Returns highlighted Overview in the navigation bar as this is the overview page . |
441 | public static ExecutionControl remoteInputOutput ( InputStream input , OutputStream output , Map < String , OutputStream > outputStreamMap , Map < String , InputStream > inputStreamMap , BiFunction < ObjectInput , ObjectOutput , ExecutionControl > factory ) throws IOException { ExecutionControl [ ] result = new ExecutionControl [ 1 ] ; Map < String , OutputStream > augmentedStreamMap = new HashMap < > ( outputStreamMap ) ; ObjectOutput commandOut = new ObjectOutputStream ( Util . multiplexingOutputStream ( "$command" , output ) ) ; for ( Entry < String , InputStream > e : inputStreamMap . entrySet ( ) ) { InputStream in = e . getValue ( ) ; OutputStream inTarget = Util . multiplexingOutputStream ( e . getKey ( ) , output ) ; augmentedStreamMap . put ( "$" + e . getKey ( ) + "-input-requested" , new OutputStream ( ) { public void write ( int b ) throws IOException { try { int r = in . read ( ) ; if ( r == ( - 1 ) ) { inTarget . write ( TAG_CLOSED ) ; } else { inTarget . write ( new byte [ ] { TAG_DATA , ( byte ) r } ) ; } } catch ( InterruptedIOException exc ) { try { result [ 0 ] . stop ( ) ; } catch ( ExecutionControlException ex ) { debug ( ex , "$" + e . getKey ( ) + "-input-requested.write" ) ; } } catch ( IOException exc ) { byte [ ] message = exc . getMessage ( ) . getBytes ( "UTF-8" ) ; inTarget . write ( TAG_EXCEPTION ) ; inTarget . write ( ( message . length >> 0 ) & 0xFF ) ; inTarget . write ( ( message . length >> 8 ) & 0xFF ) ; inTarget . write ( ( message . length >> 16 ) & 0xFF ) ; inTarget . write ( ( message . length >> 24 ) & 0xFF ) ; inTarget . write ( message ) ; } } } ) ; } PipeInputStream commandIn = new PipeInputStream ( ) ; OutputStream commandInTarget = commandIn . createOutput ( ) ; augmentedStreamMap . put ( "$command" , commandInTarget ) ; new DemultiplexInput ( input , augmentedStreamMap , Arrays . asList ( commandInTarget ) ) . start ( ) ; return result [ 0 ] = factory . apply ( new ObjectInputStream ( commandIn ) , commandOut ) ; } | Creates an ExecutionControl for given packetized input and output . The given InputStream is de - packetized and content forwarded to ObjectInput and given OutputStreams . The ObjectOutput and values read from the given InputStream are packetized and sent to the given OutputStream . |
442 | public static void main ( String [ ] args ) throws Exception { String loopBack = null ; Socket socket = new Socket ( loopBack , Integer . parseInt ( args [ 0 ] ) ) ; InputStream inStream = socket . getInputStream ( ) ; OutputStream outStream = socket . getOutputStream ( ) ; Map < String , Consumer < OutputStream > > outputs = new HashMap < > ( ) ; outputs . put ( "out" , st -> System . setOut ( new PrintStream ( st , true ) ) ) ; outputs . put ( "err" , st -> System . setErr ( new PrintStream ( st , true ) ) ) ; Map < String , Consumer < InputStream > > input = new HashMap < > ( ) ; input . put ( "in" , System :: setIn ) ; forwardExecutionControlAndIO ( new RemoteExecutionControl ( ) , inStream , outStream , outputs , input ) ; } | Launch the agent connecting to the JShell - core over the socket specified in the command - line argument . |
443 | public String varValue ( String className , String varName ) throws RunException , EngineTerminationException , InternalException { return super . varValue ( className , varName ) ; } | Overridden only so this stack frame is seen |
444 | public void organizeTypeAnnotationsSignatures ( final Env < AttrContext > env , final JCClassDecl tree ) { annotate . afterTypes ( ( ) -> { JavaFileObject oldSource = log . useSource ( env . toplevel . sourcefile ) ; try { new TypeAnnotationPositions ( true ) . scan ( tree ) ; } finally { log . useSource ( oldSource ) ; } } ) ; } | Separate type annotations from declaration annotations and determine the correct positions for type annotations . This version only visits types in signatures and should be called from MemberEnter . |
445 | public static CompileStates instance ( Context context ) { CompileStates instance = context . get ( compileStatesKey ) ; if ( instance == null ) { instance = new CompileStates ( context ) ; } return instance ; } | Get the CompileStates instance for this context . |
446 | Type sharpestAccessible ( Type originalType ) { if ( originalType . hasTag ( ARRAY ) ) { return types . makeArrayType ( sharpestAccessible ( types . elemtype ( originalType ) ) ) ; } Type type = originalType ; while ( ! rs . isAccessible ( gen . getAttrEnv ( ) , type . asElement ( ) ) ) { type = types . supertype ( type ) ; } return type ; } | If the type is not accessible from current context try to figure out the sharpest accessible supertype . |
447 | public boolean isSubclassOf ( TypeElement t1 , TypeElement t2 ) { return typeUtils . isSubtype ( t1 . asType ( ) , t2 . asType ( ) ) ; } | Test whether a class is a subclass of another class . |
448 | public void copyDocFiles ( PackageElement pe ) throws DocFileIOException { Location sourceLoc = getLocationForPackage ( pe ) ; copyDirectory ( sourceLoc , DocPath . forPackage ( pe ) . resolve ( DocPaths . DOC_FILES ) ) ; } | Copy doc - files directory and its contents from the source package directory to the generated documentation directory . For example given a package java . lang this method will copy the doc - files directory found in the package directory to the generated documentation hierarchy . |
449 | public void copyDirectory ( PackageElement pe , DocPath dir ) throws DocFileIOException { copyDirectory ( getLocationForPackage ( pe ) , dir ) ; } | Copy the given directory contents from the source package directory to the generated documentation directory . For example given a package java . lang this method will copy the entire directory to the generated documentation hierarchy . |
450 | public void copyDirectory ( ModuleElement mdle , DocPath dir ) throws DocFileIOException { copyDirectory ( getLocationForModule ( mdle ) , dir ) ; } | Copy the given directory and its contents from the source module directory to the generated documentation directory . For example given a package java . lang this method will copy the entire directory to the generated documentation hierarchy . |
451 | public void copyDirectory ( Location locn , DocPath dir ) throws DocFileIOException { boolean first = true ; for ( DocFile f : DocFile . list ( configuration , locn , dir ) ) { if ( ! f . isDirectory ( ) ) { continue ; } DocFile srcdir = f ; DocFile destdir = DocFile . createFileForOutput ( configuration , dir ) ; if ( srcdir . isSameFile ( destdir ) ) { continue ; } for ( DocFile srcfile : srcdir . list ( ) ) { DocFile destfile = destdir . resolve ( srcfile . getName ( ) ) ; if ( srcfile . isFile ( ) ) { if ( destfile . exists ( ) && ! first ) { messages . warning ( "doclet.Copy_Overwrite_warning" , srcfile . getPath ( ) , destdir . getPath ( ) ) ; } else { messages . notice ( "doclet.Copying_File_0_To_Dir_1" , srcfile . getPath ( ) , destdir . getPath ( ) ) ; destfile . copyFile ( srcfile ) ; } } else if ( srcfile . isDirectory ( ) ) { if ( configuration . copydocfilesubdirs && ! configuration . shouldExcludeDocFileDir ( srcfile . getName ( ) ) ) { copyDirectory ( locn , dir . resolve ( srcfile . getName ( ) ) ) ; } } } first = false ; } } | Copy files from a doc path location to the output . |
452 | public TypeMirror getReturnType ( ExecutableElement ee ) { return ee . getKind ( ) == CONSTRUCTOR ? null : ee . getReturnType ( ) ; } | Returns the TypeMirror of the ExecutableElement for all methods a null if constructor . |
453 | public TypeMirror getDeclaredType ( Collection < TypeMirror > values , TypeElement enclosing , TypeMirror target ) { TypeElement targetElement = asTypeElement ( target ) ; List < ? extends TypeParameterElement > targetTypeArgs = targetElement . getTypeParameters ( ) ; if ( targetTypeArgs . isEmpty ( ) ) { return target ; } List < ? extends TypeParameterElement > enclosingTypeArgs = enclosing . getTypeParameters ( ) ; List < TypeMirror > targetTypeArgTypes = new ArrayList < > ( targetTypeArgs . size ( ) ) ; if ( enclosingTypeArgs . isEmpty ( ) ) { for ( TypeMirror te : values ) { List < ? extends TypeMirror > typeArguments = ( ( DeclaredType ) te ) . getTypeArguments ( ) ; if ( typeArguments . size ( ) >= targetTypeArgs . size ( ) ) { for ( int i = 0 ; i < targetTypeArgs . size ( ) ; i ++ ) { targetTypeArgTypes . add ( typeArguments . get ( i ) ) ; } break ; } } if ( targetTypeArgTypes . isEmpty ( ) ) { return target ; } } else { if ( targetTypeArgs . size ( ) > enclosingTypeArgs . size ( ) ) { return target ; } for ( int i = 0 ; i < targetTypeArgs . size ( ) ; i ++ ) { TypeParameterElement tpe = enclosingTypeArgs . get ( i ) ; targetTypeArgTypes . add ( tpe . asType ( ) ) ; } } TypeMirror dt = typeUtils . getDeclaredType ( targetElement , targetTypeArgTypes . toArray ( new TypeMirror [ targetTypeArgTypes . size ( ) ] ) ) ; return dt ; } | Finds the declaration of the enclosing s type parameter . |
454 | public String replaceText ( String originalStr , String oldStr , String newStr ) { if ( oldStr == null || newStr == null || oldStr . equals ( newStr ) ) { return originalStr ; } return originalStr . replace ( oldStr , newStr ) ; } | Given a string replace all occurrences of newStr with oldStr . |
455 | public static JavadocHelper create ( JavacTask mainTask , Collection < ? extends Path > sourceLocations ) { StandardJavaFileManager fm = compiler . getStandardFileManager ( null , null , null ) ; try { fm . setLocationFromPaths ( StandardLocation . SOURCE_PATH , sourceLocations ) ; return new OnDemandJavadocHelper ( mainTask , fm ) ; } catch ( IOException ex ) { try { fm . close ( ) ; } catch ( IOException closeEx ) { } return new JavadocHelper ( ) { public String getResolvedDocComment ( Element forElement ) throws IOException { return null ; } public Element getSourceElement ( Element forElement ) throws IOException { return forElement ; } public void close ( ) throws IOException { } } ; } } | Create the helper . |
456 | MessageType parseAlternative ( String text ) { if ( text . charAt ( 0 ) == '\'' ) { int end = text . indexOf ( '\'' , 1 ) ; return new MessageType . CustomType ( text . substring ( 1 , end ) ) ; } for ( SimpleType st : SimpleType . values ( ) ) { if ( text . equals ( st . kindName ( ) ) ) { return st ; } } for ( CompoundType . Kind ck : CompoundType . Kind . values ( ) ) { if ( text . startsWith ( ck . kindName ) ) { MessageType elemtype = parseAlternative ( text . substring ( ck . kindName . length ( ) + 1 ) . trim ( ) ) ; return new CompoundType ( ck , elemtype ) ; } } for ( UnionType . Kind uk : UnionType . Kind . values ( ) ) { if ( text . startsWith ( uk . kindName ) ) { return new UnionType ( uk ) ; } } System . err . println ( "WARNING - unrecognized type: " + text ) ; return SimpleType . UNKNOWN ; } | Parse a subset of the type comment ; valid matches are simple types compound types union types and custom types . |
457 | public void visitClassDef ( JCClassDecl tree ) { if ( tree . sym . owner . kind == PCK ) { tree = analyzer . analyzeAndPreprocessClass ( tree ) ; } KlassInfo prevKlassInfo = kInfo ; try { kInfo = new KlassInfo ( tree ) ; super . visitClassDef ( tree ) ; if ( ! kInfo . deserializeCases . isEmpty ( ) ) { int prevPos = make . pos ; try { make . at ( tree ) ; kInfo . addMethod ( makeDeserializeMethod ( tree . sym ) ) ; } finally { make . at ( prevPos ) ; } } List < JCTree > newMethods = kInfo . appendedMethodList . toList ( ) ; tree . defs = tree . defs . appendList ( newMethods ) ; for ( JCTree lambda : newMethods ) { tree . sym . members ( ) . enter ( ( ( JCMethodDecl ) lambda ) . sym ) ; } result = tree ; } finally { kInfo = prevKlassInfo ; } } | Visit a class . Maintain the translatedMethodList across nested classes . Append the translatedMethodList to the class after it is translated . |
458 | private void apportionTypeAnnotations ( JCLambda tree , Supplier < List < Attribute . TypeCompound > > source , Consumer < List < Attribute . TypeCompound > > owner , Consumer < List < Attribute . TypeCompound > > lambda ) { ListBuffer < Attribute . TypeCompound > ownerTypeAnnos = new ListBuffer < > ( ) ; ListBuffer < Attribute . TypeCompound > lambdaTypeAnnos = new ListBuffer < > ( ) ; for ( Attribute . TypeCompound tc : source . get ( ) ) { if ( tc . position . onLambda == tree ) { lambdaTypeAnnos . append ( tc ) ; } else { ownerTypeAnnos . append ( tc ) ; } } if ( lambdaTypeAnnos . nonEmpty ( ) ) { owner . accept ( ownerTypeAnnos . toList ( ) ) ; lambda . accept ( lambdaTypeAnnos . toList ( ) ) ; } } | Reassign type annotations from the source that should really belong to the lambda |
459 | public void visitReference ( JCMemberReference tree ) { ReferenceTranslationContext localContext = ( ReferenceTranslationContext ) context ; Symbol refSym = localContext . isSignaturePolymorphic ( ) ? localContext . sigPolySym : tree . sym ; JCExpression init ; switch ( tree . kind ) { case IMPLICIT_INNER : case SUPER : init = makeThis ( localContext . owner . enclClass ( ) . asType ( ) , localContext . owner . enclClass ( ) ) ; break ; case BOUND : init = tree . getQualifierExpression ( ) ; init = attr . makeNullCheck ( init ) ; break ; case UNBOUND : case STATIC : case TOPLEVEL : case ARRAY_CTOR : init = null ; break ; default : throw new InternalError ( "Should not have an invalid kind" ) ; } List < JCExpression > indy_args = init == null ? List . nil ( ) : translate ( List . of ( init ) , localContext . prev ) ; result = makeMetafactoryIndyCall ( localContext , localContext . referenceKind ( ) , refSym , indy_args ) ; } | Translate a method reference into an invokedynamic call to the meta - factory . |
460 | public void visitIdent ( JCIdent tree ) { if ( context == null || ! analyzer . lambdaIdentSymbolFilter ( tree . sym ) ) { super . visitIdent ( tree ) ; } else { int prevPos = make . pos ; try { make . at ( tree ) ; LambdaTranslationContext lambdaContext = ( LambdaTranslationContext ) context ; JCTree ltree = lambdaContext . translate ( tree ) ; if ( ltree != null ) { result = ltree ; } else { super . visitIdent ( tree ) ; } } finally { make . at ( prevPos ) ; } } } | Translate identifiers within a lambda to the mapped identifier |
461 | public void visitSelect ( JCFieldAccess tree ) { if ( context == null || ! analyzer . lambdaFieldAccessFilter ( tree ) ) { super . visitSelect ( tree ) ; } else { int prevPos = make . pos ; try { make . at ( tree ) ; LambdaTranslationContext lambdaContext = ( LambdaTranslationContext ) context ; JCTree ltree = lambdaContext . translate ( tree ) ; if ( ltree != null ) { result = ltree ; } else { super . visitSelect ( tree ) ; } } finally { make . at ( prevPos ) ; } } } | Translate qualified this references within a lambda to the mapped identifier |
462 | private MethodSymbol makePrivateSyntheticMethod ( long flags , Name name , Type type , Symbol owner ) { return new MethodSymbol ( flags | SYNTHETIC | PRIVATE , name , type , owner ) ; } | Create new synthetic method with given flags name type owner |
463 | private int referenceKind ( Symbol refSym ) { if ( refSym . isConstructor ( ) ) { return ClassFile . REF_newInvokeSpecial ; } else { if ( refSym . isStatic ( ) ) { return ClassFile . REF_invokeStatic ; } else if ( ( refSym . flags ( ) & PRIVATE ) != 0 ) { return ClassFile . REF_invokeSpecial ; } else if ( refSym . enclClass ( ) . isInterface ( ) ) { return ClassFile . REF_invokeInterface ; } else { return ClassFile . REF_invokeVirtual ; } } } | Get the opcode associated with this method reference |
464 | ParseTask parse ( final String source ) { ParseTask pt = state . taskFactory . new ParseTask ( source , false ) ; if ( ! pt . units ( ) . isEmpty ( ) && pt . units ( ) . get ( 0 ) . getKind ( ) == Kind . EXPRESSION_STATEMENT && pt . getDiagnostics ( ) . hasOtherThanNotStatementErrors ( ) ) { ParseTask ept = state . taskFactory . new ParseTask ( source , true ) ; if ( ! ept . getDiagnostics ( ) . hasOtherThanNotStatementErrors ( ) ) { return ept ; } } return pt ; } | Parse a snippet and return our parse task handler |
465 | public static boolean isDebugEnabled ( JShell state , int flag ) { if ( debugMap == null ) { return false ; } Integer flags = debugMap . get ( state ) ; if ( flags == null ) { return false ; } return ( flags & flag ) != 0 ; } | Tests if any of the specified debug flags are enabled . |
466 | public static void debug ( JShell state , PrintStream err , int flags , String format , Object ... args ) { if ( isDebugEnabled ( state , flags ) ) { err . printf ( format , args ) ; } } | Displays debug info if the specified debug flags are enabled . |
467 | public static void debug ( JShell state , PrintStream err , Exception ex , String where ) { if ( isDebugEnabled ( state , 0xFFFFFFFF ) ) { err . printf ( "Fatal error: %s: %s\n" , where , ex . getMessage ( ) ) ; ex . printStackTrace ( err ) ; } } | Displays a fatal exception as debug info . |
468 | private void addConstantMember ( FieldDoc member , HtmlTree trTree ) { trTree . addContent ( getTypeColumn ( member ) ) ; trTree . addContent ( getNameColumn ( member ) ) ; trTree . addContent ( getValue ( member ) ) ; } | Add the row for the constant summary table . |
469 | public static DocPath create ( String p ) { return ( p == null ) || p . isEmpty ( ) ? empty : new DocPath ( p ) ; } | Create a path from a string . |
470 | public DocPath resolve ( String p ) { if ( p == null || p . isEmpty ( ) ) return this ; if ( path . isEmpty ( ) ) return new DocPath ( p ) ; return new DocPath ( path + "/" + p ) ; } | Return the path formed by appending the specified string to the current path . |
471 | public DocPath resolve ( DocPath p ) { if ( p == null || p . isEmpty ( ) ) return this ; if ( path . isEmpty ( ) ) return p ; return new DocPath ( path + "/" + p . getPath ( ) ) ; } | Return the path by appending the specified path to the current path . |
472 | void setCurrentBytes ( String className , byte [ ] bytes ) { ClassInfo ci = get ( className ) ; ci . setCurrentBytes ( bytes ) ; } | Map a class name to the current compiled class bytes . |
473 | public TypeElement loadClass ( String name ) { try { Name nameImpl = names . fromString ( name ) ; ModuleSymbol mod = syms . inferModule ( Convert . packagePart ( nameImpl ) ) ; ClassSymbol c = finder . loadClass ( mod != null ? mod : syms . errModule , nameImpl ) ; return c ; } catch ( CompletionFailure ex ) { chk . completionError ( null , ex ) ; return null ; } } | Load a class by qualified name . |
474 | public static MultiTaskListener instance ( Context context ) { MultiTaskListener instance = context . get ( taskListenerKey ) ; if ( instance == null ) instance = new MultiTaskListener ( context ) ; return instance ; } | Get the MultiTaskListener instance for this context . |
475 | public boolean handleOption ( Option option , String value ) { switch ( option ) { case ENCODING : encodingName = value ; return true ; case MULTIRELEASE : multiReleaseValue = value ; locations . setMultiReleaseValue ( value ) ; return true ; default : return locations . handleOption ( option , value ) ; } } | Common back end for OptionHelper handleFileManagerOption . |
476 | public boolean handleOptions ( Map < Option , String > map ) { boolean ok = true ; for ( Map . Entry < Option , String > e : map . entrySet ( ) ) { try { ok = ok & handleOption ( e . getKey ( ) , e . getValue ( ) ) ; } catch ( IllegalArgumentException ex ) { log . error ( Errors . IllegalArgumentForOption ( e . getKey ( ) . getPrimaryName ( ) , ex . getMessage ( ) ) ) ; ok = false ; } } return ok ; } | Call handleOption for collection of options and corresponding values . |
477 | @ DefinedBy ( Api . COMPILER ) public JavaFileObject getSource ( ) { if ( source == null ) return null ; else return source . getFile ( ) ; } | Get the name of the source file referred to by this diagnostic . |
478 | @ DefinedBy ( Api . COMPILER ) public long getLineNumber ( ) { if ( sourcePosition == null ) { sourcePosition = new SourcePosition ( ) ; } return sourcePosition . getLineNumber ( ) ; } | Get the line number within the source referred to by this diagnostic . |
479 | @ DefinedBy ( Api . COMPILER ) public long getColumnNumber ( ) { if ( sourcePosition == null ) { sourcePosition = new SourcePosition ( ) ; } return sourcePosition . getColumnNumber ( ) ; } | Get the column number within the line of source referred to by this diagnostic . |
480 | public static boolean isValidImportString ( String s ) { if ( s . equals ( "*" ) ) return true ; boolean valid = true ; String t = s ; int index = t . indexOf ( '*' ) ; if ( index != - 1 ) { if ( index == t . length ( ) - 1 ) { if ( index - 1 >= 0 ) { valid = t . charAt ( index - 1 ) == '.' ; t = t . substring ( 0 , t . length ( ) - 2 ) ; } } else return false ; } if ( valid ) { String [ ] javaIds = t . split ( "\\." , t . length ( ) + 2 ) ; for ( String javaId : javaIds ) valid &= SourceVersion . isIdentifier ( javaId ) ; } return valid ; } | Return true if the argument string is a valid import - style string specifying claimed annotations ; return false otherwise . |
481 | public void buildPackageDescription ( XMLNode node , Content packageContentTree ) { if ( configuration . nocomment ) { return ; } packageWriter . addPackageDescription ( packageContentTree ) ; } | Build the description of the summary . |
482 | protected void addLevelInfo ( TypeElement parent , Collection < TypeElement > collection , boolean isEnum , Content contentTree ) { if ( ! collection . isEmpty ( ) ) { Content ul = new HtmlTree ( HtmlTag . UL ) ; for ( TypeElement local : collection ) { HtmlTree li = new HtmlTree ( HtmlTag . LI ) ; li . addStyle ( HtmlStyle . circle ) ; addPartialInfo ( local , li ) ; addExtendsImplements ( parent , local , li ) ; addLevelInfo ( local , classtree . directSubClasses ( local , isEnum ) , isEnum , li ) ; ul . addContent ( li ) ; } contentTree . addContent ( ul ) ; } } | Add each level of the class tree . For each sub - class or sub - interface indents the next level information . Recurses itself to add sub - classes info . |
483 | protected PrintWriter wrapWriter ( OutputStream o ) throws Util . Exit { try { return new PrintWriter ( new OutputStreamWriter ( o , "ISO8859_1" ) , true ) ; } catch ( UnsupportedEncodingException use ) { util . bug ( "encoding.iso8859_1.not.found" ) ; return null ; } } | We explicitly need to write ASCII files because that is what C compilers understand . |
484 | public void run ( ) throws IOException , ClassNotFoundException , Util . Exit { int i = 0 ; if ( outFile != null ) { ByteArrayOutputStream bout = new ByteArrayOutputStream ( 8192 ) ; writeFileTop ( bout ) ; for ( TypeElement t : classes ) { write ( bout , t ) ; } writeIfChanged ( bout . toByteArray ( ) , outFile ) ; } else { for ( TypeElement t : classes ) { ByteArrayOutputStream bout = new ByteArrayOutputStream ( 8192 ) ; writeFileTop ( bout ) ; write ( bout , t ) ; writeIfChanged ( bout . toByteArray ( ) , getFileObject ( t . getQualifiedName ( ) ) ) ; } } } | After initializing state of an instance use this method to start processing . |
485 | List < VariableElement > getAllFields ( TypeElement subclazz ) { List < VariableElement > fields = new ArrayList < > ( ) ; TypeElement cd = null ; Stack < TypeElement > s = new Stack < > ( ) ; cd = subclazz ; while ( true ) { s . push ( cd ) ; TypeElement c = ( TypeElement ) ( types . asElement ( cd . getSuperclass ( ) ) ) ; if ( c == null ) break ; cd = c ; } while ( ! s . empty ( ) ) { cd = s . pop ( ) ; fields . addAll ( ElementFilter . fieldsIn ( cd . getEnclosedElements ( ) ) ) ; } return fields ; } | Including super classes fields . |
486 | String signature ( ExecutableElement e ) { StringBuilder sb = new StringBuilder ( "(" ) ; String sep = "" ; for ( VariableElement p : e . getParameters ( ) ) { sb . append ( sep ) ; sb . append ( types . erasure ( p . asType ( ) ) . toString ( ) ) ; sep = "," ; } sb . append ( ")" ) ; return sb . toString ( ) ; } | c . f . MethodDoc . signature |
487 | public static String pkgNameOfClassName ( String fqClassName ) { int i = fqClassName . lastIndexOf ( '.' ) ; String pkg = i == - 1 ? "" : fqClassName . substring ( 0 , i ) ; return ":" + pkg ; } | Extract the package name from a fully qualified class name . |
488 | public static String normalizeDriveLetter ( String file ) { if ( file . length ( ) > 2 && file . charAt ( 1 ) == ':' ) { return Character . toUpperCase ( file . charAt ( 0 ) ) + file . substring ( 1 ) ; } else if ( file . length ( ) > 3 && file . charAt ( 0 ) == '*' && file . charAt ( 2 ) == ':' ) { return file . substring ( 0 , 1 ) + Character . toUpperCase ( file . charAt ( 1 ) ) + file . substring ( 2 ) ; } return file ; } | Normalize windows drive letter paths to upper case to enable string comparison . |
489 | public static String findServerSettings ( String [ ] args ) { for ( String s : args ) { if ( s . startsWith ( "--server:" ) ) { return s ; } } return null ; } | Locate the setting for the server properties . |
490 | void setWrap ( Collection < Unit > exceptUnit , Collection < Unit > plusUnfiltered ) { if ( isImport ( ) ) { si . setOuterWrap ( state . outerMap . wrapImport ( activeGuts , si ) ) ; } else { List < Unit > units ; if ( snippet ( ) . kind ( ) == Kind . METHOD ) { String name = ( ( MethodSnippet ) snippet ( ) ) . name ( ) ; units = plusUnfiltered . stream ( ) . filter ( u -> u . snippet ( ) . kind ( ) == Kind . METHOD && ( ( MethodSnippet ) u . snippet ( ) ) . name ( ) . equals ( name ) ) . collect ( toList ( ) ) ; } else { units = Collections . singletonList ( this ) ; } Set < Key > except = exceptUnit . stream ( ) . map ( u -> u . snippet ( ) . key ( ) ) . collect ( toSet ( ) ) ; Collection < Snippet > plus = plusUnfiltered . stream ( ) . filter ( u -> ! units . contains ( u ) ) . map ( Unit :: snippet ) . collect ( toList ( ) ) ; List < Snippet > snippets = units . stream ( ) . map ( Unit :: snippet ) . collect ( toList ( ) ) ; List < Wrap > wraps = units . stream ( ) . map ( u -> u . activeGuts ) . collect ( toList ( ) ) ; si . setOuterWrap ( state . outerMap . wrapInClass ( except , plus , snippets , wraps ) ) ; state . debug ( DBG_WRAP , "++setWrap() %s\n%s\n" , si , si . outerWrap ( ) . wrapped ( ) ) ; } } | Set the outer wrap of our Snippet |
491 | boolean corralIfNeeded ( Collection < Unit > working ) { if ( isRecoverable ( ) && si . corralled ( ) != null ) { activeGuts = si . corralled ( ) ; setWrap ( working , working ) ; return isAttemptingCorral = true ; } return isAttemptingCorral = false ; } | If it meets the conditions for corralling install the corralled wrap |
492 | Stream < ClassBytecodes > classesToLoad ( List < String > classnames ) { toRedefine = new ArrayList < > ( ) ; List < ClassBytecodes > toLoad = new ArrayList < > ( ) ; if ( status . isDefined ( ) && ! isImport ( ) ) { for ( String cn : classnames ) { ClassInfo ci = state . classTracker . get ( cn ) ; if ( ci . isLoaded ( ) ) { if ( ci . isCurrent ( ) ) { } else { toRedefine . add ( ci ) ; } } else { toLoad . add ( ci . toClassBytecodes ( ) ) ; dependenciesNeeded = true ; } } } return toLoad . stream ( ) ; } | Process the class information from the last compile . Requires loading of returned list . |
493 | private Status overwriteMatchingMethod ( MethodSnippet msi ) { String qpt = msi . qualifiedParameterTypes ( ) ; List < MethodSnippet > matching = state . methods ( ) . filter ( sn -> sn != null && sn != msi && sn . status ( ) . isActive ( ) && sn . name ( ) . equals ( msi . name ( ) ) && qpt . equals ( sn . qualifiedParameterTypes ( ) ) ) . collect ( toList ( ) ) ; Status overwrittenStatus = null ; for ( MethodSnippet sn : matching ) { overwrittenStatus = sn . status ( ) ; SnippetEvent se = new SnippetEvent ( sn , overwrittenStatus , OVERWRITTEN , false , msi , null , null ) ; sn . setOverwritten ( ) ; secondaryEvents . add ( se ) ; state . debug ( DBG_EVNT , "Overwrite event #%d -- key: %s before: %s status: %s sig: %b cause: %s\n" , secondaryEvents . size ( ) , se . snippet ( ) , se . previousStatus ( ) , se . status ( ) , se . isSignatureChange ( ) , se . causeSnippet ( ) ) ; } return overwrittenStatus ; } | types are the same . if so consider it an overwrite replacement . |
494 | public Bits dup ( ) { Assert . check ( currentState != BitsState . UNKNOWN ) ; Bits tmp = new Bits ( ) ; tmp . bits = dupBits ( ) ; currentState = BitsState . NORMAL ; return tmp ; } | Return a copy of this set . |
495 | public void inclRange ( int start , int limit ) { Assert . check ( currentState != BitsState . UNKNOWN ) ; sizeTo ( ( limit >>> wordshift ) + 1 ) ; for ( int x = start ; x < limit ; x ++ ) { bits [ x >>> wordshift ] = bits [ x >>> wordshift ] | ( 1 << ( x & wordmask ) ) ; } currentState = BitsState . NORMAL ; } | Include [ start .. limit ) in this set . |
496 | public void excl ( int x ) { Assert . check ( currentState != BitsState . UNKNOWN ) ; Assert . check ( x >= 0 ) ; sizeTo ( ( x >>> wordshift ) + 1 ) ; bits [ x >>> wordshift ] = bits [ x >>> wordshift ] & ~ ( 1 << ( x & wordmask ) ) ; currentState = BitsState . NORMAL ; } | Exclude x from this set . |
497 | public boolean isMember ( int x ) { Assert . check ( currentState != BitsState . UNKNOWN ) ; return 0 <= x && x < ( bits . length << wordshift ) && ( bits [ x >>> wordshift ] & ( 1 << ( x & wordmask ) ) ) != 0 ; } | Is x an element of this set? |
498 | public Bits diffSet ( Bits xs ) { Assert . check ( currentState != BitsState . UNKNOWN ) ; for ( int i = 0 ; i < bits . length ; i ++ ) { if ( i < xs . bits . length ) { bits [ i ] = bits [ i ] & ~ xs . bits [ i ] ; } } currentState = BitsState . NORMAL ; return this ; } | this set = this set \ xs . |
499 | public Bits xorSet ( Bits xs ) { Assert . check ( currentState != BitsState . UNKNOWN ) ; sizeTo ( xs . bits . length ) ; for ( int i = 0 ; i < xs . bits . length ; i ++ ) { bits [ i ] = bits [ i ] ^ xs . bits [ i ] ; } currentState = BitsState . NORMAL ; return this ; } | this set = this set ^ xs . |