idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
153,400
public String getLabel ( ) { ASTVisitor labelFixingVisitor = getCustomLabelVisitor ( ) ; if ( labelFixingVisitor instanceof CustomLabelVisitor ) { if ( customizedLabel == null ) { String labelReplacement = findLabelReplacement ( labelFixingVisitor ) ; customizedLabel = label . replace ( BugResolution . PLACEHOLDER_STRI...
Returns the short label that briefly describes the change that will be made .
153,401
private void runInternal ( IMarker marker ) throws CoreException { Assert . isNotNull ( marker ) ; PendingRewrite pending = resolveWithoutWriting ( marker ) ; if ( pending == null ) { return ; } try { IRegion region = completeRewrite ( pending ) ; if ( region == null ) { return ; } IEditorPart part = EditorUtility . is...
This method is used by the test - framework to catch the thrown exceptions and report it to the user .
153,402
protected ICompilationUnit getCompilationUnit ( IMarker marker ) { IResource res = marker . getResource ( ) ; if ( res instanceof IFile && res . isAccessible ( ) ) { IJavaElement element = JavaCore . create ( ( IFile ) res ) ; if ( element instanceof ICompilationUnit ) { return ( ICompilationUnit ) element ; } } return...
Get the compilation unit for the marker .
153,403
protected void reportException ( Exception e ) { Assert . isNotNull ( e ) ; FindbugsPlugin . getDefault ( ) . logException ( e , e . getLocalizedMessage ( ) ) ; MessageDialog . openError ( FindbugsPlugin . getShell ( ) , "BugResolution failed." , e . getLocalizedMessage ( ) ) ; }
Reports an exception to the user . This method could be overwritten by a subclass to handle some exceptions individual .
153,404
public int getSizeOfSurroundingTryBlock ( String vmNameOfExceptionClass , int pc ) { if ( code == null ) { throw new IllegalStateException ( "Not visiting Code" ) ; } return Util . getSizeOfSurroundingTryBlock ( constantPool , code , vmNameOfExceptionClass , pc ) ; }
Get lines of code in try block that surround pc
153,405
public String getFullyQualifiedMethodName ( ) { if ( ! visitingMethod ) { throw new IllegalStateException ( "getFullyQualifiedMethodName called while not visiting method" ) ; } if ( fullyQualifiedMethodName == null ) { getMethodName ( ) ; getDottedMethodSig ( ) ; StringBuilder ref = new StringBuilder ( 5 + dottedClassN...
If currently visiting a method get the method s fully qualified name
153,406
public String getMethodName ( ) { if ( ! visitingMethod ) { throw new IllegalStateException ( "getMethodName called while not visiting method" ) ; } if ( methodName == null ) { methodName = getStringFromIndex ( method . getNameIndex ( ) ) ; } return methodName ; }
If currently visiting a method get the method s name
153,407
public static boolean hasInterestingMethod ( ConstantPool cp , Collection < MethodDescriptor > methods ) { for ( Constant c : cp . getConstantPool ( ) ) { if ( c instanceof ConstantMethodref || c instanceof ConstantInterfaceMethodref ) { ConstantCP desc = ( ConstantCP ) c ; ConstantNameAndType nameAndType = ( ConstantN...
Returns true if given constant pool probably has a reference to any of supplied methods Useful to exclude from analysis uninteresting classes
153,408
public String getMethodSig ( ) { if ( ! visitingMethod ) { throw new IllegalStateException ( "getMethodSig called while not visiting method" ) ; } if ( methodSig == null ) { methodSig = getStringFromIndex ( method . getSignatureIndex ( ) ) ; } return methodSig ; }
If currently visiting a method get the method s slash - formatted signature
153,409
public String getDottedMethodSig ( ) { if ( ! visitingMethod ) { throw new IllegalStateException ( "getDottedMethodSig called while not visiting method" ) ; } if ( dottedMethodSig == null ) { dottedMethodSig = getMethodSig ( ) . replace ( '/' , '.' ) ; } return dottedMethodSig ; }
If currently visiting a method get the method s dotted method signature
153,410
public String getFieldName ( ) { if ( ! visitingField ) { throw new IllegalStateException ( "getFieldName called while not visiting field" ) ; } if ( fieldName == null ) { fieldName = getStringFromIndex ( field . getNameIndex ( ) ) ; } return fieldName ; }
If currently visiting a field get the field s name
153,411
public String getFieldSig ( ) { if ( ! visitingField ) { throw new IllegalStateException ( "getFieldSig called while not visiting field" ) ; } if ( fieldSig == null ) { fieldSig = getStringFromIndex ( field . getSignatureIndex ( ) ) ; } return fieldSig ; }
If currently visiting a field get the field s slash - formatted signature
153,412
public String getFullyQualifiedFieldName ( ) { if ( ! visitingField ) { throw new IllegalStateException ( "getFullyQualifiedFieldName called while not visiting field" ) ; } if ( fullyQualifiedFieldName == null ) { fullyQualifiedFieldName = getDottedClassName ( ) + "." + getFieldName ( ) + " : " + getFieldSig ( ) ; } re...
If currently visiting a field get the field s fully qualified name
153,413
public String getDottedFieldSig ( ) { if ( ! visitingField ) { throw new IllegalStateException ( "getDottedFieldSig called while not visiting field" ) ; } if ( dottedFieldSig == null ) { dottedFieldSig = fieldSig . replace ( '/' , '.' ) ; } return dottedFieldSig ; }
If currently visiting a field get the field s dot - formatted signature
153,414
public ClassNotFoundException toClassNotFoundException ( ) { ClassDescriptor classDescriptor = DescriptorFactory . createClassDescriptorFromResourceName ( resourceName ) ; return new ClassNotFoundException ( "ResourceNotFoundException while looking for class " + classDescriptor . toDottedClassName ( ) + ": " + getMessa...
Convert this exception to a ClassNotFoundException . This method should only be called if the ResourceNotFoundException occurs while looking for a class . The message format is parseable by ClassNotFoundExceptionParser .
153,415
private ICodeBaseEntry search ( List < ? extends ICodeBase > codeBaseList , String resourceName ) { for ( ICodeBase codeBase : codeBaseList ) { ICodeBaseEntry resource = codeBase . lookupResource ( resourceName ) ; if ( resource != null ) { return resource ; } } return null ; }
Search list of codebases for named resource .
153,416
public void copyFrom ( StateSet other ) { this . isTop = other . isTop ; this . isBottom = other . isBottom ; this . onExceptionPath = other . onExceptionPath ; this . stateMap . clear ( ) ; for ( State state : other . stateMap . values ( ) ) { State dup = state . duplicate ( ) ; this . stateMap . put ( dup . getObliga...
Make this StateSet an exact copy of the given StateSet .
153,417
public void addObligation ( final Obligation obligation , int basicBlockId ) throws ObligationAcquiredOrReleasedInLoopException { Map < ObligationSet , State > updatedStateMap = new HashMap < > ( ) ; if ( stateMap . isEmpty ( ) ) { State s = new State ( factory ) ; s . getObligationSet ( ) . add ( obligation ) ; update...
Add an obligation to every State in the StateSet .
153,418
public void deleteObligation ( final Obligation obligation , int basicBlockId ) throws ObligationAcquiredOrReleasedInLoopException { Map < ObligationSet , State > updatedStateMap = new HashMap < > ( ) ; for ( Iterator < State > i = stateIterator ( ) ; i . hasNext ( ) ; ) { State state = i . next ( ) ; checkCircularity ...
Remove an Obligation from every State in the StateSet .
153,419
private void checkCircularity ( State state , Obligation obligation , int basicBlockId ) throws ObligationAcquiredOrReleasedInLoopException { if ( state . getPath ( ) . hasComponent ( basicBlockId ) ) { throw new ObligationAcquiredOrReleasedInLoopException ( obligation ) ; } }
Bail out of the analysis is an obligation is acquired or released in a loop .
153,420
public List < State > getPrefixStates ( Path path ) { List < State > result = new LinkedList < > ( ) ; for ( State state : stateMap . values ( ) ) { if ( state . getPath ( ) . isPrefixOf ( path ) ) { result . add ( state ) ; } } return result ; }
Get all States that have Paths which are prefixes of the given Path .
153,421
private static boolean acquireAnalysisPermitUnlessCancelled ( IProgressMonitor monitor ) throws InterruptedException { do { if ( analysisSem . tryAcquire ( 1 , TimeUnit . SECONDS ) ) { return true ; } } while ( ! monitor . isCanceled ( ) ) ; return false ; }
Acquires an analysis permit unless first cancelled .
153,422
public void setTimestamp ( String timestamp ) throws ParseException { this . analysisTimestamp = new SimpleDateFormat ( TIMESTAMP_FORMAT , Locale . ENGLISH ) . parse ( timestamp ) ; }
Set the timestamp for this analysis run .
153,423
public void addBug ( BugInstance bug ) { SourceLineAnnotation source = bug . getPrimarySourceLineAnnotation ( ) ; PackageStats stat = getPackageStats ( source . getPackageName ( ) ) ; stat . addError ( bug ) ; ++ totalErrors [ 0 ] ; int priority = bug . getPriority ( ) ; if ( priority >= 1 ) { ++ totalErrors [ Math . m...
Called when a bug is reported .
153,424
public void clearBugCounts ( ) { for ( int i = 0 ; i < totalErrors . length ; i ++ ) { totalErrors [ i ] = 0 ; } for ( PackageStats stats : packageStatsMap . values ( ) ) { stats . clearBugCounts ( ) ; } }
Clear bug counts
153,425
public void transformSummaryToHTML ( Writer htmlWriter ) throws IOException , TransformerException { ByteArrayOutputStream summaryOut = new ByteArrayOutputStream ( 8096 ) ; reportSummary ( summaryOut ) ; StreamSource in = new StreamSource ( new ByteArrayInputStream ( summaryOut . toByteArray ( ) ) ) ; StreamResult out ...
Transform summary information to HTML .
153,426
JPopupMenu createBugPopupMenu ( ) { JPopupMenu popupMenu = new JPopupMenu ( ) ; JMenuItem filterMenuItem = MainFrameHelper . newJMenuItem ( "menu.filterBugsLikeThis" , "Filter bugs like this" ) ; filterMenuItem . addActionListener ( evt -> { new NewFilterFromBug ( new FilterFromBugPicker ( currentSelectedBugLeaf . getB...
Creates popup menu for bugs on tree .
153,427
JPopupMenu createBranchPopUpMenu ( ) { JPopupMenu popupMenu = new JPopupMenu ( ) ; JMenuItem filterMenuItem = MainFrameHelper . newJMenuItem ( "menu.filterTheseBugs" , "Filter these bugs" ) ; filterMenuItem . addActionListener ( evt -> { try { int startCount ; TreePath path = MainFrame . getInstance ( ) . getTree ( ) ....
Creates the branch pop up menu that ask if the user wants to hide all the bugs in that branch .
153,428
public void accumulateBug ( BugInstance bug , SourceLineAnnotation sourceLine ) { if ( sourceLine == null ) { throw new NullPointerException ( "Missing source line" ) ; } int priority = bug . getPriority ( ) ; if ( ! performAccumulation ) { bug . addSourceLine ( sourceLine ) ; } else { bug . setPriority ( Priorities . ...
Accumulate a warning at given source location .
153,429
public void accumulateBug ( BugInstance bug , BytecodeScanningDetector visitor ) { SourceLineAnnotation source = SourceLineAnnotation . fromVisitedInstruction ( visitor ) ; accumulateBug ( bug , source ) ; }
Accumulate a warning at source location currently being visited by given BytecodeScanningDetector .
153,430
public void reportAccumulatedBugs ( ) { for ( Map . Entry < BugInstance , Data > e : map . entrySet ( ) ) { BugInstance bug = e . getKey ( ) ; Data d = e . getValue ( ) ; reportBug ( bug , d ) ; } clearBugs ( ) ; }
Report accumulated warnings to the BugReporter . Clears all accumulated warnings as a side - effect .
153,431
public void rebuild ( ) { if ( TRACE ) { System . out . println ( "rebuilding bug tree model" ) ; } NewFilterFromBug . closeAll ( ) ; if ( rebuildingThread == null ) { setOldSelectedBugs ( ) ; } Debug . println ( "Please Wait called right before starting rebuild thread" ) ; mainFrame . acquireDisplayWait ( ) ; rebuildi...
Swaps in a new BugTreeModel and a new JTree
153,432
public static Collection < TypeQualifierValue < ? > > getComplementaryExclusiveTypeQualifierValue ( TypeQualifierValue < ? > tqv ) { assert tqv . isExclusiveQualifier ( ) ; LinkedList < TypeQualifierValue < ? > > result = new LinkedList < > ( ) ; for ( TypeQualifierValue < ? > t : instance . get ( ) . allKnownTypeQuali...
Get the complementary TypeQualifierValues for given exclusive type qualifier .
153,433
private int getIntValue ( int stackDepth , int defaultValue ) { if ( stack . getStackDepth ( ) < stackDepth ) { return defaultValue ; } OpcodeStack . Item it = stack . getStackItem ( stackDepth ) ; Object value = it . getConstant ( ) ; if ( ! ( value instanceof Integer ) ) { return defaultValue ; } return ( ( Number ) ...
return an int on the stack or defaultValue if can t determine
153,434
public static synchronized SortedMap < String , String > getContributedDetectors ( ) { if ( contributedDetectors != null ) { return new TreeMap < > ( contributedDetectors ) ; } TreeMap < String , String > set = new TreeMap < > ( ) ; IExtensionRegistry registry = Platform . getExtensionRegistry ( ) ; for ( IConfiguratio...
key is the plugin id value is the plugin library path
153,435
private static String resolvePluginClassesDir ( String bundleName , File sourceDir ) { if ( sourceDir . listFiles ( ) == null ) { FindbugsPlugin . getDefault ( ) . logException ( new IllegalStateException ( "No files in the bundle!" ) , "Failed to create temporary detector package for bundle " + sourceDir ) ; return nu...
Used for Eclipse instances running inside debugger . During development Eclipse plugins are just directories . The code below tries to locate plugin s bin directory . It doesn t work if the plugin build . properties are not existing or contain invalid content
153,436
public static LocalVariableAnnotation getParameterLocalVariableAnnotation ( Method method , int local ) { LocalVariableAnnotation lva = getLocalVariableAnnotation ( method , local , 0 , 0 ) ; if ( lva . isNamed ( ) ) { lva . setDescription ( LocalVariableAnnotation . PARAMETER_NAMED_ROLE ) ; } else { lva . setDescripti...
Get a local variable annotation describing a parameter .
153,437
public char next ( ) { ++ docPos ; if ( docPos < segmentEnd || segmentEnd >= doc . getLength ( ) ) { return text . next ( ) ; } try { doc . getText ( segmentEnd , doc . getLength ( ) - segmentEnd , text ) ; } catch ( BadLocationException e ) { throw new RuntimeException ( e ) ; } segmentEnd += text . count ; return tex...
Increments the iterator s index by one and returns the character at the new index .
153,438
public static String rewriteMethodSignature ( ClassNameRewriter classNameRewriter , String methodSignature ) { if ( classNameRewriter != IdentityClassNameRewriter . instance ( ) ) { SignatureParser parser = new SignatureParser ( methodSignature ) ; StringBuilder buf = new StringBuilder ( ) ; buf . append ( '(' ) ; for ...
Rewrite a method signature .
153,439
public static String rewriteSignature ( ClassNameRewriter classNameRewriter , String signature ) { if ( classNameRewriter != IdentityClassNameRewriter . instance ( ) && signature . startsWith ( "L" ) ) { String className = signature . substring ( 1 , signature . length ( ) - 1 ) . replace ( '/' , '.' ) ; className = cl...
Rewrite a signature .
153,440
public static MethodAnnotation convertMethodAnnotation ( ClassNameRewriter classNameRewriter , MethodAnnotation annotation ) { if ( classNameRewriter != IdentityClassNameRewriter . instance ( ) ) { annotation = new MethodAnnotation ( classNameRewriter . rewriteClassName ( annotation . getClassName ( ) ) , annotation . ...
Rewrite a MethodAnnotation to update the class name and any class names mentioned in the method signature .
153,441
public static FieldAnnotation convertFieldAnnotation ( ClassNameRewriter classNameRewriter , FieldAnnotation annotation ) { if ( classNameRewriter != IdentityClassNameRewriter . instance ( ) ) { annotation = new FieldAnnotation ( classNameRewriter . rewriteClassName ( annotation . getClassName ( ) ) , annotation . getF...
Rewrite a FieldAnnotation to update the class name and field signature if needed .
153,442
private InterproceduralCallGraphVertex findVertex ( XMethod xmethod ) { InterproceduralCallGraphVertex vertex ; vertex = callGraph . lookupVertex ( xmethod . getMethodDescriptor ( ) ) ; if ( vertex == null ) { vertex = new InterproceduralCallGraphVertex ( ) ; vertex . setXmethod ( xmethod ) ; callGraph . addVertex ( ve...
Find the InterproceduralCallGraphVertex for given XMethod .
153,443
public boolean hasComponent ( int blockId ) { for ( int i = 0 ; i < length ; i ++ ) { if ( blockIdList [ i ] == blockId ) { return true ; } } return false ; }
Determine whether or not the id of the given BasicBlock appears anywhere in the path .
153,444
public void copyFrom ( Path other ) { grow ( other . length - 1 ) ; System . arraycopy ( other . blockIdList , 0 , this . blockIdList , 0 , other . length ) ; this . length = other . length ; this . cachedHashCode = other . cachedHashCode ; }
Make this Path identical to the given one .
153,445
public void acceptVisitor ( CFG cfg , PathVisitor visitor ) { if ( getLength ( ) > 0 ) { BasicBlock startBlock = cfg . lookupBlockByLabel ( getBlockIdAt ( 0 ) ) ; acceptVisitorStartingFromLocation ( cfg , visitor , startBlock , startBlock . getFirstInstruction ( ) ) ; } }
Accept a PathVisitor .
153,446
public void acceptVisitorStartingFromLocation ( CFG cfg , PathVisitor visitor , BasicBlock startBlock , InstructionHandle startHandle ) { int index ; for ( index = 0 ; index < getLength ( ) ; index ++ ) { if ( getBlockIdAt ( index ) == startBlock . getLabel ( ) ) { break ; } } assert index < getLength ( ) ; Iterator < ...
Accept a PathVisitor starting from a given BasicBlock and InstructionHandle .
153,447
public boolean isPrefixOf ( Path path ) { if ( this . getLength ( ) > path . getLength ( ) ) { return false ; } for ( int i = 0 ; i < getLength ( ) ; i ++ ) { if ( this . getBlockIdAt ( i ) != path . getBlockIdAt ( i ) ) { return false ; } } return true ; }
Determine whether or not given Path is a prefix of this one .
153,448
private void produce ( IsNullValue value ) { IsNullValueFrame frame = getFrame ( ) ; frame . pushValue ( value ) ; newValueOnTOS ( ) ; }
to produce different values in each of the control successors .
153,449
private void handleInvoke ( InvokeInstruction obj ) { if ( obj instanceof INVOKEDYNAMIC ) { return ; } Type returnType = obj . getReturnType ( getCPG ( ) ) ; Location location = getLocation ( ) ; if ( trackValueNumbers ) { try { ValueNumberFrame vnaFrame = vnaDataflow . getFactAtLocation ( location ) ; Set < ValueNumbe...
Handle method invocations . Generally we want to get rid of null information following a call to a likely exception thrower or assertion .
153,450
private boolean checkForKnownValue ( Instruction obj ) { if ( trackValueNumbers ) { try { ValueNumberFrame vnaFrameAfter = vnaDataflow . getFactAfterLocation ( getLocation ( ) ) ; if ( vnaFrameAfter . isValid ( ) ) { ValueNumber tosVN = vnaFrameAfter . getTopValue ( ) ; IsNullValue knownValue = getFrame ( ) . getKnownV...
Check given Instruction to see if it produces a known value . If so model the instruction and return true . Otherwise do nothing and return false . Should only be used for instructions that produce a single value on the top of the stack .
153,451
public static String trimComma ( String s ) { if ( s . endsWith ( "," ) ) { s = s . substring ( 0 , s . length ( ) - 1 ) ; } return s ; }
Trim trailing comma from given string .
153,452
public static boolean initializeUnescapePattern ( ) { if ( paternIsInitialized == true ) { return true ; } synchronized ( unescapeInitLockObject ) { if ( paternIsInitialized == true ) { return true ; } try { unescapePattern = Pattern . compile ( unicodeUnescapeMatchExpression ) ; } catch ( PatternSyntaxException pse ) ...
Initialize regular expressions used in unescaping . This method will be invoked automatically the first time a string is unescaped .
153,453
public String getReturnTypeSignature ( ) { int endOfParams = signature . lastIndexOf ( ')' ) ; if ( endOfParams < 0 ) { throw new IllegalArgumentException ( "Bad method signature: " + signature ) ; } return signature . substring ( endOfParams + 1 ) ; }
Get the method return type signature .
153,454
public int getNumParameters ( ) { int count = 0 ; for ( Iterator < String > i = parameterSignatureIterator ( ) ; i . hasNext ( ) ; ) { i . next ( ) ; ++ count ; } return count ; }
Get the number of parameters in the signature .
153,455
public static boolean compareSignatures ( String plainSignature , String genericSignature ) { GenericSignatureParser plainParser = new GenericSignatureParser ( plainSignature ) ; GenericSignatureParser genericParser = new GenericSignatureParser ( genericSignature ) ; return plainParser . getNumParameters ( ) == generic...
Compare a plain method signature to the a generic method Signature and return true if they match
153,456
public static String findCodeBaseInClassPath ( Pattern codeBaseNamePattern , String classPath ) { if ( classPath == null ) { return null ; } StringTokenizer tok = new StringTokenizer ( classPath , File . pathSeparator ) ; while ( tok . hasMoreTokens ( ) ) { String t = tok . nextToken ( ) ; File f = new File ( t ) ; Mat...
Try to find a codebase matching the given pattern in the given class path string .
153,457
public static void skipFully ( InputStream in , long bytes ) throws IOException { if ( bytes < 0 ) { throw new IllegalArgumentException ( "Can't skip " + bytes + " bytes" ) ; } long remaining = bytes ; while ( remaining > 0 ) { long skipped = in . skip ( remaining ) ; if ( skipped <= 0 ) { throw new EOFException ( "Rea...
Provide a skip fully method . Either skips the requested number of bytes or throws an IOException ;
153,458
public static Type fromExceptionSet ( ExceptionSet exceptionSet ) throws ClassNotFoundException { Type commonSupertype = exceptionSet . getCommonSupertype ( ) ; if ( commonSupertype . getType ( ) != Const . T_OBJECT ) { return commonSupertype ; } ObjectType exceptionSupertype = ( ObjectType ) commonSupertype ; String c...
Initialize object from an exception set .
153,459
public String parseNext ( ) { StringBuilder result = new StringBuilder ( ) ; if ( signature . startsWith ( "[" ) ) { int dimensions = 0 ; do { ++ dimensions ; signature = signature . substring ( 1 ) ; } while ( signature . charAt ( 0 ) == '[' ) ; result . append ( parseNext ( ) ) ; while ( dimensions -- > 0 ) { result ...
Parse a single type out of the signature starting at the beginning of the remaining part of the signature . For example if the first character of the remaining part is I then this method will return int and the I will be consumed . Arrays reference types and basic types are all handled .
153,460
static public void reportMissingClass ( ClassNotFoundException e ) { requireNonNull ( e , "argument is null" ) ; String missing = AbstractBugReporter . getMissingClassName ( e ) ; if ( skipReportingMissingClass ( missing ) ) { return ; } if ( ! analyzingApplicationClass ( ) ) { return ; } RepositoryLookupFailureCallbac...
file a ClassNotFoundException with the lookupFailureCallback
153,461
public final void loadInterproceduralDatabases ( ) { loadPropertyDatabase ( getFieldStoreTypeDatabase ( ) , FieldStoreTypeDatabase . DEFAULT_FILENAME , "field store type database" ) ; loadPropertyDatabase ( getUnconditionalDerefParamDatabase ( ) , UNCONDITIONAL_DEREF_DB_FILENAME , "unconditional param deref database" )...
If possible load interprocedural property databases .
153,462
public final void setDatabaseInputDir ( String databaseInputDir ) { if ( DEBUG ) { System . out . println ( "Setting database input directory: " + databaseInputDir ) ; } this . databaseInputDir = databaseInputDir ; }
Set the interprocedural database input directory .
153,463
public final void setDatabaseOutputDir ( String databaseOutputDir ) { if ( DEBUG ) { System . out . println ( "Setting database output directory: " + databaseOutputDir ) ; } this . databaseOutputDir = databaseOutputDir ; }
Set the interprocedural database output directory .
153,464
public < DatabaseType extends PropertyDatabase < KeyType , Property > , KeyType extends FieldOrMethodDescriptor , Property > void storePropertyDatabase ( DatabaseType database , String fileName , String description ) { try { File dbFile = new File ( getDatabaseOutputDir ( ) , fileName ) ; if ( DEBUG ) { System . out . ...
Write an interprocedural property database .
153,465
public static void setCurrentAnalysisContext ( AnalysisContext analysisContext ) { currentAnalysisContext . set ( analysisContext ) ; if ( Global . getAnalysisCache ( ) != null ) { currentXFactory . set ( new XFactory ( ) ) ; } }
Set the current analysis context for this thread .
153,466
public ClassContext getClassContext ( JavaClass javaClass ) { ClassDescriptor classDescriptor = DescriptorFactory . instance ( ) . getClassDescriptor ( ClassName . toSlashedClassName ( javaClass . getClassName ( ) ) ) ; try { return Global . getAnalysisCache ( ) . getClassAnalysis ( ClassContext . class , classDescript...
Get the ClassContext for a class .
153,467
public void copyFrom ( BlockType other ) { this . isValid = other . isValid ; this . isTop = other . isTop ; if ( isValid ) { this . depth = other . depth ; this . clear ( ) ; this . or ( other ) ; } }
Make this object an exact duplicate of given object .
153,468
public boolean sameAs ( BlockType other ) { if ( ! this . isValid ) { return ! other . isValid && ( this . isTop == other . isTop ) ; } else { if ( ! other . isValid ) { return false ; } else { if ( this . depth != other . depth ) { return false ; } for ( int i = 0 ; i < this . depth ; ++ i ) { if ( this . get ( i ) !=...
Return whether or not this object is identical to the one given .
153,469
public void mergeWith ( BlockType other ) { if ( this . isTop ( ) || other . isBottom ( ) ) { copyFrom ( other ) ; } else if ( isValid ( ) ) { int pfxLen = Math . min ( this . depth , other . depth ) ; int commonLen ; for ( commonLen = 0 ; commonLen < pfxLen ; ++ commonLen ) { if ( this . get ( commonLen ) != other . g...
Merge other dataflow value into this value .
153,470
public static synchronized Map < String , List < QuickFixContribution > > getContributedQuickFixes ( ) { if ( contributedQuickFixes != null ) { return contributedQuickFixes ; } HashMap < String , List < QuickFixContribution > > set = new HashMap < > ( ) ; IExtensionRegistry registry = Platform . getExtensionRegistry ( ...
key is the pattern id the value is the corresponding contribution
153,471
public static void getDirectApplications ( Set < TypeQualifierAnnotation > result , XMethod o , int parameter ) { Collection < AnnotationValue > values = getDirectAnnotation ( o , parameter ) ; for ( AnnotationValue v : values ) { constructTypeQualifierAnnotation ( result , v ) ; } }
Populate a Set of TypeQualifierAnnotations representing directly - applied type qualifier annotations on given method parameter .
153,472
public static void getDirectApplications ( Set < TypeQualifierAnnotation > result , AnnotatedObject o , ElementType e ) { if ( ! o . getElementType ( ) . equals ( e ) ) { return ; } Collection < AnnotationValue > values = getDirectAnnotation ( o ) ; for ( AnnotationValue v : values ) { constructTypeQualifierAnnotation ...
Populate a Set of TypeQualifierAnnotations representing directly - applied type qualifier annotations on given AnnotatedObject .
153,473
public static TypeQualifierAnnotation constructTypeQualifierAnnotation ( AnnotationValue v ) { assert v != null ; EnumValue whenValue = ( EnumValue ) v . getValue ( "when" ) ; When when = whenValue == null ? When . ALWAYS : When . valueOf ( whenValue . value ) ; ClassDescriptor annotationClass = v . getAnnotationClass ...
Resolve a raw AnnotationValue into a TypeQualifierAnnotation .
153,474
public static void constructTypeQualifierAnnotation ( Set < TypeQualifierAnnotation > set , AnnotationValue v ) { assert set != null ; TypeQualifierAnnotation tqa = constructTypeQualifierAnnotation ( v ) ; set . add ( tqa ) ; }
Resolve a raw AnnotationValue into a TypeQualifierAnnotation storing result in given Set .
153,475
private static TypeQualifierAnnotation findMatchingTypeQualifierAnnotation ( Collection < TypeQualifierAnnotation > typeQualifierAnnotations , TypeQualifierValue < ? > typeQualifierValue ) { for ( TypeQualifierAnnotation typeQualifierAnnotation : typeQualifierAnnotations ) { if ( typeQualifierAnnotation . typeQualifier...
Look up a TypeQualifierAnnotation matching given TypeQualifierValue .
153,476
private static TypeQualifierAnnotation getDefaultAnnotation ( AnnotatedObject o , TypeQualifierValue < ? > typeQualifierValue , ElementType elementType ) { TypeQualifierAnnotation result ; Collection < AnnotationValue > values = TypeQualifierResolver . resolveTypeQualifierDefaults ( o . getAnnotations ( ) , elementType...
Look for a default type qualifier annotation .
153,477
private static TypeQualifierAnnotation getDirectTypeQualifierAnnotation ( AnnotatedObject o , TypeQualifierValue < ? > typeQualifierValue ) { TypeQualifierAnnotation result ; Set < TypeQualifierAnnotation > applications = new HashSet < > ( ) ; getDirectApplications ( applications , o , o . getElementType ( ) ) ; result...
Get a directly - applied TypeQualifierAnnotation on given AnnotatedObject .
153,478
public static TypeQualifierAnnotation getInheritedTypeQualifierAnnotation ( XMethod o , TypeQualifierValue < ? > typeQualifierValue ) { assert ! o . isStatic ( ) ; ReturnTypeAnnotationAccumulator accumulator = new ReturnTypeAnnotationAccumulator ( typeQualifierValue , o ) ; try { AnalysisContext . currentAnalysisContex...
Get the effective inherited TypeQualifierAnnotation on given instance method .
153,479
public static TypeQualifierAnnotation getDirectTypeQualifierAnnotation ( XMethod xmethod , int parameter , TypeQualifierValue < ? > typeQualifierValue ) { XMethod bridge = xmethod . bridgeTo ( ) ; if ( bridge != null ) { xmethod = bridge ; } Set < TypeQualifierAnnotation > applications = new HashSet < > ( ) ; getDirect...
Get the TypeQualifierAnnotation directly applied to given method parameter .
153,480
public static TypeQualifierAnnotation getInheritedTypeQualifierAnnotation ( XMethod xmethod , int parameter , TypeQualifierValue < ? > typeQualifierValue ) { assert ! xmethod . isStatic ( ) ; ParameterAnnotationAccumulator accumulator = new ParameterAnnotationAccumulator ( typeQualifierValue , xmethod , parameter ) ; t...
Get the effective inherited TypeQualifierAnnotation on the given instance method parameter .
153,481
private void setSorterCheckBoxes ( ) { SorterTableColumnModel sorter = MainFrame . getInstance ( ) . getSorter ( ) ; for ( SortableCheckBox c : checkBoxSortList ) { c . setSelected ( sorter . isShown ( c . sortable ) ) ; } }
Sets the checkboxes in the sorter panel to what is shown in the MainFrame . This assumes that sorterTableColumnModel will return the list of which box is checked in the same order as the order that sorter panel has .
153,482
public static MethodAnnotation fromVisitedMethod ( PreorderVisitor visitor ) { String className = visitor . getDottedClassName ( ) ; MethodAnnotation result = new MethodAnnotation ( className , visitor . getMethodName ( ) , visitor . getMethodSig ( ) , visitor . getMethod ( ) . isStatic ( ) ) ; SourceLineAnnotation src...
Factory method to create a MethodAnnotation from the method the given visitor is currently visiting .
153,483
public static MethodAnnotation fromCalledMethod ( DismantleBytecode visitor ) { String className = visitor . getDottedClassConstantOperand ( ) ; String methodName = visitor . getNameConstantOperand ( ) ; String methodSig = visitor . getSigConstantOperand ( ) ; if ( visitor instanceof OpcodeStackDetector && visitor . ge...
Factory method to create a MethodAnnotation from a method called by the instruction the given visitor is currently visiting .
153,484
public static MethodAnnotation fromCalledMethod ( String className , String methodName , String methodSig , boolean isStatic ) { MethodAnnotation methodAnnotation = fromForeignMethod ( className , methodName , methodSig , isStatic ) ; methodAnnotation . setDescription ( METHOD_CALLED ) ; return methodAnnotation ; }
Create a MethodAnnotation from a method that is not directly accessible . We will use the repository to try to find its class in order to populate the information as fully as possible .
153,485
public static MethodAnnotation fromXMethod ( XMethod xmethod ) { return fromForeignMethod ( xmethod . getClassName ( ) , xmethod . getName ( ) , xmethod . getSignature ( ) , xmethod . isStatic ( ) ) ; }
Create a MethodAnnotation from an XMethod .
153,486
public static MethodAnnotation fromMethodDescriptor ( MethodDescriptor methodDescriptor ) { return fromForeignMethod ( methodDescriptor . getSlashedClassName ( ) , methodDescriptor . getName ( ) , methodDescriptor . getSignature ( ) , methodDescriptor . isStatic ( ) ) ; }
Create a MethodAnnotation from a MethodDescriptor .
153,487
public void execute ( ) throws CheckedAnalysisException , IOException , InterruptedException { File dir = new File ( rootSourceDirectory ) ; if ( ! dir . isDirectory ( ) ) { throw new IOException ( "Path " + rootSourceDirectory + " is not a directory" ) ; } progress . startRecursiveDirectorySearch ( ) ; RecursiveFileSe...
Execute the search for source directories .
153,488
public static void addFiles ( final Project findBugsProject , File clzDir , final Pattern pat ) { if ( clzDir . isDirectory ( ) ) { clzDir . listFiles ( new FileCollector ( pat , findBugsProject ) ) ; } }
recurse add all the files matching given name pattern inside the given directory and all subdirectories
153,489
private static void mapResource ( WorkItem resource , Map < IProject , List < WorkItem > > projectsMap , boolean checkJavaProject ) { IProject project = resource . getProject ( ) ; if ( checkJavaProject && ! ProjectUtilities . isJavaProject ( project ) ) { return ; } List < WorkItem > resources = projectsMap . get ( pr...
Maps the resource into its project
153,490
@ SuppressWarnings ( "restriction" ) public static List < WorkItem > getResources ( ChangeSet set ) { if ( set != null && ! set . isEmpty ( ) ) { IResource [ ] resources = set . getResources ( ) ; List < WorkItem > filtered = new ArrayList < > ( ) ; for ( IResource resource : resources ) { if ( resource . getType ( ) =...
Extracts only files from a change set
153,491
public static IResource getResource ( Object element ) { if ( element instanceof IJavaElement ) { return ( ( IJavaElement ) element ) . getResource ( ) ; } return Util . getAdapter ( IResource . class , element ) ; }
Convenient method to get resources from adaptables
153,492
private ClassDescriptor getNullnessAnnotationClassDescriptor ( NullnessAnnotation n ) { if ( n == NullnessAnnotation . CHECK_FOR_NULL ) { return JSR305NullnessAnnotations . CHECK_FOR_NULL ; } else if ( n == NullnessAnnotation . NONNULL ) { return JSR305NullnessAnnotations . NONNULL ; } else if ( n == NullnessAnnotation...
Convert a NullnessAnnotation into the ClassDescriptor of the equivalent JSR - 305 nullness type qualifier .
153,493
public void addAll ( Collection < BugInstance > collection , boolean updateActiveTime ) { for ( BugInstance warning : collection ) { add ( warning , updateActiveTime ) ; } }
Add a Collection of BugInstances to this BugCollection object .
153,494
public AppVersion getCurrentAppVersion ( ) { return new AppVersion ( getSequenceNumber ( ) ) . setReleaseName ( getReleaseName ( ) ) . setTimestamp ( getTimestamp ( ) ) . setNumClasses ( getProjectStats ( ) . getNumClasses ( ) ) . setCodeSize ( getProjectStats ( ) . getCodeSize ( ) ) ; }
Get the current AppVersion .
153,495
public void readXML ( File file ) throws IOException , DocumentException { project . setCurrentWorkingDirectory ( file . getParentFile ( ) ) ; dataSource = file . getAbsolutePath ( ) ; InputStream in = progessMonitoredInputStream ( file , "Loading analysis" ) ; try { readXML ( in , file ) ; } catch ( IOException e ) { ...
Read XML data from given file into this object populating given Project as a side effect .
153,496
public Document toDocument ( ) { assert project != null ; DocumentFactory docFactory = new DocumentFactory ( ) ; Document document = docFactory . createDocument ( ) ; Dom4JXMLOutput treeBuilder = new Dom4JXMLOutput ( document ) ; try { writeXML ( treeBuilder ) ; } catch ( IOException e ) { } return document ; }
Convert the BugCollection into a dom4j Document object .
153,497
public static void cloneAll ( Collection < BugInstance > dest , Collection < BugInstance > source ) { for ( BugInstance obj : source ) { dest . add ( ( BugInstance ) obj . clone ( ) ) ; } }
Clone all of the BugInstance objects in the source Collection and add them to the destination Collection .
153,498
public static void writeXML ( XMLOutput xmlOutput , String elementName , BugAnnotation annotation , XMLAttributeList attributeList , boolean addMessages ) throws IOException { SourceLineAnnotation src = null ; if ( annotation instanceof BugAnnotationWithSourceLines ) { src = ( ( BugAnnotationWithSourceLines ) annotatio...
Write a BugAnnotation as XML .
153,499
public InnerClassAccess getInnerClassAccess ( String className , String methodName ) throws ClassNotFoundException { Map < String , InnerClassAccess > map = getAccessMapForClass ( className ) ; return map . get ( methodName ) ; }
Get the InnerClassAccess in given class with the given method name .