idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
30,000 | private < T > boolean addToListInternal ( Collection < T > list , T value ) { if ( ! list . contains ( value ) ) { list . add ( value ) ; isModified = true ; return true ; } else { return false ; } } | Add a value to given list making the Project modified if the value is not already present in the list . |
30,001 | private boolean doRedundantLoadElimination ( ) { if ( ! REDUNDANT_LOAD_ELIMINATION ) { return false ; } XField xfield = loadedFieldSet . getField ( handle ) ; if ( xfield == null ) { return false ; } return ! ( xfield . getSignature ( ) . equals ( "D" ) || xfield . getSignature ( ) . equals ( "J" ) ) ; } | Determine whether redundant load elimination should be performed for the heap location referenced by the current instruction . |
30,002 | private boolean doForwardSubstitution ( ) { if ( ! REDUNDANT_LOAD_ELIMINATION ) { return false ; } XField xfield = loadedFieldSet . getField ( handle ) ; if ( xfield == null ) { return false ; } if ( xfield . getSignature ( ) . equals ( "D" ) || xfield . getSignature ( ) . equals ( "J" ) ) { return false ; } return loa... | Determine whether forward substitution should be performed for the heap location referenced by the current instruction . |
30,003 | public void modelNormalInstruction ( Instruction ins , int numWordsConsumed , int numWordsProduced ) { int flags = 0 ; if ( ins instanceof InvokeInstruction ) { flags = ValueNumber . RETURN_VALUE ; } else if ( ins instanceof ArrayInstruction ) { flags = ValueNumber . ARRAY_VALUE ; } else if ( ins instanceof ConstantPus... | This is the default instruction modeling method . |
30,004 | private ValueNumber [ ] popInputValues ( int numWordsConsumed ) { ValueNumberFrame frame = getFrame ( ) ; ValueNumber [ ] inputValueList = allocateValueNumberArray ( numWordsConsumed ) ; try { frame . getTopStackWords ( inputValueList ) ; while ( numWordsConsumed -- > 0 ) { frame . popValue ( ) ; } } catch ( DataflowAn... | Pop the input values for the given instruction from the current frame . |
30,005 | private void pushOutputValues ( ValueNumber [ ] outputValueList ) { ValueNumberFrame frame = getFrame ( ) ; for ( ValueNumber aOutputValueList : outputValueList ) { frame . pushValue ( aOutputValueList ) ; } } | Push given output values onto the current frame . |
30,006 | private void loadInstanceField ( XField instanceField , Instruction obj ) { if ( RLE_DEBUG ) { System . out . println ( "[loadInstanceField for field " + instanceField + " in instruction " + handle ) ; } ValueNumberFrame frame = getFrame ( ) ; try { ValueNumber reference = frame . popValue ( ) ; AvailableLoad available... | Load an instance field . |
30,007 | private void loadStaticField ( XField staticField , Instruction obj ) { if ( RLE_DEBUG ) { System . out . println ( "[loadStaticField for field " + staticField + " in instruction " + handle ) ; } ValueNumberFrame frame = getFrame ( ) ; AvailableLoad availableLoad = new AvailableLoad ( staticField ) ; ValueNumber [ ] lo... | Load a static field . |
30,008 | private void storeInstanceField ( XField instanceField , Instruction obj , boolean pushStoredValue ) { if ( RLE_DEBUG ) { System . out . println ( "[storeInstanceField for field " + instanceField + " in instruction " + handle ) ; } ValueNumberFrame frame = getFrame ( ) ; int numWordsConsumed = getNumWordsConsumed ( obj... | Store an instance field . |
30,009 | private void storeStaticField ( XField staticField , Instruction obj , boolean pushStoredValue ) { if ( RLE_DEBUG ) { System . out . println ( "[storeStaticField for field " + staticField + " in instruction " + handle ) ; } ValueNumberFrame frame = getFrame ( ) ; AvailableLoad availableLoad = new AvailableLoad ( static... | Store a static field . |
30,010 | @ 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 |
30,011 | @ 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 |
30,012 | 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 ; |
30,013 | 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 . |
30,014 | 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 . |
30,015 | 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 . |
30,016 | 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 . |
30,017 | public Object getMethodAnalysis ( Class < ? > analysisClass , MethodDescriptor methodDescriptor ) { Map < MethodDescriptor , Object > objectMap = getObjectMap ( analysisClass ) ; return objectMap . get ( methodDescriptor ) ; } | Retrieve a method analysis object . |
30,018 | 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 . |
30,019 | 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 . |
30,020 | 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... |
30,021 | 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 . |
30,022 | 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 |
30,023 | 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 . |
30,024 | 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 . |
30,025 | public void clear ( ) { exceptionSet . clear ( ) ; explicitSet . clear ( ) ; universalHandler = false ; commonSupertype = null ; size = 0 ; } | Remove all exceptions from the set . |
30,026 | 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 . |
30,027 | 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 . |
30,028 | 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 . |
30,029 | 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 . |
30,030 | public int compareTo ( Edge other ) { int cmp = super . compareTo ( other ) ; if ( cmp != 0 ) { return cmp ; } return type - other . type ; } | Compare with other edge . |
30,031 | 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 . |
30,032 | 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 . |
30,033 | 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 . |
30,034 | public TypeQualifierAnnotation getEffectiveTypeQualifierAnnotation ( ) { boolean firstPartialResult = true ; TypeQualifierAnnotation effective = null ; for ( PartialResult partialResult : partialResultList ) { if ( firstPartialResult ) { effective = partialResult . getTypeQualifierAnnotation ( ) ; firstPartialResult = ... | Get the effective TypeQualifierAnnotation . |
30,035 | 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 |
30,036 | 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 . |
30,037 | 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 . |
30,038 | 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 . |
30,039 | private void configureAnalysisFeatures ( ) { for ( AnalysisFeatureSetting setting : analysisOptions . analysisFeatureSettingList ) { setting . configure ( AnalysisContext . currentAnalysisContext ( ) ) ; } AnalysisContext . currentAnalysisContext ( ) . setBoolProperty ( AnalysisFeatures . MERGE_SIMILAR_WARNINGS , analy... | Configure analysis feature settings . |
30,040 | 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 . |
30,041 | 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 . |
30,042 | public static < E > Set < E > newSetFromMap ( Map < E , Boolean > m ) { return new SetFromMap < > ( m ) ; } | Duplication 1 . 6 functionality of Collections . newSetFromMap |
30,043 | 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 . |
30,044 | 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 |
30,045 | 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 . |
30,046 | 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 . |
30,047 | 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 . |
30,048 | 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 . |
30,049 | 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 . |
30,050 | 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 . |
30,051 | 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 . |
30,052 | 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 . |
30,053 | 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 . |
30,054 | 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 . |
30,055 | 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 . |
30,056 | 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 . |
30,057 | 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 . |
30,058 | 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 |
30,059 | 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 . |
30,060 | 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 |
30,061 | 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 . |
30,062 | 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 . |
30,063 | 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 . |
30,064 | 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 . |
30,065 | 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 . |
30,066 | 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 . |
30,067 | 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 |
30,068 | 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 . |
30,069 | 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 . |
30,070 | 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 . |
30,071 | 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 . |
30,072 | 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 . |
30,073 | 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 . |
30,074 | 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 . |
30,075 | 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 . |
30,076 | 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 . |
30,077 | protected IDocument getDocument ( ) { Assert . isNotNull ( editor ) ; IDocumentProvider provider = editor . getDocumentProvider ( ) ; return provider . getDocument ( editor . getEditorInput ( ) ) ; } | Retrieves the document from the editor . |
30,078 | 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 . |
30,079 | 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 . |
30,080 | 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 . |
30,081 | 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 . |
30,082 | public void loadProject ( String arg ) throws IOException { Project newProject = Project . readProject ( arg ) ; newProject . setConfiguration ( project . getConfiguration ( ) ) ; project = newProject ; projectLoadedFromFile = true ; } | Load given project file . |
30,083 | 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 . |
30,084 | 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 . |
30,085 | 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 . |
30,086 | 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 . |
30,087 | 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 . |
30,088 | 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 . |
30,089 | @ 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 . |
30,090 | @ 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 . |
30,091 | 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 . |
30,092 | 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 . |
30,093 | public static TypeQualifierAnnotation combineReturnTypeAnnotations ( TypeQualifierAnnotation a , TypeQualifierAnnotation b ) { return combineAnnotations ( a , b , combineReturnValueMatrix ) ; } | Combine return type annotations . |
30,094 | public final String getPackageName ( ) { int lastDot = className . lastIndexOf ( '.' ) ; if ( lastDot < 0 ) { return "" ; } else { return className . substring ( 0 , lastDot ) ; } } | Get the package name . |
30,095 | 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 |
30,096 | 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 . |
30,097 | 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 . |
30,098 | 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 . |
30,099 | 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 . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.