Merge branch 'fileprovider-instance' into eclipse-dep
This commit is contained in:
commit
e0d3df8ea7
|
@ -62,7 +62,7 @@ public class JDTJava15IRTests extends IRTests {
|
|||
};
|
||||
|
||||
try {
|
||||
engine.setExclusionsFile(FileProvider
|
||||
engine.setExclusionsFile((new FileProvider())
|
||||
.getFileFromPlugin(CoreTestsPlugin.getDefault(), CallGraphTestUtil.REGRESSION_EXCLUSIONS).getAbsolutePath());
|
||||
} catch (IOException e) {
|
||||
Assert.assertFalse("Cannot find exclusions file", true);
|
||||
|
|
|
@ -96,7 +96,7 @@ public class JDTJavaIRTests extends JavaIRTests {
|
|||
};
|
||||
|
||||
try {
|
||||
engine.setExclusionsFile(FileProvider
|
||||
engine.setExclusionsFile((new FileProvider())
|
||||
.getFileFromPlugin(CoreTestsPlugin.getDefault(), CallGraphTestUtil.REGRESSION_EXCLUSIONS).getAbsolutePath());
|
||||
} catch (IOException e) {
|
||||
Assert.assertFalse("Cannot find exclusions file", true);
|
||||
|
|
|
@ -64,7 +64,7 @@ public class EclipseProjectSourceAnalysisEngine extends EclipseProjectAnalysisEn
|
|||
super(project);
|
||||
this.fileExt = fileExt;
|
||||
try {
|
||||
setExclusionsFile(FileProvider.getFileFromPlugin(CorePlugin.getDefault(), "J2SEClassHierarchyExclusions.txt")
|
||||
setExclusionsFile((new FileProvider()).getFileFromPlugin(CorePlugin.getDefault(), "J2SEClassHierarchyExclusions.txt")
|
||||
.getAbsolutePath());
|
||||
} catch (IOException e) {
|
||||
Assertions.UNREACHABLE("Cannot find exclusions file");
|
||||
|
|
|
@ -125,7 +125,7 @@ public class HTMLCGBuilder {
|
|||
// first try interpreting as local file name, if that doesn't work just
|
||||
// assume it's a URL
|
||||
try {
|
||||
File f = FileProvider.getFileFromClassLoader(src, HTMLCGBuilder.class.getClassLoader());
|
||||
File f = (new FileProvider()).getFileFromClassLoader(src, HTMLCGBuilder.class.getClassLoader());
|
||||
URL url = f.toURI().toURL();
|
||||
return url;
|
||||
} catch (FileNotFoundException fnfe) {
|
||||
|
|
|
@ -270,7 +270,7 @@ public class CorrelationFinder {
|
|||
private URL toUrl(String src) throws MalformedURLException {
|
||||
// first try interpreting as local file name, if that doesn't work just assume it's a URL
|
||||
try {
|
||||
File f = FileProvider.getFileFromClassLoader(src, this.getClass().getClassLoader());
|
||||
File f = (new FileProvider()).getFileFromClassLoader(src, this.getClass().getClassLoader());
|
||||
URL url = f.toURI().toURL();
|
||||
return url;
|
||||
} catch(FileNotFoundException fnfe) {
|
||||
|
|
|
@ -45,7 +45,7 @@ public class CallGraphTestUtil {
|
|||
private static final boolean CHECK_FOOTPRINT = false;
|
||||
|
||||
public static AnalysisScope makeJ2SEAnalysisScope(String scopeFile, String exclusionsFile) throws IOException {
|
||||
AnalysisScope scope = AnalysisScopeReader.readJavaScope(scopeFile, FileProvider.getFile(exclusionsFile), MY_CLASSLOADER);
|
||||
AnalysisScope scope = AnalysisScopeReader.readJavaScope(scopeFile, (new FileProvider()).getFile(exclusionsFile), MY_CLASSLOADER);
|
||||
return scope;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ public class DupFieldsTest extends WalaTestCase {
|
|||
|
||||
@Test public void testDupFieldNames() throws IOException, ClassHierarchyException {
|
||||
AnalysisScope scope = null;
|
||||
scope = AnalysisScopeReader.readJavaScope(TestConstants.WALA_TESTDATA, FileProvider.getFile("J2SEClassHierarchyExclusions.txt"), DupFieldsTest.class.getClassLoader());
|
||||
scope = AnalysisScopeReader.readJavaScope(TestConstants.WALA_TESTDATA, (new FileProvider()).getFile("J2SEClassHierarchyExclusions.txt"), DupFieldsTest.class.getClassLoader());
|
||||
ClassHierarchy cha = ClassHierarchy.make(scope);
|
||||
TypeReference ref = TypeReference.findOrCreate(ClassLoaderReference.Application, "LDupFieldName");
|
||||
IClass klass = cha.lookupClass(ref);
|
||||
|
|
|
@ -28,7 +28,7 @@ public class ExclusionsTest {
|
|||
|
||||
@Test
|
||||
public void testExclusions() throws IOException {
|
||||
AnalysisScope scope = AnalysisScopeReader.readJavaScope(TestConstants.WALA_TESTDATA, FileProvider.getFile("GUIExclusions.txt"),
|
||||
AnalysisScope scope = AnalysisScopeReader.readJavaScope(TestConstants.WALA_TESTDATA, (new FileProvider()).getFile("GUIExclusions.txt"),
|
||||
ExclusionsTest.class.getClassLoader());
|
||||
TypeReference buttonRef = TypeReference.findOrCreate(ClassLoaderReference.Application,
|
||||
StringStuff.deployment2CanonicalTypeString("java.awt.Button"));
|
||||
|
|
|
@ -48,7 +48,7 @@ public class GetTargetsTest extends WalaTestCase {
|
|||
@BeforeClass
|
||||
public static void beforeClass() throws Exception {
|
||||
|
||||
scope = AnalysisScopeReader.readJavaScope(TestConstants.WALA_TESTDATA, FileProvider.getFile("J2SEClassHierarchyExclusions.txt"), MY_CLASSLOADER);
|
||||
scope = AnalysisScopeReader.readJavaScope(TestConstants.WALA_TESTDATA, (new FileProvider()).getFile("J2SEClassHierarchyExclusions.txt"), MY_CLASSLOADER);
|
||||
|
||||
ClassLoaderFactory factory = new ClassLoaderFactoryImpl(scope.getExclusions() );
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ public class InnerClassesTest extends WalaTestCase {
|
|||
|
||||
@BeforeClass
|
||||
public static void beforeClass() throws Exception {
|
||||
scope = AnalysisScopeReader.readJavaScope(TestConstants.WALA_TESTDATA, FileProvider.getFile("J2SEClassHierarchyExclusions.txt"),
|
||||
scope = AnalysisScopeReader.readJavaScope(TestConstants.WALA_TESTDATA, (new FileProvider()).getFile("J2SEClassHierarchyExclusions.txt"),
|
||||
MY_CLASSLOADER);
|
||||
|
||||
ClassLoaderFactory factory = new ClassLoaderFactoryImpl(scope.getExclusions());
|
||||
|
|
|
@ -45,7 +45,7 @@ public class InterfaceTest extends WalaTestCase {
|
|||
|
||||
@BeforeClass
|
||||
public static void beforeClass() throws Exception {
|
||||
scope = AnalysisScopeReader.readJavaScope(TestConstants.WALA_TESTDATA, FileProvider.getFile("J2SEClassHierarchyExclusions.txt"), MY_CLASSLOADER);
|
||||
scope = AnalysisScopeReader.readJavaScope(TestConstants.WALA_TESTDATA, (new FileProvider()).getFile("J2SEClassHierarchyExclusions.txt"), MY_CLASSLOADER);
|
||||
|
||||
ClassLoaderFactory factory = new ClassLoaderFactoryImpl(scope.getExclusions() );
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ public class LibraryVersionTest extends WalaTestCase {
|
|||
private static final ClassLoader MY_CLASSLOADER = DeterministicIRTest.class.getClassLoader();
|
||||
|
||||
@Test public void testLibraryVersion() throws IOException {
|
||||
AnalysisScope scope = AnalysisScopeReader.readJavaScope(TestConstants.WALA_TESTDATA, FileProvider.getFile("J2SEClassHierarchyExclusions.txt"), MY_CLASSLOADER);
|
||||
AnalysisScope scope = AnalysisScopeReader.readJavaScope(TestConstants.WALA_TESTDATA, (new FileProvider()).getFile("J2SEClassHierarchyExclusions.txt"), MY_CLASSLOADER);
|
||||
System.err.println("java library version is " + scope.getJavaLibraryVersion());
|
||||
Assert.assertTrue(scope.isJava16Libraries() || scope.isJava15Libraries()||scope.isJava14Libraries());
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ public class AnnotationTest extends WalaTestCase {
|
|||
@BeforeClass
|
||||
public static void before() throws IOException, ClassHierarchyException {
|
||||
AnalysisScope scope = AnalysisScopeReader.readJavaScope(TestConstants.WALA_TESTDATA,
|
||||
FileProvider.getFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS), AnnotationTest.class.getClassLoader());
|
||||
(new FileProvider()).getFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS), AnnotationTest.class.getClassLoader());
|
||||
cha = ClassHierarchy.make(scope);
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ public class CFGSanitizerTest extends WalaTestCase {
|
|||
*/
|
||||
@Test
|
||||
public void testSyntheticEdgeToExit() throws IOException, IllegalArgumentException, WalaException {
|
||||
AnalysisScope scope = AnalysisScopeReader.makePrimordialScope(FileProvider.getFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
|
||||
AnalysisScope scope = AnalysisScopeReader.makePrimordialScope((new FileProvider()).getFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
|
||||
|
||||
ClassHierarchy cha = ClassHierarchy.make(scope);
|
||||
ClassLoader cl = CFGSanitizerTest.class.getClassLoader();
|
||||
|
|
|
@ -56,7 +56,7 @@ public class CFGTest extends WalaTestCase {
|
|||
public static void beforeClass() throws Exception {
|
||||
|
||||
scope = AnalysisScopeReader.readJavaScope(TestConstants.WALA_TESTDATA,
|
||||
FileProvider.getFile("J2SEClassHierarchyExclusions.txt"), CFGTest.class.getClassLoader());
|
||||
(new FileProvider()).getFile("J2SEClassHierarchyExclusions.txt"), CFGTest.class.getClassLoader());
|
||||
ClassLoaderFactory factory = new ClassLoaderFactoryImpl(scope.getExclusions());
|
||||
|
||||
try {
|
||||
|
|
|
@ -53,7 +53,7 @@ public class CornerCasesTest extends WalaTestCase {
|
|||
*/
|
||||
@Test public void testBug38484() throws ClassHierarchyException, IOException {
|
||||
AnalysisScope scope = null;
|
||||
scope = AnalysisScopeReader.readJavaScope(TestConstants.WALA_TESTDATA, FileProvider.getFile("J2SEClassHierarchyExclusions.txt"), MY_CLASSLOADER);
|
||||
scope = AnalysisScopeReader.readJavaScope(TestConstants.WALA_TESTDATA, (new FileProvider()).getFile("J2SEClassHierarchyExclusions.txt"), MY_CLASSLOADER);
|
||||
ClassHierarchy cha = ClassHierarchy.make(scope);
|
||||
TypeReference t = TypeReference.findOrCreateClass(scope.getApplicationLoader(), "cornerCases", "YuckyInterface");
|
||||
IClass klass = cha.lookupClass(t);
|
||||
|
@ -71,7 +71,7 @@ public class CornerCasesTest extends WalaTestCase {
|
|||
*/
|
||||
@Test public void testBug38540() throws ClassHierarchyException, IOException {
|
||||
AnalysisScope scope = null;
|
||||
scope = AnalysisScopeReader.readJavaScope(TestConstants.WALA_TESTDATA, FileProvider.getFile("J2SEClassHierarchyExclusions.txt"), MY_CLASSLOADER);
|
||||
scope = AnalysisScopeReader.readJavaScope(TestConstants.WALA_TESTDATA, (new FileProvider()).getFile("J2SEClassHierarchyExclusions.txt"), MY_CLASSLOADER);
|
||||
AnalysisOptions options = new AnalysisOptions();
|
||||
ClassHierarchy cha = ClassHierarchy.make(scope);
|
||||
TypeReference t = TypeReference.findOrCreateClass(scope.getApplicationLoader(), "cornerCases", "Main");
|
||||
|
|
|
@ -66,7 +66,7 @@ public class DeterministicIRTest extends WalaTestCase {
|
|||
public static void beforeClass() throws Exception {
|
||||
|
||||
scope = AnalysisScopeReader.readJavaScope(TestConstants.WALA_TESTDATA,
|
||||
FileProvider.getFile("J2SEClassHierarchyExclusions.txt"), MY_CLASSLOADER);
|
||||
(new FileProvider()).getFile("J2SEClassHierarchyExclusions.txt"), MY_CLASSLOADER);
|
||||
options = new AnalysisOptions(scope, null);
|
||||
cache = new AnalysisCache();
|
||||
ClassLoaderFactory factory = new ClassLoaderFactoryImpl(scope.getExclusions());
|
||||
|
|
|
@ -68,7 +68,7 @@ public class LocalNamesTest extends WalaTestCase {
|
|||
public static void beforeClass() throws Exception {
|
||||
|
||||
scope = AnalysisScopeReader.readJavaScope(TestConstants.WALA_TESTDATA,
|
||||
FileProvider.getFile("J2SEClassHierarchyExclusions.txt"), MY_CLASSLOADER);
|
||||
(new FileProvider()).getFile("J2SEClassHierarchyExclusions.txt"), MY_CLASSLOADER);
|
||||
|
||||
options = new AnalysisOptions(scope, null);
|
||||
cache = new AnalysisCache();
|
||||
|
@ -100,7 +100,7 @@ public class LocalNamesTest extends WalaTestCase {
|
|||
@Test
|
||||
public void testAliasNames() {
|
||||
try {
|
||||
AnalysisScope scope = AnalysisScopeReader.readJavaScope(TestConstants.WALA_TESTDATA, FileProvider
|
||||
AnalysisScope scope = AnalysisScopeReader.readJavaScope(TestConstants.WALA_TESTDATA, (new FileProvider())
|
||||
.getFile("J2SEClassHierarchyExclusions.txt"), MY_CLASSLOADER);
|
||||
ClassHierarchy cha = ClassHierarchy.make(scope);
|
||||
TypeReference t = TypeReference.findOrCreateClass(scope.getApplicationLoader(), "cornerCases", "AliasNames");
|
||||
|
|
|
@ -41,7 +41,7 @@ public class MultiNewArrayTest extends WalaTestCase {
|
|||
|
||||
@Test public void testMultiNewArray1() throws IOException, ClassHierarchyException {
|
||||
AnalysisScope scope = null;
|
||||
scope = AnalysisScopeReader.readJavaScope(TestConstants.WALA_TESTDATA, FileProvider.getFile("J2SEClassHierarchyExclusions.txt"), MY_CLASSLOADER);
|
||||
scope = AnalysisScopeReader.readJavaScope(TestConstants.WALA_TESTDATA, (new FileProvider()).getFile("J2SEClassHierarchyExclusions.txt"), MY_CLASSLOADER);
|
||||
ClassHierarchy cha = ClassHierarchy.make(scope);
|
||||
IClass klass = cha.lookupClass(TypeReference.findOrCreate(ClassLoaderReference.Application, TestConstants.MULTI_DIM_MAIN));
|
||||
Assert.assertTrue(klass != null);
|
||||
|
|
|
@ -64,7 +64,7 @@ public class TypeInferenceTest extends WalaTestCase {
|
|||
@BeforeClass
|
||||
public static void beforeClass() throws Exception {
|
||||
|
||||
scope = AnalysisScopeReader.readJavaScope(TestConstants.WALA_TESTDATA, FileProvider.getFile("J2SEClassHierarchyExclusions.txt"), MY_CLASSLOADER);
|
||||
scope = AnalysisScopeReader.readJavaScope(TestConstants.WALA_TESTDATA, (new FileProvider()).getFile("J2SEClassHierarchyExclusions.txt"), MY_CLASSLOADER);
|
||||
|
||||
options = new AnalysisOptions(scope, null);
|
||||
cache = new AnalysisCache();
|
||||
|
|
|
@ -67,7 +67,7 @@ public class DataflowTest extends WalaTestCase {
|
|||
public static void beforeClass() throws Exception {
|
||||
|
||||
scope = AnalysisScopeReader.readJavaScope(TestConstants.WALA_TESTDATA,
|
||||
FileProvider.getFile("J2SEClassHierarchyExclusions.txt"), DataflowTest.class.getClassLoader());
|
||||
(new FileProvider()).getFile("J2SEClassHierarchyExclusions.txt"), DataflowTest.class.getClassLoader());
|
||||
|
||||
try {
|
||||
cha = ClassHierarchy.make(scope);
|
||||
|
|
|
@ -40,7 +40,7 @@ public class JavaViewerDriver {
|
|||
|
||||
private static void run(String classPath, String exclusionFilePath) throws IOException, ClassHierarchyException, CallGraphBuilderCancelException{
|
||||
|
||||
File exclusionFile = FileProvider.getFile(exclusionFilePath);
|
||||
File exclusionFile = (new FileProvider()).getFile(exclusionFilePath);
|
||||
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(classPath, exclusionFile != null ? exclusionFile
|
||||
: new File(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ public class PDFCallGraph {
|
|||
*/
|
||||
public static Process run(String appJar, String exclusionFile) throws IllegalArgumentException, CancelException {
|
||||
try {
|
||||
Graph<CGNode> g = buildPrunedCallGraph(appJar, FileProvider.getFile(exclusionFile));
|
||||
Graph<CGNode> g = buildPrunedCallGraph(appJar, (new FileProvider()).getFile(exclusionFile));
|
||||
|
||||
Properties p = null;
|
||||
try {
|
||||
|
|
|
@ -87,7 +87,7 @@ public class PDFControlDependenceGraph {
|
|||
if (PDFCallGraph.isDirectory(appJar)) {
|
||||
appJar = PDFCallGraph.findJarFiles(new String[] { appJar });
|
||||
}
|
||||
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar, FileProvider.getFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
|
||||
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar, (new FileProvider()).getFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
|
||||
|
||||
ClassHierarchy cha = ClassHierarchy.make(scope);
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ public class PDFSDG {
|
|||
*/
|
||||
public static Process run(String appJar, String mainClass, DataDependenceOptions dOptions, ControlDependenceOptions cOptions) throws IllegalArgumentException, CancelException, IOException {
|
||||
try {
|
||||
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar, FileProvider.getFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
|
||||
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar, (new FileProvider()).getFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
|
||||
|
||||
// generate a WALA-consumable wrapper around the incoming scope object
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ public class PDFSlice {
|
|||
IOException {
|
||||
try {
|
||||
// create an analysis scope representing the appJar as a J2SE application
|
||||
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar, FileProvider
|
||||
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar, (new FileProvider())
|
||||
.getFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
|
||||
|
||||
// build a class hierarchy, call graph, and system dependence graph
|
||||
|
|
|
@ -71,7 +71,7 @@ public class PDFTypeHierarchy {
|
|||
try {
|
||||
validateCommandLine(args);
|
||||
String classpath = args[CLASSPATH_INDEX];
|
||||
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(classpath, FileProvider.getFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
|
||||
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(classpath, (new FileProvider()).getFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
|
||||
|
||||
// invoke WALA to build a class hierarchy
|
||||
ClassHierarchy cha = ClassHierarchy.make(scope);
|
||||
|
|
|
@ -72,7 +72,7 @@ public class PDFWalaIR {
|
|||
|
||||
// Build an AnalysisScope which represents the set of classes to analyze. In particular,
|
||||
// we will analyze the contents of the appJar jar file and the Java standard libraries.
|
||||
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar, FileProvider
|
||||
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar, (new FileProvider())
|
||||
.getFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
|
||||
|
||||
// Build a class hierarchy representing all classes to analyze. This step will read the class
|
||||
|
|
|
@ -43,7 +43,7 @@ public final class WalaExamplesProperties {
|
|||
throw new IllegalStateException("failed to find URL for wala.examples.properties");
|
||||
}
|
||||
|
||||
return new File(FileProvider.filePathFromURL(url)).getParentFile().getParentFile().getAbsolutePath();
|
||||
return new File((new FileProvider()).filePathFromURL(url)).getParentFile().getParentFile().getAbsolutePath();
|
||||
}
|
||||
|
||||
}
|
|
@ -17,7 +17,7 @@ public class FileProviderTest {
|
|||
URL url = new URL("file:///c:/my/File.jar");
|
||||
String expected = "/c:/my/File.jar";
|
||||
// exercise:
|
||||
String actual = FileProvider.filePathFromURL(url);
|
||||
String actual = (new FileProvider()).filePathFromURL(url);
|
||||
// verify:
|
||||
assertEquals(expected, actual);
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public class FileProviderTest {
|
|||
URL url = new URL("file:///[Eclipse]/File.jar");
|
||||
String expected = PlatformUtil.onWindows() ? "/C:/[Eclipse]/File.jar" : "/[Eclipse]/File.jar";
|
||||
// exercise:
|
||||
String actual = FileProvider.filePathFromURL(url);
|
||||
String actual = (new FileProvider()).filePathFromURL(url);
|
||||
// verify:
|
||||
assertEquals(expected, actual);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public abstract class AbstractURLModule implements Module, ModuleEntry {
|
|||
if (con instanceof JarURLConnection)
|
||||
return ((JarURLConnection) con).getEntryName();
|
||||
else
|
||||
return FileProvider.filePathFromURL(url);
|
||||
return (new FileProvider()).filePathFromURL(url);
|
||||
} catch (IOException e) {
|
||||
Assertions.UNREACHABLE();
|
||||
return null;
|
||||
|
|
|
@ -510,7 +510,7 @@ public class ClassLoaderImpl implements IClassLoader {
|
|||
String jarFileName = archive.getJarFile().getName();
|
||||
InputStream s = null;
|
||||
try {
|
||||
File jarFile = FileProvider.getFile(jarFileName);
|
||||
File jarFile = (new FileProvider()).getFile(jarFileName);
|
||||
int bufferSize = 65536;
|
||||
s = new BufferedInputStream(new FileInputStream(jarFile), bufferSize);
|
||||
byte[] b = new byte[1024];
|
||||
|
|
|
@ -154,7 +154,7 @@ public abstract class AbstractAnalysisEngine implements AnalysisEngine {
|
|||
Assertions.UNREACHABLE("no j2selibs specified. You probably did not call AppAnalysisEngine.setJ2SELibrary.");
|
||||
}
|
||||
|
||||
scope = AnalysisScopeReader.readJavaScope(SYNTHETIC_J2SE_MODEL, FileProvider.getFile(getExclusionsFile()), getClass()
|
||||
scope = AnalysisScopeReader.readJavaScope(SYNTHETIC_J2SE_MODEL, (new FileProvider()).getFile(getExclusionsFile()), getClass()
|
||||
.getClassLoader());
|
||||
|
||||
// add standard libraries
|
||||
|
|
|
@ -143,7 +143,7 @@ public final class WalaProperties {
|
|||
if (url == null) {
|
||||
return System.getProperty("user.dir"); //$NON-NLS-1$
|
||||
} else {
|
||||
return new File(FileProvider.filePathFromURL(url)).getParentFile().getParentFile().getPath();
|
||||
return new File((new FileProvider()).filePathFromURL(url)).getParentFile().getParentFile().getPath();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ public class AnalysisScopeReader {
|
|||
Plugin plugIn) throws IOException {
|
||||
BufferedReader r = null;
|
||||
try {
|
||||
File scopeFile = (plugIn == null) ? FileProvider.getFile(scopeFileName, javaLoader) : FileProvider.getFileFromPlugin(plugIn,
|
||||
File scopeFile = (plugIn == null) ? (new FileProvider()).getFile(scopeFileName, javaLoader) : (new FileProvider()).getFileFromPlugin(plugIn,
|
||||
scopeFileName);
|
||||
assert scopeFile.exists();
|
||||
|
||||
|
@ -107,26 +107,27 @@ public class AnalysisScopeReader {
|
|||
String language = toks.nextToken();
|
||||
String entryType = toks.nextToken();
|
||||
String entryPathname = toks.nextToken();
|
||||
FileProvider fp = (new FileProvider());
|
||||
if ("classFile".equals(entryType)) {
|
||||
File cf = FileProvider.getFile(entryPathname, javaLoader);
|
||||
File cf = fp.getFile(entryPathname, javaLoader);
|
||||
try {
|
||||
scope.addClassFileToScope(walaLoader, cf);
|
||||
} catch (InvalidClassFileException e) {
|
||||
Assertions.UNREACHABLE(e.toString());
|
||||
}
|
||||
} else if ("sourceFile".equals(entryType)) {
|
||||
File sf = FileProvider.getFile(entryPathname, javaLoader);
|
||||
File sf = fp.getFile(entryPathname, javaLoader);
|
||||
scope.addSourceFileToScope(walaLoader, sf, entryPathname);
|
||||
} else if ("binaryDir".equals(entryType)) {
|
||||
File bd = FileProvider.getFile(entryPathname, javaLoader);
|
||||
File bd = fp.getFile(entryPathname, javaLoader);
|
||||
assert bd.isDirectory();
|
||||
scope.addToScope(walaLoader, new BinaryDirectoryTreeModule(bd));
|
||||
} else if ("sourceDir".equals(entryType)) {
|
||||
File sd = FileProvider.getFile(entryPathname, javaLoader);
|
||||
File sd = fp.getFile(entryPathname, javaLoader);
|
||||
assert sd.isDirectory();
|
||||
scope.addToScope(walaLoader, new SourceDirectoryTreeModule(sd));
|
||||
} else if ("jarFile".equals(entryType)) {
|
||||
Module M = FileProvider.getJarFileModule(entryPathname, javaLoader);
|
||||
Module M = fp.getJarFileModule(entryPathname, javaLoader);
|
||||
scope.addToScope(walaLoader, M);
|
||||
} else if ("loaderImpl".equals(entryType)) {
|
||||
scope.setLoaderImpl(walaLoader, entryPathname);
|
||||
|
|
|
@ -78,21 +78,17 @@ public class FileProvider {
|
|||
}
|
||||
|
||||
private final static int DEBUG_LEVEL = 0;
|
||||
|
||||
public FileProvider() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param fileName
|
||||
* @return the jar file packaged with this plug-in of the given name, or null
|
||||
* if not found.
|
||||
*/
|
||||
public static Module getJarFileModule(String fileName) throws IOException {
|
||||
public Module getJarFileModule(String fileName) throws IOException {
|
||||
return getJarFileModule(fileName, FileProvider.class.getClassLoader());
|
||||
}
|
||||
|
||||
public static Module getJarFileModule(String fileName, ClassLoader loader) throws IOException {
|
||||
public Module getJarFileModule(String fileName, ClassLoader loader) throws IOException {
|
||||
if (CorePlugin.getDefault() == null) {
|
||||
return getJarFileFromClassLoader(fileName, loader);
|
||||
} else if (CorePlugin.IS_RESOURCES_BUNDLE_AVAILABLE) {
|
||||
|
@ -104,14 +100,14 @@ public class FileProvider {
|
|||
return getFromPlugin(CorePlugin.getDefault(), fileName);
|
||||
}
|
||||
|
||||
public static URL getResource(String fileName) throws IOException {
|
||||
public URL getResource(String fileName) throws IOException {
|
||||
if (fileName == null) {
|
||||
throw new IllegalArgumentException("null fileName");
|
||||
}
|
||||
return getResource(fileName, FileProvider.class.getClassLoader());
|
||||
}
|
||||
|
||||
public static URL getResource(String fileName, ClassLoader loader) throws IOException {
|
||||
public URL getResource(String fileName, ClassLoader loader) throws IOException {
|
||||
if (fileName == null) {
|
||||
throw new IllegalArgumentException("null fileName");
|
||||
}
|
||||
|
@ -122,14 +118,14 @@ public class FileProvider {
|
|||
new Path(fileName), null);
|
||||
}
|
||||
|
||||
public static File getFile(String fileName) throws IOException {
|
||||
public File getFile(String fileName) throws IOException {
|
||||
if (fileName == null) {
|
||||
throw new IllegalArgumentException("null fileName");
|
||||
}
|
||||
return getFile(fileName, FileProvider.class.getClassLoader());
|
||||
}
|
||||
|
||||
public static File getFile(String fileName, ClassLoader loader) throws IOException {
|
||||
public File getFile(String fileName, ClassLoader loader) throws IOException {
|
||||
return (CorePlugin.getDefault() == null) ? getFileFromClassLoader(fileName, loader) : getFileFromPlugin(
|
||||
CorePlugin.getDefault(), fileName);
|
||||
}
|
||||
|
@ -141,7 +137,7 @@ public class FileProvider {
|
|||
* @throws IllegalArgumentException
|
||||
* if p is null
|
||||
*/
|
||||
public static File getFileFromPlugin(Plugin p, String fileName) throws IOException {
|
||||
public File getFileFromPlugin(Plugin p, String fileName) throws IOException {
|
||||
|
||||
if (p == null) {
|
||||
throw new IllegalArgumentException("p is null");
|
||||
|
@ -161,7 +157,7 @@ public class FileProvider {
|
|||
* @return the jar file packaged with this plug-in of the given name, or null
|
||||
* if not found.
|
||||
*/
|
||||
private static JarFileModule getFromPlugin(Plugin p, String fileName) throws IOException {
|
||||
private JarFileModule getFromPlugin(Plugin p, String fileName) throws IOException {
|
||||
URL url = getFileURLFromPlugin(p, fileName);
|
||||
return (url == null) ? null : new JarFileModule(new JarFile(filePathFromURL(url)));
|
||||
}
|
||||
|
@ -174,7 +170,7 @@ public class FileProvider {
|
|||
* @return the URL, or <code>null</code> if the file is not found
|
||||
* @throws IOException
|
||||
*/
|
||||
private static URL getFileURLFromPlugin(Plugin p, String fileName) throws IOException {
|
||||
private URL getFileURLFromPlugin(Plugin p, String fileName) throws IOException {
|
||||
try {
|
||||
URL url = FileLocator.find(p.getBundle(), new Path(fileName), null);
|
||||
if (url == null) {
|
||||
|
@ -212,7 +208,7 @@ public class FileProvider {
|
|||
* @param url
|
||||
* @return an escaped version of the URL
|
||||
*/
|
||||
private static URL fixupFileURLSpaces(URL url) {
|
||||
private URL fixupFileURLSpaces(URL url) {
|
||||
String urlString = url.toExternalForm();
|
||||
StringBuffer fixedUpUrl = new StringBuffer();
|
||||
int lastIndex = 0;
|
||||
|
@ -240,7 +236,7 @@ public class FileProvider {
|
|||
/**
|
||||
* @throws FileNotFoundException
|
||||
*/
|
||||
public static File getFileFromClassLoader(String fileName, ClassLoader loader) throws FileNotFoundException {
|
||||
public File getFileFromClassLoader(String fileName, ClassLoader loader) throws FileNotFoundException {
|
||||
if (loader == null) {
|
||||
throw new IllegalArgumentException("null loader");
|
||||
}
|
||||
|
@ -271,7 +267,7 @@ public class FileProvider {
|
|||
/**
|
||||
* @throws FileNotFoundException
|
||||
*/
|
||||
public static InputStream getInputStreamFromClassLoader(String fileName, ClassLoader loader) throws FileNotFoundException {
|
||||
public InputStream getInputStreamFromClassLoader(String fileName, ClassLoader loader) throws FileNotFoundException {
|
||||
if (loader == null) {
|
||||
throw new IllegalArgumentException("null loader");
|
||||
}
|
||||
|
@ -290,7 +286,7 @@ public class FileProvider {
|
|||
* if not found: wrapped as a JarFileModule or a NestedJarFileModule
|
||||
* @throws IOException
|
||||
*/
|
||||
public static Module getJarFileFromClassLoader(String fileName, ClassLoader loader) throws IOException {
|
||||
public Module getJarFileFromClassLoader(String fileName, ClassLoader loader) throws IOException {
|
||||
if (fileName == null) {
|
||||
throw new IllegalArgumentException("null fileName");
|
||||
}
|
||||
|
@ -334,7 +330,7 @@ public class FileProvider {
|
|||
* @throws IllegalArgumentException
|
||||
* if url is null
|
||||
*/
|
||||
public static String filePathFromURL(URL url) {
|
||||
public String filePathFromURL(URL url) {
|
||||
if (url == null) {
|
||||
throw new IllegalArgumentException("url is null");
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ public class SWTCallGraph {
|
|||
String exclusionFile = p.getProperty("exclusions");
|
||||
|
||||
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar, exclusionFile != null ? new File(exclusionFile)
|
||||
: FileProvider.getFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
|
||||
: (new FileProvider()).getFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
|
||||
|
||||
ClassHierarchy cha = ClassHierarchy.make(scope);
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ public class SWTPointsTo {
|
|||
}
|
||||
|
||||
public static Graph<Object> buildPointsTo(String appJar) throws WalaException, IllegalArgumentException, CancelException, IOException {
|
||||
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar, FileProvider.getFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
|
||||
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar, (new FileProvider()).getFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
|
||||
|
||||
|
||||
ClassHierarchy cha = ClassHierarchy.make(scope);
|
||||
|
|
|
@ -54,7 +54,7 @@ public class SWTTypeHierarchy {
|
|||
public static ApplicationWindow run(String classpath) {
|
||||
|
||||
try {
|
||||
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(classpath, FileProvider
|
||||
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(classpath, (new FileProvider())
|
||||
.getFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
|
||||
|
||||
// invoke WALA to build a class hierarchy
|
||||
|
|
|
@ -48,7 +48,7 @@ public class J2EEAnalysisScope extends AnalysisScope {
|
|||
* @param lifecycleEntrypoints Should EJB lifecycle entrypoints be considered as call graph entrypoints?
|
||||
*/
|
||||
public J2EEAnalysisScope(String baseScope, ClassLoader loader, boolean lifecycleEntrypoints) throws IOException {
|
||||
this(baseScope, loader, FileProvider.getFile(EXCLUSIONS_FILE), lifecycleEntrypoints);
|
||||
this(baseScope, loader, (new FileProvider()).getFile(EXCLUSIONS_FILE), lifecycleEntrypoints);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue