idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
153,300
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 .
153,301
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 .
153,302
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 .
153,303
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 .
153,304
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 .
153,305
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 .
153,306
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 .
153,307
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 .
153,308
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 .
153,309
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 .
153,310
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 .
153,311
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 .
153,312
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 .
153,313
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 .
153,314
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 .
153,315
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 .
153,316
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 .
153,317
private void assignToPass ( DetectorFactory factory , AnalysisPass pass ) { pass . addToPass ( factory ) ; assignedToPassSet . add ( factory ) ; }
Make a DetectorFactory a member of an AnalysisPass .
153,318
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 .
153,319
@ 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 .
153,320
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
153,321
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 .
153,322
public void addFieldLine ( String className , String fieldName , SourceLineRange range ) { fieldLineMap . put ( new FieldDescriptor ( className , fieldName ) , range ) ; }
Add a line number entry for a field .
153,323
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 .
153,324
public SourceLineRange getFieldLine ( String className , String fieldName ) { return fieldLineMap . get ( new FieldDescriptor ( className , fieldName ) ) ; }
Look up the line number range for a field .
153,325
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 .
153,326
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 .
153,327
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 .
153,328
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 .
153,329
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
153,330
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
153,331
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 .
153,332
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 .
153,333
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 .
153,334
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 .
153,335
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 .
153,336
private boolean isStore ( Location location ) { Instruction ins = location . getHandle ( ) . getInstruction ( ) ; return ( ins instanceof StoreInstruction ) || ( ins instanceof IINC ) ; }
Is instruction at given location a store?
153,337
private boolean isLoad ( Location location ) { Instruction ins = location . getHandle ( ) . getInstruction ( ) ; return ( ins instanceof LoadInstruction ) || ( ins instanceof IINC ) ; }
Is instruction at given location a load?
153,338
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 .
153,339
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
153,340
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 .
153,341
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 .
153,342
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 .
153,343
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 .
153,344
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 .
153,345
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 .
153,346
private UnconditionalValueDerefSet duplicateFact ( UnconditionalValueDerefSet fact ) { UnconditionalValueDerefSet copyOfFact = createFact ( ) ; copy ( fact , copyOfFact ) ; fact = copyOfFact ; return fact ; }
Return a duplicate of given dataflow fact .
153,347
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 .
153,348
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 .
153,349
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 .
153,350
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 .
153,351
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 .
153,352
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 .
153,353
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 .
153,354
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 .
153,355
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 .
153,356
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 .
153,357
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 .
153,358
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 .
153,359
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 .
153,360
@ 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
153,361
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 .
153,362
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
153,363
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
153,364
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
153,365
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 .
153,366
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
153,367
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
153,368
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 .
153,369
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
153,370
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 .
153,371
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 .
153,372
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
153,373
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 .
153,374
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 .
153,375
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 .
153,376
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 .
153,377
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 .
153,378
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
153,379
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 .
153,380
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 .
153,381
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 .
153,382
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 .
153,383
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 .
153,384
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 .
153,385
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
153,386
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 .
153,387
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 .
153,388
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 .
153,389
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 .
153,390
public void setLockCount ( int valueNumber , int lockCount ) { int index = findIndex ( valueNumber ) ; if ( index < 0 ) { addEntry ( index , valueNumber , lockCount ) ; } else { array [ index + 1 ] = lockCount ; } }
Set the lock count for a lock object .
153,391
public int getNumLockedObjects ( ) { int result = 0 ; for ( int i = 0 ; i + 1 < array . length ; i += 2 ) { if ( array [ i ] == INVALID ) { break ; } if ( array [ i + 1 ] > 0 ) { ++ result ; } } return result ; }
Get the number of distinct lock values with positive lock counts .
153,392
public void copyFrom ( LockSet other ) { if ( other . array . length != array . length ) { array = new int [ other . array . length ] ; } System . arraycopy ( other . array , 0 , array , 0 , array . length ) ; this . defaultLockCount = other . defaultLockCount ; }
Make this LockSet the same as the given one .
153,393
public void meetWith ( LockSet other ) { for ( int i = 0 ; i + 1 < array . length ; i += 2 ) { int valueNumber = array [ i ] ; if ( valueNumber < 0 ) { break ; } int mine = array [ i + 1 ] ; int his = other . getLockCount ( valueNumber ) ; array [ i + 1 ] = mergeValues ( mine , his ) ; } for ( int i = 0 ; i + 1 < other...
Meet this LockSet with another LockSet storing the result in this object .
153,394
public boolean containsReturnValue ( ValueNumberFactory factory ) { for ( int i = 0 ; i + 1 < array . length ; i += 2 ) { int valueNumber = array [ i ] ; if ( valueNumber < 0 ) { break ; } int lockCount = array [ i + 1 ] ; if ( lockCount > 0 && factory . forNumber ( valueNumber ) . hasFlag ( ValueNumber . RETURN_VALUE ...
Determine whether or not this lock set contains any locked values which are method return values .
153,395
public boolean isEmpty ( ) { for ( int i = 0 ; i + 1 < array . length ; i += 2 ) { int valueNumber = array [ i ] ; if ( valueNumber < 0 ) { return true ; } int myLockCount = array [ i + 1 ] ; if ( myLockCount > 0 ) { return false ; } } return true ; }
Return whether or not this lock set is empty meaning that no locks have a positive lock count .
153,396
public SimplePathEnumerator enumerate ( ) { Iterator < Edge > entryOut = cfg . outgoingEdgeIterator ( cfg . getEntry ( ) ) ; if ( ! entryOut . hasNext ( ) ) { throw new IllegalStateException ( ) ; } Edge entryEdge = entryOut . next ( ) ; LinkedList < Edge > init = new LinkedList < > ( ) ; init . add ( entryEdge ) ; wor...
Enumerate the simple paths .
153,397
public void visitClassContext ( ClassContext classContext ) { int majorVersion = classContext . getJavaClass ( ) . getMajor ( ) ; if ( majorVersion >= Const . MAJOR_1_5 && hasInterestingMethod ( classContext . getJavaClass ( ) . getConstantPool ( ) , methods ) ) { super . visitClassContext ( classContext ) ; } }
The detector is only meaningful for Java5 class libraries .
153,398
public static Collection < AnnotationValue > resolveTypeQualifiers ( AnnotationValue value ) { LinkedList < AnnotationValue > result = new LinkedList < > ( ) ; resolveTypeQualifierNicknames ( value , result , new LinkedList < ClassDescriptor > ( ) ) ; return result ; }
Resolve an AnnotationValue into a list of AnnotationValues representing type qualifier annotations .
153,399
public void mergeVertices ( Set < VertexType > vertexSet , GraphType g , VertexCombinator < VertexType > combinator , GraphToolkit < GraphType , EdgeType , VertexType > toolkit ) { if ( vertexSet . size ( ) <= 1 ) { return ; } TreeSet < EdgeType > edgeSet = new TreeSet < > ( ) ; for ( Iterator < EdgeType > i = g . edge...
Merge the specified set of vertices into a single vertex .