idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
153,500
public InnerClassAccess getInnerClassAccess ( INVOKESTATIC inv , ConstantPoolGen cpg ) throws ClassNotFoundException { String methodName = inv . getMethodName ( cpg ) ; if ( methodName . startsWith ( "access$" ) ) { String className = inv . getClassName ( cpg ) ; return getInnerClassAccess ( className , methodName ) ; ...
Get the inner class access object for given invokestatic instruction . Returns null if the called method is not an inner class access .
153,501
private Map < String , InnerClassAccess > getAccessMapForClass ( String className ) throws ClassNotFoundException { Map < String , InnerClassAccess > map = classToAccessMap . get ( className ) ; if ( map == null ) { map = new HashMap < > ( 3 ) ; if ( ! className . startsWith ( "[" ) ) { JavaClass javaClass = Repository...
Return a map of inner - class member access method names to the fields that they access for given class name .
153,502
public int getMnemonic ( ) { int mnemonic = KeyEvent . VK_UNDEFINED ; if ( ! MAC_OS_X ) { int index = getMnemonicIndex ( ) ; if ( ( index >= 0 ) && ( ( index + 1 ) < myAnnotatedString . length ( ) ) ) { mnemonic = Character . toUpperCase ( myAnnotatedString . charAt ( index + 1 ) ) ; } } return mnemonic ; }
Return the appropriate mnemonic character for this string . If no mnemonic should be displayed KeyEvent . VK_UNDEFINED is returned .
153,503
public static void localiseButton ( AbstractButton button , String key , String defaultString , boolean setMnemonic ) { AnnotatedString as = new AnnotatedString ( L10N . getLocalString ( key , defaultString ) ) ; button . setText ( as . toString ( ) ) ; int mnemonic ; if ( setMnemonic && ( mnemonic = as . getMnemonic (...
Localise the given AbstractButton setting the text and optionally mnemonic Note that AbstractButton includes menus and menu items .
153,504
public MethodHash computeHash ( Method method ) { final MessageDigest digest = Util . getMD5Digest ( ) ; byte [ ] code ; if ( method . getCode ( ) == null || method . getCode ( ) . getCode ( ) == null ) { code = new byte [ 0 ] ; } else { code = method . getCode ( ) . getCode ( ) ; } BytecodeScanner . Callback callback ...
Compute hash on given method .
153,505
static int compareGroups ( BugGroup m1 , BugGroup m2 ) { int result = m1 . compareTo ( m2 ) ; if ( result == 0 ) { return m1 . getShortDescription ( ) . compareToIgnoreCase ( m2 . getShortDescription ( ) ) ; } return result ; }
Sorts bug groups on severity first then on bug pattern name .
153,506
static int compareMarkers ( IMarker m1 , IMarker m2 ) { if ( m1 == null || m2 == null || ! m1 . exists ( ) || ! m2 . exists ( ) ) { return 0 ; } int rank1 = MarkerUtil . findBugRankForMarker ( m1 ) ; int rank2 = MarkerUtil . findBugRankForMarker ( m2 ) ; int result = rank1 - rank2 ; if ( result != 0 ) { return result ;...
Sorts markers on rank then priority and then on name if requested
153,507
public void setParamsWithProperty ( BitSet nonNullSet ) { for ( int i = 0 ; i < 32 ; ++ i ) { setParamWithProperty ( i , nonNullSet . get ( i ) ) ; } }
Set the non - null param set from given BitSet .
153,508
public void setParamWithProperty ( int param , boolean hasProperty ) { if ( param < 0 || param > 31 ) { return ; } if ( hasProperty ) { bits |= ( 1 << param ) ; } else { bits &= ~ ( 1 << param ) ; } }
Set whether or not a parameter might be non - null .
153,509
public BitSet getMatchingParameters ( BitSet nullArgSet ) { BitSet result = new BitSet ( ) ; for ( int i = 0 ; i < 32 ; ++ i ) { result . set ( i , nullArgSet . get ( i ) && hasProperty ( i ) ) ; } return result ; }
Given a bitset of null arguments passed to the method represented by this property return a bitset indicating which null arguments correspond to an non - null param .
153,510
public static int getNumParametersForInvocation ( InvokeInstruction inv , ConstantPoolGen cpg ) { SignatureParser sigParser = new SignatureParser ( inv . getSignature ( cpg ) ) ; return sigParser . getNumParameters ( ) ; }
Get the number of parameters passed to method invocation .
153,511
public void build ( ) { int numGood = 0 , numBytecodes = 0 ; if ( DEBUG ) { System . out . println ( "Method: " + methodGen . getName ( ) + " - " + methodGen . getSignature ( ) + "in class " + methodGen . getClassName ( ) ) ; } LineNumberTable table = methodGen . getLineNumberTable ( methodGen . getConstantPool ( ) ) ;...
Build the line number information . Should be called before any other methods .
153,512
public void setReturnValue ( MethodDescriptor methodDesc , TypeQualifierValue < ? > tqv , TypeQualifierAnnotation tqa ) { Map < TypeQualifierValue < ? > , TypeQualifierAnnotation > map = returnValueMap . get ( methodDesc ) ; if ( map == null ) { map = new HashMap < > ( ) ; returnValueMap . put ( methodDesc , map ) ; } ...
Set a TypeQualifierAnnotation on a method return value .
153,513
public TypeQualifierAnnotation getReturnValue ( MethodDescriptor methodDesc , TypeQualifierValue < ? > tqv ) { Map < TypeQualifierValue < ? > , TypeQualifierAnnotation > map = returnValueMap . get ( methodDesc ) ; if ( map == null ) { return null ; } return map . get ( tqv ) ; }
Get the TypeQualifierAnnotation on a method return value .
153,514
public void setParameter ( MethodDescriptor methodDesc , int param , TypeQualifierValue < ? > tqv , TypeQualifierAnnotation tqa ) { Map < TypeQualifierValue < ? > , TypeQualifierAnnotation > map = parameterMap . get ( methodDesc , param ) ; if ( map == null ) { map = new HashMap < > ( ) ; parameterMap . put ( methodDes...
Set a TypeQualifierAnnotation on a method parameter .
153,515
public TypeQualifierAnnotation getParameter ( MethodDescriptor methodDesc , int param , TypeQualifierValue < ? > tqv ) { Map < TypeQualifierValue < ? > , TypeQualifierAnnotation > map = parameterMap . get ( methodDesc , param ) ; if ( map == null ) { return null ; } return map . get ( tqv ) ; }
Get the TypeQualifierAnnotation on a parameter .
153,516
protected static boolean isLongOrDouble ( FieldInstruction fieldIns , ConstantPoolGen cpg ) { Type type = fieldIns . getFieldType ( cpg ) ; int code = type . getType ( ) ; return code == Const . T_LONG || code == Const . T_DOUBLE ; }
Return whether the given FieldInstruction accesses a long or double field .
153,517
protected static Variable snarfFieldValue ( FieldInstruction fieldIns , ConstantPoolGen cpg , ValueNumberFrame frame ) throws DataflowAnalysisException { if ( isLongOrDouble ( fieldIns , cpg ) ) { int numSlots = frame . getNumSlots ( ) ; ValueNumber topValue = frame . getValue ( numSlots - 1 ) ; ValueNumber nextValue =...
Get a Variable representing the stack value which will either be stored into or loaded from a field .
153,518
public static Collection < TypeQualifierValue < ? > > getRelevantTypeQualifiers ( MethodDescriptor methodDescriptor , CFG cfg ) throws CheckedAnalysisException { final HashSet < TypeQualifierValue < ? > > result = new HashSet < > ( ) ; XMethod xmethod = XFactory . createXMethod ( methodDescriptor ) ; if ( FIND_EFFECTIV...
Find relevant type qualifiers needing to be checked for a given method .
153,519
public static ClassDescriptor createClassDescriptorFromResourceName ( String resourceName ) { if ( ! isClassResource ( resourceName ) ) { throw new IllegalArgumentException ( "Resource " + resourceName + " is not a class" ) ; } return createClassDescriptor ( resourceName . substring ( 0 , resourceName . length ( ) - 6 ...
Create a class descriptor from a resource name .
153,520
public static ClassDescriptor createClassDescriptorFromFieldSignature ( String signature ) { int start = signature . indexOf ( 'L' ) ; if ( start < 0 ) { return null ; } int end = signature . indexOf ( ';' , start ) ; if ( end < 0 ) { return null ; } return createClassDescriptor ( signature . substring ( start + 1 , en...
Create a class descriptor from a field signature
153,521
public void setPluginList ( Path src ) { if ( pluginList == null ) { pluginList = src ; } else { pluginList . append ( src ) ; } }
the plugin list to use .
153,522
public void addAllowedClass ( String className ) { String classRegex = START + dotsToRegex ( className ) + ".class$" ; LOG . debug ( "Class regex: {}" , classRegex ) ; patternList . add ( Pattern . compile ( classRegex ) . matcher ( "" ) ) ; }
Add the name of a class to be matched by the screener .
153,523
public void addAllowedPackage ( String packageName ) { if ( packageName . endsWith ( "." ) ) { packageName = packageName . substring ( 0 , packageName . length ( ) - 1 ) ; } String packageRegex = START + dotsToRegex ( packageName ) + SEP + JAVA_IDENTIFIER_PART + "+.class$" ; LOG . debug ( "Package regex: {}" , packageR...
Add the name of a package to be matched by the screener . All class files that appear to be in the package should be matched .
153,524
public void addAllowedPrefix ( String prefix ) { if ( prefix . endsWith ( "." ) ) { prefix = prefix . substring ( 0 , prefix . length ( ) - 1 ) ; } LOG . debug ( "Allowed prefix: {}" , prefix ) ; String packageRegex = START + dotsToRegex ( prefix ) + SEP ; LOG . debug ( "Prefix regex: {}" , packageRegex ) ; patternList...
Add the name of a prefix to be matched by the screener . All class files that appear to be in the package specified by the prefix or a more deeply nested package should be matched .
153,525
public String getMessage ( String key ) { BugPattern bugPattern = DetectorFactoryCollection . instance ( ) . lookupBugPattern ( key ) ; if ( bugPattern == null ) { return L10N . getLocalString ( "err.missing_pattern" , "Error: missing bug pattern for key" ) + " " + key ; } return bugPattern . getAbbrev ( ) + ": " + bug...
Get a message string . This is a format pattern for describing an entire bug instance in a single line .
153,526
public String getDetailHTML ( String key ) { BugPattern bugPattern = DetectorFactoryCollection . instance ( ) . lookupBugPattern ( key ) ; if ( bugPattern == null ) { return L10N . getLocalString ( "err.missing_pattern" , "Error: missing bug pattern for key" ) + " " + key ; } return bugPattern . getDetailHTML ( ) ; }
Get an HTML document describing the bug pattern for given key in detail .
153,527
public String getAnnotationDescription ( String key ) { try { return annotationDescriptionBundle . getString ( key ) ; } catch ( MissingResourceException mre ) { if ( DEBUG ) { return "TRANSLATE(" + key + ") (param={0}}" ; } else { try { return englishAnnotationDescriptionBundle . getString ( key ) ; } catch ( MissingR...
Get an annotation description string . This is a format pattern which will describe a BugAnnotation in the context of a particular bug instance . Its single format argument is the BugAnnotation .
153,528
public String getBugCategoryDescription ( String category ) { BugCategory bc = DetectorFactoryCollection . instance ( ) . getBugCategory ( category ) ; return ( bc != null ? bc . getShortDescription ( ) : category ) ; }
Get the description of a bug category . Returns the category if no description can be found .
153,529
JPanel createSourceCodePanel ( ) { Font sourceFont = new Font ( "Monospaced" , Font . PLAIN , ( int ) Driver . getFontSize ( ) ) ; mainFrame . getSourceCodeTextPane ( ) . setFont ( sourceFont ) ; mainFrame . getSourceCodeTextPane ( ) . setEditable ( false ) ; mainFrame . getSourceCodeTextPane ( ) . getCaret ( ) . setSe...
Creates the source code panel but does not put anything in it .
153,530
public void scrollLineToVisible ( int line , int margin ) { int maxMargin = ( parentHeight ( ) - 20 ) / 2 ; if ( margin > maxMargin ) { margin = Math . max ( 0 , maxMargin ) ; } scrollLineToVisibleImpl ( line , margin ) ; }
scroll the specified line into view with a margin of margin pixels above and below
153,531
public void scrollLinesToVisible ( int startLine , int endLine , Collection < Integer > otherLines ) { int startY , endY ; try { startY = lineToY ( startLine ) ; } catch ( BadLocationException ble ) { if ( MainFrame . GUI2_DEBUG ) { ble . printStackTrace ( ) ; } return ; } try { endY = lineToY ( endLine ) ; } catch ( B...
scroll the specified primary lines into view along with as many of the other lines as is convenient
153,532
private void examineBasicBlocks ( ) throws DataflowAnalysisException , CFGBuilderException { Iterator < BasicBlock > bbIter = invDataflow . getCFG ( ) . blockIterator ( ) ; while ( bbIter . hasNext ( ) ) { BasicBlock basicBlock = bbIter . next ( ) ; if ( basicBlock . isNullCheck ( ) ) { analyzeNullCheck ( invDataflow ,...
Examine basic blocks for null checks and potentially - redundant null comparisons .
153,533
private void examineNullValues ( ) throws CFGBuilderException , DataflowAnalysisException { Set < LocationWhereValueBecomesNull > locationWhereValueBecomesNullSet = invDataflow . getAnalysis ( ) . getLocationWhereValueBecomesNullSet ( ) ; if ( DEBUG_DEREFS ) { System . out . println ( "----------------------- examineNu...
Examine null values . Report any that are guaranteed to be dereferenced on non - implicit - exception paths .
153,534
private void noteUnconditionallyDereferencedNullValue ( Location thisLocation , Map < ValueNumber , SortedSet < Location > > bugLocations , Map < ValueNumber , NullValueUnconditionalDeref > nullValueGuaranteedDerefMap , UnconditionalValueDerefSet derefSet , IsNullValue isNullValue , ValueNumber valueNumber ) { if ( DEB...
Note the locations where a known - null value is unconditionally dereferenced .
153,535
private void examineRedundantBranches ( ) { for ( RedundantBranch redundantBranch : redundantBranchList ) { if ( DEBUG ) { System . out . println ( "Redundant branch: " + redundantBranch ) ; } int lineNumber = redundantBranch . lineNumber ; boolean confused = undeterminedBranchSet . get ( lineNumber ) || ( definitelySa...
Examine redundant branches .
153,536
private void analyzeIfNullBranch ( BasicBlock basicBlock , InstructionHandle lastHandle ) throws DataflowAnalysisException { Location location = new Location ( lastHandle , basicBlock ) ; IsNullValueFrame frame = invDataflow . getFactAtLocation ( location ) ; if ( ! frame . isValid ( ) ) { return ; } IsNullValue top = ...
This is called for both IFNULL and IFNONNULL instructions .
153,537
public BugPattern getBugPattern ( ) { BugPattern result = DetectorFactoryCollection . instance ( ) . lookupBugPattern ( getType ( ) ) ; if ( result != null ) { return result ; } AnalysisContext . logError ( "Unable to find description of bug pattern " + getType ( ) ) ; result = DetectorFactoryCollection . instance ( ) ...
Get the BugPattern .
153,538
private < T extends BugAnnotation > T findPrimaryAnnotationOfType ( Class < T > cls ) { T firstMatch = null ; for ( Iterator < BugAnnotation > i = annotationIterator ( ) ; i . hasNext ( ) ; ) { BugAnnotation annotation = i . next ( ) ; if ( cls . isAssignableFrom ( annotation . getClass ( ) ) ) { if ( annotation . getD...
Find the first BugAnnotation in the list of annotations that is the same type or a subtype as the given Class parameter .
153,539
public < A extends BugAnnotation > A getAnnotationWithRole ( Class < A > c , String role ) { for ( BugAnnotation a : annotationList ) { if ( c . isInstance ( a ) && Objects . equals ( role , a . getDescription ( ) ) ) { return c . cast ( a ) ; } } return null ; }
Get the first bug annotation with the specified class and role ; return null if no such annotation exists ;
153,540
public String getProperty ( String name ) { BugProperty prop = lookupProperty ( name ) ; return prop != null ? prop . getValue ( ) : null ; }
Get value of given property .
153,541
public String getProperty ( String name , String defaultValue ) { String value = getProperty ( name ) ; return value != null ? value : defaultValue ; }
Get value of given property returning given default value if the property has not been set .
153,542
public BugInstance setProperty ( String name , String value ) { BugProperty prop = lookupProperty ( name ) ; if ( prop != null ) { prop . setValue ( value ) ; } else { prop = new BugProperty ( name , value ) ; addProperty ( prop ) ; } return this ; }
Set value of given property .
153,543
public BugProperty lookupProperty ( String name ) { BugProperty prop = propertyListHead ; while ( prop != null ) { if ( prop . getName ( ) . equals ( name ) ) { break ; } prop = prop . getNext ( ) ; } return prop ; }
Look up a property by name .
153,544
public boolean deleteProperty ( String name ) { BugProperty prev = null ; BugProperty prop = propertyListHead ; while ( prop != null ) { if ( prop . getName ( ) . equals ( name ) ) { break ; } prev = prop ; prop = prop . getNext ( ) ; } if ( prop != null ) { if ( prev != null ) { prev . setNext ( prop . getNext ( ) ) ;...
Delete property with given name .
153,545
public BugInstance addAnnotations ( Collection < ? extends BugAnnotation > annotationCollection ) { for ( BugAnnotation annotation : annotationCollection ) { add ( annotation ) ; } return this ; }
Add a Collection of BugAnnotations .
153,546
public BugInstance addClassAndMethod ( PreorderVisitor visitor ) { addClass ( visitor ) ; XMethod m = visitor . getXMethod ( ) ; addMethod ( visitor ) ; if ( ! MemberUtils . isUserGenerated ( m ) ) { foundInAutogeneratedMethod ( ) ; } return this ; }
Add a class annotation and a method annotation for the class and method which the given visitor is currently visiting .
153,547
public BugInstance addClassAndMethod ( JavaClass javaClass , Method method ) { addClass ( javaClass . getClassName ( ) ) ; addMethod ( javaClass , method ) ; if ( ! MemberUtils . isUserGenerated ( method ) ) { foundInAutogeneratedMethod ( ) ; } return this ; }
Add class and method annotations for given class and method .
153,548
public BugInstance addClass ( ClassNode classNode ) { String dottedClassName = ClassName . toDottedClassName ( classNode . name ) ; ClassAnnotation classAnnotation = new ClassAnnotation ( dottedClassName ) ; add ( classAnnotation ) ; return this ; }
Add a class annotation for the classNode .
153,549
public BugInstance addClass ( PreorderVisitor visitor ) { String className = visitor . getDottedClassName ( ) ; addClass ( className ) ; return this ; }
Add a class annotation for the class that the visitor is currently visiting .
153,550
public BugInstance addSuperclass ( PreorderVisitor visitor ) { String className = ClassName . toDottedClassName ( visitor . getSuperclassName ( ) ) ; addClass ( className ) ; return this ; }
Add a class annotation for the superclass of the class the visitor is currently visiting .
153,551
public BugInstance addType ( String typeDescriptor ) { TypeAnnotation typeAnnotation = new TypeAnnotation ( typeDescriptor ) ; add ( typeAnnotation ) ; return this ; }
Add a type annotation . Handy for referring to array types .
153,552
public BugInstance addField ( String className , String fieldName , String fieldSig , boolean isStatic ) { addField ( new FieldAnnotation ( className , fieldName , fieldSig , isStatic ) ) ; return this ; }
Add a field annotation .
153,553
public BugInstance addField ( FieldVariable field ) { return addField ( field . getClassName ( ) , field . getFieldName ( ) , field . getFieldSig ( ) , field . isStatic ( ) ) ; }
Add a field annotation for a FieldVariable matched in a ByteCodePattern .
153,554
public BugInstance addField ( FieldDescriptor fieldDescriptor ) { FieldAnnotation fieldAnnotation = FieldAnnotation . fromFieldDescriptor ( fieldDescriptor ) ; add ( fieldAnnotation ) ; return this ; }
Add a field annotation for a FieldDescriptor .
153,555
public BugInstance addVisitedField ( PreorderVisitor visitor ) { FieldAnnotation f = FieldAnnotation . fromVisitedField ( visitor ) ; addField ( f ) ; return this ; }
Add a field annotation for the field which is being visited by given visitor .
153,556
public BugInstance addOptionalLocalVariable ( DismantleBytecode dbc , OpcodeStack . Item item ) { int register = item . getRegisterNumber ( ) ; if ( register >= 0 ) { this . add ( LocalVariableAnnotation . getLocalVariableAnnotation ( dbc . getMethod ( ) , register , dbc . getPC ( ) - 1 , dbc . getPC ( ) ) ) ; } return...
Local variable adders
153,557
public BugInstance addMethod ( PreorderVisitor visitor ) { MethodAnnotation methodAnnotation = MethodAnnotation . fromVisitedMethod ( visitor ) ; addMethod ( methodAnnotation ) ; addSourceLinesForMethod ( methodAnnotation , SourceLineAnnotation . fromVisitedMethod ( visitor ) ) ; return this ; }
Add a method annotation for the method which the given visitor is currently visiting . If the method has source line information then a SourceLineAnnotation is added to the method .
153,558
public BugInstance addCalledMethod ( DismantleBytecode visitor ) { return addMethod ( MethodAnnotation . fromCalledMethod ( visitor ) ) . describe ( MethodAnnotation . METHOD_CALLED ) ; }
Add a method annotation for the method which has been called by the method currently being visited by given visitor . Assumes that the visitor has just looked at an invoke instruction of some kind .
153,559
public BugInstance addCalledMethod ( String className , String methodName , String methodSig , boolean isStatic ) { return addMethod ( MethodAnnotation . fromCalledMethod ( className , methodName , methodSig , isStatic ) ) . describe ( MethodAnnotation . METHOD_CALLED ) ; }
Add a method annotation .
153,560
public BugInstance addParameterAnnotation ( int index , String role ) { return addInt ( index + 1 ) . describe ( role ) ; }
Add an annotation about a parameter
153,561
public BugInstance addString ( char c ) { add ( StringAnnotation . fromRawString ( Character . toString ( c ) ) ) ; return this ; }
Add a String annotation .
153,562
public BugInstance addSourceLine ( ClassContext classContext , MethodGen methodGen , String sourceFile , InstructionHandle start , InstructionHandle end ) { if ( start . getPosition ( ) > end . getPosition ( ) ) { InstructionHandle tmp = start ; start = end ; end = tmp ; } SourceLineAnnotation sourceLineAnnotation = So...
Add a source line annotation describing a range of instructions .
153,563
public BugInstance addUnknownSourceLine ( String className , String sourceFile ) { SourceLineAnnotation sourceLineAnnotation = SourceLineAnnotation . createUnknown ( className , sourceFile ) ; if ( sourceLineAnnotation != null ) { add ( sourceLineAnnotation ) ; } return this ; }
Add a non - specific source line annotation . This will result in the entire source file being displayed .
153,564
public BugInstance describe ( String description ) { annotationList . get ( annotationList . size ( ) - 1 ) . setDescription ( description ) ; return this ; }
Add a description to the most recently added bug annotation .
153,565
public ExceptionSet getEdgeExceptionSet ( Edge edge ) { CachedExceptionSet cachedExceptionSet = thrownExceptionSetMap . get ( edge . getSource ( ) ) ; return cachedExceptionSet . getEdgeExceptionSet ( edge ) ; }
Get the set of exceptions that can be thrown on given edge . This should only be called after the analysis completes .
153,566
private CachedExceptionSet getCachedExceptionSet ( BasicBlock basicBlock ) { CachedExceptionSet cachedExceptionSet = thrownExceptionSetMap . get ( basicBlock ) ; if ( cachedExceptionSet == null ) { TypeFrame top = createFact ( ) ; makeFactTop ( top ) ; cachedExceptionSet = new CachedExceptionSet ( top , exceptionSetFac...
Get the cached set of exceptions that can be thrown from given basic block . If this information hasn t been computed yet then an empty exception set is returned .
153,567
private CachedExceptionSet computeBlockExceptionSet ( BasicBlock basicBlock , TypeFrame result ) throws DataflowAnalysisException { ExceptionSet exceptionSet = computeThrownExceptionTypes ( basicBlock ) ; TypeFrame copyOfResult = createFact ( ) ; copy ( result , copyOfResult ) ; CachedExceptionSet cachedExceptionSet = ...
Compute the set of exceptions that can be thrown from the given basic block . This should only be called if the existing cached exception set is out of date .
153,568
private ExceptionSet computeEdgeExceptionSet ( Edge edge , ExceptionSet thrownExceptionSet ) { if ( thrownExceptionSet . isEmpty ( ) ) { return thrownExceptionSet ; } ExceptionSet result = exceptionSetFactory . createExceptionSet ( ) ; if ( edge . getType ( ) == UNHANDLED_EXCEPTION_EDGE ) { result . addAll ( thrownExce...
Based on the set of exceptions that can be thrown from the source basic block compute the set of exceptions that can propagate along given exception edge . This method should be called for each outgoing exception edge in sequence so the caught exceptions can be removed from the thrown exception set as needed .
153,569
private ExceptionSet computeThrownExceptionTypes ( BasicBlock basicBlock ) throws DataflowAnalysisException { ExceptionSet exceptionTypeSet = exceptionSetFactory . createExceptionSet ( ) ; InstructionHandle pei = basicBlock . getExceptionThrower ( ) ; Instruction ins = pei . getInstruction ( ) ; ExceptionThrower except...
Compute the set of exception types that can be thrown by given basic block .
153,570
public static JavaClass getOuterClass ( JavaClass obj ) throws ClassNotFoundException { for ( Attribute a : obj . getAttributes ( ) ) { if ( a instanceof InnerClasses ) { for ( InnerClass ic : ( ( InnerClasses ) a ) . getInnerClasses ( ) ) { if ( obj . getClassNameIndex ( ) == ic . getInnerClassIndex ( ) ) { ConstantCl...
Determine the outer class of obj .
153,571
public void addVerticesToSet ( Set < VertexType > set ) { set . add ( this . m_vertex ) ; Iterator < SearchTree < VertexType > > i = childIterator ( ) ; while ( i . hasNext ( ) ) { SearchTree < VertexType > child = i . next ( ) ; child . addVerticesToSet ( set ) ; } }
Add all vertices contained in this search tree to the given set .
153,572
private void checkQualifier ( XMethod xmethod , CFG cfg , TypeQualifierValue < ? > typeQualifierValue , ForwardTypeQualifierDataflowFactory forwardDataflowFactory , BackwardTypeQualifierDataflowFactory backwardDataflowFactory , ValueNumberDataflow vnaDataflow ) throws CheckedAnalysisException { if ( DEBUG ) { System . ...
Check a specific TypeQualifierValue on a method .
153,573
public void setMethodHash ( XMethod method , byte [ ] methodHash ) { methodHashMap . put ( method , new MethodHash ( method . getName ( ) , method . getSignature ( ) , method . isStatic ( ) , methodHash ) ) ; }
Set method hash for given method .
153,574
public void setClassHash ( byte [ ] classHash ) { this . classHash = new byte [ classHash . length ] ; System . arraycopy ( classHash , 0 , this . classHash , 0 , classHash . length ) ; }
Set class hash .
153,575
public ClassHash computeHash ( JavaClass javaClass ) { this . className = javaClass . getClassName ( ) ; Method [ ] methodList = new Method [ javaClass . getMethods ( ) . length ] ; System . arraycopy ( javaClass . getMethods ( ) , 0 , methodList , 0 , javaClass . getMethods ( ) . length ) ; Arrays . sort ( methodList ...
Compute hash for given class and all of its methods .
153,576
public static String hashToString ( byte [ ] hash ) { StringBuilder buf = new StringBuilder ( ) ; for ( byte b : hash ) { buf . append ( HEX_CHARS [ ( b >> 4 ) & 0xF ] ) ; buf . append ( HEX_CHARS [ b & 0xF ] ) ; } return buf . toString ( ) ; }
Convert a hash to a string of hex digits .
153,577
public static byte [ ] stringToHash ( String s ) { if ( s . length ( ) % 2 != 0 ) { throw new IllegalArgumentException ( "Invalid hash string: " + s ) ; } byte [ ] hash = new byte [ s . length ( ) / 2 ] ; for ( int i = 0 ; i < s . length ( ) ; i += 2 ) { byte b = ( byte ) ( ( hexDigitValue ( s . charAt ( i ) ) << 4 ) +...
Convert a string of hex digits to a hash .
153,578
public static Variable lookup ( String varName , BindingSet bindingSet ) { if ( bindingSet == null ) { return null ; } Binding binding = bindingSet . lookup ( varName ) ; return ( binding != null ) ? binding . getVariable ( ) : null ; }
Look up a variable definition in given BindingSet .
153,579
public WarningPropertySet < T > addProperty ( T prop ) { map . put ( prop , Boolean . TRUE ) ; return this ; }
Add a warning property to the set . The warning implicitly has the boolean value true as its attribute .
153,580
public WarningPropertySet < T > setProperty ( T prop , String value ) { map . put ( prop , value ) ; return this ; }
Add a warning property and its attribute value .
153,581
public boolean checkProperty ( T prop , Object value ) { Object attribute = getProperty ( prop ) ; return ( attribute != null && attribute . equals ( value ) ) ; }
Check whether or not the given WarningProperty has the given attribute value .
153,582
public int computePriority ( int basePriority ) { boolean relaxedReporting = FindBugsAnalysisFeatures . isRelaxedMode ( ) ; boolean atLeastMedium = false ; boolean falsePositive = false ; boolean atMostLow = false ; boolean atMostMedium = false ; boolean peggedHigh = false ; int aLittleBitLower = 0 ; int priority = bas...
Use the PriorityAdjustments specified by the set s WarningProperty elements to compute a warning priority from the given base priority .
153,583
public void decorateBugInstance ( BugInstance bugInstance ) { int priority = computePriority ( bugInstance . getPriority ( ) ) ; bugInstance . setPriority ( priority ) ; for ( Map . Entry < T , Object > entry : map . entrySet ( ) ) { WarningProperty prop = entry . getKey ( ) ; Object attribute = entry . getValue ( ) ; ...
Decorate given BugInstance with properties .
153,584
public ValueNumber getEntryValueForParameter ( int param ) { SignatureParser sigParser = new SignatureParser ( methodGen . getSignature ( ) ) ; int p = 0 ; int slotOffset = methodGen . isStatic ( ) ? 0 : 1 ; for ( String paramSig : sigParser . parameterSignatures ( ) ) { if ( p == param ) { return getEntryValue ( slotO...
Get the value number assigned to the given parameter upon entry to the method .
153,585
public static void writeCollection ( XMLOutput xmlOutput , Collection < ? extends XMLWriteable > collection ) throws IOException { for ( XMLWriteable obj : collection ) { obj . writeXML ( xmlOutput ) ; } }
Write a Collection of XMLWriteable objects .
153,586
public void addParameterAnnotation ( int param , AnnotationValue annotationValue ) { HashMap < Integer , Map < ClassDescriptor , AnnotationValue > > updatedAnnotations = new HashMap < > ( methodParameterAnnotations ) ; Map < ClassDescriptor , AnnotationValue > paramMap = updatedAnnotations . get ( param ) ; if ( paramM...
Destructively add a parameter annotation .
153,587
String getResourceName ( ) { if ( ! resourceNameKnown ) { try { resourceName = getClassDescriptor ( ) . toResourceName ( ) ; } catch ( Exception e ) { resourceName = fileName ; } resourceNameKnown = true ; } return resourceName ; }
Get the resource name of the single file . We have to open the file and parse the constant pool in order to find this out .
153,588
public InputStream getInputStreamFromOffset ( int offset ) throws IOException { loadFileData ( ) ; return new ByteArrayInputStream ( data , offset , data . length - offset ) ; }
Get an InputStream on data starting at given offset .
153,589
public void addLineOffset ( int offset ) { if ( numLines >= lineNumberMap . length ) { int capacity = lineNumberMap . length * 2 ; int [ ] newLineNumberMap = new int [ capacity ] ; System . arraycopy ( lineNumberMap , 0 , newLineNumberMap , 0 , lineNumberMap . length ) ; lineNumberMap = newLineNumberMap ; } lineNumberM...
Add a source line byte offset . This method should be called for each line in the source file in order .
153,590
public int getLineOffset ( int line ) { try { loadFileData ( ) ; } catch ( IOException e ) { System . err . println ( "SourceFile.getLineOffset: " + e . getMessage ( ) ) ; return - 1 ; } if ( line < 0 || line >= numLines ) { return - 1 ; } return lineNumberMap [ line ] ; }
Get the byte offset in the data for a source line . Note that lines are considered to be zero - index so the first line in the file is numbered zero .
153,591
public void findStronglyConnectedComponents ( GraphType g , GraphToolkit < GraphType , EdgeType , VertexType > toolkit ) { DepthFirstSearch < GraphType , EdgeType , VertexType > initialDFS = new DepthFirstSearch < > ( g ) ; if ( m_vertexChooser != null ) { initialDFS . setVertexChooser ( m_vertexChooser ) ; } initialDF...
Find the strongly connected components in given graph .
153,592
public Collection < String > split ( ) { String s = ident ; Set < String > result = new HashSet < > ( ) ; while ( s . length ( ) > 0 ) { StringBuilder buf = new StringBuilder ( ) ; char first = s . charAt ( 0 ) ; buf . append ( first ) ; int i = 1 ; if ( s . length ( ) > 1 ) { boolean camelWord ; if ( Character . isLow...
Split the identifier into words .
153,593
private static void collectAllAnonymous ( List < IType > list , IParent parent , boolean allowNested ) throws JavaModelException { IJavaElement [ ] children = parent . getChildren ( ) ; for ( int i = 0 ; i < children . length ; i ++ ) { IJavaElement childElem = children [ i ] ; if ( isAnonymousType ( childElem ) ) { li...
Traverses down the children tree of this parent and collect all child anon . classes
153,594
private static void sortAnonymous ( List < IType > anonymous , IType anonType ) { SourceOffsetComparator sourceComparator = new SourceOffsetComparator ( ) ; final AnonymClassComparator classComparator = new AnonymClassComparator ( anonType , sourceComparator ) ; Collections . sort ( anonymous , classComparator ) ; }
Sort given anonymous classes in order like java compiler would generate output classes in context of given anonymous type
153,595
public static void addFindBugsNature ( IProject project , IProgressMonitor monitor ) throws CoreException { if ( hasFindBugsNature ( project ) ) { return ; } IProjectDescription description = project . getDescription ( ) ; String [ ] prevNatures = description . getNatureIds ( ) ; for ( int i = 0 ; i < prevNatures . len...
Adds a FindBugs nature to a project .
153,596
public static boolean hasFindBugsNature ( IProject project ) { try { return ProjectUtilities . isJavaProject ( project ) && project . hasNature ( FindbugsPlugin . NATURE_ID ) ; } catch ( CoreException e ) { FindbugsPlugin . getDefault ( ) . logException ( e , "Error while testing SpotBugs nature for project " + project...
Using the natures name check whether the current project has FindBugs nature .
153,597
public static void removeFindBugsNature ( IProject project , IProgressMonitor monitor ) throws CoreException { if ( ! hasFindBugsNature ( project ) ) { return ; } IProjectDescription description = project . getDescription ( ) ; String [ ] prevNatures = description . getNatureIds ( ) ; ArrayList < String > newNaturesLis...
Removes the FindBugs nature from a project .
153,598
public void execute ( ) throws CFGBuilderException { JavaClass jclass = classContext . getJavaClass ( ) ; Method [ ] methods = jclass . getMethods ( ) ; LOG . debug ( "Class has {} methods" , methods . length ) ; for ( Method method : methods ) { callGraph . addNode ( method ) ; } LOG . debug ( "Added {} nodes to graph...
Find the self calls .
153,599
public Iterator < CallSite > callSiteIterator ( ) { return new Iterator < CallSite > ( ) { private final Iterator < CallGraphEdge > iter = callGraph . edgeIterator ( ) ; public boolean hasNext ( ) { return iter . hasNext ( ) ; } public CallSite next ( ) { return iter . next ( ) . getCallSite ( ) ; } public void remove ...
Get an Iterator over all self call sites .