idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
29,600
public DetectorFactory getFactoryByShortName ( final String shortName ) { return findFirstMatchingFactory ( factory -> factory . getShortName ( ) . equals ( shortName ) ) ; }
Look up a DetectorFactory by short name .
29,601
public DetectorFactory getFactoryByFullName ( final String fullName ) { return findFirstMatchingFactory ( factory -> factory . getFullName ( ) . equals ( fullName ) ) ; }
Look up a DetectorFactory by full name .
29,602
public Collection < TypeQualifierValue < ? > > getDirectlyRelevantTypeQualifiers ( MethodDescriptor m ) { Collection < TypeQualifierValue < ? > > result = methodToDirectlyRelevantQualifiersMap . get ( m ) ; if ( result != null ) { return result ; } return Collections . < TypeQualifierValue < ? > > emptyList ( ) ; }
Get the directly - relevant type qualifiers applied to given method .
29,603
public void setDirectlyRelevantTypeQualifiers ( MethodDescriptor methodDescriptor , Collection < TypeQualifierValue < ? > > qualifiers ) { methodToDirectlyRelevantQualifiersMap . put ( methodDescriptor , qualifiers ) ; allKnownQualifiers . addAll ( qualifiers ) ; }
Set the collection of directly - relevant type qualifiers for a given method .
29,604
private int adjustPriority ( int priority ) { try { Subtypes2 subtypes2 = AnalysisContext . currentAnalysisContext ( ) . getSubtypes2 ( ) ; if ( ! subtypes2 . hasSubtypes ( getClassDescriptor ( ) ) ) { priority ++ ; } else { Set < ClassDescriptor > mySubtypes = subtypes2 . getSubtypes ( getClassDescriptor ( ) ) ; Strin...
Adjust the priority of a warning about to be reported .
29,605
void registerDetector ( DetectorFactory factory ) { if ( FindBugs . DEBUG ) { System . out . println ( "Registering detector: " + factory . getFullName ( ) ) ; } String detectorName = factory . getShortName ( ) ; if ( ! factoryList . contains ( factory ) ) { factoryList . add ( factory ) ; } else { LOGGER . log ( Level...
Register a DetectorFactory .
29,606
public BugPattern lookupBugPattern ( String bugType ) { if ( bugType == null ) { return null ; } return bugPatternMap . get ( bugType ) ; }
Look up bug pattern .
29,607
public Collection < String > getBugCategories ( ) { ArrayList < String > result = new ArrayList < > ( categoryDescriptionMap . size ( ) ) ; for ( BugCategory c : categoryDescriptionMap . values ( ) ) { if ( ! c . isHidden ( ) ) { result . add ( c . getCategory ( ) ) ; } } return result ; }
Get a Collection containing all known bug category keys . E . g . CORRECTNESS MT_CORRECTNESS PERFORMANCE etc .
29,608
public static boolean isGetterMethod ( ClassContext classContext , Method method ) { MethodGen methodGen = classContext . getMethodGen ( method ) ; if ( methodGen == null ) { return false ; } InstructionList il = methodGen . getInstructionList ( ) ; if ( il . getLength ( ) > 60 ) { return false ; } int count = 0 ; Iter...
Determine whether or not the the given method is a getter method . I . e . if it just returns the value of an instance field .
29,609
private FieldStats getStats ( XField field ) { FieldStats stats = statMap . get ( field ) ; if ( stats == null ) { stats = new FieldStats ( field ) ; statMap . put ( field , stats ) ; } return stats ; }
Get the access statistics for given field .
29,610
private static Set < Method > findLockedMethods ( ClassContext classContext , SelfCalls selfCalls , Set < CallSite > obviouslyLockedSites ) { JavaClass javaClass = classContext . getJavaClass ( ) ; Method [ ] methodList = javaClass . getMethods ( ) ; CallGraph callGraph = selfCalls . getCallGraph ( ) ; Set < Method > l...
Find methods that appear to always be called from a locked context . We assume that nonpublic methods will only be called from within the class which is not really a valid assumption .
29,611
private static Set < CallSite > findObviouslyLockedCallSites ( ClassContext classContext , SelfCalls selfCalls ) throws CFGBuilderException , DataflowAnalysisException { ConstantPoolGen cpg = classContext . getConstantPoolGen ( ) ; Set < CallSite > obviouslyLockedSites = new HashSet < > ( ) ; for ( Iterator < CallSite ...
Find all self - call sites that are obviously locked .
29,612
private static boolean implementsMap ( ClassDescriptor d ) { while ( d != null ) { try { if ( "java.util.EnumMap" . equals ( d . getDottedClassName ( ) ) ) { return false ; } if ( "java.util.Map" . equals ( d . getDottedClassName ( ) ) ) { return true ; } XClass classNameAndInfo = Global . getAnalysisCache ( ) . getCla...
Determine from the class descriptor for a variable whether that variable implements java . util . Map .
29,613
private void restoreDefaultSettings ( ) { if ( getProject ( ) != null ) { chkEnableFindBugs . setSelection ( false ) ; chkRunAtFullBuild . setEnabled ( false ) ; FindBugsPreferenceInitializer . restoreDefaults ( projectStore ) ; } else { FindBugsPreferenceInitializer . restoreDefaults ( workspaceStore ) ; } currentUser...
Restore default settings . This just changes the dialog widgets - the user still needs to confirm by clicking the OK button .
29,614
public boolean performOk ( ) { reportConfigurationTab . performOk ( ) ; boolean analysisSettingsChanged = false ; boolean reporterSettingsChanged = false ; boolean needRedisplayMarkers = false ; if ( workspaceSettingsTab != null ) { workspaceSettingsTab . performOK ( ) ; } boolean pluginsChanged = false ; if ( ! curren...
Will be called when the user presses the OK button .
29,615
public Token next ( ) throws IOException { skipWhitespace ( ) ; int c = reader . read ( ) ; if ( c < 0 ) { return new Token ( Token . EOF ) ; } else if ( c == '\n' ) { return new Token ( Token . EOL ) ; } else if ( c == '\'' || c == '"' ) { return munchString ( c ) ; } else if ( c == '/' ) { return maybeComment ( ) ; }...
Get the next Token in the stream .
29,616
private void reportResultsToConsole ( ) { if ( ! isStreamReportingEnabled ( ) ) { return ; } printToStream ( "Finished, found: " + bugCount + " bugs" ) ; ConfigurableXmlOutputStream xmlStream = new ConfigurableXmlOutputStream ( stream , true ) ; ProjectStats stats = bugCollection . getProjectStats ( ) ; printToStream (...
If there is a FB console opened report results and statistics to it .
29,617
public ByteCodePattern addWild ( int numWild ) { Wild wild = isLastWild ( ) ; if ( wild != null ) { wild . setMinAndMax ( 0 , numWild ) ; } else { addElement ( new Wild ( numWild ) ) ; } return this ; }
Add a wildcard to match between 0 and given number of instructions . If there is already a wildcard at the end of the current pattern resets its max value to that given .
29,618
public Edge lookupEdgeById ( int id ) { Iterator < Edge > i = edgeIterator ( ) ; while ( i . hasNext ( ) ) { Edge edge = i . next ( ) ; if ( edge . getId ( ) == id ) { return edge ; } } return null ; }
Look up an Edge by its id .
29,619
public BasicBlock lookupBlockByLabel ( int blockLabel ) { for ( Iterator < BasicBlock > i = blockIterator ( ) ; i . hasNext ( ) ; ) { BasicBlock basicBlock = i . next ( ) ; if ( basicBlock . getLabel ( ) == blockLabel ) { return basicBlock ; } } return null ; }
Look up a BasicBlock by its unique label .
29,620
public Collection < Location > orderedLocations ( ) { TreeSet < Location > tree = new TreeSet < > ( ) ; for ( Iterator < Location > locs = locationIterator ( ) ; locs . hasNext ( ) ; ) { Location loc = locs . next ( ) ; tree . add ( loc ) ; } return tree ; }
Returns a collection of locations ordered according to the compareTo ordering over locations . If you want to list all the locations in a CFG for debugging purposes this is a good order to do so in .
29,621
public Collection < BasicBlock > getBlocks ( BitSet labelSet ) { LinkedList < BasicBlock > result = new LinkedList < > ( ) ; for ( Iterator < BasicBlock > i = blockIterator ( ) ; i . hasNext ( ) ; ) { BasicBlock block = i . next ( ) ; if ( labelSet . get ( block . getLabel ( ) ) ) { result . add ( block ) ; } } return ...
Get Collection of basic blocks whose IDs are specified by given BitSet .
29,622
public Collection < BasicBlock > getBlocksContainingInstructionWithOffset ( int offset ) { LinkedList < BasicBlock > result = new LinkedList < > ( ) ; for ( Iterator < BasicBlock > i = blockIterator ( ) ; i . hasNext ( ) ; ) { BasicBlock block = i . next ( ) ; if ( block . containsInstructionWithOffset ( offset ) ) { r...
Get a Collection of basic blocks which contain the bytecode instruction with given offset .
29,623
public Collection < Location > getLocationsContainingInstructionWithOffset ( int offset ) { LinkedList < Location > result = new LinkedList < > ( ) ; for ( Iterator < Location > i = locationIterator ( ) ; i . hasNext ( ) ; ) { Location location = i . next ( ) ; if ( location . getHandle ( ) . getPosition ( ) == offset ...
Get a Collection of Locations which specify the instruction at given bytecode offset .
29,624
public int getNumNonExceptionSucessors ( BasicBlock block ) { int numNonExceptionSuccessors = block . getNumNonExceptionSuccessors ( ) ; if ( numNonExceptionSuccessors < 0 ) { numNonExceptionSuccessors = 0 ; for ( Iterator < Edge > i = outgoingEdgeIterator ( block ) ; i . hasNext ( ) ; ) { Edge edge = i . next ( ) ; if...
Get number of non - exception control successors of given basic block .
29,625
public Location getLocationAtEntry ( ) { InstructionHandle handle = getEntry ( ) . getFirstInstruction ( ) ; assert handle != null ; return new Location ( handle , getEntry ( ) ) ; }
Get the Location representing the entry to the CFG . Note that this is a fake Location and shouldn t be relied on to yield source line information .
29,626
public void addPlugin ( Plugin plugin ) throws OrderingConstraintException { if ( DEBUG ) { System . out . println ( "Adding plugin " + plugin . getPluginId ( ) + " to execution plan" ) ; } pluginList . add ( plugin ) ; copyTo ( plugin . interPassConstraintIterator ( ) , interPassConstraintList ) ; copyTo ( plugin . in...
Add a Plugin whose Detectors should be added to the execution plan .
29,627
private void assignToPass ( DetectorFactory factory , AnalysisPass pass ) { pass . addToPass ( factory ) ; assignedToPassSet . add ( factory ) ; }
Make a DetectorFactory a member of an AnalysisPass .
29,628
public void execute ( InstructionScannerGenerator generator ) { while ( edgeIter . hasNext ( ) ) { Edge edge = edgeIter . next ( ) ; BasicBlock source = edge . getSource ( ) ; if ( DEBUG ) { System . out . println ( "ISD: scanning instructions in block " + source . getLabel ( ) ) ; } Iterator < InstructionHandle > i = ...
Execute by driving the InstructionScannerGenerator over all instructions . Each generated InstructionScanner is driven over all instructions and edges .
29,629
@ SuppressWarnings ( "rawtypes" ) protected IProject [ ] build ( int kind , Map args , IProgressMonitor monitor ) throws CoreException { monitor . subTask ( "Running SpotBugs..." ) ; switch ( kind ) { case IncrementalProjectBuilder . FULL_BUILD : { FindBugs2Eclipse . cleanClassClache ( getProject ( ) ) ; if ( FindbugsP...
Run the builder .
29,630
protected void work ( final IResource resource , final List < WorkItem > resources , IProgressMonitor monitor ) { IPreferenceStore store = FindbugsPlugin . getPluginPreferences ( getProject ( ) ) ; boolean runAsJob = store . getBoolean ( FindBugsConstants . KEY_RUN_ANALYSIS_AS_EXTRA_JOB ) ; FindBugsJob fbJob = new Star...
Run a FindBugs analysis on the given resource as build job BUT not delaying the current Java build
29,631
public static String getMissingClassName ( ClassNotFoundException ex ) { Throwable cause = ex . getCause ( ) ; if ( cause instanceof ResourceNotFoundException ) { String resourceName = ( ( ResourceNotFoundException ) cause ) . getResourceName ( ) ; if ( resourceName != null ) { ClassDescriptor classDesc = DescriptorFac...
Get the name of the missing class from a ClassNotFoundException .
29,632
public void addFieldLine ( String className , String fieldName , SourceLineRange range ) { fieldLineMap . put ( new FieldDescriptor ( className , fieldName ) , range ) ; }
Add a line number entry for a field .
29,633
public void addMethodLine ( String className , String methodName , String methodSignature , SourceLineRange range ) { methodLineMap . put ( new MethodDescriptor ( className , methodName , methodSignature ) , range ) ; }
Add a line number entry for a method .
29,634
public SourceLineRange getFieldLine ( String className , String fieldName ) { return fieldLineMap . get ( new FieldDescriptor ( className , fieldName ) ) ; }
Look up the line number range for a field .
29,635
public SourceLineRange getMethodLine ( String className , String methodName , String methodSignature ) { return methodLineMap . get ( new MethodDescriptor ( className , methodName , methodSignature ) ) ; }
Look up the line number range for a method .
29,636
private static String parseVersionNumber ( String line ) { StringTokenizer tokenizer = new StringTokenizer ( line , " \t" ) ; if ( ! expect ( tokenizer , "sourceInfo" ) || ! expect ( tokenizer , "version" ) || ! tokenizer . hasMoreTokens ( ) ) { return null ; } return tokenizer . nextToken ( ) ; }
Parse the sourceInfo version string .
29,637
private static boolean expect ( StringTokenizer tokenizer , String token ) { if ( ! tokenizer . hasMoreTokens ( ) ) { return false ; } String s = tokenizer . nextToken ( ) ; if ( DEBUG ) { System . out . println ( "token=" + s ) ; } return s . equals ( token ) ; }
Expect a particular token string to be returned by the given StringTokenizer .
29,638
private int compareClassesAllowingNull ( ClassAnnotation lhs , ClassAnnotation rhs ) { if ( lhs == null || rhs == null ) { return compareNullElements ( lhs , rhs ) ; } String lhsClassName = classNameRewriter . rewriteClassName ( lhs . getClassName ( ) ) ; String rhsClassName = classNameRewriter . rewriteClassName ( rhs...
Compare class annotations .
29,639
static int countFilteredBugs ( ) { int result = 0 ; for ( BugLeafNode bug : getMainBugSet ( ) . mainList ) { if ( suppress ( bug ) ) { result ++ ; } } return result ; }
used to update the status bar in mainframe with the number of bugs that are filtered out
29,640
public BugSet query ( BugAspects a ) { BugSet result = this ; for ( SortableValue sp : a ) { result = result . query ( sp ) ; } return result ; }
Gives you back the BugSet containing all bugs that match your query
29,641
private static Location pcToLocation ( ClassContext classContext , Method method , int pc ) throws CFGBuilderException { CFG cfg = classContext . getCFG ( method ) ; for ( Iterator < Location > i = cfg . locationIterator ( ) ; i . hasNext ( ) ; ) { Location location = i . next ( ) ; if ( location . getHandle ( ) . getP...
Get a Location matching the given PC value . Because of JSR subroutines there may be multiple Locations referring to the given instruction . This method simply returns one of them arbitrarily .
29,642
private static void addReceiverObjectType ( WarningPropertySet < WarningProperty > propertySet , ClassContext classContext , Method method , Location location ) { try { Instruction ins = location . getHandle ( ) . getInstruction ( ) ; if ( ! receiverObjectInstructionSet . get ( ins . getOpcode ( ) ) ) { return ; } Type...
Add a RECEIVER_OBJECT_TYPE warning property for a particular location in a method to given warning property set .
29,643
private Set < String > buildClassSet ( BugCollection bugCollection ) { Set < String > classSet = new HashSet < > ( ) ; for ( Iterator < BugInstance > i = bugCollection . iterator ( ) ; i . hasNext ( ) ; ) { BugInstance warning = i . next ( ) ; for ( Iterator < BugAnnotation > j = warning . annotationIterator ( ) ; j . ...
Find set of classes referenced in given BugCollection .
29,644
private void suppressWarningsIfOneLiveStoreOnLine ( BugAccumulator accumulator , BitSet liveStoreSourceLineSet ) { if ( ! SUPPRESS_IF_AT_LEAST_ONE_LIVE_STORE_ON_LINE ) { return ; } entryLoop : for ( Iterator < ? extends BugInstance > i = accumulator . uniqueBugs ( ) . iterator ( ) ; i . hasNext ( ) ; ) { for ( SourceLi...
If feature is enabled suppress warnings where there is at least one live store on the line where the warning would be reported .
29,645
private void countLocalStoresLoadsAndIncrements ( int [ ] localStoreCount , int [ ] localLoadCount , int [ ] localIncrementCount , CFG cfg ) { for ( Iterator < Location > i = cfg . locationIterator ( ) ; i . hasNext ( ) ; ) { Location location = i . next ( ) ; if ( location . getBasicBlock ( ) . isExceptionHandler ( ) ...
Count stores loads and increments of local variables in method whose CFG is given .
29,646
private boolean isStore ( Location location ) { Instruction ins = location . getHandle ( ) . getInstruction ( ) ; return ( ins instanceof StoreInstruction ) || ( ins instanceof IINC ) ; }
Is instruction at given location a store?
29,647
private boolean isLoad ( Location location ) { Instruction ins = location . getHandle ( ) . getInstruction ( ) ; return ( ins instanceof LoadInstruction ) || ( ins instanceof IINC ) ; }
Is instruction at given location a load?
29,648
public AnnotationVisitor getAnnotationVisitor ( ) { return new AnnotationVisitor ( FindBugsASM . ASM_VERSION ) { public void visit ( String name , Object value ) { name = canonicalString ( name ) ; valueMap . put ( name , value ) ; } public AnnotationVisitor visitAnnotation ( String name , String desc ) { name = canoni...
Get an AnnotationVisitor which can populate this AnnotationValue object .
29,649
private Constant readConstant ( ) throws InvalidClassFileFormatException , IOException { int tag = in . readUnsignedByte ( ) ; if ( tag < 0 || tag >= CONSTANT_FORMAT_MAP . length ) { throw new InvalidClassFileFormatException ( expectedClassDescriptor , codeBaseEntry ) ; } String format = CONSTANT_FORMAT_MAP [ tag ] ; i...
Read a constant from the constant pool . Return null for
29,650
private String getUtf8String ( int refIndex ) throws InvalidClassFileFormatException { checkConstantPoolIndex ( refIndex ) ; Constant refConstant = constantPool [ refIndex ] ; checkConstantTag ( refConstant , IClassConstants . CONSTANT_Utf8 ) ; return ( String ) refConstant . data [ 0 ] ; }
Get the UTF - 8 string constant at given constant pool index .
29,651
private void checkConstantPoolIndex ( int index ) throws InvalidClassFileFormatException { if ( index < 0 || index >= constantPool . length || constantPool [ index ] == null ) { throw new InvalidClassFileFormatException ( expectedClassDescriptor , codeBaseEntry ) ; } }
Check that a constant pool index is valid .
29,652
private void checkConstantTag ( Constant constant , int expectedTag ) throws InvalidClassFileFormatException { if ( constant . tag != expectedTag ) { throw new InvalidClassFileFormatException ( expectedClassDescriptor , codeBaseEntry ) ; } }
Check that a constant has the expected tag .
29,653
private String getSignatureFromNameAndType ( int index ) throws InvalidClassFileFormatException { checkConstantPoolIndex ( index ) ; Constant constant = constantPool [ index ] ; checkConstantTag ( constant , IClassConstants . CONSTANT_NameAndType ) ; return getUtf8String ( ( Integer ) constant . data [ 1 ] ) ; }
Get the signature from a CONSTANT_NameAndType .
29,654
private void checkUnconditionalDerefDatabase ( Location location , ValueNumberFrame vnaFrame , UnconditionalValueDerefSet fact ) throws DataflowAnalysisException { ConstantPoolGen constantPool = methodGen . getConstantPool ( ) ; for ( ValueNumber vn : checkUnconditionalDerefDatabase ( location , vnaFrame , constantPool...
Check method call at given location to see if it unconditionally dereferences a parameter . Mark any such arguments as derefs .
29,655
private void checkInstance ( Location location , ValueNumberFrame vnaFrame , UnconditionalValueDerefSet fact ) throws DataflowAnalysisException { if ( ! location . isFirstInstructionInBasicBlock ( ) ) { return ; } if ( invDataflow == null ) { return ; } BasicBlock fallThroughPredecessor = cfg . getPredecessorWithEdgeTy...
Check to see if the instruction has a null check associated with it and if so add a dereference .
29,656
private UnconditionalValueDerefSet duplicateFact ( UnconditionalValueDerefSet fact ) { UnconditionalValueDerefSet copyOfFact = createFact ( ) ; copy ( fact , copyOfFact ) ; fact = copyOfFact ; return fact ; }
Return a duplicate of given dataflow fact .
29,657
private ValueNumber findValueKnownNonnullOnBranch ( UnconditionalValueDerefSet fact , Edge edge ) { IsNullValueFrame invFrame = invDataflow . getResultFact ( edge . getSource ( ) ) ; if ( ! invFrame . isValid ( ) ) { return null ; } IsNullConditionDecision decision = invFrame . getDecision ( ) ; if ( decision == null )...
Clear deref sets of values if this edge is the non - null branch of an if comparison .
29,658
private boolean isExceptionEdge ( Edge edge ) { boolean isExceptionEdge = edge . isExceptionEdge ( ) ; if ( isExceptionEdge ) { if ( DEBUG ) { System . out . println ( "NOT Ignoring " + edge ) ; } return true ; } if ( edge . getType ( ) != EdgeTypes . FALL_THROUGH_EDGE ) { return false ; } InstructionHandle h = edge . ...
Determine whether dataflow should be propagated on given edge .
29,659
public static boolean isSubtype ( ReferenceType t , ReferenceType possibleSupertype ) throws ClassNotFoundException { return Global . getAnalysisCache ( ) . getDatabase ( Subtypes2 . class ) . isSubtype ( t , possibleSupertype ) ; }
Determine if one reference type is a subtype of another .
29,660
public static boolean isMonitorWait ( String methodName , String methodSig ) { return "wait" . equals ( methodName ) && ( "()V" . equals ( methodSig ) || "(J)V" . equals ( methodSig ) || "(JI)V" . equals ( methodSig ) ) ; }
Determine if method whose name and signature is specified is a monitor wait operation .
29,661
public static boolean isMonitorNotify ( String methodName , String methodSig ) { return ( "notify" . equals ( methodName ) || "notifyAll" . equals ( methodName ) ) && "()V" . equals ( methodSig ) ; }
Determine if method whose name and signature is specified is a monitor notify operation .
29,662
public static boolean isMonitorNotify ( Instruction ins , ConstantPoolGen cpg ) { if ( ! ( ins instanceof InvokeInstruction ) ) { return false ; } if ( ins . getOpcode ( ) == Const . INVOKESTATIC ) { return false ; } InvokeInstruction inv = ( InvokeInstruction ) ins ; String methodName = inv . getMethodName ( cpg ) ; S...
Determine if given Instruction is a monitor wait .
29,663
public static JavaClassAndMethod visitSuperClassMethods ( JavaClassAndMethod method , JavaClassAndMethodChooser chooser ) throws ClassNotFoundException { return findMethod ( method . getJavaClass ( ) . getSuperClasses ( ) , method . getMethod ( ) . getName ( ) , method . getMethod ( ) . getSignature ( ) , chooser ) ; }
Visit all superclass methods which the given method overrides .
29,664
public static JavaClassAndMethod visitSuperInterfaceMethods ( JavaClassAndMethod method , JavaClassAndMethodChooser chooser ) throws ClassNotFoundException { return findMethod ( method . getJavaClass ( ) . getAllInterfaces ( ) , method . getMethod ( ) . getName ( ) , method . getMethod ( ) . getSignature ( ) , chooser ...
Visit all superinterface methods which the given method implements .
29,665
public static Set < JavaClassAndMethod > resolveMethodCallTargets ( ReferenceType receiverType , InvokeInstruction invokeInstruction , ConstantPoolGen cpg ) throws ClassNotFoundException { return resolveMethodCallTargets ( receiverType , invokeInstruction , cpg , false ) ; }
Resolve possible instance method call targets . Assumes that invokevirtual and invokeinterface methods may call any subtype of the receiver class .
29,666
public static boolean isConcrete ( XMethod xmethod ) { int accessFlags = xmethod . getAccessFlags ( ) ; return ( accessFlags & Const . ACC_ABSTRACT ) == 0 && ( accessFlags & Const . ACC_NATIVE ) == 0 ; }
Return whether or not the given method is concrete .
29,667
public static Field findField ( String className , String fieldName ) throws ClassNotFoundException { JavaClass jclass = Repository . lookupClass ( className ) ; while ( jclass != null ) { Field [ ] fieldList = jclass . getFields ( ) ; for ( Field field : fieldList ) { if ( field . getName ( ) . equals ( fieldName ) ) ...
Find a field with given name defined in given class .
29,668
public static boolean isInnerClassAccess ( INVOKESTATIC inv , ConstantPoolGen cpg ) { String methodName = inv . getName ( cpg ) ; return methodName . startsWith ( "access$" ) ; }
Determine whether the given INVOKESTATIC instruction is an inner - class field accessor method .
29,669
public static InnerClassAccess getInnerClassAccess ( INVOKESTATIC inv , ConstantPoolGen cpg ) throws ClassNotFoundException { String className = inv . getClassName ( cpg ) ; String methodName = inv . getName ( cpg ) ; String methodSig = inv . getSignature ( cpg ) ; InnerClassAccess access = AnalysisContext . currentAna...
Get the InnerClassAccess for access method called by given INVOKESTATIC .
29,670
@ SuppressWarnings ( "unchecked" ) public synchronized Enumeration < Object > keys ( ) { Set < ? > set = keySet ( ) ; return ( Enumeration < Object > ) sortKeys ( ( Set < String > ) set ) ; }
Overriden to be able to write properties sorted by keys to the disk
29,671
public void loadXml ( String fileName ) throws CoreException { if ( fileName == null ) { return ; } st = new StopTimer ( ) ; clearMarkers ( null ) ; final Project findBugsProject = new Project ( ) ; final Reporter bugReporter = new Reporter ( javaProject , findBugsProject , monitor ) ; bugReporter . setPriorityThreshol...
Load existing FindBugs xml report for the given collection of files .
29,672
private void clearMarkers ( List < WorkItem > files ) throws CoreException { if ( files == null ) { project . deleteMarkers ( FindBugsMarker . NAME , true , IResource . DEPTH_INFINITE ) ; return ; } for ( WorkItem item : files ) { if ( item != null ) { item . clearMarkers ( ) ; } } }
Clear associated markers
29,673
private void collectClassFiles ( List < WorkItem > resources , Map < IPath , IPath > outLocations , Project fbProject ) { for ( WorkItem workItem : resources ) { workItem . addFilesToProject ( fbProject , outLocations ) ; } }
Updates given outputFiles map with class name patterns matching given java source names
29,674
private void runFindBugs ( final FindBugs2 findBugs ) { if ( DEBUG ) { FindbugsPlugin . log ( "Running findbugs in thread " + Thread . currentThread ( ) . getName ( ) ) ; } System . setProperty ( "findbugs.progress" , "true" ) ; try { findBugs . execute ( ) ; } catch ( InterruptedException e ) { if ( DEBUG ) { Findbugs...
this method will block current thread until the findbugs is running
29,675
private void updateBugCollection ( Project findBugsProject , Reporter bugReporter , boolean incremental ) { SortedBugCollection newBugCollection = bugReporter . getBugCollection ( ) ; try { st . newPoint ( "getBugCollection" ) ; SortedBugCollection oldBugCollection = FindbugsPlugin . getBugCollection ( project , monito...
Update the BugCollection for the project .
29,676
public static IPath getFilterPath ( String filePath , IProject project ) { IPath path = new Path ( filePath ) ; if ( path . isAbsolute ( ) ) { return path ; } if ( project != null ) { IPath newPath = project . getLocation ( ) . append ( path ) ; if ( newPath . toFile ( ) . exists ( ) ) { return newPath ; } } IPath wspL...
Checks the given path and convert it to absolute path if it is specified relative to the given project or workspace
29,677
public static IPath toFilterPath ( String filePath , IProject project ) { IPath path = new Path ( filePath ) ; IPath commonPath ; if ( project != null ) { commonPath = project . getLocation ( ) ; IPath relativePath = getRelativePath ( path , commonPath ) ; if ( ! relativePath . equals ( path ) ) { return relativePath ;...
Checks the given absolute path and convert it to relative path if it is relative to the given project or workspace . This representation can be used to store filter paths in user preferences file
29,678
public static ProjectFilterSettings fromEncodedString ( String s ) { ProjectFilterSettings result = new ProjectFilterSettings ( ) ; if ( s . length ( ) > 0 ) { int bar = s . indexOf ( FIELD_DELIMITER ) ; String minPriority ; if ( bar >= 0 ) { minPriority = s . substring ( 0 , bar ) ; s = s . substring ( bar + 1 ) ; } e...
Create ProjectFilterSettings from an encoded string .
29,679
public static void hiddenFromEncodedString ( ProjectFilterSettings result , String s ) { if ( s . length ( ) > 0 ) { int bar = s . indexOf ( FIELD_DELIMITER ) ; String categories ; if ( bar >= 0 ) { categories = s . substring ( 0 , bar ) ; } else { categories = s ; } StringTokenizer t = new StringTokenizer ( categories...
set the hidden bug categories on the specifed ProjectFilterSettings from an encoded string
29,680
public boolean displayWarning ( BugInstance bugInstance ) { int priority = bugInstance . getPriority ( ) ; if ( priority > getMinPriorityAsInt ( ) ) { return false ; } int rank = bugInstance . getBugRank ( ) ; if ( rank > getMinRank ( ) ) { return false ; } BugPattern bugPattern = bugInstance . getBugPattern ( ) ; if (...
Return whether or not a warning should be displayed according to the project filter settings .
29,681
public void setMinPriority ( String minPriority ) { this . minPriority = minPriority ; Integer value = priorityNameToValueMap . get ( minPriority ) ; if ( value == null ) { value = priorityNameToValueMap . get ( DEFAULT_PRIORITY ) ; if ( value == null ) { throw new IllegalStateException ( ) ; } } this . minPriorityAsIn...
Set minimum warning priority threshold .
29,682
public String hiddenToEncodedString ( ) { StringBuilder buf = new StringBuilder ( ) ; for ( Iterator < String > i = hiddenBugCategorySet . iterator ( ) ; i . hasNext ( ) ; ) { buf . append ( i . next ( ) ) ; if ( i . hasNext ( ) ) { buf . append ( LISTITEM_DELIMITER ) ; } } buf . append ( FIELD_DELIMITER ) ; return buf...
Create a string containing the encoded form of the hidden bug categories
29,683
public String toEncodedString ( ) { StringBuilder buf = new StringBuilder ( ) ; buf . append ( getMinPriority ( ) ) ; buf . append ( FIELD_DELIMITER ) ; for ( Iterator < String > i = activeBugCategorySet . iterator ( ) ; i . hasNext ( ) ; ) { buf . append ( i . next ( ) ) ; if ( i . hasNext ( ) ) { buf . append ( LISTI...
Create a string containing the encoded form of the ProjectFilterSettings .
29,684
public static String getIntPriorityAsString ( int prio ) { String minPriority ; switch ( prio ) { case Priorities . EXP_PRIORITY : minPriority = ProjectFilterSettings . EXPERIMENTAL_PRIORITY ; break ; case Priorities . LOW_PRIORITY : minPriority = ProjectFilterSettings . LOW_PRIORITY ; break ; case Priorities . NORMAL_...
Convert an integer warning priority threshold value to a String .
29,685
public GraphType transpose ( GraphType orig , GraphToolkit < GraphType , EdgeType , VertexType > toolkit ) { GraphType trans = toolkit . createGraph ( ) ; for ( Iterator < VertexType > i = orig . vertexIterator ( ) ; i . hasNext ( ) ; ) { VertexType v = i . next ( ) ; VertexType dupVertex = toolkit . duplicateVertex ( ...
Transpose a graph . Note that the original graph is not modified ; the new graph and its vertices and edges are new objects .
29,686
public void mapInputToOutput ( ValueNumber input , ValueNumber output ) { BitSet inputSet = getInputSet ( output ) ; inputSet . set ( input . getNumber ( ) ) ; if ( DEBUG ) { System . out . println ( input . getNumber ( ) + "->" + output . getNumber ( ) ) ; System . out . println ( "Input set for " + output . getNumber...
Map an input ValueNumber to an output ValueNumber .
29,687
public BitSet getInputSet ( ValueNumber output ) { BitSet outputSet = outputToInputMap . get ( output ) ; if ( outputSet == null ) { if ( DEBUG ) { System . out . println ( "Create new input set for " + output . getNumber ( ) ) ; } outputSet = new BitSet ( ) ; outputToInputMap . put ( output , outputSet ) ; } return ou...
Get the set of input ValueNumbers which directly contributed to the given output ValueNumber .
29,688
private static boolean mightInheritFromException ( ClassDescriptor d ) { while ( d != null ) { try { if ( "java.lang.Exception" . equals ( d . getDottedClassName ( ) ) ) { return true ; } XClass classNameAndInfo = Global . getAnalysisCache ( ) . getClassAnalysis ( XClass . class , d ) ; d = classNameAndInfo . getSuperc...
Determine whether the class descriptor ultimately inherits from java . lang . Exception
29,689
public void launch ( ) throws Exception { if ( ! CheckBcel . check ( ) ) { System . exit ( 1 ) ; } int launchProperty = getLaunchProperty ( ) ; if ( GraphicsEnvironment . isHeadless ( ) || launchProperty == TEXTUI ) { FindBugs2 . main ( args ) ; } else if ( launchProperty == SHOW_HELP ) { ShowHelp . main ( args ) ; } e...
Launch the appropriate UI .
29,690
private int getLaunchProperty ( ) { if ( args . length > 0 ) { String firstArg = args [ 0 ] ; if ( firstArg . startsWith ( "-" ) ) { String uiName = firstArg . substring ( 1 ) ; if ( uiNameToCodeMap . containsKey ( uiName ) ) { String [ ] modifiedArgs = new String [ args . length - 1 ] ; System . arraycopy ( args , 1 ,...
Find out what UI should be launched .
29,691
public void configure ( ) throws CoreException { if ( DEBUG ) { System . out . println ( "Adding findbugs to the project build spec." ) ; } addToBuildSpec ( FindbugsPlugin . BUILDER_ID ) ; }
Adds the FindBugs builder to the project .
29,692
public void deconfigure ( ) throws CoreException { if ( DEBUG ) { System . out . println ( "Removing findbugs from the project build spec." ) ; } removeFromBuildSpec ( FindbugsPlugin . BUILDER_ID ) ; }
Removes the FindBugs builder from the project .
29,693
protected void removeFromBuildSpec ( String builderID ) throws CoreException { MarkerUtil . removeMarkers ( getProject ( ) ) ; IProjectDescription description = getProject ( ) . getDescription ( ) ; ICommand [ ] commands = description . getBuildSpec ( ) ; for ( int i = 0 ; i < commands . length ; ++ i ) { if ( commands...
Removes the given builder from the build spec for the given project .
29,694
protected void addToBuildSpec ( String builderID ) throws CoreException { IProjectDescription description = getProject ( ) . getDescription ( ) ; ICommand findBugsCommand = getFindBugsCommand ( description ) ; if ( findBugsCommand == null ) { ICommand newCommand = description . newCommand ( ) ; newCommand . setBuilderN...
Adds a builder to the build spec for the given project .
29,695
private ICommand getFindBugsCommand ( IProjectDescription description ) { ICommand [ ] commands = description . getBuildSpec ( ) ; for ( int i = 0 ; i < commands . length ; ++ i ) { if ( FindbugsPlugin . BUILDER_ID . equals ( commands [ i ] . getBuilderName ( ) ) ) { return commands [ i ] ; } } return null ; }
Find the specific FindBugs command amongst the build spec of a given description
29,696
public void addSwitch ( String option , String description ) { optionList . add ( option ) ; optionDescriptionMap . put ( option , description ) ; if ( option . length ( ) > maxWidth ) { maxWidth = option . length ( ) ; } }
Add a command line switch . This method is for adding options that do not require an argument .
29,697
public void addSwitchWithOptionalExtraPart ( String option , String optionExtraPartSynopsis , String description ) { optionList . add ( option ) ; optionExtraPartSynopsisMap . put ( option , optionExtraPartSynopsis ) ; optionDescriptionMap . put ( option , description ) ; int length = option . length ( ) + optionExtraP...
Add a command line switch that allows optional extra information to be specified as part of it .
29,698
public void addOption ( String option , String argumentDesc , String description ) { optionList . add ( option ) ; optionDescriptionMap . put ( option , description ) ; requiresArgumentSet . add ( option ) ; argumentDescriptionMap . put ( option , argumentDesc ) ; int width = option . length ( ) + 3 + argumentDesc . le...
Add an option requiring an argument .
29,699
public void printUsage ( OutputStream os ) { int count = 0 ; PrintStream out = UTF8 . printStream ( os ) ; for ( String option : optionList ) { if ( optionGroups . containsKey ( count ) ) { out . println ( " " + optionGroups . get ( count ) ) ; } count ++ ; if ( unlistedOptions . contains ( option ) ) { continue ; } o...
Print command line usage information to given stream .