idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
153,700
@ SuppressFBWarnings ( "ES_COMPARING_STRINGS_WITH_EQ" ) public String getDottedClassConstantOperand ( ) { if ( dottedClassConstantOperand != null ) { assert dottedClassConstantOperand != NOT_AVAILABLE ; return dottedClassConstantOperand ; } if ( classConstantOperand == NOT_AVAILABLE ) { throw new IllegalStateException ...
If the current opcode has a class operand get the associated class constant dot - formatted
153,701
@ SuppressFBWarnings ( "ES_COMPARING_STRINGS_WITH_EQ" ) public String getRefConstantOperand ( ) { if ( refConstantOperand == NOT_AVAILABLE ) { throw new IllegalStateException ( "getRefConstantOperand called but value not available" ) ; } if ( refConstantOperand == null ) { String dottedClassConstantOperand = getDottedC...
If the current opcode has a reference constant operand get its string representation
153,702
public int getPrevOpcode ( int offset ) { if ( offset < 0 ) { throw new IllegalArgumentException ( "offset (" + offset + ") must be nonnegative" ) ; } if ( offset >= prevOpcode . length || offset > sizePrevOpcodeBuffer ) { return Const . NOP ; } int pos = currentPosInPrevOpcodeBuffer - offset ; if ( pos < 0 ) { pos += ...
return previous opcode ;
153,703
public void append ( DetectorFactory factory ) { if ( ! memberSet . contains ( factory ) ) { throw new IllegalArgumentException ( "Detector " + factory . getFullName ( ) + " appended to pass it doesn't belong to" ) ; } this . orderedFactoryList . addLast ( factory ) ; }
Append the given DetectorFactory to the end of the ordered detector list . The factory must be a member of the pass .
153,704
public Set < DetectorFactory > getUnpositionedMembers ( ) { HashSet < DetectorFactory > result = new HashSet < > ( memberSet ) ; result . removeAll ( orderedFactoryList ) ; return result ; }
Get Set of pass members which haven t been assigned a position in the pass .
153,705
protected void mergeInto ( FrameType other , FrameType result ) throws DataflowAnalysisException { if ( result . isTop ( ) ) { result . copyFrom ( other ) ; return ; } else if ( other . isTop ( ) ) { return ; } if ( result . isBottom ( ) ) { return ; } else if ( other . isBottom ( ) ) { result . setBottom ( ) ; return ...
Merge one frame into another .
153,706
public LockSet getFactAtLocation ( Location location ) throws DataflowAnalysisException { if ( lockDataflow != null ) { return lockDataflow . getFactAtLocation ( location ) ; } else { LockSet lockSet = cache . get ( location ) ; if ( lockSet == null ) { lockSet = new LockSet ( ) ; lockSet . setDefaultLockCount ( 0 ) ; ...
Get LockSet at given Location .
153,707
public Object getMethodAnalysis ( Class < ? > analysisClass , MethodDescriptor methodDescriptor ) { Map < MethodDescriptor , Object > objectMap = getObjectMap ( analysisClass ) ; return objectMap . get ( methodDescriptor ) ; }
Retrieve a method analysis object .
153,708
public void purgeMethodAnalyses ( MethodDescriptor methodDescriptor ) { Set < Map . Entry < Class < ? > , Map < MethodDescriptor , Object > > > entrySet = methodAnalysisObjectMap . entrySet ( ) ; for ( Iterator < Map . Entry < Class < ? > , Map < MethodDescriptor , Object > > > i = entrySet . iterator ( ) ; i . hasNext...
Purge all CFG - based method analyses for given method .
153,709
public Method getMethod ( MethodGen methodGen ) { Method [ ] methodList = jclass . getMethods ( ) ; for ( Method method : methodList ) { if ( method . getName ( ) . equals ( methodGen . getName ( ) ) && method . getSignature ( ) . equals ( methodGen . getSignature ( ) ) && method . getAccessFlags ( ) == methodGen . get...
Look up the Method represented by given MethodGen .
153,710
static public BitSet getBytecodeSet ( JavaClass clazz , Method method ) { XMethod xmethod = XFactory . createXMethod ( clazz , method ) ; if ( cachedBitsets ( ) . containsKey ( xmethod ) ) { return cachedBitsets ( ) . get ( xmethod ) ; } Code code = method . getCode ( ) ; if ( code == null ) { return null ; } byte [ ] ...
Get a BitSet representing the bytecodes that are used in the given method . This is useful for prescreening a method for the existence of particular instructions . Because this step doesn t require building a MethodGen it is very fast and memory - efficient . It may allow a Detector to avoid some very expensive analysi...
153,711
public ExceptionSet duplicate ( ) { ExceptionSet dup = factory . createExceptionSet ( ) ; dup . exceptionSet . clear ( ) ; dup . exceptionSet . or ( this . exceptionSet ) ; dup . explicitSet . clear ( ) ; dup . explicitSet . or ( this . explicitSet ) ; dup . size = this . size ; dup . universalHandler = this . universa...
Return an exact copy of this object .
153,712
public boolean isSingleton ( String exceptionName ) { if ( size != 1 ) { return false ; } ObjectType e = iterator ( ) . next ( ) ; return e . toString ( ) . equals ( exceptionName ) ; }
Checks to see if the exception set is a singleton set containing just the named exception
153,713
public void add ( ObjectType type , boolean explicit ) { int index = factory . getIndexOfType ( type ) ; if ( ! exceptionSet . get ( index ) ) { ++ size ; } exceptionSet . set ( index ) ; if ( explicit ) { explicitSet . set ( index ) ; } commonSupertype = null ; }
Add an exception .
153,714
public void addAll ( ExceptionSet other ) { exceptionSet . or ( other . exceptionSet ) ; explicitSet . or ( other . explicitSet ) ; size = countBits ( exceptionSet ) ; commonSupertype = null ; }
Add all exceptions in the given set .
153,715
public void clear ( ) { exceptionSet . clear ( ) ; explicitSet . clear ( ) ; universalHandler = false ; commonSupertype = null ; size = 0 ; }
Remove all exceptions from the set .
153,716
public boolean containsCheckedExceptions ( ) throws ClassNotFoundException { for ( ThrownExceptionIterator i = iterator ( ) ; i . hasNext ( ) ; ) { ObjectType type = i . next ( ) ; if ( ! Hierarchy . isUncheckedException ( type ) ) { return true ; } } return false ; }
Return whether or not the set contains any checked exceptions .
153,717
public boolean containsExplicitExceptions ( ) { for ( ThrownExceptionIterator i = iterator ( ) ; i . hasNext ( ) ; ) { i . next ( ) ; if ( i . isExplicit ( ) ) { return true ; } } return false ; }
Return whether or not the set contains any explicit exceptions .
153,718
public void fileReused ( File f ) { if ( ! recentFiles . contains ( f ) ) { throw new IllegalStateException ( "Selected a recent project that doesn't exist?" ) ; } else { recentFiles . remove ( f ) ; recentFiles . add ( f ) ; } }
This should be the method called to add a reused file for the recent menu .
153,719
public void fileNotFound ( File f ) { if ( ! recentFiles . contains ( f ) ) { throw new IllegalStateException ( "Well no wonder it wasn't found, its not in the list." ) ; } else { recentFiles . remove ( f ) ; } }
Call to remove a file from the list .
153,720
public int compareTo ( Edge other ) { int cmp = super . compareTo ( other ) ; if ( cmp != 0 ) { return cmp ; } return type - other . type ; }
Compare with other edge .
153,721
public String formatAsString ( boolean reverse ) { BasicBlock source = getSource ( ) ; BasicBlock target = getTarget ( ) ; StringBuilder buf = new StringBuilder ( ) ; buf . append ( reverse ? "REVERSE_EDGE(" : "EDGE(" ) ; buf . append ( getLabel ( ) ) ; buf . append ( ") type " ) ; buf . append ( edgeTypeToString ( typ...
Return a string representation of the edge .
153,722
public static int stringToEdgeType ( String s ) { s = s . toUpperCase ( Locale . ENGLISH ) ; if ( "FALL_THROUGH" . equals ( s ) ) { return FALL_THROUGH_EDGE ; } else if ( "IFCMP" . equals ( s ) ) { return IFCMP_EDGE ; } else if ( "SWITCH" . equals ( s ) ) { return SWITCH_EDGE ; } else if ( "SWITCH_DEFAULT" . equals ( s...
Get numeric edge type from string representation .
153,723
public boolean isSameOrNewerThan ( JavaVersion other ) { return this . major > other . major || ( this . major == other . major && this . minor >= other . minor ) ; }
Return whether the Java version represented by this object is at least as recent as the one given .
153,724
public TypeQualifierAnnotation getEffectiveTypeQualifierAnnotation ( ) { boolean firstPartialResult = true ; TypeQualifierAnnotation effective = null ; for ( PartialResult partialResult : partialResultList ) { if ( firstPartialResult ) { effective = partialResult . getTypeQualifierAnnotation ( ) ; firstPartialResult = ...
Get the effective TypeQualifierAnnotation .
153,725
protected void clearCaches ( ) { DescriptorFactory . clearInstance ( ) ; ObjectTypeFactory . clearInstance ( ) ; TypeQualifierApplications . clearInstance ( ) ; TypeQualifierAnnotation . clearInstance ( ) ; TypeQualifierValue . clearInstance ( ) ; AnalysisContext . removeCurrentAnalysisContext ( ) ; Global . removeAnal...
Protected to allow Eclipse plugin remember some cache data for later reuse
153,726
public static void registerBuiltInAnalysisEngines ( IAnalysisCache analysisCache ) { new edu . umd . cs . findbugs . classfile . engine . EngineRegistrar ( ) . registerAnalysisEngines ( analysisCache ) ; new edu . umd . cs . findbugs . classfile . engine . asm . EngineRegistrar ( ) . registerAnalysisEngines ( analysisC...
Register the built - in analysis engines with given IAnalysisCache .
153,727
public static void registerPluginAnalysisEngines ( DetectorFactoryCollection detectorFactoryCollection , IAnalysisCache analysisCache ) throws IOException { for ( Iterator < Plugin > i = detectorFactoryCollection . pluginIterator ( ) ; i . hasNext ( ) ; ) { Plugin plugin = i . next ( ) ; Class < ? extends IAnalysisEngi...
Register all of the analysis engines defined in the plugins contained in a DetectorFactoryCollection with an IAnalysisCache .
153,728
private void buildClassPath ( ) throws InterruptedException , IOException , CheckedAnalysisException { IClassPathBuilder builder = classFactory . createClassPathBuilder ( bugReporter ) ; { HashSet < String > seen = new HashSet < > ( ) ; for ( String path : project . getFileArray ( ) ) { if ( seen . add ( path ) ) { bui...
Build the classpath from project codebases and system codebases .
153,729
private void configureAnalysisFeatures ( ) { for ( AnalysisFeatureSetting setting : analysisOptions . analysisFeatureSettingList ) { setting . configure ( AnalysisContext . currentAnalysisContext ( ) ) ; } AnalysisContext . currentAnalysisContext ( ) . setBoolProperty ( AnalysisFeatures . MERGE_SIMILAR_WARNINGS , analy...
Configure analysis feature settings .
153,730
private void createExecutionPlan ( ) throws OrderingConstraintException { executionPlan = new ExecutionPlan ( ) ; DetectorFactoryChooser detectorFactoryChooser = new DetectorFactoryChooser ( ) { HashSet < DetectorFactory > forcedEnabled = new HashSet < > ( ) ; public boolean choose ( DetectorFactory factory ) { boolean...
Create an execution plan .
153,731
private void logRecoverableException ( ClassDescriptor classDescriptor , Detector2 detector , Throwable e ) { bugReporter . logError ( "Exception analyzing " + classDescriptor . toDottedClassName ( ) + " using detector " + detector . getDetectorClassName ( ) , e ) ; }
Report an exception that occurred while analyzing a class with a detector .
153,732
public static < E > Set < E > newSetFromMap ( Map < E , Boolean > m ) { return new SetFromMap < > ( m ) ; }
Duplication 1 . 6 functionality of Collections . newSetFromMap
153,733
protected VertexType getNextSearchTreeRoot ( ) { for ( Iterator < VertexType > i = graph . vertexIterator ( ) ; i . hasNext ( ) ; ) { VertexType vertex = i . next ( ) ; if ( visitMe ( vertex ) ) { return vertex ; } } return null ; }
Choose the next search tree root . By default this method just scans for a WHITE vertex . Subclasses may override this method in order to choose which vertices are used as search tree roots .
153,734
private void classifyUnknownEdges ( ) { Iterator < EdgeType > edgeIter = graph . edgeIterator ( ) ; while ( edgeIter . hasNext ( ) ) { EdgeType edge = edgeIter . next ( ) ; int dfsEdgeType = getDFSEdgeType ( edge ) ; if ( dfsEdgeType == UNKNOWN_EDGE ) { int srcDiscoveryTime = getDiscoveryTime ( getSource ( edge ) ) ; i...
Classify CROSS and FORWARD edges
153,735
protected void consumeStack ( Instruction ins ) { ConstantPoolGen cpg = getCPG ( ) ; TypeFrame frame = getFrame ( ) ; int numWordsConsumed = ins . consumeStack ( cpg ) ; if ( numWordsConsumed == Const . UNPREDICTABLE ) { throw new InvalidBytecodeException ( "Unpredictable stack consumption for " + ins ) ; } if ( numWor...
Consume stack . This is a convenience method for instructions where the types of popped operands can be ignored .
153,736
protected void pushReturnType ( InvokeInstruction ins ) { ConstantPoolGen cpg = getCPG ( ) ; Type type = ins . getType ( cpg ) ; if ( type . getType ( ) != Const . T_VOID ) { pushValue ( type ) ; } }
Helper for pushing the return type of an invoke instruction .
153,737
public void modelNormalInstruction ( Instruction ins , int numWordsConsumed , int numWordsProduced ) { if ( VERIFY_INTEGRITY ) { if ( numWordsProduced > 0 ) { throw new InvalidBytecodeException ( "missing visitor method for " + ins ) ; } } super . modelNormalInstruction ( ins , numWordsConsumed , numWordsProduced ) ; }
This is overridden only to ensure that we don t rely on the base class to handle instructions that produce stack operands .
153,738
private Iterator < Edge > logicalPredecessorEdgeIterator ( BasicBlock block ) { return isForwards ? cfg . incomingEdgeIterator ( block ) : cfg . outgoingEdgeIterator ( block ) ; }
Return an Iterator over edges that connect given block to its logical predecessors . For forward analyses this is the incoming edges . For backward analyses this is the outgoing edges .
153,739
private int stackEntryThatMustBeNonnegative ( int seen ) { switch ( seen ) { case Const . INVOKEINTERFACE : if ( "java/util/List" . equals ( getClassConstantOperand ( ) ) ) { return getStackEntryOfListCallThatMustBeNonnegative ( ) ; } break ; case Const . INVOKEVIRTUAL : if ( "java/util/LinkedList" . equals ( getClassC...
Return index of stack entry that must be nonnegative .
153,740
private void flush ( ) { if ( pendingAbsoluteValueBug != null ) { absoluteValueAccumulator . accumulateBug ( pendingAbsoluteValueBug , pendingAbsoluteValueBugSourceLine ) ; pendingAbsoluteValueBug = null ; pendingAbsoluteValueBugSourceLine = null ; } accumulator . reportAccumulatedBugs ( ) ; if ( sawLoadOfMinValue ) { ...
Flush out cached state at the end of a method .
153,741
public boolean isNullCheck ( ) { if ( ! isExceptionThrower ( ) || getFirstInstruction ( ) != null ) { return false ; } short opcode = exceptionThrower . getInstruction ( ) . getOpcode ( ) ; return nullCheckInstructionSet . get ( opcode ) ; }
Return whether or not this block is a null check .
153,742
public InstructionHandle getSuccessorOf ( InstructionHandle handle ) { if ( VERIFY_INTEGRITY && ! containsInstruction ( handle ) ) { throw new IllegalStateException ( ) ; } return handle == lastInstruction ? null : handle . getNext ( ) ; }
Get the successor of given instruction within the basic block .
153,743
public InstructionHandle getPredecessorOf ( InstructionHandle handle ) { if ( VERIFY_INTEGRITY && ! containsInstruction ( handle ) ) { throw new IllegalStateException ( ) ; } return handle == firstInstruction ? null : handle . getPrev ( ) ; }
Get the predecessor of given instruction within the basic block .
153,744
public void addInstruction ( InstructionHandle handle ) { if ( firstInstruction == null ) { firstInstruction = lastInstruction = handle ; } else { if ( VERIFY_INTEGRITY && handle != lastInstruction . getNext ( ) ) { throw new IllegalStateException ( "Adding non-consecutive instruction" ) ; } lastInstruction = handle ; ...
Add an InstructionHandle to the basic block .
153,745
public boolean containsInstruction ( InstructionHandle handle ) { Iterator < InstructionHandle > i = instructionIterator ( ) ; while ( i . hasNext ( ) ) { if ( i . next ( ) == handle ) { return true ; } } return false ; }
Return whether or not the basic block contains the given instruction .
153,746
public boolean containsInstructionWithOffset ( int offset ) { Iterator < InstructionHandle > i = instructionIterator ( ) ; while ( i . hasNext ( ) ) { if ( i . next ( ) . getPosition ( ) == offset ) { return true ; } } return false ; }
Return whether or not the basic block contains the instruction with the given bytecode offset .
153,747
public static void writeFile ( IFile file , final FileOutput output , IProgressMonitor monitor ) throws CoreException { try { ByteArrayOutputStream bos = new ByteArrayOutputStream ( ) ; output . writeFile ( bos ) ; ByteArrayInputStream bis = new ByteArrayInputStream ( bos . toByteArray ( ) ) ; if ( ! file . exists ( ) ...
Write the contents of a file in the Eclipse workspace .
153,748
public static void writeFile ( final File file , final FileOutput output , final IProgressMonitor monitor ) throws CoreException { try ( FileOutputStream fout = new FileOutputStream ( file ) ; BufferedOutputStream bout = new BufferedOutputStream ( fout ) ) { if ( monitor != null ) { monitor . subTask ( "writing data to...
Write the contents of a java . io . File
153,749
public static void createMarkers ( final IJavaProject javaProject , final SortedBugCollection theCollection , final ISchedulingRule rule , IProgressMonitor monitor ) { if ( monitor . isCanceled ( ) ) { return ; } final List < MarkerParameter > bugParameters = createBugParameters ( javaProject , theCollection , monitor ...
Create an Eclipse marker for given BugInstance .
153,750
public static List < MarkerParameter > createBugParameters ( IJavaProject project , BugCollection theCollection , IProgressMonitor monitor ) { List < MarkerParameter > bugParameters = new ArrayList < > ( ) ; if ( project == null ) { FindbugsPlugin . getDefault ( ) . logException ( new NullPointerException ( "project is...
As a side - effect this method updates missing line information for some bugs stored in the given bug collection
153,751
public static void removeMarkers ( IResource res ) throws CoreException { res . deleteMarkers ( FindBugsMarker . NAME , true , IResource . DEPTH_INFINITE ) ; if ( res instanceof IProject ) { IProject project = ( IProject ) res ; FindbugsPlugin . clearBugCollection ( project ) ; } }
Remove all FindBugs problem markers for given resource . If the given resource is project will also clear bug collection .
153,752
public static void redisplayMarkers ( final IJavaProject javaProject ) { final IProject project = javaProject . getProject ( ) ; FindBugsJob job = new FindBugsJob ( "Refreshing SpotBugs markers" , project ) { protected void runWithProgress ( IProgressMonitor monitor ) throws CoreException { SortedBugCollection bugs = F...
Attempt to redisplay FindBugs problem markers for given project .
153,753
public static BugInstance findBugInstanceForMarker ( IMarker marker ) { BugCollectionAndInstance bci = findBugCollectionAndInstanceForMarker ( marker ) ; if ( bci == null ) { return null ; } return bci . bugInstance ; }
Find the BugInstance associated with given FindBugs marker .
153,754
public static BugCollectionAndInstance findBugCollectionAndInstanceForMarker ( IMarker marker ) { IResource resource = marker . getResource ( ) ; IProject project = resource . getProject ( ) ; if ( project == null ) { FindbugsPlugin . getDefault ( ) . logError ( "No project for warning marker" ) ; return null ; } if ( ...
Find the BugCollectionAndInstance associated with given FindBugs marker .
153,755
public static Set < IMarker > getMarkerFromSelection ( ISelection selection ) { Set < IMarker > markers = new HashSet < > ( ) ; if ( ! ( selection instanceof IStructuredSelection ) ) { return markers ; } IStructuredSelection sSelection = ( IStructuredSelection ) selection ; for ( Iterator < ? > iter = sSelection . iter...
Fish an IMarker out of given selection .
153,756
public static IMarker getMarkerFromEditor ( ITextSelection selection , IEditorPart editor ) { IResource resource = ( IResource ) editor . getEditorInput ( ) . getAdapter ( IFile . class ) ; IMarker [ ] allMarkers ; if ( resource != null ) { allMarkers = getMarkers ( resource , IResource . DEPTH_ZERO ) ; } else { IClass...
Tries to retrieve right bug marker for given selection . If there are many markers for given editor and text selection doesn t match any of them return null . If there is only one marker for given editor returns this marker in any case .
153,757
public static IMarker [ ] getMarkers ( IResource fileOrFolder , int depth ) { if ( fileOrFolder . getType ( ) == IResource . PROJECT ) { if ( ! fileOrFolder . isAccessible ( ) ) { return EMPTY ; } } try { return fileOrFolder . findMarkers ( FindBugsMarker . NAME , true , depth ) ; } catch ( CoreException e ) { Findbugs...
Retrieves all the FB markers from given resource and all its descendants
153,758
private void syncMenu ( ) { if ( bugInstance != null ) { BugProperty severityProperty = bugInstance . lookupProperty ( BugProperty . SEVERITY ) ; if ( severityProperty != null ) { try { int severity = severityProperty . getValueAsInt ( ) ; if ( severity > 0 && severity <= severityItemList . length ) { selectSeverity ( ...
Synchronize the menu with the current BugInstance .
153,759
private void selectSeverity ( int severity ) { int index = severity - 1 ; for ( int i = 0 ; i < severityItemList . length ; ++ i ) { MenuItem menuItem = severityItemList [ i ] ; menuItem . setEnabled ( true ) ; menuItem . setSelection ( i == index ) ; } }
Set the menu to given severity level .
153,760
private void resetMenuItems ( boolean enable ) { for ( int i = 0 ; i < severityItemList . length ; ++ i ) { MenuItem menuItem = severityItemList [ i ] ; menuItem . setEnabled ( enable ) ; menuItem . setSelection ( false ) ; } }
Reset menu items so they are unchecked .
153,761
public ValueNumber [ ] lookupOutputValues ( Entry entry ) { if ( DEBUG ) { System . out . println ( "VN cache lookup: " + entry ) ; } ValueNumber [ ] result = entryToOutputMap . get ( entry ) ; if ( DEBUG ) { System . out . println ( " result ==> " + Arrays . toString ( result ) ) ; } return result ; }
Look up cached output values for given entry .
153,762
public Binding lookup ( String varName ) { if ( varName . equals ( binding . getVarName ( ) ) ) { return binding ; } return parent != null ? parent . lookup ( varName ) : null ; }
Look for a Binding for given variable .
153,763
private IsNullValueFrame replaceValues ( IsNullValueFrame origFrame , IsNullValueFrame frame , ValueNumber replaceMe , ValueNumberFrame prevVnaFrame , ValueNumberFrame targetVnaFrame , IsNullValue replacementValue ) { if ( ! targetVnaFrame . isValid ( ) ) { throw new IllegalArgumentException ( "Invalid frame in " + met...
Update is - null information at a branch target based on information gained at a null comparison branch .
153,764
protected void obtainFindBugsMarkers ( ) { markers . clear ( ) ; if ( editor == null || ruler == null ) { return ; } IResource resource = ( IResource ) editor . getEditorInput ( ) . getAdapter ( IFile . class ) ; if ( resource == null ) { return ; } IMarker [ ] allMarkers = MarkerUtil . getMarkers ( resource , IResourc...
Fills markers field with all of the FindBugs markers associated with the current line in the text editor s ruler marign .
153,765
protected boolean includesRulerLine ( Position position , IDocument document ) { if ( position != null && ruler != null ) { try { int markerLine = document . getLineOfOffset ( position . getOffset ( ) ) ; int line = ruler . getLineOfLastMouseButtonActivity ( ) ; if ( line == markerLine ) { return true ; } } catch ( Bad...
Checks a Position in a document to see whether the line of last mouse activity falls within this region .
153,766
protected AbstractMarkerAnnotationModel getModel ( ) { if ( editor == null ) { return null ; } IDocumentProvider provider = editor . getDocumentProvider ( ) ; IAnnotationModel model = provider . getAnnotationModel ( editor . getEditorInput ( ) ) ; if ( model instanceof AbstractMarkerAnnotationModel ) { return ( Abstrac...
Retrieves the AbstractMarkerAnnontationsModel from the editor .
153,767
protected IDocument getDocument ( ) { Assert . isNotNull ( editor ) ; IDocumentProvider provider = editor . getDocumentProvider ( ) ; return provider . getDocument ( editor . getEditorInput ( ) ) ; }
Retrieves the document from the editor .
153,768
public void setProjectChanged ( boolean b ) { if ( curProject == null ) { return ; } if ( projectChanged == b ) { return ; } projectChanged = b ; mainFrameMenu . setSaveMenu ( this ) ; getRootPane ( ) . putClientProperty ( WINDOW_MODIFIED , b ) ; }
Called when something in the project is changed and the change needs to be saved . This method should be called instead of using projectChanged = b .
153,769
void callOnClose ( ) { if ( projectChanged && ! SystemProperties . getBoolean ( "findbugs.skipSaveChangesWarning" ) ) { Object [ ] options = { L10N . getLocalString ( "dlg.save_btn" , "Save" ) , L10N . getLocalString ( "dlg.dontsave_btn" , "Don't Save" ) , L10N . getLocalString ( "dlg.cancel_btn" , "Cancel" ) , } ; int...
This method is called when the application is closing . This is either by the exit menuItem or by clicking on the window s system menu .
153,770
public boolean openAnalysis ( File f , SaveType saveType ) { if ( ! f . exists ( ) || ! f . canRead ( ) ) { throw new IllegalArgumentException ( "Can't read " + f . getPath ( ) ) ; } mainFrameLoadSaveHelper . prepareForFileLoad ( f , saveType ) ; mainFrameLoadSaveHelper . loadAnalysis ( f ) ; return true ; }
Opens the analysis . Also clears the source and summary panes . Makes comments enabled false . Sets the saveType and adds the file to the recent menu .
153,771
public void updateTitle ( ) { Project project = getProject ( ) ; String name = project . getProjectName ( ) ; if ( ( name == null || "" . equals ( name . trim ( ) ) ) && saveFile != null ) { name = saveFile . getAbsolutePath ( ) ; } if ( name == null ) { name = "" ; } String oldTitle = this . getTitle ( ) ; String newT...
Changes the title based on curProject and saveFile .
153,772
public void loadProject ( String arg ) throws IOException { Project newProject = Project . readProject ( arg ) ; newProject . setConfiguration ( project . getConfiguration ( ) ) ; project = newProject ; projectLoadedFromFile = true ; }
Load given project file .
153,773
public void execute ( ) { Iterator < ? > elementIter = XMLUtil . selectNodes ( document , "/BugCollection/BugInstance" ) . iterator ( ) ; Iterator < BugInstance > bugInstanceIter = bugCollection . iterator ( ) ; Set < String > bugTypeSet = new HashSet < > ( ) ; Set < String > bugCategorySet = new HashSet < > ( ) ; Set ...
Add messages to the dom4j tree .
153,774
private void addBugCategories ( Set < String > bugCategorySet ) { Element root = document . getRootElement ( ) ; for ( String category : bugCategorySet ) { Element element = root . addElement ( "BugCategory" ) ; element . addAttribute ( "category" , category ) ; Element description = element . addElement ( "Description...
Add BugCategory elements .
153,775
private void addBugCodes ( Set < String > bugCodeSet ) { Element root = document . getRootElement ( ) ; for ( String bugCode : bugCodeSet ) { Element element = root . addElement ( "BugCode" ) ; element . addAttribute ( "abbrev" , bugCode ) ; Element description = element . addElement ( "Description" ) ; description . s...
Add BugCode elements .
153,776
public static Constant merge ( Constant a , Constant b ) { if ( ! a . isConstant ( ) || ! b . isConstant ( ) ) { return NOT_CONSTANT ; } if ( a . value . getClass ( ) != b . value . getClass ( ) || ! a . value . equals ( b . value ) ) { return NOT_CONSTANT ; } return a ; }
Merge two Constnts .
153,777
private void createBugCategoriesGroup ( Composite parent , final IProject project ) { Group checkBoxGroup = new Group ( parent , SWT . SHADOW_ETCHED_OUT ) ; checkBoxGroup . setText ( getMessage ( "property.categoriesGroup" ) ) ; checkBoxGroup . setLayout ( new GridLayout ( 1 , true ) ) ; checkBoxGroup . setLayoutData (...
Build list of bug categories to be enabled or disabled . Populates chkEnableBugCategoryList and bugCategoryList fields .
153,778
protected void syncSelectedCategories ( ) { ProjectFilterSettings filterSettings = getCurrentProps ( ) . getFilterSettings ( ) ; for ( Button checkBox : chkEnableBugCategoryList ) { String category = ( String ) checkBox . getData ( ) ; if ( checkBox . getSelection ( ) ) { filterSettings . addCategory ( category ) ; } e...
Synchronize selected bug category checkboxes with the current user preferences .
153,779
@ SuppressFBWarnings ( "TQ_EXPLICIT_UNKNOWN_SOURCE_VALUE_REACHES_ALWAYS_SINK" ) public static String toSlashedClassName ( @ SlashedClassName ( when = When . UNKNOWN ) String className ) { if ( className . indexOf ( '.' ) >= 0 ) { return className . replace ( '.' , '/' ) ; } return className ; }
Convert class name to slashed format . If the class name is already in slashed format it is returned unmodified .
153,780
@ SuppressFBWarnings ( "TQ_EXPLICIT_UNKNOWN_SOURCE_VALUE_REACHES_NEVER_SINK" ) public static String toDottedClassName ( @ SlashedClassName ( when = When . UNKNOWN ) String className ) { if ( className . indexOf ( '/' ) >= 0 ) { return className . replace ( '/' , '.' ) ; } return className ; }
Convert class name to dotted format . If the class name is already in dotted format it is returned unmodified .
153,781
public static boolean isAnonymous ( String className ) { int i = className . lastIndexOf ( '$' ) ; if ( i >= 0 && ++ i < className . length ( ) ) { while ( i < className . length ( ) ) { if ( ! Character . isDigit ( className . charAt ( i ) ) ) { return false ; } i ++ ; } return true ; } return false ; }
Does a class name appear to designate an anonymous class? Only the name is analyzed . No classes are loaded or looked up .
153,782
public static String extractClassName ( String originalName ) { String name = originalName ; if ( name . charAt ( 0 ) != '[' && name . charAt ( name . length ( ) - 1 ) != ';' ) { return name ; } while ( name . charAt ( 0 ) == '[' ) { name = name . substring ( 1 ) ; } if ( name . charAt ( 0 ) == 'L' && name . charAt ( n...
Extract a slashed classname from a JVM classname or signature .
153,783
public static TypeQualifierAnnotation combineReturnTypeAnnotations ( TypeQualifierAnnotation a , TypeQualifierAnnotation b ) { return combineAnnotations ( a , b , combineReturnValueMatrix ) ; }
Combine return type annotations .
153,784
public final String getPackageName ( ) { int lastDot = className . lastIndexOf ( '.' ) ; if ( lastDot < 0 ) { return "" ; } else { return className . substring ( 0 , lastDot ) ; } }
Get the package name .
153,785
protected static String removePackageName ( String typeName ) { int index = typeName . lastIndexOf ( '.' ) ; if ( index >= 0 ) { typeName = typeName . substring ( index + 1 ) ; } return typeName ; }
Shorten a type name by removing the package name
153,786
public void downgradeOnControlSplit ( ) { final int numSlots = getNumSlots ( ) ; for ( int i = 0 ; i < numSlots ; ++ i ) { IsNullValue value = getValue ( i ) ; value = value . downgradeOnControlSplit ( ) ; setValue ( i , value ) ; } if ( knownValueMap != null ) { for ( Map . Entry < ValueNumber , IsNullValue > entry : ...
Downgrade all NSP values in frame . Should be called when a non - exception control split occurs .
153,787
public static void printCode ( Method [ ] methods ) { for ( Method m : methods ) { System . out . println ( m ) ; Code code = m . getCode ( ) ; if ( code != null ) { System . out . println ( code ) ; } } }
Dump the disassembled code of all methods in the class .
153,788
protected boolean isReferenceType ( byte type ) { return type == Const . T_OBJECT || type == Const . T_ARRAY || type == T_NULL || type == T_EXCEPTION ; }
Determine if the given typecode refers to a reference type . This implementation just checks that the type code is T_OBJECT T_ARRAY T_NULL or T_EXCEPTION . Subclasses should override this if they have defined new object types with different type codes .
153,789
protected ReferenceType mergeReferenceTypes ( ReferenceType aRef , ReferenceType bRef ) throws DataflowAnalysisException { if ( aRef . equals ( bRef ) ) { return aRef ; } byte aType = aRef . getType ( ) ; byte bType = bRef . getType ( ) ; try { if ( isObjectType ( aType ) && isObjectType ( bType ) && ( ( aType == T_EXC...
Default implementation of merging reference types . This just returns the first common superclass which is compliant with the JVM Spec . Subclasses may override this method in order to implement extended type rules .
153,790
public void read ( ) { File prefFile = new File ( SystemProperties . getProperty ( "user.home" ) , PREF_FILE_NAME ) ; if ( ! prefFile . exists ( ) || ! prefFile . isFile ( ) ) { return ; } try { read ( new FileInputStream ( prefFile ) ) ; } catch ( IOException e ) { } }
Read persistent global UserPreferences from file in the user s home directory .
153,791
public void write ( ) { try { File prefFile = new File ( SystemProperties . getProperty ( "user.home" ) , PREF_FILE_NAME ) ; write ( new FileOutputStream ( prefFile ) ) ; } catch ( IOException e ) { if ( FindBugs . DEBUG ) { e . printStackTrace ( ) ; } } }
Write persistent global UserPreferences to file in user s home directory .
153,792
public void useProject ( String projectName ) { removeProject ( projectName ) ; recentProjectsList . addFirst ( projectName ) ; while ( recentProjectsList . size ( ) > MAX_RECENT_FILES ) { recentProjectsList . removeLast ( ) ; } }
Add given project filename to the front of the recently - used project list .
153,793
public void removeProject ( String projectName ) { Iterator < String > it = recentProjectsList . iterator ( ) ; while ( it . hasNext ( ) ) { if ( projectName . equals ( it . next ( ) ) ) { it . remove ( ) ; } } }
Remove project filename from the recently - used project list .
153,794
public void enableAllDetectors ( boolean enable ) { detectorEnablementMap . clear ( ) ; Collection < Plugin > allPlugins = Plugin . getAllPlugins ( ) ; for ( Plugin plugin : allPlugins ) { for ( DetectorFactory factory : plugin . getDetectorFactories ( ) ) { detectorEnablementMap . put ( factory . getShortName ( ) , en...
Enable or disable all known Detectors .
153,795
private static Map < String , Boolean > readProperties ( Properties props , String keyPrefix ) { Map < String , Boolean > filters = new TreeMap < > ( ) ; int counter = 0 ; boolean keyFound = true ; while ( keyFound ) { String property = props . getProperty ( keyPrefix + counter ) ; if ( property != null ) { int pipePos...
Helper method to read array of strings out of the properties file using a Findbugs style format .
153,796
private static void writeProperties ( Properties props , String keyPrefix , Map < String , Boolean > filters ) { int counter = 0 ; Set < Entry < String , Boolean > > entrySet = filters . entrySet ( ) ; for ( Entry < String , Boolean > entry : entrySet ) { props . setProperty ( keyPrefix + counter , entry . getKey ( ) +...
Helper method to write array of strings out of the properties file using a Findbugs style format .
153,797
public AnalysisFeatureSetting [ ] getAnalysisFeatureSettings ( ) { if ( EFFORT_DEFAULT . equals ( effort ) ) { return FindBugs . DEFAULT_EFFORT ; } else if ( EFFORT_MIN . equals ( effort ) ) { return FindBugs . MIN_EFFORT ; } return FindBugs . MAX_EFFORT ; }
Returns the effort level as an array of feature settings as expected by FindBugs .
153,798
public JavaClass parse ( ) throws IOException { JavaClass jclass = classParser . parse ( ) ; Repository . addClass ( jclass ) ; return jclass ; }
Parse the class file into a JavaClass object . If successful the new JavaClass is entered into the Repository .
153,799
void setSourceBaseList ( Iterable < String > sourceBaseList ) { for ( String repos : sourceBaseList ) { if ( repos . endsWith ( ".zip" ) || repos . endsWith ( ".jar" ) || repos . endsWith ( ".z0p.gz" ) ) { try { if ( repos . startsWith ( "http:" ) || repos . startsWith ( "https:" ) || repos . startsWith ( "file:" ) ) {...
Set the list of source directories .