code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
@Override
@Nonnull
public String getLabel() {
ASTVisitor labelFixingVisitor = getCustomLabelVisitor();
if (labelFixingVisitor instanceof CustomLabelVisitor) {
if (customizedLabel == null) {
String labelReplacement = findLabelReplacement(labelFixingVisitor);
... | java |
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){
... | java |
@CheckForNull
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) {
... | java |
protected void reportException(Exception e) {
Assert.isNotNull(e);
FindbugsPlugin.getDefault().logException(e, e.getLocalizedMessage());
MessageDialog.openError(FindbugsPlugin.getShell(), "BugResolution failed.", e.getLocalizedMessage());
} | java |
public int getSizeOfSurroundingTryBlock(String vmNameOfExceptionClass, int pc) {
if (code == null) {
throw new IllegalStateException("Not visiting Code");
}
return Util.getSizeOfSurroundingTryBlock(constantPool, code, vmNameOfExceptionClass, pc);
} | java |
public String getFullyQualifiedMethodName() {
if (!visitingMethod) {
throw new IllegalStateException("getFullyQualifiedMethodName called while not visiting method");
}
if (fullyQualifiedMethodName == null) {
getMethodName();
getDottedMethodSig();
S... | java |
public String getMethodName() {
if (!visitingMethod) {
throw new IllegalStateException("getMethodName called while not visiting method");
}
if (methodName == null) {
methodName = getStringFromIndex(method.getNameIndex());
}
return methodName;
} | java |
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;
ConstantNameAn... | java |
public String getMethodSig() {
if (!visitingMethod) {
throw new IllegalStateException("getMethodSig called while not visiting method");
}
if (methodSig == null) {
methodSig = getStringFromIndex(method.getSignatureIndex());
}
return methodSig;
} | java |
public String getDottedMethodSig() {
if (!visitingMethod) {
throw new IllegalStateException("getDottedMethodSig called while not visiting method");
}
if (dottedMethodSig == null) {
dottedMethodSig = getMethodSig().replace('/', '.');
}
return dottedMethodSi... | java |
public String getFieldName() {
if (!visitingField) {
throw new IllegalStateException("getFieldName called while not visiting field");
}
if (fieldName == null) {
fieldName = getStringFromIndex(field.getNameIndex());
}
return fieldName;
} | java |
public String getFieldSig() {
if (!visitingField) {
throw new IllegalStateException("getFieldSig called while not visiting field");
}
if (fieldSig == null) {
fieldSig = getStringFromIndex(field.getSignatureIndex());
}
return fieldSig;
} | java |
public String getFullyQualifiedFieldName() {
if (!visitingField) {
throw new IllegalStateException("getFullyQualifiedFieldName called while not visiting field");
}
if (fullyQualifiedFieldName == null) {
fullyQualifiedFieldName = getDottedClassName() + "." + getFieldName()... | java |
@Deprecated
public String getDottedFieldSig() {
if (!visitingField) {
throw new IllegalStateException("getDottedFieldSig called while not visiting field");
}
if (dottedFieldSig == null) {
dottedFieldSig = fieldSig.replace('/', '.');
}
return dottedFiel... | java |
public ClassNotFoundException toClassNotFoundException() {
ClassDescriptor classDescriptor = DescriptorFactory.createClassDescriptorFromResourceName(resourceName);
return new ClassNotFoundException("ResourceNotFoundException while looking for class "
+ classDescriptor.toDottedClassName()... | java |
private ICodeBaseEntry search(List<? extends ICodeBase> codeBaseList, String resourceName) {
for (ICodeBase codeBase : codeBaseList) {
ICodeBaseEntry resource = codeBase.lookupResource(resourceName);
if (resource != null) {
return resource;
}
// Ig... | java |
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... | java |
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);... | java |
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();
... | java |
private void checkCircularity(State state, Obligation obligation, int basicBlockId)
throws ObligationAcquiredOrReleasedInLoopException {
if (state.getPath().hasComponent(basicBlockId)) {
throw new ObligationAcquiredOrReleasedInLoopException(obligation);
}
} | java |
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;
} | java |
private static boolean acquireAnalysisPermitUnlessCancelled(IProgressMonitor monitor) throws InterruptedException {
do {
if (analysisSem.tryAcquire(1, TimeUnit.SECONDS)) {
return true;
}
} while (!monitor.isCanceled());
return false;
} | java |
public void setTimestamp(String timestamp) throws ParseException {
this.analysisTimestamp = new SimpleDateFormat(TIMESTAMP_FORMAT, Locale.ENGLISH).parse(timestamp);
} | java |
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) {
... | java |
public void clearBugCounts() {
for (int i = 0; i < totalErrors.length; i++) {
totalErrors[i] = 0;
}
for (PackageStats stats : packageStatsMap.values()) {
stats.clearBugCounts();
}
} | java |
public void transformSummaryToHTML(Writer htmlWriter) throws IOException, TransformerException {
ByteArrayOutputStream summaryOut = new ByteArrayOutputStream(8096);
reportSummary(summaryOut);
StreamSource in = new StreamSource(new ByteArrayInputStream(summaryOut.toByteArray()));
Stream... | java |
JPopupMenu createBugPopupMenu() {
JPopupMenu popupMenu = new JPopupMenu();
JMenuItem filterMenuItem = MainFrameHelper.newJMenuItem("menu.filterBugsLikeThis", "Filter bugs like this");
filterMenuItem.addActionListener(evt -> {
new NewFilterFromBug(new FilterFromBugPicker(currentSele... | java |
JPopupMenu createBranchPopUpMenu() {
JPopupMenu popupMenu = new JPopupMenu();
JMenuItem filterMenuItem = MainFrameHelper.newJMenuItem("menu.filterTheseBugs", "Filter these bugs");
filterMenuItem.addActionListener(evt -> {
// TODO This code does a smarter version of filtering that i... | java |
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);
} ... | java |
public void accumulateBug(BugInstance bug, BytecodeScanningDetector visitor) {
SourceLineAnnotation source = SourceLineAnnotation.fromVisitedInstruction(visitor);
accumulateBug(bug, source);
} | java |
public void reportAccumulatedBugs() {
for (Map.Entry<BugInstance, Data> e : map.entrySet()) {
BugInstance bug = e.getKey();
Data d = e.getValue();
reportBug(bug, d);
}
clearBugs();
} | java |
public void rebuild() {
if (TRACE) {
System.out.println("rebuilding bug tree model");
}
NewFilterFromBug.closeAll();
// If this thread is not interrupting a previous thread, set the paths
// to be opened when the new tree is complete
// If the thread is inte... | java |
public static Collection<TypeQualifierValue<?>> getComplementaryExclusiveTypeQualifierValue(TypeQualifierValue<?> tqv) {
assert tqv.isExclusiveQualifier();
LinkedList<TypeQualifierValue<?>> result = new LinkedList<>();
for (TypeQualifierValue<?> t : instance.get().allKnownTypeQualifiers) {
... | java |
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 de... | java |
public static synchronized SortedMap<String, String> getContributedDetectors() {
if (contributedDetectors != null) {
return new TreeMap<>(contributedDetectors);
}
TreeMap<String, String> set = new TreeMap<>();
IExtensionRegistry registry = Platform.getExtensionRegistry();
... | java |
@CheckForNull
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 f... | java |
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 {
... | java |
@Override
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 Runti... | java |
public static String rewriteMethodSignature(ClassNameRewriter classNameRewriter, String methodSignature) {
if (classNameRewriter != IdentityClassNameRewriter.instance()) {
SignatureParser parser = new SignatureParser(methodSignature);
StringBuilder buf = new StringBuilder();
... | java |
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 = c... | java |
public static MethodAnnotation convertMethodAnnotation(ClassNameRewriter classNameRewriter, MethodAnnotation annotation) {
if (classNameRewriter != IdentityClassNameRewriter.instance()) {
annotation = new MethodAnnotation(classNameRewriter.rewriteClassName(annotation.getClassName()),
... | java |
public static FieldAnnotation convertFieldAnnotation(ClassNameRewriter classNameRewriter, FieldAnnotation annotation) {
if (classNameRewriter != IdentityClassNameRewriter.instance()) {
annotation = new FieldAnnotation(classNameRewriter.rewriteClassName(annotation.getClassName()),
... | java |
private InterproceduralCallGraphVertex findVertex(XMethod xmethod) {
InterproceduralCallGraphVertex vertex;
vertex = callGraph.lookupVertex(xmethod.getMethodDescriptor());
if (vertex == null) {
vertex = new InterproceduralCallGraphVertex();
vertex.setXmethod(xmethod);
... | java |
public boolean hasComponent(int blockId) {
for (int i = 0; i < length; i++) {
if (blockIdList[i] == blockId) {
return true;
}
}
return false;
} | java |
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;
} | java |
public void acceptVisitor(CFG cfg, PathVisitor visitor) {
if (getLength() > 0) {
BasicBlock startBlock = cfg.lookupBlockByLabel(getBlockIdAt(0));
acceptVisitorStartingFromLocation(cfg, visitor, startBlock, startBlock.getFirstInstruction());
}
} | java |
public void acceptVisitorStartingFromLocation(CFG cfg, PathVisitor visitor, BasicBlock startBlock,
InstructionHandle startHandle) {
// Find the start block in the path
int index;
for (index = 0; index < getLength(); index++) {
if (getBlockIdAt(index) == startBlock.getLabe... | java |
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;
} | java |
private void produce(IsNullValue value) {
IsNullValueFrame frame = getFrame();
frame.pushValue(value);
newValueOnTOS();
} | java |
private void handleInvoke(InvokeInstruction obj) {
if (obj instanceof INVOKEDYNAMIC) {
// should not happen
return;
}
Type returnType = obj.getReturnType(getCPG());
Location location = getLocation();
if (trackValueNumbers) {
try {
... | java |
private boolean checkForKnownValue(Instruction obj) {
if (trackValueNumbers) {
try {
// See if the value number loaded here is a known value
ValueNumberFrame vnaFrameAfter = vnaDataflow.getFactAfterLocation(getLocation());
if (vnaFrameAfter.isValid()) ... | java |
public static String trimComma(String s) {
if (s.endsWith(",")) {
s = s.substring(0, s.length() - 1);
}
return s;
} | java |
public static boolean initializeUnescapePattern() {
if (paternIsInitialized == true) {
return true;
}
synchronized (unescapeInitLockObject) {
if (paternIsInitialized == true) {
return true;
}
try {
unescapePattern ... | java |
public String getReturnTypeSignature() {
int endOfParams = signature.lastIndexOf(')');
if (endOfParams < 0) {
throw new IllegalArgumentException("Bad method signature: " + signature);
}
return signature.substring(endOfParams + 1);
} | java |
public int getNumParameters() {
int count = 0;
for (Iterator<String> i = parameterSignatureIterator(); i.hasNext();) {
i.next();
++count;
}
return count;
} | java |
public static boolean compareSignatures(String plainSignature, String genericSignature) {
GenericSignatureParser plainParser = new GenericSignatureParser(plainSignature);
GenericSignatureParser genericParser = new GenericSignatureParser(genericSignature);
return plainParser.getNumParameters() =... | java |
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(... | java |
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... | java |
public static Type fromExceptionSet(ExceptionSet exceptionSet) throws ClassNotFoundException {
Type commonSupertype = exceptionSet.getCommonSupertype();
if (commonSupertype.getType() != Const.T_OBJECT) {
return commonSupertype;
}
ObjectType exceptionSupertype = (ObjectType) ... | java |
public String parseNext() {
StringBuilder result = new StringBuilder();
if (signature.startsWith("[")) {
int dimensions = 0;
do {
++dimensions;
signature = signature.substring(1);
} while (signature.charAt(0) == '[');
resul... | java |
static public void reportMissingClass(ClassNotFoundException e) {
requireNonNull(e, "argument is null");
String missing = AbstractBugReporter.getMissingClassName(e);
if (skipReportingMissingClass(missing)) {
return;
}
if (!analyzingApplicationClass()) {
re... | java |
public final void loadInterproceduralDatabases() {
loadPropertyDatabase(getFieldStoreTypeDatabase(), FieldStoreTypeDatabase.DEFAULT_FILENAME, "field store type database");
loadPropertyDatabase(getUnconditionalDerefParamDatabase(), UNCONDITIONAL_DEREF_DB_FILENAME,
"unconditional param der... | java |
public final void setDatabaseInputDir(String databaseInputDir) {
if (DEBUG) {
System.out.println("Setting database input directory: " + databaseInputDir);
}
this.databaseInputDir = databaseInputDir;
} | java |
public final void setDatabaseOutputDir(String databaseOutputDir) {
if (DEBUG) {
System.out.println("Setting database output directory: " + databaseOutputDir);
}
this.databaseOutputDir = databaseOutputDir;
} | java |
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 (... | java |
public static void setCurrentAnalysisContext(AnalysisContext analysisContext) {
currentAnalysisContext.set(analysisContext);
if (Global.getAnalysisCache() != null) {
currentXFactory.set(new XFactory());
}
} | java |
public ClassContext getClassContext(JavaClass javaClass) {
// This is a bit silly since we're doing an unnecessary
// ClassDescriptor->JavaClass lookup.
// However, we can be assured that it will succeed.
ClassDescriptor classDescriptor = DescriptorFactory.instance().getClassDescriptor(... | java |
public void copyFrom(BlockType other) {
this.isValid = other.isValid;
this.isTop = other.isTop;
if (isValid) {
this.depth = other.depth;
this.clear();
this.or(other);
}
} | java |
public boolean sameAs(BlockType other) {
if (!this.isValid) {
return !other.isValid && (this.isTop == other.isTop);
} else {
if (!other.isValid) {
return false;
} else {
// Both facts are valid
if (this.depth != other.de... | java |
public void mergeWith(BlockType other) {
if (this.isTop() || other.isBottom()) {
copyFrom(other);
} else if (isValid()) {
// To merge, we take the common prefix
int pfxLen = Math.min(this.depth, other.depth);
int commonLen;
for (commonLen = 0; ... | java |
public static synchronized Map<String, List<QuickFixContribution>> getContributedQuickFixes() {
if (contributedQuickFixes != null) {
return contributedQuickFixes;
}
HashMap<String, List<QuickFixContribution>> set = new HashMap<>();
IExtensionRegistry registry = Platform.getE... | java |
public static void getDirectApplications(Set<TypeQualifierAnnotation> result, XMethod o, int parameter) {
Collection<AnnotationValue> values = getDirectAnnotation(o, parameter);
for (AnnotationValue v : values) {
constructTypeQualifierAnnotation(result, v);
}
} | java |
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) {
constru... | java |
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.getAnnotati... | java |
public static void constructTypeQualifierAnnotation(Set<TypeQualifierAnnotation> set, AnnotationValue v) {
assert set != null;
TypeQualifierAnnotation tqa = constructTypeQualifierAnnotation(v);
set.add(tqa);
} | java |
private static @CheckForNull
TypeQualifierAnnotation findMatchingTypeQualifierAnnotation(Collection<TypeQualifierAnnotation> typeQualifierAnnotations,
TypeQualifierValue<?> typeQualifierValue) {
for (TypeQualifierAnnotation typeQualifierAnnotation : typeQualifierAnnotations) {
if (ty... | java |
private static @CheckForNull
TypeQualifierAnnotation getDefaultAnnotation(AnnotatedObject o, TypeQualifierValue<?> typeQualifierValue, ElementType elementType) {
//
// Try to find a default annotation using the standard JSR-305
// default annotation mechanism.
//
TypeQualifie... | java |
private static TypeQualifierAnnotation getDirectTypeQualifierAnnotation(AnnotatedObject o,
TypeQualifierValue<?> typeQualifierValue) {
TypeQualifierAnnotation result;
Set<TypeQualifierAnnotation> applications = new HashSet<>();
getDirectApplications(applications, o, o.getElementType... | java |
public static TypeQualifierAnnotation getInheritedTypeQualifierAnnotation(XMethod o, TypeQualifierValue<?> typeQualifierValue) {
assert !o.isStatic();
ReturnTypeAnnotationAccumulator accumulator = new ReturnTypeAnnotationAccumulator(typeQualifierValue, o);
try {
AnalysisContext.curr... | java |
public static @CheckForNull @CheckReturnValue
TypeQualifierAnnotation getDirectTypeQualifierAnnotation(XMethod xmethod, int parameter, TypeQualifierValue<?> typeQualifierValue) {
XMethod bridge = xmethod.bridgeTo();
if (bridge != null) {
xmethod = bridge;
}
Set<TypeQualif... | java |
public static @CheckForNull
TypeQualifierAnnotation getInheritedTypeQualifierAnnotation(XMethod xmethod, int parameter,
TypeQualifierValue<?> typeQualifierValue) {
assert !xmethod.isStatic();
ParameterAnnotationAccumulator accumulator = new ParameterAnnotationAccumulator(typeQualifierVa... | java |
private void setSorterCheckBoxes() {
SorterTableColumnModel sorter = MainFrame.getInstance().getSorter();
for (SortableCheckBox c : checkBoxSortList) {
c.setSelected(sorter.isShown(c.sortable));
}
} | java |
public static MethodAnnotation fromVisitedMethod(PreorderVisitor visitor) {
String className = visitor.getDottedClassName();
MethodAnnotation result = new MethodAnnotation(className, visitor.getMethodName(), visitor.getMethodSig(), visitor
.getMethod().isStatic());
// Try to fin... | java |
public static MethodAnnotation fromCalledMethod(DismantleBytecode visitor) {
String className = visitor.getDottedClassConstantOperand();
String methodName = visitor.getNameConstantOperand();
String methodSig = visitor.getSigConstantOperand();
if (visitor instanceof OpcodeStackDetector &... | java |
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;
... | java |
public static MethodAnnotation fromXMethod(XMethod xmethod) {
return fromForeignMethod(xmethod.getClassName(), xmethod.getName(), xmethod.getSignature(), xmethod.isStatic());
} | java |
public static MethodAnnotation fromMethodDescriptor(MethodDescriptor methodDescriptor) {
return fromForeignMethod(methodDescriptor.getSlashedClassName(), methodDescriptor.getName(),
methodDescriptor.getSignature(), methodDescriptor.isStatic());
} | java |
public void execute() throws CheckedAnalysisException, IOException, InterruptedException {
File dir = new File(rootSourceDirectory);
if (!dir.isDirectory()) {
throw new IOException("Path " + rootSourceDirectory + " is not a directory");
}
// Find all directories underneath t... | java |
public static void addFiles(final Project findBugsProject, File clzDir, final Pattern pat) {
if (clzDir.isDirectory()) {
clzDir.listFiles(new FileCollector(pat, findBugsProject));
}
} | java |
private static void mapResource(WorkItem resource, Map<IProject, List<WorkItem>> projectsMap, boolean checkJavaProject) {
IProject project = resource.getProject();
if (checkJavaProject && !ProjectUtilities.isJavaProject(project)) {
// non java projects: can happen only for changesets
... | java |
@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) {
... | java |
@javax.annotation.CheckForNull
public static IResource getResource(Object element) {
if (element instanceof IJavaElement) {
return ((IJavaElement) element).getResource();
}
return Util.getAdapter(IResource.class, element);
} | java |
private ClassDescriptor getNullnessAnnotationClassDescriptor(NullnessAnnotation n) {
if (n == NullnessAnnotation.CHECK_FOR_NULL) {
return JSR305NullnessAnnotations.CHECK_FOR_NULL;
} else if (n == NullnessAnnotation.NONNULL) {
return JSR305NullnessAnnotations.NONNULL;
} el... | java |
public void addAll(Collection<BugInstance> collection, boolean updateActiveTime) {
for (BugInstance warning : collection) {
add(warning, updateActiveTime);
}
} | java |
@Override
public AppVersion getCurrentAppVersion() {
return new AppVersion(getSequenceNumber()).setReleaseName(getReleaseName()).setTimestamp(getTimestamp())
.setNumClasses(getProjectStats().getNumClasses()).setCodeSize(getProjectStats().getCodeSize());
} | java |
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);
} cat... | java |
@Override
public Document toDocument() {
// if (project == null) throw new NullPointerException("No project");
assert project != null;
DocumentFactory docFactory = new DocumentFactory();
Document document = docFactory.createDocument();
Dom4JXMLOutput treeBuilder = new Dom4JX... | java |
public static void cloneAll(Collection<BugInstance> dest, Collection<BugInstance> source) {
for (BugInstance obj : source) {
dest.add((BugInstance) obj.clone());
}
} | java |
public static void writeXML(XMLOutput xmlOutput, String elementName, BugAnnotation annotation,
XMLAttributeList attributeList, boolean addMessages) throws IOException {
SourceLineAnnotation src = null;
if (annotation instanceof BugAnnotationWithSourceLines) {
src = ((BugAnnotati... | java |
public InnerClassAccess getInnerClassAccess(String className, String methodName) throws ClassNotFoundException {
Map<String, InnerClassAccess> map = getAccessMapForClass(className);
return map.get(methodName);
} | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.