Merge branch 'master' of https://github.com/wala/WALA
This commit is contained in:
commit
5b23010116
|
@ -76,7 +76,7 @@ org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
|||
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
|
||||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
|
||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
|
||||
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=error
|
||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
|
||||
|
|
|
@ -20,14 +20,8 @@
|
|||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
</natures>
|
||||
|
|
|
@ -76,7 +76,7 @@ org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
|||
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
|
||||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
|
||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
|
||||
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
|
||||
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=error
|
||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=error
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
|
||||
|
|
|
@ -11,4 +11,3 @@ javacProjectSettings = true
|
|||
bin.excludes = dat/core-modules/.eslintrc,\
|
||||
dat/core-modules/.gitignore,\
|
||||
dat/core-modules/.gitkeep
|
||||
javacDefaultEncoding.. = UTF-8
|
||||
|
|
|
@ -69,9 +69,8 @@ public class NodejsRequiredSourceModule extends SourceFileModule {
|
|||
|
||||
@Override
|
||||
public InputStream getInputStream() {
|
||||
InputStream inputStream = super.getInputStream();
|
||||
String moduleSource = null;
|
||||
try {
|
||||
try (final InputStream inputStream = super.getInputStream()) {
|
||||
moduleSource = IOUtils.toString(inputStream);
|
||||
} catch (IOException e) {
|
||||
Assertions.UNREACHABLE(e.getMessage());
|
||||
|
@ -117,8 +116,9 @@ public class NodejsRequiredSourceModule extends SourceFileModule {
|
|||
}
|
||||
|
||||
private static String loadWrapperSource(String filename) throws IOException {
|
||||
InputStream url = NodejsRequiredSourceModule.class.getClassLoader().getResourceAsStream(filename);
|
||||
return new String(Streams.inputStream2ByteArray(url));
|
||||
try (final InputStream url = NodejsRequiredSourceModule.class.getClassLoader().getResourceAsStream(filename)) {
|
||||
return new String(Streams.inputStream2ByteArray(url));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -87,7 +87,7 @@ org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
|||
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=error
|
||||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
|
||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
|
||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=error
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
|
||||
|
@ -104,7 +104,7 @@ org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
|
|||
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
|
||||
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
|
||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=error
|
||||
|
|
|
@ -36,6 +36,8 @@ public class JavaPrimitiveType extends PrimitiveType {
|
|||
|
||||
public static final PrimitiveType DOUBLE = makePrimitive(TypeReference.Double, 64);
|
||||
|
||||
public static final PrimitiveType VOID = makePrimitive(TypeReference.Void, 0);
|
||||
|
||||
public static void init() {
|
||||
|
||||
}
|
||||
|
|
|
@ -57,8 +57,7 @@ public abstract class AbstractNestedJarFileModule implements Module {
|
|||
return;
|
||||
}
|
||||
cache = HashMapFactory.make();
|
||||
try {
|
||||
final JarInputStream stream = new JarInputStream(getNestedContents(), false);
|
||||
try (final JarInputStream stream = new JarInputStream(getNestedContents(), false)) {
|
||||
for (ZipEntry z = stream.getNextEntry(); z != null; z = stream.getNextEntry()) {
|
||||
final String name = z.getName();
|
||||
if (DEBUG) {
|
||||
|
|
|
@ -316,8 +316,7 @@ public class ClassLoaderImpl implements IClassLoader {
|
|||
return null;
|
||||
}
|
||||
Map<String, Object> result = HashMapFactory.make();
|
||||
try {
|
||||
JarInputStream s = new JarInputStream(new ByteArrayInputStream(jarFileContents), false);
|
||||
try (final JarInputStream s = new JarInputStream(new ByteArrayInputStream(jarFileContents), false)) {
|
||||
JarEntry entry = null;
|
||||
while ((entry = s.getNextJarEntry()) != null) {
|
||||
byte[] entryBytes = getEntryBytes(entrySizesForFile.get(entry.getName()), s);
|
||||
|
|
|
@ -392,11 +392,10 @@ public class AnalysisScope {
|
|||
}
|
||||
|
||||
public String getJavaLibraryVersion() throws IllegalStateException {
|
||||
JarFile rtJar = getRtJar();
|
||||
if (rtJar == null) {
|
||||
throw new IllegalStateException("cannot find runtime libraries");
|
||||
}
|
||||
try {
|
||||
try (final JarFile rtJar = getRtJar()) {
|
||||
if (rtJar == null) {
|
||||
throw new IllegalStateException("cannot find runtime libraries");
|
||||
}
|
||||
Manifest man = rtJar.getManifest();
|
||||
assert man != null : "runtime library has no manifest!";
|
||||
String result = man.getMainAttributes().getValue("Specification-Version");
|
||||
|
|
|
@ -13,6 +13,7 @@ package com.ibm.wala.ipa.callgraph.impl;
|
|||
import java.io.BufferedInputStream;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
@ -104,10 +105,13 @@ public class Util {
|
|||
throw new IllegalArgumentException("cha cannot be null");
|
||||
}
|
||||
|
||||
InputStream s = cl.getResourceAsStream(xmlFile);
|
||||
XMLMethodSummaryReader summary = new XMLMethodSummaryReader(s, scope);
|
||||
|
||||
addBypassLogic(options, scope, cl, summary, cha);
|
||||
try (final InputStream s = cl.getResourceAsStream(xmlFile)) {
|
||||
XMLMethodSummaryReader summary = new XMLMethodSummaryReader(s, scope);
|
||||
addBypassLogic(options, scope, cl, summary, cha);
|
||||
} catch (IOException e) {
|
||||
System.err.println("Could not close XML method summary reader: " + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void addBypassLogic(AnalysisOptions options, AnalysisScope scope, ClassLoader cl, XMLMethodSummaryReader summary,
|
||||
|
@ -543,13 +547,15 @@ public class Util {
|
|||
addBypassLogic(options, scope, cl, nativeSpec, cha);
|
||||
} else {
|
||||
// try to load from filesystem
|
||||
try {
|
||||
BufferedInputStream bIn = new BufferedInputStream(new FileInputStream(nativeSpec));
|
||||
try (final BufferedInputStream bIn = new BufferedInputStream(new FileInputStream(nativeSpec))) {
|
||||
XMLMethodSummaryReader reader = new XMLMethodSummaryReader(bIn, scope);
|
||||
addBypassLogic(options, scope, cl, reader, cha);
|
||||
} catch (FileNotFoundException e) {
|
||||
System.err.println("Could not load natives xml file from: " + nativeSpec);
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
System.err.println("Could not close natives xml file " + nativeSpec);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -134,28 +134,29 @@ public final class WalaProperties {
|
|||
if (fileName == null) {
|
||||
throw new IllegalArgumentException("null fileName");
|
||||
}
|
||||
final InputStream propertyStream = loader.getResourceAsStream(fileName);
|
||||
if (propertyStream == null) {
|
||||
// create default properties
|
||||
Properties defprop = new Properties();
|
||||
defprop.setProperty(OUTPUT_DIR, "./out");
|
||||
defprop.setProperty(INPUT_DIR, "./in");
|
||||
defprop.setProperty(ECLIPSE_PLUGINS_DIR, "./plugins");
|
||||
defprop.setProperty(WALA_REPORT, "./wala_report.txt");
|
||||
defprop.setProperty(J2EE_DIR, "./j2ee");
|
||||
final String j2selib = guessJavaLib();
|
||||
defprop.setProperty(J2SE_DIR, j2selib);
|
||||
|
||||
return defprop;
|
||||
try (final InputStream propertyStream = loader.getResourceAsStream(fileName)) {
|
||||
if (propertyStream == null) {
|
||||
// create default properties
|
||||
Properties defprop = new Properties();
|
||||
defprop.setProperty(OUTPUT_DIR, "./out");
|
||||
defprop.setProperty(INPUT_DIR, "./in");
|
||||
defprop.setProperty(ECLIPSE_PLUGINS_DIR, "./plugins");
|
||||
defprop.setProperty(WALA_REPORT, "./wala_report.txt");
|
||||
defprop.setProperty(J2EE_DIR, "./j2ee");
|
||||
final String j2selib = guessJavaLib();
|
||||
defprop.setProperty(J2SE_DIR, j2selib);
|
||||
|
||||
return defprop;
|
||||
}
|
||||
Properties result = new Properties();
|
||||
result.load(propertyStream);
|
||||
|
||||
if (!result.containsKey(J2SE_DIR)) {
|
||||
final String j2selib = guessJavaLib();
|
||||
result.setProperty(J2SE_DIR, j2selib);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
Properties result = new Properties();
|
||||
result.load(propertyStream);
|
||||
|
||||
if (!result.containsKey(J2SE_DIR)) {
|
||||
final String j2selib = guessJavaLib();
|
||||
result.setProperty(J2SE_DIR, j2selib);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String guessJavaLib() throws IOException {
|
||||
|
|
|
@ -81,8 +81,9 @@ public class AnalysisScopeReader {
|
|||
}
|
||||
|
||||
if (exclusionsFile != null) {
|
||||
InputStream fs = exclusionsFile.exists()? new FileInputStream(exclusionsFile): FileProvider.class.getClassLoader().getResourceAsStream(exclusionsFile.getName());
|
||||
scope.setExclusions(new FileOfClasses(fs));
|
||||
try (InputStream fs = exclusionsFile.exists()? new FileInputStream(exclusionsFile): FileProvider.class.getClassLoader().getResourceAsStream(exclusionsFile.getName())) {
|
||||
scope.setExclusions(new FileOfClasses(fs));
|
||||
}
|
||||
}
|
||||
|
||||
} finally {
|
||||
|
@ -113,11 +114,11 @@ public class AnalysisScopeReader {
|
|||
}
|
||||
|
||||
if (exclusionsFile != null) {
|
||||
final InputStream fs = exclusionsFile.exists()
|
||||
try (final InputStream fs = exclusionsFile.exists()
|
||||
? new FileInputStream(exclusionsFile)
|
||||
: FileProvider.class.getClassLoader().getResourceAsStream(exclusionsFile.getName());
|
||||
|
||||
scope.setExclusions(new FileOfClasses(fs));
|
||||
: FileProvider.class.getClassLoader().getResourceAsStream(exclusionsFile.getName())) {
|
||||
scope.setExclusions(new FileOfClasses(fs));
|
||||
}
|
||||
}
|
||||
|
||||
} finally {
|
||||
|
|
|
@ -93,7 +93,7 @@ org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
|
|||
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
|
||||
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error
|
||||
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
|
||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=error
|
||||
|
|
|
@ -100,11 +100,12 @@ public class SWTCallGraph {
|
|||
ClassHierarchy cha = ClassHierarchyFactory.make(scope);
|
||||
|
||||
Iterable<Entrypoint> entrypoints = null;
|
||||
JarFile jar = new JarFile(appJar);
|
||||
if (jar.getManifest() != null) {
|
||||
String mainClass = jar.getManifest().getMainAttributes().getValue("Main-Class");
|
||||
if (mainClass != null) {
|
||||
entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, "L" + mainClass.replace('.', '/'));
|
||||
try (final JarFile jar = new JarFile(appJar)) {
|
||||
if (jar.getManifest() != null) {
|
||||
String mainClass = jar.getManifest().getMainAttributes().getValue("Main-Class");
|
||||
if (mainClass != null) {
|
||||
entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, "L" + mainClass.replace('.', '/'));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (entrypoints == null) {
|
||||
|
|
|
@ -86,7 +86,7 @@ org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
|||
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=error
|
||||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
|
||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
|
||||
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=error
|
||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=error
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=error
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
|
||||
|
|
|
@ -76,7 +76,7 @@ org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
|||
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=error
|
||||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
|
||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
|
||||
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=error
|
||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=error
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
|
||||
|
|
Loading…
Reference in New Issue