idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
156,700
protected void checkResourcePathWhiteBlackList ( final String relativePath , final LogNode log ) { if ( ! scanSpec . classpathElementResourcePathWhiteBlackList . whitelistAndBlacklistAreEmpty ( ) ) { if ( scanSpec . classpathElementResourcePathWhiteBlackList . isBlacklisted ( relativePath ) ) { if ( log != null ) { log...
Check relativePath against classpathElementResourcePathWhiteBlackList .
156,701
protected void addWhitelistedResource ( final Resource resource , final ScanSpecPathMatch parentMatchStatus , final LogNode log ) { final String path = resource . getPath ( ) ; final boolean isClassFile = FileUtils . isClassfile ( path ) ; boolean isWhitelisted = false ; if ( isClassFile ) { if ( scanSpec . enableClass...
Add a resource discovered during the scan .
156,702
public URI getLocation ( ) { if ( locationURI == null ) { locationURI = moduleRef != null ? moduleRef . getLocation ( ) : null ; if ( locationURI == null ) { locationURI = classpathElement . getURI ( ) ; } } return locationURI ; }
The module location or null for modules whose location is unknown .
156,703
void addAnnotations ( final AnnotationInfoList moduleAnnotations ) { if ( moduleAnnotations != null && ! moduleAnnotations . isEmpty ( ) ) { if ( this . annotationInfo == null ) { this . annotationInfo = new AnnotationInfoList ( moduleAnnotations ) ; } else { this . annotationInfo . addAll ( moduleAnnotations ) ; } } }
Add annotations found in a module descriptor classfile .
156,704
static TypeVariableSignature parse ( final Parser parser , final String definingClassName ) throws ParseException { final char peek = parser . peek ( ) ; if ( peek == 'T' ) { parser . next ( ) ; if ( ! TypeUtils . getIdentifierToken ( parser ) ) { throw new ParseException ( parser , "Could not parse type variable signa...
Parse a TypeVariableSignature .
156,705
private void logJavaInfo ( ) { log ( "Operating system: " + VersionFinder . getProperty ( "os.name" ) + " " + VersionFinder . getProperty ( "os.version" ) + " " + VersionFinder . getProperty ( "os.arch" ) ) ; log ( "Java version: " + VersionFinder . getProperty ( "java.version" ) + " / " + VersionFinder . getProperty (...
Log the Java version and the JRE paths that were found .
156,706
private void appendLine ( final String timeStampStr , final int indentLevel , final String line , final StringBuilder buf ) { buf . append ( timeStampStr ) ; buf . append ( '\t' ) ; buf . append ( ClassGraph . class . getSimpleName ( ) ) ; buf . append ( '\t' ) ; final int numDashes = 2 * ( indentLevel - 1 ) ; for ( in...
Append a line to the log output indenting this log entry according to tree structure .
156,707
private LogNode addChild ( final String sortKey , final String msg , final long elapsedTimeNanos , final Throwable exception ) { final String newSortKey = sortKeyPrefix + "\t" + ( sortKey == null ? "" : sortKey ) + "\t" + String . format ( "%09d" , sortKeyUniqueSuffix . getAndIncrement ( ) ) ; final LogNode newChild = ...
Add a child log node .
156,708
private LogNode addChild ( final String sortKey , final String msg , final long elapsedTimeNanos ) { return addChild ( sortKey , msg , elapsedTimeNanos , null ) ; }
Add a child log node for a message .
156,709
public LogNode log ( final String sortKey , final String msg , final long elapsedTimeNanos ) { return addChild ( sortKey , msg , elapsedTimeNanos ) ; }
Add a log entry with sort key for deterministic ordering .
156,710
public LogNode log ( final String msg , final Throwable e ) { return addChild ( "" , msg , - 1L ) . addChild ( e ) ; }
Add a log entry .
156,711
public LogNode log ( final Collection < String > msgs ) { LogNode last = null ; for ( final String m : msgs ) { last = log ( m ) ; } return last ; }
Add a series of log entries . Returns the last LogNode created .
156,712
public void flush ( ) { if ( parent != null ) { throw new IllegalArgumentException ( "Only flush the toplevel LogNode" ) ; } if ( ! children . isEmpty ( ) ) { final String logOutput = this . toString ( ) ; this . children . clear ( ) ; log . info ( logOutput ) ; } }
Flush out the log to stderr and clear the log contents . Only call this on the toplevel log node when threads do not have access to references of internal log nodes so that they cannot add more log entries inside the tree otherwise log entries may be lost .
156,713
public boolean checkAndReturn ( ) { if ( interrupted . get ( ) ) { interrupt ( ) ; return true ; } if ( Thread . currentThread ( ) . isInterrupted ( ) ) { interrupted . set ( true ) ; return true ; } return false ; }
Check for interruption and return interruption status .
156,714
public void check ( ) throws InterruptedException , ExecutionException { final ExecutionException executionException = getExecutionException ( ) ; if ( executionException != null ) { throw executionException ; } if ( checkAndReturn ( ) ) { throw new InterruptedException ( ) ; } }
Check if this thread or any other thread that shares this InterruptionChecker instance has been interrupted or has thrown an exception and if so throw InterruptedException .
156,715
public boolean isSystemModule ( ) { if ( name == null || name . isEmpty ( ) ) { return false ; } return name . startsWith ( "java." ) || name . startsWith ( "jdk." ) || name . startsWith ( "javafx." ) || name . startsWith ( "oracle." ) ; }
Checks if this module is a system module .
156,716
static MethodTypeSignature parse ( final String typeDescriptor , final String definingClassName ) throws ParseException { if ( typeDescriptor . equals ( "<init>" ) ) { return new MethodTypeSignature ( Collections . < TypeParameter > emptyList ( ) , Collections . < TypeSignature > emptyList ( ) , new BaseTypeSignature (...
Parse a method signature .
156,717
void toJSONString ( final Map < ReferenceEqualityKey < JSONReference > , CharSequence > jsonReferenceToId , final boolean includeNullValuedFields , final int depth , final int indentWidth , final StringBuilder buf ) { final boolean prettyPrint = indentWidth > 0 ; final int n = items . size ( ) ; if ( n == 0 ) { buf . a...
Serialize this JSONArray to a string .
156,718
boolean addRelatedClass ( final RelType relType , final ClassInfo classInfo ) { Set < ClassInfo > classInfoSet = relatedClasses . get ( relType ) ; if ( classInfoSet == null ) { relatedClasses . put ( relType , classInfoSet = new LinkedHashSet < > ( 4 ) ) ; } return classInfoSet . add ( classInfo ) ; }
Add a class with a given relationship type . Return whether the collection changed as a result of the call .
156,719
static ClassInfo getOrCreateClassInfo ( final String className , final int classModifiers , final Map < String , ClassInfo > classNameToClassInfo ) { ClassInfo classInfo = classNameToClassInfo . get ( className ) ; if ( classInfo == null ) { classNameToClassInfo . put ( className , classInfo = new ClassInfo ( className...
Get a ClassInfo object or create it if it doesn t exist . N . B . not threadsafe so ClassInfo objects should only ever be constructed by a single thread .
156,720
void setModifiers ( final int modifiers ) { this . modifiers |= modifiers ; if ( ( modifiers & ANNOTATION_CLASS_MODIFIER ) != 0 ) { this . isAnnotation = true ; } if ( ( modifiers & Modifier . INTERFACE ) != 0 ) { this . isInterface = true ; } }
Set class modifiers .
156,721
void addSuperclass ( final String superclassName , final Map < String , ClassInfo > classNameToClassInfo ) { if ( superclassName != null && ! superclassName . equals ( "java.lang.Object" ) ) { final ClassInfo superclassClassInfo = getOrCreateClassInfo ( superclassName , 0 , classNameToClassInfo ) ; this . addRelatedCla...
Add a superclass to this class .
156,722
void addImplementedInterface ( final String interfaceName , final Map < String , ClassInfo > classNameToClassInfo ) { final ClassInfo interfaceClassInfo = getOrCreateClassInfo ( interfaceName , Modifier . INTERFACE , classNameToClassInfo ) ; interfaceClassInfo . isInterface = true ; interfaceClassInfo . modifiers |= Mo...
Add an implemented interface to this class .
156,723
static void addClassContainment ( final List < SimpleEntry < String , String > > classContainmentEntries , final Map < String , ClassInfo > classNameToClassInfo ) { for ( final SimpleEntry < String , String > ent : classContainmentEntries ) { final String innerClassName = ent . getKey ( ) ; final ClassInfo innerClassIn...
Add class containment info .
156,724
void addClassAnnotation ( final AnnotationInfo classAnnotationInfo , final Map < String , ClassInfo > classNameToClassInfo ) { final ClassInfo annotationClassInfo = getOrCreateClassInfo ( classAnnotationInfo . getName ( ) , ANNOTATION_CLASS_MODIFIER , classNameToClassInfo ) ; if ( this . annotationInfo == null ) { this...
Add an annotation to this class .
156,725
private void addFieldOrMethodAnnotationInfo ( final AnnotationInfoList annotationInfoList , final boolean isField , final Map < String , ClassInfo > classNameToClassInfo ) { if ( annotationInfoList != null ) { for ( final AnnotationInfo fieldAnnotationInfo : annotationInfoList ) { final ClassInfo annotationClassInfo = ...
Add field or method annotation cross - links .
156,726
void addFieldInfo ( final FieldInfoList fieldInfoList , final Map < String , ClassInfo > classNameToClassInfo ) { for ( final FieldInfo fi : fieldInfoList ) { addFieldOrMethodAnnotationInfo ( fi . annotationInfo , true , classNameToClassInfo ) ; } if ( this . fieldInfo == null ) { this . fieldInfo = fieldInfoList ; } e...
Add field info .
156,727
void addMethodInfo ( final MethodInfoList methodInfoList , final Map < String , ClassInfo > classNameToClassInfo ) { for ( final MethodInfo mi : methodInfoList ) { addFieldOrMethodAnnotationInfo ( mi . annotationInfo , false , classNameToClassInfo ) ; if ( mi . parameterAnnotationInfo != null ) { for ( int i = 0 ; i < ...
Add method info .
156,728
private static Set < ClassInfo > filterClassInfo ( final Collection < ClassInfo > classes , final ScanSpec scanSpec , final boolean strictWhitelist , final ClassType ... classTypes ) { if ( classes == null ) { return Collections . < ClassInfo > emptySet ( ) ; } boolean includeAllTypes = classTypes . length == 0 ; boole...
Filter classes according to scan spec and class type .
156,729
static ClassInfoList getAllClasses ( final Collection < ClassInfo > classes , final ScanSpec scanSpec ) { return new ClassInfoList ( ClassInfo . filterClassInfo ( classes , scanSpec , true , ClassType . ALL ) , true ) ; }
Get all classes found during the scan .
156,730
static ClassInfoList getAllStandardClasses ( final Collection < ClassInfo > classes , final ScanSpec scanSpec ) { return new ClassInfoList ( ClassInfo . filterClassInfo ( classes , scanSpec , true , ClassType . STANDARD_CLASS ) , true ) ; }
Get all standard classes found during the scan .
156,731
public String getModifiersStr ( ) { final StringBuilder buf = new StringBuilder ( ) ; TypeUtils . modifiersToString ( modifiers , ModifierType . CLASS , false , buf ) ; return buf . toString ( ) ; }
Get the class modifiers as a String .
156,732
public boolean hasField ( final String fieldName ) { for ( final ClassInfo ci : getOverrideOrder ( ) ) { if ( ci . hasDeclaredField ( fieldName ) ) { return true ; } } return false ; }
Checks whether this class or one of its superclasses has the named field .
156,733
public boolean hasDeclaredFieldAnnotation ( final String fieldAnnotationName ) { for ( final FieldInfo fi : getDeclaredFieldInfo ( ) ) { if ( fi . hasAnnotation ( fieldAnnotationName ) ) { return true ; } } return false ; }
Checks whether this class declares a field with the named annotation .
156,734
public boolean hasFieldAnnotation ( final String fieldAnnotationName ) { for ( final ClassInfo ci : getOverrideOrder ( ) ) { if ( ci . hasDeclaredFieldAnnotation ( fieldAnnotationName ) ) { return true ; } } return false ; }
Checks whether this class or one of its superclasses declares a field with the named annotation .
156,735
public boolean hasMethod ( final String methodName ) { for ( final ClassInfo ci : getOverrideOrder ( ) ) { if ( ci . hasDeclaredMethod ( methodName ) ) { return true ; } } return false ; }
Checks whether this class or one of its superclasses or interfaces declares a method of the given name .
156,736
public boolean hasMethodAnnotation ( final String methodAnnotationName ) { for ( final ClassInfo ci : getOverrideOrder ( ) ) { if ( ci . hasDeclaredMethodAnnotation ( methodAnnotationName ) ) { return true ; } } return false ; }
Checks whether this class or one of its superclasses or interfaces declares a method with the named annotation .
156,737
public boolean hasMethodParameterAnnotation ( final String methodParameterAnnotationName ) { for ( final ClassInfo ci : getOverrideOrder ( ) ) { if ( ci . hasDeclaredMethodParameterAnnotation ( methodParameterAnnotationName ) ) { return true ; } } return false ; }
Checks whether this class or one of its superclasses or interfaces has a method with the named annotation .
156,738
private List < ClassInfo > getOverrideOrder ( final Set < ClassInfo > visited , final List < ClassInfo > overrideOrderOut ) { if ( visited . add ( this ) ) { overrideOrderOut . add ( this ) ; for ( final ClassInfo iface : getInterfaces ( ) ) { iface . getOverrideOrder ( visited , overrideOrderOut ) ; } final ClassInfo ...
Recurse to interfaces and superclasses to get the order that fields and methods are overridden in .
156,739
public ClassInfoList getInterfaces ( ) { final ReachableAndDirectlyRelatedClasses implementedInterfaces = this . filterClassInfo ( RelType . IMPLEMENTED_INTERFACES , false ) ; final Set < ClassInfo > allInterfaces = new LinkedHashSet < > ( implementedInterfaces . reachableClasses ) ; for ( final ClassInfo superclass : ...
Get the interfaces implemented by this class or by one of its superclasses if this is a standard class or the superinterfaces extended by this interface if this is an interface .
156,740
private ClassInfoList getClassesWithFieldOrMethodAnnotation ( final RelType relType ) { final boolean isField = relType == RelType . CLASSES_WITH_FIELD_ANNOTATION ; if ( ! ( isField ? scanResult . scanSpec . enableFieldInfo : scanResult . scanSpec . enableMethodInfo ) || ! scanResult . scanSpec . enableAnnotationInfo )...
Get the classes that have this class as a field method or method parameter annotation .
156,741
public AnnotationParameterValueList getAnnotationDefaultParameterValues ( ) { if ( ! scanResult . scanSpec . enableAnnotationInfo ) { throw new IllegalArgumentException ( "Please call ClassGraph#enableAnnotationInfo() before #scan()" ) ; } if ( ! isAnnotation ) { throw new IllegalArgumentException ( "Class is not an an...
Get the default parameter values for this annotation if this is an annotation class .
156,742
public ClassInfoList getClassesWithAnnotation ( ) { if ( ! scanResult . scanSpec . enableAnnotationInfo ) { throw new IllegalArgumentException ( "Please call ClassGraph#enableAnnotationInfo() before #scan()" ) ; } if ( ! isAnnotation ) { throw new IllegalArgumentException ( "Class is not an annotation: " + getName ( ) ...
Get the classes that have this class as an annotation .
156,743
public ClassTypeSignature getTypeSignature ( ) { if ( typeSignatureStr == null ) { return null ; } if ( typeSignature == null ) { try { typeSignature = ClassTypeSignature . parse ( typeSignatureStr , this ) ; typeSignature . setScanResult ( scanResult ) ; } catch ( final ParseException e ) { throw new IllegalArgumentEx...
Get the type signature of the class .
156,744
void addReferencedClassNames ( final Set < String > refdClassNames ) { if ( this . referencedClassNames == null ) { this . referencedClassNames = refdClassNames ; } else { this . referencedClassNames . addAll ( refdClassNames ) ; } }
Add names of classes referenced by this class .
156,745
protected void findReferencedClassNames ( final Set < String > referencedClassNames ) { if ( this . referencedClassNames != null ) { referencedClassNames . addAll ( this . referencedClassNames ) ; } getMethodInfo ( ) . findReferencedClassNames ( referencedClassNames ) ; getFieldInfo ( ) . findReferencedClassNames ( ref...
Get the names of any classes referenced in this class type descriptor or the type descriptors of fields methods or annotations .
156,746
public ClassInfoList getClassDependencies ( ) { if ( ! scanResult . scanSpec . enableInterClassDependencies ) { throw new IllegalArgumentException ( "Please call ClassGraph#enableInterClassDependencies() before #scan()" ) ; } return referencedClasses == null ? ClassInfoList . EMPTY_LIST : referencedClasses ; }
Get the class dependencies .
156,747
private static void translateSeparator ( final String path , final int startIdx , final int endIdx , final boolean stripFinalSeparator , final StringBuilder buf ) { for ( int i = startIdx ; i < endIdx ; i ++ ) { final char c = path . charAt ( i ) ; if ( c == '\\' || c == '/' ) { if ( i < endIdx - 1 || ! stripFinalSepar...
Translate backslashes to forward slashes optionally removing trailing separator .
156,748
private TypeSignature getTypeSignature ( ) { if ( typeSignature == null ) { try { typeSignature = TypeSignature . parse ( typeDescriptorStr , null ) ; typeSignature . setScanResult ( scanResult ) ; } catch ( final ParseException e ) { throw new IllegalArgumentException ( e ) ; } } return typeSignature ; }
Get the type signature .
156,749
private String sanitizeFilename ( final String filename ) { return filename . replace ( '/' , '_' ) . replace ( '\\' , '_' ) . replace ( ':' , '_' ) . replace ( '?' , '_' ) . replace ( '&' , '_' ) . replace ( '=' , '_' ) . replace ( ' ' , '_' ) ; }
Sanitize filename .
156,750
private File makeTempFile ( final String filePath , final boolean onlyUseLeafname ) throws IOException { final File tempFile = File . createTempFile ( "ClassGraph--" , TEMP_FILENAME_LEAF_SEPARATOR + sanitizeFilename ( onlyUseLeafname ? leafname ( filePath ) : filePath ) ) ; tempFile . deleteOnExit ( ) ; tempFiles . add...
Create a temporary file and mark it for deletion on exit .
156,751
private File downloadTempFile ( final String jarURL , final LogNode log ) { final LogNode subLog = log == null ? null : log . log ( jarURL , "Downloading URL " + jarURL ) ; File tempFile ; try { tempFile = makeTempFile ( jarURL , true ) ; final URL url = new URL ( jarURL ) ; try ( InputStream inputStream = url . openSt...
Download a jar from a URL to a temporary file .
156,752
public String generateGraphVizDotFile ( final float sizeX , final float sizeY ) { return generateGraphVizDotFile ( sizeX , sizeY , true , true , true , true , true ) ; }
Generate a . dot file which can be fed into GraphViz for layout and visualization of the class graph .
156,753
public void generateGraphVizDotFile ( final File file ) throws IOException { try ( PrintWriter writer = new PrintWriter ( file ) ) { writer . print ( generateGraphVizDotFile ( ) ) ; } }
Generate a and save a . dot file which can be fed into GraphViz for layout and visualization of the class graph .
156,754
public boolean containsName ( final String name ) { for ( final T i : this ) { if ( i . getName ( ) . equals ( name ) ) { return true ; } } return false ; }
Check if this list contains an item with the given name .
156,755
public T get ( final String name ) { for ( final T i : this ) { if ( i . getName ( ) . equals ( name ) ) { return i ; } } return null ; }
Get the list item with the given name or null if not found .
156,756
public static < U > void runWorkQueue ( final Collection < U > elements , final ExecutorService executorService , final InterruptionChecker interruptionChecker , final int numParallelTasks , final LogNode log , final WorkUnitProcessor < U > workUnitProcessor ) throws InterruptedException , ExecutionException { if ( ele...
Start a work queue on the elements in the provided collection blocking until all work units have been completed .
156,757
private void startWorkers ( final ExecutorService executorService , final int numTasks ) { for ( int i = 0 ; i < numTasks ; i ++ ) { workerFutures . add ( executorService . submit ( new Callable < Void > ( ) { public Void call ( ) throws Exception { runWorkLoop ( ) ; return null ; } } ) ) ; } }
Start worker threads with a shared log .
156,758
private void sendPoisonPills ( ) { for ( int i = 0 ; i < numWorkers ; i ++ ) { workUnits . add ( new WorkUnitWrapper < T > ( null ) ) ; } }
Send poison pills to workers .
156,759
public void addWorkUnit ( final T workUnit ) { if ( workUnit == null ) { throw new NullPointerException ( "workUnit cannot be null" ) ; } numIncompleteWorkUnits . incrementAndGet ( ) ; workUnits . add ( new WorkUnitWrapper < > ( workUnit ) ) ; }
Add a unit of work . May be called by workers to add more work units to the tail of the queue .
156,760
ClassFields get ( final Class < ? > cls ) { ClassFields classFields = classToClassFields . get ( cls ) ; if ( classFields == null ) { classToClassFields . put ( cls , classFields = new ClassFields ( cls , resolveTypes , onlySerializePublicFields , this ) ) ; } return classFields ; }
For a given resolved type find the visible and accessible fields resolve the types of any generically typed fields and return the resolved fields .
156,761
private static Class < ? > getConcreteType ( final Class < ? > rawType , final boolean returnNullIfNotMapOrCollection ) { if ( rawType == Map . class || rawType == AbstractMap . class || rawType == HashMap . class ) { return HashMap . class ; } else if ( rawType == ConcurrentMap . class || rawType == ConcurrentHashMap ...
Get the concrete type for a map or collection whose raw type is an interface or abstract class .
156,762
Constructor < ? > getDefaultConstructorForConcreteTypeOf ( final Class < ? > cls ) { if ( cls == null ) { throw new IllegalArgumentException ( "Class reference cannot be null" ) ; } final Constructor < ? > constructor = defaultConstructorForConcreteType . get ( cls ) ; if ( constructor != null ) { return constructor ; ...
Get the concrete type of the given class then return the default constructor for that type .
156,763
static Object getFieldValue ( final Object containingObj , final Field field ) throws IllegalArgumentException , IllegalAccessException { final Class < ? > fieldType = field . getType ( ) ; if ( fieldType == Integer . TYPE ) { return field . getInt ( containingObj ) ; } else if ( fieldType == Long . TYPE ) { return fie...
Get a field value appropriately handling primitive - typed fields .
156,764
static boolean isBasicValueType ( final Type type ) { if ( type instanceof Class < ? > ) { return isBasicValueType ( ( Class < ? > ) type ) ; } else if ( type instanceof ParameterizedType ) { return isBasicValueType ( ( ( ParameterizedType ) type ) . getRawType ( ) ) ; } else { return false ; } }
Return true for types that can be converted directly to and from string representation .
156,765
static boolean isBasicValueType ( final Object obj ) { return obj == null || obj instanceof String || obj instanceof Integer || obj instanceof Boolean || obj instanceof Long || obj instanceof Float || obj instanceof Double || obj instanceof Short || obj instanceof Byte || obj instanceof Character || obj . getClass ( ) ...
Return true for objects that can be converted directly to and from string representation .
156,766
static boolean fieldIsSerializable ( final Field field , final boolean onlySerializePublicFields ) { final int modifiers = field . getModifiers ( ) ; if ( ( ! onlySerializePublicFields || Modifier . isPublic ( modifiers ) ) && ! Modifier . isTransient ( modifiers ) && ! Modifier . isFinal ( modifiers ) && ( ( modifiers...
Check if a field is serializable . Don t serialize transient final synthetic or inaccessible fields .
156,767
public AnnotationParameterValueList getParameterValues ( ) { if ( annotationParamValuesWithDefaults == null ) { final ClassInfo classInfo = getClassInfo ( ) ; if ( classInfo == null ) { return annotationParamValues == null ? AnnotationParameterValueList . EMPTY_LIST : annotationParamValues ; } if ( annotationParamValue...
Get the parameter values .
156,768
public AnnotationInfoList getAnnotationInfo ( ) { if ( ! scanResult . scanSpec . enableAnnotationInfo ) { throw new IllegalArgumentException ( "Please call ClassGraph#enableAnnotationInfo() before #scan()" ) ; } return annotationInfo == null ? AnnotationInfoList . EMPTY_LIST : AnnotationInfoList . getIndirectAnnotation...
Get a list of annotations on this method along with any annotation parameter values .
156,769
public boolean hasParameterAnnotation ( final String annotationName ) { for ( final MethodParameterInfo methodParameterInfo : getParameterInfo ( ) ) { if ( methodParameterInfo . hasAnnotation ( annotationName ) ) { return true ; } } return false ; }
Check if this method has a parameter with the named annotation .
156,770
public int compareTo ( final MethodInfo other ) { final int diff0 = declaringClassName . compareTo ( other . declaringClassName ) ; if ( diff0 != 0 ) { return diff0 ; } final int diff1 = name . compareTo ( other . name ) ; if ( diff1 != 0 ) { return diff1 ; } return typeDescriptorStr . compareTo ( other . typeDescripto...
Sort in order of class name method name then type descriptor .
156,771
public static synchronized String getVersion ( ) { final Class < ? > cls = ClassGraph . class ; try { final String className = cls . getName ( ) ; final URL classpathResource = cls . getResource ( "/" + JarUtils . classNameToClassfilePath ( className ) ) ; if ( classpathResource != null ) { final Path absolutePackagePa...
Get the version number of ClassGraph .
156,772
private ByteBuffer getChunk ( final int chunkIdx ) throws IOException , InterruptedException { ByteBuffer chunk = chunkCache [ chunkIdx ] ; if ( chunk == null ) { final ByteBuffer byteBufferDup = zipFileSlice . physicalZipFile . getByteBuffer ( chunkIdx ) . duplicate ( ) ; chunk = chunkCache [ chunkIdx ] = byteBufferDu...
Get the 2GB chunk of the zipfile with the given chunk index .
156,773
static int getShort ( final byte [ ] arr , final long off ) throws IndexOutOfBoundsException { final int ioff = ( int ) off ; if ( ioff < 0 || ioff > arr . length - 2 ) { throw new IndexOutOfBoundsException ( ) ; } return ( ( arr [ ioff + 1 ] & 0xff ) << 8 ) | ( arr [ ioff ] & 0xff ) ; }
Get a short from a byte array .
156,774
int getShort ( final long off ) throws IOException , InterruptedException { if ( off < 0 || off > zipFileSlice . len - 2 ) { throw new IndexOutOfBoundsException ( ) ; } if ( read ( off , scratch , 0 , 2 ) < 2 ) { throw new EOFException ( "Unexpected EOF" ) ; } return ( ( scratch [ 1 ] & 0xff ) << 8 ) | ( scratch [ 0 ] ...
Get a short from the zipfile slice .
156,775
static int getInt ( final byte [ ] arr , final long off ) throws IOException { final int ioff = ( int ) off ; if ( ioff < 0 || ioff > arr . length - 4 ) { throw new IndexOutOfBoundsException ( ) ; } return ( ( arr [ ioff + 3 ] & 0xff ) << 24 ) | ( ( arr [ ioff + 2 ] & 0xff ) << 16 ) | ( ( arr [ ioff + 1 ] & 0xff ) << 8...
Get an int from a byte array .
156,776
static long getLong ( final byte [ ] arr , final long off ) throws IOException { final int ioff = ( int ) off ; if ( ioff < 0 || ioff > arr . length - 8 ) { throw new IndexOutOfBoundsException ( ) ; } return ( ( arr [ ioff + 7 ] & 0xffL ) << 56 ) | ( ( arr [ ioff + 6 ] & 0xffL ) << 48 ) | ( ( arr [ ioff + 5 ] & 0xffL )...
Get a long from a byte array .
156,777
long getLong ( final long off ) throws IOException , InterruptedException { if ( off < 0 || off > zipFileSlice . len - 8 ) { throw new IndexOutOfBoundsException ( ) ; } if ( read ( off , scratch , 0 , 8 ) < 8 ) { throw new EOFException ( "Unexpected EOF" ) ; } return ( ( scratch [ 7 ] & 0xffL ) << 56 ) | ( ( scratch [ ...
Get a long from the zipfile slice .
156,778
static String getString ( final byte [ ] arr , final long off , final int lenBytes ) throws IOException { final int ioff = ( int ) off ; if ( ioff < 0 || ioff > arr . length - lenBytes ) { throw new IndexOutOfBoundsException ( ) ; } return new String ( arr , ioff , lenBytes , StandardCharsets . UTF_8 ) ; }
Get a string from a byte array .
156,779
String getString ( final long off , final int lenBytes ) throws IOException , InterruptedException { if ( off < 0 || off > zipFileSlice . len - lenBytes ) { throw new IndexOutOfBoundsException ( ) ; } final byte [ ] scratchToUse = lenBytes <= scratch . length ? scratch : new byte [ lenBytes ] ; if ( read ( off , scratc...
Get a string from the zipfile slice .
156,780
static ReferenceTypeSignature parseReferenceTypeSignature ( final Parser parser , final String definingClassName ) throws ParseException { final ClassRefTypeSignature classTypeSignature = ClassRefTypeSignature . parse ( parser , definingClassName ) ; if ( classTypeSignature != null ) { return classTypeSignature ; } fin...
Parse a reference type signature .
156,781
static ReferenceTypeSignature parseClassBound ( final Parser parser , final String definingClassName ) throws ParseException { parser . expect ( ':' ) ; return parseReferenceTypeSignature ( parser , definingClassName ) ; }
Parse a class bound .
156,782
public static boolean isClassfile ( final String path ) { final int len = path . length ( ) ; return len > 6 && path . regionMatches ( true , len - 6 , ".class" , 0 , 6 ) ; }
Check if the path ends with a . class extension ignoring case .
156,783
public static String getParentDirPath ( final String path , final char separator ) { final int lastSlashIdx = path . lastIndexOf ( separator ) ; if ( lastSlashIdx <= 0 ) { return "" ; } return path . substring ( 0 , lastSlashIdx ) ; }
Get the parent dir path .
156,784
public static Object getStaticFieldVal ( final Class < ? > cls , final String fieldName , final boolean throwException ) throws IllegalArgumentException { if ( cls == null || fieldName == null ) { if ( throwException ) { throw new NullPointerException ( ) ; } else { return null ; } } return getFieldVal ( cls , null , f...
Get the value of the named static field in the given class or any of its superclasses . If an exception is thrown while trying to read the field value and throwException is true then IllegalArgumentException is thrown wrapping the cause otherwise this will return null . If passed a null class reference returns null unl...
156,785
private static String getContentLocation ( final Object content ) { final File file = ( File ) ReflectionUtils . invokeMethod ( content , "getFile" , false ) ; return file != null ? file . toURI ( ) . toString ( ) : null ; }
Get the content location .
156,786
private static void addBundle ( final Object bundleWiring , final ClassLoader classLoader , final ClasspathOrder classpathOrderOut , final Set < Object > bundles , final ScanSpec scanSpec , final LogNode log ) { bundles . add ( bundleWiring ) ; final Object revision = ReflectionUtils . invokeMethod ( bundleWiring , "ge...
Adds the bundle .
156,787
void toStringParamValueOnly ( final StringBuilder buf ) { if ( value == null ) { buf . append ( "null" ) ; } else { final Object paramVal = value . get ( ) ; final Class < ? > valClass = paramVal . getClass ( ) ; if ( valClass . isArray ( ) ) { buf . append ( '[' ) ; for ( int j = 0 , n = Array . getLength ( paramVal )...
To string param value only .
156,788
private static boolean addJREPath ( final File dir ) { if ( dir != null && ! dir . getPath ( ) . isEmpty ( ) && FileUtils . canRead ( dir ) && dir . isDirectory ( ) ) { final File [ ] dirFiles = dir . listFiles ( ) ; if ( dirFiles != null ) { for ( final File file : dirFiles ) { final String filePath = file . getPath (...
Add and search a JRE path .
156,789
private static Entry < String , Integer > getManifestValue ( final byte [ ] manifest , final int startIdx ) { int curr = startIdx ; final int len = manifest . length ; while ( curr < len && manifest [ curr ] == ( byte ) ' ' ) { curr ++ ; } final int firstNonSpaceIdx = curr ; boolean isMultiLine = false ; for ( ; curr <...
Extract a value from the manifest and return the value as a string along with the index after the terminating newline . Manifest files support three different line terminator types and entries can be split across lines with a line terminator followed by a space .
156,790
private static byte [ ] manifestKeyToBytes ( final String key ) { final byte [ ] bytes = new byte [ key . length ( ) ] ; for ( int i = 0 ; i < key . length ( ) ; i ++ ) { bytes [ i ] = ( byte ) Character . toLowerCase ( key . charAt ( i ) ) ; } return bytes ; }
Manifest key to bytes .
156,791
private static boolean keyMatchesAtPosition ( final byte [ ] manifest , final byte [ ] key , final int pos ) { if ( pos + key . length + 1 > manifest . length || manifest [ pos + key . length ] != ':' ) { return false ; } for ( int i = 0 ; i < key . length ; i ++ ) { if ( toLowerCase [ manifest [ i + pos ] ] != key [ i...
Key matches at position .
156,792
public String getModuleName ( ) { String moduleName = moduleRef . getName ( ) ; if ( moduleName == null || moduleName . isEmpty ( ) ) { moduleName = moduleNameFromModuleDescriptor ; } return moduleName == null || moduleName . isEmpty ( ) ? null : moduleName ; }
Get the module name from the module reference or the module descriptor .
156,793
void addAnnotations ( final AnnotationInfoList packageAnnotations ) { if ( packageAnnotations != null && ! packageAnnotations . isEmpty ( ) ) { if ( this . annotationInfo == null ) { this . annotationInfo = new AnnotationInfoList ( packageAnnotations ) ; } else { this . annotationInfo . addAll ( packageAnnotations ) ; ...
Add annotations found in a package descriptor classfile .
156,794
public PackageInfoList getChildren ( ) { if ( children == null ) { return PackageInfoList . EMPTY_LIST ; } final PackageInfoList childrenSorted = new PackageInfoList ( children ) ; CollectionUtils . sortIfNotEmpty ( childrenSorted , new Comparator < PackageInfo > ( ) { public int compare ( final PackageInfo o1 , final ...
The child packages of this package or the empty list if none .
156,795
static String getParentPackageName ( final String packageOrClassName ) { if ( packageOrClassName . isEmpty ( ) ) { return null ; } final int lastDotIdx = packageOrClassName . lastIndexOf ( '.' ) ; return lastDotIdx < 0 ? "" : packageOrClassName . substring ( 0 , lastDotIdx ) ; }
Get the name of the parent package of a parent or the package of the named class .
156,796
public String getPositionInfo ( ) { final int showStart = Math . max ( 0 , position - SHOW_BEFORE ) ; final int showEnd = Math . min ( string . length ( ) , position + SHOW_AFTER ) ; return "before: \"" + JSONUtils . escapeJSONString ( string . substring ( showStart , position ) ) + "\"; after: \"" + JSONUtils . escape...
Get the parsing context as a string for debugging .
156,797
public void expect ( final char expectedChar ) throws ParseException { final int next = getc ( ) ; if ( next != expectedChar ) { throw new ParseException ( this , "Expected '" + expectedChar + "'; got '" + ( char ) next + "'" ) ; } }
Expect the next character .
156,798
public void skipWhitespace ( ) { while ( position < string . length ( ) ) { final char c = string . charAt ( position ) ; if ( c == ' ' || c == '\n' || c == '\r' || c == '\t' ) { position ++ ; } else { break ; } } }
Skip whitespace starting at the current position .
156,799
void toJSONString ( final Map < ReferenceEqualityKey < JSONReference > , CharSequence > jsonReferenceToId , final boolean includeNullValuedFields , final int depth , final int indentWidth , final StringBuilder buf ) { final boolean prettyPrint = indentWidth > 0 ; final int n = items . size ( ) ; int numDisplayedFields ...
Serialize this JSONObject to a string .