idx
int64 0
41.2k
| question
stringlengths 74
4.21k
| target
stringlengths 5
888
|
---|---|---|
800 |
static String readResource ( String name ) throws IOException { String spec = String . format ( BUILTIN_FILE_PATH_FORMAT , name ) ; try ( InputStream in = JShellTool . class . getResourceAsStream ( spec ) ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( in ) ) ) { return reader . lines ( ) . collect ( Collectors . joining ( "\n" , "" , "\n" ) ) ; } }
|
Read a built - in file from resources
|
801 |
public Map < String , PubApi > getPubapis ( Collection < JavaFileObject > explicitJFOs , boolean explicits ) { Map < String , PubApi > result = new HashMap < > ( ) ; for ( ClassSymbol cs : publicApiPerClass . keySet ( ) ) { boolean amongExplicits = explicitJFOs . contains ( cs . sourcefile ) ; if ( explicits != amongExplicits ) continue ; String pkg = ":" + cs . packge ( ) . fullname ; PubApi currentPubApi = result . getOrDefault ( pkg , new PubApi ( ) ) ; result . put ( pkg , PubApi . mergeTypes ( currentPubApi , publicApiPerClass . get ( cs ) ) ) ; } return result ; }
|
Convert the map from class names to their pubapi to a map from package names to their pubapi .
|
802 |
@ SuppressWarnings ( "deprecation" ) public void visitPubapi ( Element e ) { if ( e == null ) return ; PubapiVisitor v = new PubapiVisitor ( ) ; v . visit ( e ) ; publicApiPerClass . put ( ( ClassSymbol ) e , v . getCollectedPubApi ( ) ) ; }
|
Visit the api of a class and construct a pubapi and store it into the pubapi_perclass map .
|
803 |
public static String flagNames ( long flags ) { StringBuilder sbuf = new StringBuilder ( ) ; int i = 0 ; long f = flags & StandardFlags ; while ( f != 0 ) { if ( ( f & 1 ) != 0 ) { sbuf . append ( " " ) ; sbuf . append ( flagName [ i ] ) ; } f = f >> 1 ; i ++ ; } return sbuf . toString ( ) ; }
|
Return flags as a string separated by .
|
804 |
void putChar ( ByteBuffer buf , int op , int x ) { buf . elems [ op ] = ( byte ) ( ( x >> 8 ) & 0xFF ) ; buf . elems [ op + 1 ] = ( byte ) ( ( x ) & 0xFF ) ; }
|
Write a character into given byte buffer ; byte buffer will not be grown .
|
805 |
void putInt ( ByteBuffer buf , int adr , int x ) { buf . elems [ adr ] = ( byte ) ( ( x >> 24 ) & 0xFF ) ; buf . elems [ adr + 1 ] = ( byte ) ( ( x >> 16 ) & 0xFF ) ; buf . elems [ adr + 2 ] = ( byte ) ( ( x >> 8 ) & 0xFF ) ; buf . elems [ adr + 3 ] = ( byte ) ( ( x ) & 0xFF ) ; }
|
Write an integer into given byte buffer ; byte buffer will not be grown .
|
806 |
Name typeSig ( Type type ) { Assert . check ( signatureGen . isEmpty ( ) ) ; signatureGen . assembleSig ( type ) ; Name n = signatureGen . toName ( ) ; signatureGen . reset ( ) ; return n ; }
|
Return signature of given type
|
807 |
int writeAttr ( Name attrName ) { databuf . appendChar ( pool . put ( attrName ) ) ; databuf . appendInt ( 0 ) ; return databuf . length ; }
|
Write header for an attribute to data buffer and return position past attribute length index .
|
808 |
int writeMethodParametersAttr ( MethodSymbol m ) { MethodType ty = m . externalType ( types ) . asMethodType ( ) ; final int allparams = ty . argtypes . size ( ) ; if ( m . params != null && allparams != 0 ) { final int attrIndex = writeAttr ( names . MethodParameters ) ; databuf . appendByte ( allparams ) ; for ( VarSymbol s : m . extraParams ) { final int flags = ( ( int ) s . flags ( ) & ( FINAL | SYNTHETIC | MANDATED ) ) | ( ( int ) m . flags ( ) & SYNTHETIC ) ; databuf . appendChar ( pool . put ( s . name ) ) ; databuf . appendChar ( flags ) ; } for ( VarSymbol s : m . params ) { final int flags = ( ( int ) s . flags ( ) & ( FINAL | SYNTHETIC | MANDATED ) ) | ( ( int ) m . flags ( ) & SYNTHETIC ) ; databuf . appendChar ( pool . put ( s . name ) ) ; databuf . appendChar ( flags ) ; } for ( VarSymbol s : m . capturedLocals ) { final int flags = ( ( int ) s . flags ( ) & ( FINAL | SYNTHETIC | MANDATED ) ) | ( ( int ) m . flags ( ) & SYNTHETIC ) ; databuf . appendChar ( pool . put ( s . name ) ) ; databuf . appendChar ( flags ) ; } endAttr ( attrIndex ) ; return 1 ; } else return 0 ; }
|
Write method parameter names attribute .
|
809 |
void writeCompoundAttribute ( Attribute . Compound c ) { databuf . appendChar ( pool . put ( typeSig ( c . type ) ) ) ; databuf . appendChar ( c . values . length ( ) ) ; for ( Pair < Symbol . MethodSymbol , Attribute > p : c . values ) { databuf . appendChar ( pool . put ( p . fst . name ) ) ; p . snd . accept ( awriter ) ; } }
|
Write a compound attribute excluding the
|
810 |
void writeInnerClasses ( ) { int alenIdx = writeAttr ( names . InnerClasses ) ; databuf . appendChar ( innerClassesQueue . length ( ) ) ; for ( List < ClassSymbol > l = innerClassesQueue . toList ( ) ; l . nonEmpty ( ) ; l = l . tail ) { ClassSymbol inner = l . head ; inner . markAbstractIfNeeded ( types ) ; char flags = ( char ) adjustFlags ( inner . flags_field ) ; if ( ( flags & INTERFACE ) != 0 ) flags |= ABSTRACT ; flags &= ~ STRICTFP ; if ( dumpInnerClassModifiers ) { PrintWriter pw = log . getWriter ( Log . WriterKind . ERROR ) ; pw . println ( "INNERCLASS " + inner . name ) ; pw . println ( "---" + flagNames ( flags ) ) ; } databuf . appendChar ( pool . get ( inner ) ) ; databuf . appendChar ( inner . owner . kind == TYP && ! inner . name . isEmpty ( ) ? pool . get ( inner . owner ) : 0 ) ; databuf . appendChar ( ! inner . name . isEmpty ( ) ? pool . get ( inner . name ) : 0 ) ; databuf . appendChar ( flags ) ; } endAttr ( alenIdx ) ; }
|
Write inner classes attribute .
|
811 |
void writeField ( VarSymbol v ) { int flags = adjustFlags ( v . flags ( ) ) ; databuf . appendChar ( flags ) ; if ( dumpFieldModifiers ) { PrintWriter pw = log . getWriter ( Log . WriterKind . ERROR ) ; pw . println ( "FIELD " + v . name ) ; pw . println ( "---" + flagNames ( v . flags ( ) ) ) ; } databuf . appendChar ( pool . put ( v . name ) ) ; databuf . appendChar ( pool . put ( typeSig ( v . erasure ( types ) ) ) ) ; int acountIdx = beginAttrs ( ) ; int acount = 0 ; if ( v . getConstValue ( ) != null ) { int alenIdx = writeAttr ( names . ConstantValue ) ; databuf . appendChar ( pool . put ( v . getConstValue ( ) ) ) ; endAttr ( alenIdx ) ; acount ++ ; } acount += writeMemberAttrs ( v ) ; endAttrs ( acountIdx , acount ) ; }
|
Write field symbol entering all references into constant pool .
|
812 |
public final R visit ( DocTree node , P p ) { return ( node == null ) ? null : node . accept ( this , p ) ; }
|
Invokes the appropriate visit method specific to the type of the node .
|
813 |
public final R visit ( Iterable < ? extends DocTree > nodes , P p ) { R r = null ; if ( nodes != null ) { for ( DocTree node : nodes ) r = visit ( node , p ) ; } return r ; }
|
Invokes the appropriate visit method on each of a sequence of nodes .
|
814 |
private Content getInheritedTagletOutput ( boolean isParameters , Element holder , TagletWriter writer , List < ? extends Element > formalParameters , Set < String > alreadyDocumented ) { Utils utils = writer . configuration ( ) . utils ; Content result = writer . getOutputInstance ( ) ; if ( ( ! alreadyDocumented . contains ( null ) ) && utils . isExecutableElement ( holder ) ) { for ( int i = 0 ; i < formalParameters . size ( ) ; i ++ ) { if ( alreadyDocumented . contains ( String . valueOf ( i ) ) ) { continue ; } Input input = new DocFinder . Input ( writer . configuration ( ) . utils , holder , this , Integer . toString ( i ) , ! isParameters ) ; DocFinder . Output inheritedDoc = DocFinder . search ( writer . configuration ( ) , input ) ; if ( inheritedDoc . inlineTags != null && ! inheritedDoc . inlineTags . isEmpty ( ) ) { Element e = formalParameters . get ( i ) ; String lname = isParameters ? utils . getSimpleName ( e ) : utils . getTypeName ( e . asType ( ) , false ) ; CommentHelper ch = utils . getCommentHelper ( holder ) ; ch . setOverrideElement ( inheritedDoc . holder ) ; Content content = processParamTag ( holder , isParameters , writer , inheritedDoc . holderTag , lname , alreadyDocumented . isEmpty ( ) ) ; result . addContent ( content ) ; } alreadyDocumented . add ( String . valueOf ( i ) ) ; } } return result ; }
|
Loop through each individual parameter despite not having a corresponding param tag try to inherit it .
|
815 |
public Graph < T > reduce ( ) { Builder < T > builder = new Builder < > ( ) ; nodes . stream ( ) . forEach ( u -> { builder . addNode ( u ) ; edges . get ( u ) . stream ( ) . filter ( v -> ! pathExists ( u , v , false ) ) . forEach ( v -> builder . addEdge ( u , v ) ) ; } ) ; return builder . build ( ) ; }
|
Returns a new Graph after transitive reduction
|
816 |
public Graph < T > reduce ( Graph < T > g ) { boolean subgraph = nodes . containsAll ( g . nodes ) && g . edges . keySet ( ) . stream ( ) . allMatch ( u -> adjacentNodes ( u ) . containsAll ( g . adjacentNodes ( u ) ) ) ; if ( ! subgraph ) { throw new IllegalArgumentException ( g + " is not a subgraph of " + this ) ; } Builder < T > builder = new Builder < > ( ) ; nodes . stream ( ) . forEach ( u -> { builder . addNode ( u ) ; edges . get ( u ) . stream ( ) . filter ( v -> ! g . pathExists ( u , v ) && ! pathExists ( u , v , false ) ) . forEach ( v -> builder . addEdge ( u , v ) ) ; } ) ; g . edges ( ) . keySet ( ) . stream ( ) . forEach ( u -> g . adjacentNodes ( u ) . stream ( ) . filter ( v -> isAdjacent ( u , v ) ) . forEach ( v -> builder . addEdge ( u , v ) ) ) ; return builder . build ( ) . reduce ( ) ; }
|
Returns a new Graph after transitive reduction . All edges in the given g takes precedence over this graph .
|
817 |
public Stream < T > orderedNodes ( ) { TopoSorter < T > sorter = new TopoSorter < > ( this ) ; return sorter . result . stream ( ) ; }
|
Returns nodes sorted in topological order .
|
818 |
public void ordered ( Consumer < T > action ) { TopoSorter < T > sorter = new TopoSorter < > ( this ) ; sorter . ordered ( action ) ; }
|
Traverse this graph and performs the given action in topological order
|
819 |
public void reverse ( Consumer < T > action ) { TopoSorter < T > sorter = new TopoSorter < > ( this ) ; sorter . reverse ( action ) ; }
|
Traverses this graph and performs the given action in reverse topological order
|
820 |
public Graph < T > transpose ( ) { Builder < T > builder = new Builder < > ( ) ; builder . addNodes ( nodes ) ; edges . keySet ( ) . forEach ( u -> { edges . get ( u ) . stream ( ) . forEach ( v -> builder . addEdge ( v , u ) ) ; } ) ; return builder . build ( ) ; }
|
Returns a transposed graph from this graph
|
821 |
public Set < T > dfs ( Set < T > roots ) { Deque < T > deque = new LinkedList < > ( roots ) ; Set < T > visited = new HashSet < > ( ) ; while ( ! deque . isEmpty ( ) ) { T u = deque . pop ( ) ; if ( ! visited . contains ( u ) ) { visited . add ( u ) ; if ( contains ( u ) ) { adjacentNodes ( u ) . stream ( ) . filter ( v -> ! visited . contains ( v ) ) . forEach ( deque :: push ) ; } } } return visited ; }
|
Returns all nodes reachable from the given set of roots .
|
822 |
private boolean pathExists ( T u , T v , boolean includeAdjacent ) { if ( ! nodes . contains ( u ) || ! nodes . contains ( v ) ) { return false ; } if ( includeAdjacent && isAdjacent ( u , v ) ) { return true ; } Deque < T > stack = new LinkedList < > ( ) ; Set < T > visited = new HashSet < > ( ) ; stack . push ( u ) ; while ( ! stack . isEmpty ( ) ) { T node = stack . pop ( ) ; if ( node . equals ( v ) ) { return true ; } if ( ! visited . contains ( node ) ) { visited . add ( node ) ; edges . get ( node ) . stream ( ) . filter ( e -> includeAdjacent || ! node . equals ( u ) || ! e . equals ( v ) ) . forEach ( stack :: push ) ; } } assert ! visited . contains ( v ) ; return false ; }
|
Returns true if there exists a path from u to v in this graph . If includeAdjacent is false it returns true if there exists another path from u to v of distance > 1
|
823 |
boolean foundGroupFormat ( Map < String , ? > map , String elementFormat ) { if ( map . containsKey ( elementFormat ) ) { initMessages ( ) ; messages . error ( "doclet.Same_element_name_used" , elementFormat ) ; return true ; } return false ; }
|
Search if the given map has the given element format .
|
824 |
public Map < String , SortedSet < ModuleElement > > groupModules ( Set < ModuleElement > modules ) { Map < String , SortedSet < ModuleElement > > groupModuleMap = new HashMap < > ( ) ; String defaultGroupName = ( elementNameGroupMap . isEmpty ( ) && regExpGroupMap . isEmpty ( ) ) ? configuration . getResources ( ) . getText ( "doclet.Modules" ) : configuration . getResources ( ) . getText ( "doclet.Other_Modules" ) ; if ( ! groupList . contains ( defaultGroupName ) ) { groupList . add ( defaultGroupName ) ; } for ( ModuleElement mdl : modules ) { String moduleName = mdl . isUnnamed ( ) ? null : mdl . getQualifiedName ( ) . toString ( ) ; String groupName = mdl . isUnnamed ( ) ? null : elementNameGroupMap . get ( moduleName ) ; if ( groupName == null ) { groupName = regExpGroupName ( moduleName ) ; } if ( groupName == null ) { groupName = defaultGroupName ; } getModuleList ( groupModuleMap , groupName ) . add ( mdl ) ; } return groupModuleMap ; }
|
Group the modules according the grouping information provided on the command line . Given a list of modules search each module name in regular expression map as well as module name map to get the corresponding group name . Create another map with mapping of group name to the module list which will fall under the specified group . If any module doesn t belong to any specified group on the command line then a new group named Other Modules will be created for it . If there are no groups found in other words if - group option is not at all used then all the modules will be grouped under group Modules .
|
825 |
public Map < String , SortedSet < PackageElement > > groupPackages ( Set < PackageElement > packages ) { Map < String , SortedSet < PackageElement > > groupPackageMap = new HashMap < > ( ) ; String defaultGroupName = ( elementNameGroupMap . isEmpty ( ) && regExpGroupMap . isEmpty ( ) ) ? configuration . getResources ( ) . getText ( "doclet.Packages" ) : configuration . getResources ( ) . getText ( "doclet.Other_Packages" ) ; if ( ! groupList . contains ( defaultGroupName ) ) { groupList . add ( defaultGroupName ) ; } for ( PackageElement pkg : packages ) { String pkgName = pkg . isUnnamed ( ) ? null : configuration . utils . getPackageName ( pkg ) ; String groupName = pkg . isUnnamed ( ) ? null : elementNameGroupMap . get ( pkgName ) ; if ( groupName == null ) { groupName = regExpGroupName ( pkgName ) ; } if ( groupName == null ) { groupName = defaultGroupName ; } getPkgList ( groupPackageMap , groupName ) . add ( pkg ) ; } return groupPackageMap ; }
|
Group the packages according the grouping information provided on the command line . Given a list of packages search each package name in regular expression map as well as package name map to get the corresponding group name . Create another map with mapping of group name to the package list which will fall under the specified group . If any package doesn t belong to any specified group on the command line then a new group named Other Packages will be created for it . If there are no groups found in other words if - group option is not at all used then all the packages will be grouped under group Packages .
|
826 |
String regExpGroupName ( String elementName ) { for ( String regexp : sortedRegExpList ) { if ( elementName . startsWith ( regexp ) ) { return regExpGroupMap . get ( regexp ) ; } } return null ; }
|
Search for element name in the sorted regular expression list if found return the group name . If not return null .
|
827 |
SortedSet < ModuleElement > getModuleList ( Map < String , SortedSet < ModuleElement > > map , String groupname ) { return map . computeIfAbsent ( groupname , g -> new TreeSet < > ( configuration . utils . makeModuleComparator ( ) ) ) ; }
|
For the given group name return the module list on which it is mapped . Create a new list if not found .
|
828 |
public Type wildUpperBound ( Type t ) { if ( t . hasTag ( WILDCARD ) ) { WildcardType w = ( WildcardType ) t ; if ( w . isSuperBound ( ) ) return w . bound == null ? syms . objectType : w . bound . bound ; else return wildUpperBound ( w . type ) ; } else return t ; }
|
Get a wildcard s upper bound returning non - wildcards unchanged .
|
829 |
public Type cvarUpperBound ( Type t ) { if ( t . hasTag ( TYPEVAR ) ) { TypeVar v = ( TypeVar ) t ; return v . isCaptured ( ) ? cvarUpperBound ( v . bound ) : v ; } else return t ; }
|
Get a capture variable s upper bound returning other types unchanged .
|
830 |
public Type wildLowerBound ( Type t ) { if ( t . hasTag ( WILDCARD ) ) { WildcardType w = ( WildcardType ) t ; return w . isExtendsBound ( ) ? syms . botType : wildLowerBound ( w . type ) ; } else return t ; }
|
Get a wildcard s lower bound returning non - wildcards unchanged .
|
831 |
public Type findDescriptorType ( Type origin ) throws FunctionDescriptorLookupError { return descCache . get ( origin . tsym ) . getType ( origin ) ; }
|
Find the type of the method descriptor associated to this class symbol - if the symbol origin is not a functional interface an exception is thrown .
|
832 |
public boolean isSubtypeUnchecked ( Type t , Type s , Warner warn ) { boolean result = isSubtypeUncheckedInternal ( t , s , true , warn ) ; if ( result ) { checkUnsafeVarargsConversion ( t , s , warn ) ; } return result ; }
|
Is t an unchecked subtype of s?
|
833 |
public boolean isSubtypes ( List < Type > ts , List < Type > ss ) { while ( ts . tail != null && ss . tail != null && isSubtype ( ts . head , ss . head ) ) { ts = ts . tail ; ss = ss . tail ; } return ts . tail == null && ss . tail == null ; }
|
Are corresponding elements of ts subtypes of ss? If lists are of different length return false .
|
834 |
public boolean isSubtypesUnchecked ( List < Type > ts , List < Type > ss , Warner warn ) { while ( ts . tail != null && ss . tail != null && isSubtypeUnchecked ( ts . head , ss . head , warn ) ) { ts = ts . tail ; ss = ss . tail ; } return ts . tail == null && ss . tail == null ; }
|
Are corresponding elements of ts subtypes of ss allowing unchecked conversions? If lists are of different length return false .
|
835 |
public boolean isSuperType ( Type t , Type s ) { switch ( t . getTag ( ) ) { case ERROR : return true ; case UNDETVAR : { UndetVar undet = ( UndetVar ) t ; if ( t == s || undet . qtype == s || s . hasTag ( ERROR ) || s . hasTag ( BOT ) ) { return true ; } undet . addBound ( InferenceBound . LOWER , s , this ) ; return true ; } default : return isSubtype ( s , t ) ; } }
|
Is t a supertype of s?
|
836 |
public boolean isSameTypes ( List < Type > ts , List < Type > ss ) { return isSameTypes ( ts , ss , false ) ; }
|
Are corresponding elements of the lists the same type? If lists are of different length return false .
|
837 |
public int dimensions ( Type t ) { int result = 0 ; while ( t . hasTag ( ARRAY ) ) { result ++ ; t = elemtype ( t ) ; } return result ; }
|
The number of dimensions of an array type .
|
838 |
public ArrayType makeArrayType ( Type t ) { if ( t . hasTag ( VOID ) || t . hasTag ( PACKAGE ) ) { Assert . error ( "Type t must not be a VOID or PACKAGE type, " + t . toString ( ) ) ; } return new ArrayType ( t , syms . arrayClass ) ; }
|
Returns an ArrayType with the component type t
|
839 |
public Type asOuterSuper ( Type t , Symbol sym ) { switch ( t . getTag ( ) ) { case CLASS : do { Type s = asSuper ( t , sym ) ; if ( s != null ) return s ; t = t . getEnclosingType ( ) ; } while ( t . hasTag ( CLASS ) ) ; return null ; case ARRAY : return isSubtype ( t , sym . type ) ? sym . type : null ; case TYPEVAR : return asSuper ( t , sym ) ; case ERROR : return t ; default : return null ; } }
|
Return the base type of t or any of its outer types that starts with the given symbol . If none exists return null .
|
840 |
public Type asEnclosingSuper ( Type t , Symbol sym ) { switch ( t . getTag ( ) ) { case CLASS : do { Type s = asSuper ( t , sym ) ; if ( s != null ) return s ; Type outer = t . getEnclosingType ( ) ; t = ( outer . hasTag ( CLASS ) ) ? outer : ( t . tsym . owner . enclClass ( ) != null ) ? t . tsym . owner . enclClass ( ) . type : Type . noType ; } while ( t . hasTag ( CLASS ) ) ; return null ; case ARRAY : return isSubtype ( t , sym . type ) ? sym . type : null ; case TYPEVAR : return asSuper ( t , sym ) ; case ERROR : return t ; default : return null ; } }
|
Return the base type of t or any of its enclosing types that starts with the given symbol . If none exists return null .
|
841 |
public Type memberType ( Type t , Symbol sym ) { return ( sym . flags ( ) & STATIC ) != 0 ? sym . type : memberType . visit ( t , sym ) ; }
|
The type of given symbol seen as a member of t .
|
842 |
public List < Type > getBounds ( TypeVar t ) { if ( t . bound . hasTag ( NONE ) ) return List . nil ( ) ; else if ( t . bound . isErroneous ( ) || ! t . bound . isCompound ( ) ) return List . of ( t . bound ) ; else if ( ( erasure ( t ) . tsym . flags ( ) & INTERFACE ) == 0 ) return interfaces ( t ) . prepend ( supertype ( t ) ) ; else return interfaces ( t ) ; }
|
Return list of bounds of the given type variable .
|
843 |
public MethodSymbol firstUnimplementedAbstract ( ClassSymbol sym ) { try { return firstUnimplementedAbstractImpl ( sym , sym ) ; } catch ( CompletionFailure ex ) { chk . completionError ( enter . getEnv ( sym ) . tree . pos ( ) , ex ) ; return null ; } }
|
Return first abstract member of class sym .
|
844 |
public boolean hasSameBounds ( ForAll t , ForAll s ) { List < Type > l1 = t . tvars ; List < Type > l2 = s . tvars ; while ( l1 . nonEmpty ( ) && l2 . nonEmpty ( ) && isSameType ( l1 . head . getUpperBound ( ) , subst ( l2 . head . getUpperBound ( ) , s . tvars , t . tvars ) ) ) { l1 = l1 . tail ; l2 = l2 . tail ; } return l1 . isEmpty ( ) && l2 . isEmpty ( ) ; }
|
Does t have the same bounds for quantified variables as s?
|
845 |
public List < Type > newInstances ( List < Type > tvars ) { List < Type > tvars1 = tvars . map ( newInstanceFun ) ; for ( List < Type > l = tvars1 ; l . nonEmpty ( ) ; l = l . tail ) { TypeVar tv = ( TypeVar ) l . head ; tv . bound = subst ( tv . bound , tvars , tvars1 ) ; } return tvars1 ; }
|
Create new vector of type variables from list of variables changing all recursive bounds from old to new list .
|
846 |
public List < Type > closure ( Type t ) { List < Type > cl = closureCache . get ( t ) ; if ( cl == null ) { Type st = supertype ( t ) ; if ( ! t . isCompound ( ) ) { if ( st . hasTag ( CLASS ) ) { cl = insert ( closure ( st ) , t ) ; } else if ( st . hasTag ( TYPEVAR ) ) { cl = closure ( st ) . prepend ( t ) ; } else { cl = List . of ( t ) ; } } else { cl = closure ( supertype ( t ) ) ; } for ( List < Type > l = interfaces ( t ) ; l . nonEmpty ( ) ; l = l . tail ) cl = union ( cl , closure ( l . head ) ) ; closureCache . put ( t , cl ) ; } return cl ; }
|
Returns the closure of a class or interface type .
|
847 |
public Collector < Type , ClosureHolder , List < Type > > closureCollector ( boolean minClosure , BiPredicate < Type , Type > shouldSkip ) { return Collector . of ( ( ) -> new ClosureHolder ( minClosure , shouldSkip ) , ClosureHolder :: add , ClosureHolder :: merge , ClosureHolder :: closure ) ; }
|
Collect types into a new closure ( using a
|
848 |
public List < Type > intersect ( List < Type > cl1 , List < Type > cl2 ) { if ( cl1 == cl2 ) return cl1 ; if ( cl1 . isEmpty ( ) || cl2 . isEmpty ( ) ) return List . nil ( ) ; if ( cl1 . head . tsym . precedes ( cl2 . head . tsym , this ) ) return intersect ( cl1 . tail , cl2 ) ; if ( cl2 . head . tsym . precedes ( cl1 . head . tsym , this ) ) return intersect ( cl1 , cl2 . tail ) ; if ( isSameType ( cl1 . head , cl2 . head ) ) return intersect ( cl1 . tail , cl2 . tail ) . prepend ( cl1 . head ) ; if ( cl1 . head . tsym == cl2 . head . tsym && cl1 . head . hasTag ( CLASS ) && cl2 . head . hasTag ( CLASS ) ) { if ( cl1 . head . isParameterized ( ) && cl2 . head . isParameterized ( ) ) { Type merge = merge ( cl1 . head , cl2 . head ) ; return intersect ( cl1 . tail , cl2 . tail ) . prepend ( merge ) ; } if ( cl1 . head . isRaw ( ) || cl2 . head . isRaw ( ) ) return intersect ( cl1 . tail , cl2 . tail ) . prepend ( erasure ( cl1 . head ) ) ; } return intersect ( cl1 . tail , cl2 . tail ) ; }
|
Intersect two closures
|
849 |
private Type compoundMin ( List < Type > cl ) { if ( cl . isEmpty ( ) ) return syms . objectType ; List < Type > compound = closureMin ( cl ) ; if ( compound . isEmpty ( ) ) return null ; else if ( compound . tail . isEmpty ( ) ) return compound . head ; else return makeIntersectionType ( compound ) ; }
|
Return the minimum type of a closure a compound type if no unique minimum exists .
|
850 |
private List < Type > closureMin ( List < Type > cl ) { ListBuffer < Type > classes = new ListBuffer < > ( ) ; ListBuffer < Type > interfaces = new ListBuffer < > ( ) ; Set < Type > toSkip = new HashSet < > ( ) ; while ( ! cl . isEmpty ( ) ) { Type current = cl . head ; boolean keep = ! toSkip . contains ( current ) ; if ( keep && current . hasTag ( TYPEVAR ) ) { for ( Type t : cl . tail ) { if ( isSubtypeNoCapture ( t , current ) ) { keep = false ; break ; } } } if ( keep ) { if ( current . isInterface ( ) ) interfaces . append ( current ) ; else classes . append ( current ) ; for ( Type t : cl . tail ) { if ( isSubtypeNoCapture ( current , t ) ) toSkip . add ( t ) ; } } cl = cl . tail ; } return classes . appendList ( interfaces ) . toList ( ) ; }
|
Return the minimum types of a closure suitable for computing compoundMin or glb .
|
851 |
public Type lub ( List < Type > ts ) { return lub ( ts . toArray ( new Type [ ts . length ( ) ] ) ) ; }
|
Return the least upper bound of list of types . if the lub does not exist return null .
|
852 |
public boolean returnTypeSubstitutable ( Type r1 , Type r2 ) { if ( hasSameArgs ( r1 , r2 ) ) return resultSubtype ( r1 , r2 , noWarnings ) ; else return covariantReturnType ( r1 . getReturnType ( ) , erasure ( r2 . getReturnType ( ) ) , noWarnings ) ; }
|
Return - Type - Substitutable .
|
853 |
public Type boxedTypeOrType ( Type t ) { return t . isPrimitive ( ) ? boxedClass ( t ) . type : t ; }
|
Return the boxed type if t is primitive otherwise return t itself .
|
854 |
public Type unboxedType ( Type t ) { for ( int i = 0 ; i < syms . boxedName . length ; i ++ ) { Name box = syms . boxedName [ i ] ; if ( box != null && asSuper ( t , syms . enterClass ( syms . java_base , box ) ) != null ) return syms . typeOfTag [ i ] ; } return Type . noType ; }
|
Return the primitive type corresponding to a boxed type .
|
855 |
public Type unboxedTypeOrType ( Type t ) { Type unboxedType = unboxedType ( t ) ; return unboxedType . hasTag ( NONE ) ? t : unboxedType ; }
|
Return the unboxed type if t is a boxed class otherwise return t itself .
|
856 |
public List < Type > capture ( List < Type > ts ) { List < Type > buf = List . nil ( ) ; for ( Type t : ts ) { buf = buf . prepend ( capture ( t ) ) ; } return buf . reverse ( ) ; }
|
Capture conversion as specified by the JLS .
|
857 |
public void adapt ( Type source , Type target , ListBuffer < Type > from , ListBuffer < Type > to ) throws AdaptFailure { new Adapter ( from , to ) . adapt ( source , target ) ; }
|
Adapt a type by computing a substitution which maps a source type to a target type .
|
858 |
public AnnotationTypeDoc annotationType ( ) { ClassSymbol atsym = ( ClassSymbol ) annotation . type . tsym ; if ( annotation . type . isErroneous ( ) ) { env . warning ( null , "javadoc.class_not_found" , annotation . type . toString ( ) ) ; return new AnnotationTypeDocImpl ( env , atsym ) ; } else { return ( AnnotationTypeDoc ) env . getClassDoc ( atsym ) ; } }
|
Returns the annotation type of this annotation .
|
859 |
public ElementValuePair [ ] elementValues ( ) { List < Pair < MethodSymbol , Attribute > > vals = annotation . values ; ElementValuePair res [ ] = new ElementValuePair [ vals . length ( ) ] ; int i = 0 ; for ( Pair < MethodSymbol , Attribute > val : vals ) { res [ i ++ ] = new ElementValuePairImpl ( env , val . fst , val . snd ) ; } return res ; }
|
Returns this annotation s elements and their values . Only those explicitly present in the annotation are included not those assuming their default values . Returns an empty array if there are none .
|
860 |
public List < Taglet > getCustomTaglets ( Element e ) { switch ( e . getKind ( ) ) { case CONSTRUCTOR : return getConstructorCustomTaglets ( ) ; case METHOD : return getMethodCustomTaglets ( ) ; case ENUM_CONSTANT : case FIELD : return getFieldCustomTaglets ( ) ; case ANNOTATION_TYPE : case INTERFACE : case CLASS : case ENUM : return getTypeCustomTaglets ( ) ; case MODULE : return getModuleCustomTaglets ( ) ; case PACKAGE : return getPackageCustomTaglets ( ) ; case OTHER : return getOverviewCustomTaglets ( ) ; default : throw new AssertionError ( "unknown element: " + e + " ,kind: " + e . getKind ( ) ) ; } }
|
Returns the custom tags for a given element .
|
861 |
private void initCustomTaglets ( ) { moduleTags = new ArrayList < > ( ) ; packageTags = new ArrayList < > ( ) ; typeTags = new ArrayList < > ( ) ; fieldTags = new ArrayList < > ( ) ; constructorTags = new ArrayList < > ( ) ; methodTags = new ArrayList < > ( ) ; inlineTags = new ArrayList < > ( ) ; overviewTags = new ArrayList < > ( ) ; for ( Taglet current : customTags . values ( ) ) { if ( current . inModule ( ) && ! current . isInlineTag ( ) ) { moduleTags . add ( current ) ; } if ( current . inPackage ( ) && ! current . isInlineTag ( ) ) { packageTags . add ( current ) ; } if ( current . inType ( ) && ! current . isInlineTag ( ) ) { typeTags . add ( current ) ; } if ( current . inField ( ) && ! current . isInlineTag ( ) ) { fieldTags . add ( current ) ; } if ( current . inConstructor ( ) && ! current . isInlineTag ( ) ) { constructorTags . add ( current ) ; } if ( current . inMethod ( ) && ! current . isInlineTag ( ) ) { methodTags . add ( current ) ; } if ( current . isInlineTag ( ) ) { inlineTags . add ( current ) ; } if ( current . inOverview ( ) && ! current . isInlineTag ( ) ) { overviewTags . add ( current ) ; } } serializedFormTags = new ArrayList < > ( ) ; serializedFormTags . add ( customTags . get ( SERIAL_DATA . tagName ) ) ; serializedFormTags . add ( customTags . get ( THROWS . tagName ) ) ; if ( ! nosince ) serializedFormTags . add ( customTags . get ( SINCE . tagName ) ) ; serializedFormTags . add ( customTags . get ( SEE . tagName ) ) ; }
|
Initialize the custom tag Lists .
|
862 |
public com . sun . javadoc . Type returnType ( ) { return TypeMaker . getType ( env , sym . type . getReturnType ( ) , false ) ; }
|
Get return type .
|
863 |
private Scope membersOf ( ClassSymbol c ) { try { return c . members ( ) ; } catch ( CompletionFailure cf ) { return membersOf ( c ) ; } }
|
Retrieve members of c ignoring any CompletionFailures that occur .
|
864 |
private void onCodeContainerAnimationEnd ( boolean isCodeVisible ) { if ( isCodeVisible ) { mCodeContainer . setVisibility ( View . GONE ) ; mFab . setImageResource ( R . drawable . ic_code_black_24dp ) ; mCodeContainer . scrollTo ( 0 , 0 ) ; } else { mFab . setImageResource ( R . drawable . ic_close_black_24dp ) ; } mIsAnimating = false ; }
|
Updates the view on animation end .
|
865 |
private void setupImageContainer ( ) { Resources res = getResources ( ) ; Bitmap bitmap = BitmapFactory . decodeResource ( getResources ( ) , R . drawable . grid ) ; int cellH = ( int ) TypedValue . applyDimension ( TypedValue . COMPLEX_UNIT_DIP , 22 , res . getDisplayMetrics ( ) ) ; bitmap = Bitmap . createScaledBitmap ( bitmap , cellH , cellH , true ) ; BitmapDrawable bitmapDrawable = new BitmapDrawable ( res , bitmap ) ; bitmapDrawable . setTileModeX ( Shader . TileMode . REPEAT ) ; bitmapDrawable . setTileModeY ( Shader . TileMode . REPEAT ) ; mImageContainer . setBackgroundDrawable ( bitmapDrawable ) ; }
|
Setup image container
|
866 |
public void genDotFile ( Path path , String name , Configuration configuration , Attributes attributes ) throws IOException { Graph < String > graph = apiOnly ? requiresTransitiveGraph ( configuration , Set . of ( name ) ) : gengraph ( configuration ) ; DotGraphBuilder builder = new DotGraphBuilder ( name , graph , attributes ) ; builder . subgraph ( "se" , "java" , attributes . javaSubgraphColor ( ) , DotGraphBuilder . JAVA_SE_SUBGRAPH ) . subgraph ( "jdk" , "jdk" , attributes . jdkSubgraphColor ( ) , DotGraphBuilder . JDK_SUBGRAPH ) . modules ( graph . nodes ( ) . stream ( ) . map ( mn -> configuration . findModule ( mn ) . get ( ) . reference ( ) . descriptor ( ) ) ) ; builder . build ( path ) ; }
|
Generate dotfile of the given path
|
867 |
private Graph < String > gengraph ( Configuration cf ) { Graph . Builder < String > builder = new Graph . Builder < > ( ) ; cf . modules ( ) . stream ( ) . forEach ( rm -> { String mn = rm . name ( ) ; builder . addNode ( mn ) ; rm . reads ( ) . stream ( ) . map ( ResolvedModule :: name ) . forEach ( target -> builder . addEdge ( mn , target ) ) ; } ) ; Graph < String > rpg = requiresTransitiveGraph ( cf , builder . nodes ) ; return builder . build ( ) . reduce ( rpg ) ; }
|
Returns a Graph of the given Configuration after transitive reduction .
|
868 |
public Graph < String > requiresTransitiveGraph ( Configuration cf , Set < String > roots ) { Deque < String > deque = new ArrayDeque < > ( roots ) ; Set < String > visited = new HashSet < > ( ) ; Graph . Builder < String > builder = new Graph . Builder < > ( ) ; while ( deque . peek ( ) != null ) { String mn = deque . pop ( ) ; if ( visited . contains ( mn ) ) continue ; visited . add ( mn ) ; builder . addNode ( mn ) ; cf . findModule ( mn ) . get ( ) . reference ( ) . descriptor ( ) . requires ( ) . stream ( ) . filter ( d -> d . modifiers ( ) . contains ( TRANSITIVE ) || d . name ( ) . equals ( "java.base" ) ) . map ( Requires :: name ) . forEach ( d -> { deque . add ( d ) ; builder . addEdge ( mn , d ) ; } ) ; } return builder . build ( ) . reduce ( ) ; }
|
Returns a Graph containing only requires transitive edges with transitive reduction .
|
869 |
public static void convertRoot ( ConfigurationImpl configuration , DocletEnvironment docEnv , DocPath outputdir ) throws DocFileIOException , SimpleDocletException { new SourceToHTMLConverter ( configuration , docEnv , outputdir ) . generate ( ) ; }
|
Translate the TypeElements in the given DocletEnvironment to HTML representation .
|
870 |
public void convertPackage ( PackageElement pkg , DocPath outputdir ) throws DocFileIOException , SimpleDocletException { if ( pkg == null ) { return ; } for ( Element te : utils . getAllClasses ( pkg ) ) { if ( ! ( configuration . nodeprecated && utils . isDeprecated ( te ) ) ) convertClass ( ( TypeElement ) te , outputdir ) ; } }
|
Convert the Classes in the given Package to an HTML file .
|
871 |
private void writeToFile ( Content body , DocPath path ) throws DocFileIOException { Content htmlDocType = configuration . isOutputHtml5 ( ) ? DocType . HTML5 : DocType . TRANSITIONAL ; Content head = new HtmlTree ( HtmlTag . HEAD ) ; head . addContent ( HtmlTree . TITLE ( new StringContent ( configuration . getText ( "doclet.Window_Source_title" ) ) ) ) ; head . addContent ( getStyleSheetProperties ( ) ) ; Content htmlTree = HtmlTree . HTML ( configuration . getLocale ( ) . getLanguage ( ) , head , body ) ; Content htmlDocument = new HtmlDocument ( htmlDocType , htmlTree ) ; messages . notice ( "doclet.Generating_0" , path . getPath ( ) ) ; DocFile df = DocFile . createFileForOutput ( configuration , path ) ; try ( Writer w = df . openWriter ( ) ) { htmlDocument . write ( w , true ) ; } catch ( IOException e ) { throw new DocFileIOException ( df , DocFileIOException . Mode . WRITE , e ) ; } }
|
Write the output to the file .
|
872 |
public WriteableScope dupUnshared ( Symbol newOwner ) { if ( shared > 0 ) { Set < Scope > acceptScopes = Collections . newSetFromMap ( new IdentityHashMap < > ( ) ) ; ScopeImpl c = this ; while ( c != null ) { acceptScopes . add ( c ) ; c = c . next ; } int n = 0 ; Entry [ ] oldTable = this . table ; Entry [ ] newTable = new Entry [ this . table . length ] ; for ( int i = 0 ; i < oldTable . length ; i ++ ) { Entry e = oldTable [ i ] ; while ( e != null && e != sentinel && ! acceptScopes . contains ( e . scope ) ) { e = e . shadowed ; } if ( e != null ) { n ++ ; newTable [ i ] = e ; } } return new ScopeImpl ( this , newOwner , newTable , n ) ; } else { return new ScopeImpl ( this , newOwner , this . table . clone ( ) , this . nelems ) ; } }
|
Construct a fresh scope within this scope with new owner with a new hash table whose contents initially are those of the table of its outer scope .
|
873 |
public WriteableScope leave ( ) { Assert . check ( shared == 0 ) ; if ( table != next . table ) return next ; while ( elems != null ) { int hash = getIndex ( elems . sym . name ) ; Entry e = table [ hash ] ; Assert . check ( e == elems , elems . sym ) ; table [ hash ] = elems . shadowed ; elems = elems . sibling ; } Assert . check ( next . shared > 0 ) ; next . shared -- ; next . nelems = nelems ; return next ; }
|
Remove all entries of this scope from its table if shared with next .
|
874 |
private void dble ( ) { Assert . check ( shared == 0 ) ; Entry [ ] oldtable = table ; Entry [ ] newtable = new Entry [ oldtable . length * 2 ] ; for ( ScopeImpl s = this ; s != null ; s = s . next ) { if ( s . table == oldtable ) { Assert . check ( s == this || s . shared != 0 ) ; s . table = newtable ; s . hashMask = newtable . length - 1 ; } } int n = 0 ; for ( int i = oldtable . length ; -- i >= 0 ; ) { Entry e = oldtable [ i ] ; if ( e != null && e != sentinel ) { table [ getIndex ( e . sym . name ) ] = e ; n ++ ; } } nelems = n ; }
|
Double size of hash table .
|
875 |
public void enter ( Symbol sym ) { Assert . check ( shared == 0 ) ; if ( nelems * 3 >= hashMask * 2 ) dble ( ) ; int hash = getIndex ( sym . name ) ; Entry old = table [ hash ] ; if ( old == null ) { old = sentinel ; nelems ++ ; } Entry e = new Entry ( sym , old , elems , this ) ; table [ hash ] = e ; elems = e ; listeners . symbolAdded ( sym , this ) ; }
|
Enter symbol sym in this scope .
|
876 |
public void enterIfAbsent ( Symbol sym ) { Assert . check ( shared == 0 ) ; Entry e = lookup ( sym . name ) ; while ( e . scope == this && e . sym . kind != sym . kind ) e = e . next ( ) ; if ( e . scope != this ) enter ( sym ) ; }
|
Enter symbol sym in this scope if not already there .
|
877 |
int getIndex ( Name name ) { int h = name . hashCode ( ) ; int i = h & hashMask ; int x = hashMask - ( ( h + ( h >> 16 ) ) << 1 ) ; int d = - 1 ; for ( ; ; ) { Entry e = table [ i ] ; if ( e == null ) return d >= 0 ? d : i ; if ( e == sentinel ) { if ( d < 0 ) d = i ; } else if ( e . sym . name == name ) return i ; i = ( i + x ) & hashMask ; } }
|
Look for slot in the table . We use open addressing with double hashing .
|
878 |
public void finalizeScope ( ) { for ( List < Scope > scopes = this . subScopes ; scopes . nonEmpty ( ) ; scopes = scopes . tail ) { Scope impScope = scopes . head ; if ( impScope instanceof FilterImportScope && impScope . owner . kind == Kind . TYP ) { WriteableScope finalized = WriteableScope . create ( impScope . owner ) ; for ( Symbol sym : impScope . getSymbols ( ) ) { finalized . enter ( sym ) ; } finalized . listeners . add ( new ScopeListener ( ) { public void symbolAdded ( Symbol sym , Scope s ) { Assert . error ( "The scope is sealed." ) ; } public void symbolRemoved ( Symbol sym , Scope s ) { Assert . error ( "The scope is sealed." ) ; } } ) ; scopes . head = finalized ; } } }
|
Finalize the content of the ImportScope to speed - up future lookups . No further changes to class hierarchy or class content will be reflected .
|
879 |
public String formatJavadoc ( String header , String javadoc ) { try { StringBuilder result = new StringBuilder ( ) ; result . append ( escape ( CODE_HIGHLIGHT ) ) . append ( header ) . append ( escape ( CODE_RESET ) ) . append ( "\n" ) ; if ( javadoc == null ) { return result . toString ( ) ; } JavacTask task = ( JavacTask ) ToolProvider . getSystemJavaCompiler ( ) . getTask ( null , null , null , null , null , null ) ; DocTrees trees = DocTrees . instance ( task ) ; DocCommentTree docComment = trees . getDocCommentTree ( new SimpleJavaFileObject ( new URI ( "mem://doc.html" ) , Kind . HTML ) { @ DefinedBy ( Api . COMPILER ) public CharSequence getCharContent ( boolean ignoreEncodingErrors ) throws IOException { return "<body>" + javadoc + "</body>" ; } } ) ; new FormatJavadocScanner ( result , task ) . scan ( docComment , null ) ; addNewLineIfNeeded ( result ) ; return result . toString ( ) ; } catch ( URISyntaxException ex ) { throw new InternalError ( "Unexpected exception" , ex ) ; } }
|
Format javadoc to plain text .
|
880 |
public Module lookupModule ( String mod ) { Module m = modules . get ( mod ) ; if ( m == null ) { m = new Module ( mod , "???" ) ; modules . put ( mod , m ) ; } return m ; }
|
Lookup a module from a name . Create the module if it does not exist yet .
|
881 |
public void flattenArtifacts ( Map < String , Module > m ) { modules = m ; for ( Module i : modules . values ( ) ) { for ( Map . Entry < String , Package > j : i . packages ( ) . entrySet ( ) ) { Package p = packages . get ( j . getKey ( ) ) ; Assert . check ( p == null || p == j . getValue ( ) ) ; p = j . getValue ( ) ; packages . put ( j . getKey ( ) , j . getValue ( ) ) ; for ( Map . Entry < String , File > g : p . artifacts ( ) . entrySet ( ) ) { File f = artifacts . get ( g . getKey ( ) ) ; Assert . check ( f == null || f == g . getValue ( ) ) ; artifacts . put ( g . getKey ( ) , g . getValue ( ) ) ; } } } }
|
Store references to all artifacts found in the module tree into the maps stored in the build state .
|
882 |
public Module loadModule ( String l ) { Module m = Module . load ( l ) ; modules . put ( m . name ( ) , m ) ; return m ; }
|
Load a module from the javac state file .
|
883 |
public Package loadPackage ( Module lastModule , String l ) { Package p = Package . load ( lastModule , l ) ; lastModule . addPackage ( p ) ; packages . put ( p . name ( ) , p ) ; return p ; }
|
Load a package from the javac state file .
|
884 |
public Source loadSource ( Package lastPackage , String l , boolean is_generated ) { Source s = Source . load ( lastPackage , l , is_generated ) ; lastPackage . addSource ( s ) ; sources . put ( s . name ( ) , s ) ; return s ; }
|
Load a source from the javac state file .
|
885 |
public static void findSourceFiles ( List < SourceLocation > sourceLocations , Set < String > sourceTypes , Map < String , Source > foundFiles , Map < String , Module > foundModules , Module currentModule , boolean permitSourcesInDefaultPackage , boolean inLinksrc ) throws IOException { for ( SourceLocation source : sourceLocations ) { source . findSourceFiles ( sourceTypes , foundFiles , foundModules , currentModule , permitSourcesInDefaultPackage , inLinksrc ) ; } }
|
Find source files in the given source locations .
|
886 |
public EMFModule configure ( Feature feature , boolean state ) { if ( state ) { enable ( feature ) ; } else { disable ( feature ) ; } return this ; }
|
Configures the module with one of possible Feature .
|
887 |
public static String getElementName ( ENamedElement element ) { String value = getValue ( element , "JsonProperty" , "value" ) ; if ( value == null ) { value = getValue ( element , EXTENDED_METADATA , "name" ) ; } return value == null ? element . getName ( ) : value ; }
|
Returns the name that should be use to serialize the property .
|
888 |
public static EcoreTypeInfo getTypeProperty ( final EClassifier classifier ) { String property = getValue ( classifier , "JsonType" , "property" ) ; String use = getValue ( classifier , "JsonType" , "use" ) ; ValueReader < String , EClass > valueReader = EcoreTypeInfo . defaultValueReader ; ValueWriter < EClass , String > valueWriter = EcoreTypeInfo . defaultValueWriter ; if ( use != null ) { EcoreTypeInfo . USE useType = EcoreTypeInfo . USE . valueOf ( use . toUpperCase ( ) ) ; if ( useType == NAME ) { valueReader = ( value , context ) -> { EClass type = value != null && value . equalsIgnoreCase ( classifier . getName ( ) ) ? ( EClass ) classifier : null ; if ( type == null ) { type = EMFContext . findEClassByName ( value , classifier . getEPackage ( ) ) ; } return type ; } ; valueWriter = ( value , context ) -> value . getName ( ) ; } else if ( useType == CLASS ) { valueReader = ( value , context ) -> { EClass type = value != null && value . equalsIgnoreCase ( classifier . getInstanceClassName ( ) ) ? ( EClass ) classifier : null ; if ( type == null ) { type = EMFContext . findEClassByQualifiedName ( value , classifier . getEPackage ( ) ) ; } return type ; } ; valueWriter = ( value , context ) -> value . getInstanceClassName ( ) ; } else { valueReader = EcoreTypeInfo . defaultValueReader ; valueWriter = EcoreTypeInfo . defaultValueWriter ; } } return property != null ? new EcoreTypeInfo ( property , valueReader , valueWriter ) : null ; }
|
Returns the property that should be use to store the type information of the classifier .
|
889 |
ThrowsTag [ ] throwsTags ( ) { ListBuffer < ThrowsTag > found = new ListBuffer < > ( ) ; for ( Tag next : tagList ) { if ( next instanceof ThrowsTag ) { found . append ( ( ThrowsTag ) next ) ; } } return found . toArray ( new ThrowsTag [ found . length ( ) ] ) ; }
|
Return throws tags in this comment .
|
890 |
SerialFieldTag [ ] serialFieldTags ( ) { ListBuffer < SerialFieldTag > found = new ListBuffer < > ( ) ; for ( Tag next : tagList ) { if ( next instanceof SerialFieldTag ) { found . append ( ( SerialFieldTag ) next ) ; } } return found . toArray ( new SerialFieldTag [ found . length ( ) ] ) ; }
|
Return serialField tags in this comment .
|
891 |
private static int findInlineTagDelim ( String inlineText , int searchStart ) { int delimEnd , nestedOpenBrace ; if ( ( delimEnd = inlineText . indexOf ( "}" , searchStart ) ) == - 1 ) { return - 1 ; } else if ( ( ( nestedOpenBrace = inlineText . indexOf ( "{" , searchStart ) ) != - 1 ) && nestedOpenBrace < delimEnd ) { int nestedCloseBrace = findInlineTagDelim ( inlineText , nestedOpenBrace + 1 ) ; return ( nestedCloseBrace != - 1 ) ? findInlineTagDelim ( inlineText , nestedCloseBrace + 1 ) : - 1 ; } else { return delimEnd ; } }
|
Recursively find the index of the closing } character for an inline tag and return it . If it can t be found return - 1 .
|
892 |
static Tag [ ] firstSentenceTags ( DocImpl holder , String text ) { DocLocale doclocale = holder . env . doclocale ; return getInlineTags ( holder , doclocale . localeSpecificFirstSentence ( holder , text ) ) ; }
|
Return array of tags for the locale specific first sentence in the text .
|
893 |
public boolean start ( RootDoc root ) { Object retVal ; String methodName = "start" ; Class < ? > [ ] paramTypes = { RootDoc . class } ; Object [ ] params = { root } ; try { retVal = invoke ( methodName , null , paramTypes , params ) ; } catch ( DocletInvokeException exc ) { return false ; } if ( retVal instanceof Boolean ) { return ( ( Boolean ) retVal ) ; } else { messager . error ( Messager . NOPOS , "main.must_return_boolean" , docletClassName , methodName ) ; return false ; } }
|
Generate documentation here . Return true on success .
|
894 |
public int optionLength ( String option ) { Object retVal ; String methodName = "optionLength" ; Class < ? > [ ] paramTypes = { String . class } ; Object [ ] params = { option } ; try { retVal = invoke ( methodName , 0 , paramTypes , params ) ; } catch ( DocletInvokeException exc ) { return - 1 ; } if ( retVal instanceof Integer ) { return ( ( Integer ) retVal ) ; } else { messager . error ( Messager . NOPOS , "main.must_return_int" , docletClassName , methodName ) ; return - 1 ; } }
|
Check for doclet added options here . Zero return means option not known . Positive value indicates number of arguments to option . Negative value means error occurred .
|
895 |
public boolean validOptions ( List < String [ ] > optlist ) { Object retVal ; String options [ ] [ ] = optlist . toArray ( new String [ optlist . length ( ) ] [ ] ) ; String methodName = "validOptions" ; DocErrorReporter reporter = messager ; Class < ? > [ ] paramTypes = { String [ ] [ ] . class , DocErrorReporter . class } ; Object [ ] params = { options , reporter } ; try { retVal = invoke ( methodName , Boolean . TRUE , paramTypes , params ) ; } catch ( DocletInvokeException exc ) { return false ; } if ( retVal instanceof Boolean ) { return ( ( Boolean ) retVal ) ; } else { messager . error ( Messager . NOPOS , "main.must_return_boolean" , docletClassName , methodName ) ; return false ; } }
|
Let doclet check that all options are OK . Returning true means options are OK . If method does not exist assume true .
|
896 |
private void exportInternalAPI ( ClassLoader cl ) { String [ ] packages = { "com.sun.tools.doclets" , "com.sun.tools.doclets.standard" , "com.sun.tools.doclets.internal.toolkit" , "com.sun.tools.doclets.internal.toolkit.taglets" , "com.sun.tools.doclets.internal.toolkit.builders" , "com.sun.tools.doclets.internal.toolkit.util" , "com.sun.tools.doclets.internal.toolkit.util.links" , "com.sun.tools.doclets.formats.html" , "com.sun.tools.doclets.formats.html.markup" } ; try { Method getModuleMethod = Class . class . getDeclaredMethod ( "getModule" ) ; Object thisModule = getModuleMethod . invoke ( getClass ( ) ) ; Class < ? > moduleClass = Class . forName ( "java.lang.Module" ) ; Method addExportsMethod = moduleClass . getDeclaredMethod ( "addExports" , String . class , moduleClass ) ; Method getUnnamedModuleMethod = ClassLoader . class . getDeclaredMethod ( "getUnnamedModule" ) ; Object target = getUnnamedModuleMethod . invoke ( cl ) ; for ( String pack : packages ) { addExportsMethod . invoke ( thisModule , pack , target ) ; } } catch ( Exception e ) { } }
|
Export javadoc internal API to the unnamed module for a classloader . This is to support continued use of existing non - standard doclets that use the internal toolkit API and related classes .
|
897 |
private static URL fileToURL ( Path file ) { Path p ; try { p = file . toRealPath ( ) ; } catch ( IOException e ) { p = file . toAbsolutePath ( ) ; } try { return p . normalize ( ) . toUri ( ) . toURL ( ) ; } catch ( MalformedURLException e ) { return null ; } }
|
Returns the directory or JAR file URL corresponding to the specified local file name .
|
898 |
public static JavacProcessingEnvironment instance ( Context context ) { JavacProcessingEnvironment instance = context . get ( JavacProcessingEnvironment . class ) ; if ( instance == null ) instance = new JavacProcessingEnvironment ( context ) ; return instance ; }
|
Get the JavacProcessingEnvironment instance for this context .
|
899 |
private Iterator < Processor > handleServiceLoaderUnavailability ( String key , Exception e ) { if ( fileManager instanceof JavacFileManager ) { StandardJavaFileManager standardFileManager = ( JavacFileManager ) fileManager ; Iterable < ? extends Path > workingPath = fileManager . hasLocation ( ANNOTATION_PROCESSOR_PATH ) ? standardFileManager . getLocationAsPaths ( ANNOTATION_PROCESSOR_PATH ) : standardFileManager . getLocationAsPaths ( CLASS_PATH ) ; if ( needClassLoader ( options . get ( Option . PROCESSOR ) , workingPath ) ) handleException ( key , e ) ; } else { handleException ( key , e ) ; } java . util . List < Processor > pl = Collections . emptyList ( ) ; return pl . iterator ( ) ; }
|
Returns an empty processor iterator if no processors are on the relevant path otherwise if processors are present logs an error . Called when a service loader is unavailable for some reason either because a service loader class cannot be found or because a security policy prevents class loaders from being created .
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.