public static String getPlatformName(SourceLineAnnotation source) { return getPlatformName(source.getPackageName(), getOrGuessSourceFile(source)); }
private void copySourceForAnnotation(BugAnnotation ann) { SourceLineAnnotation sourceAnnotation; if (ann instanceof BugAnnotationWithSourceLines) { sourceAnnotation = ((BugAnnotationWithSourceLines) ann).getSourceLines(); } else if (ann instanceof SourceLineAnnotation) { sourceAnnotation = (SourceLineAnnotation) ann; } else { return; } if (sourceAnnotation == null) { return; } if (sourceAnnotation.isUnknown()) { return; } String fullName = SourceFinder.getPlatformName(sourceAnnotation); SourceFile sourceFile; try { sourceFile = sourceFinder.findSourceFile(sourceAnnotation); } catch (IOException e) { if (couldNotFind.add(fullName)) { System.out.println("Did not find " + fullName); } return; } if (copied.add(fullName)) { copySourceFile(fullName, sourceFile); } }
/** * A zip or jar archive containing source files. */ static class ZipSourceRepository implements SourceRepository { ZipFile zipFile; public ZipSourceRepository(@WillCloseWhenClosed ZipFile zipFile) { this.zipFile = zipFile; } @Override public boolean contains(String fileName) { return zipFile.getEntry(fileName) != null; } @Override public boolean isPlatformDependent() { return false; } @Override public SourceFileDataSource getDataSource(String fileName) { return new ZipSourceFileDataSource(zipFile, fileName); } @Override public void close() throws IOException { zipFile.close(); } }
String platformName = getPlatformName(packageName, fileName); String canonicalName = getCanonicalName(packageName, fileName);
public static String getPlatformName(SourceLineAnnotation source) { return getPlatformName(source.getPackageName(), getOrGuessSourceFile(source)); }
private void copySourceForAnnotation(BugAnnotation ann) { SourceLineAnnotation sourceAnnotation; if (ann instanceof BugAnnotationWithSourceLines) { sourceAnnotation = ((BugAnnotationWithSourceLines) ann).getSourceLines(); } else if (ann instanceof SourceLineAnnotation) { sourceAnnotation = (SourceLineAnnotation) ann; } else { return; } if (sourceAnnotation == null) { return; } if (sourceAnnotation.isUnknown()) { return; } String fullName = SourceFinder.getPlatformName(sourceAnnotation); SourceFile sourceFile; try { sourceFile = sourceFinder.findSourceFile(sourceAnnotation); } catch (IOException e) { if (couldNotFind.add(fullName)) { System.out.println("Did not find " + fullName); } return; } if (copied.add(fullName)) { copySourceFile(fullName, sourceFile); } }
/** * A zip or jar archive containing source files. */ static class ZipSourceRepository implements SourceRepository { ZipFile zipFile; public ZipSourceRepository(ZipFile zipFile) { this.zipFile = zipFile; } @Override public boolean contains(String fileName) { return zipFile.getEntry(fileName) != null; } @Override public boolean isPlatformDependent() { return false; } @Override public SourceFileDataSource getDataSource(String fileName) { return new ZipSourceFileDataSource(zipFile, fileName); } }
String platformName = getPlatformName(packageName, fileName); String canonicalName = getCanonicalName(packageName, fileName);