more reflection tests
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2726 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
parent
1ea215abbe
commit
bf8e4d8b58
|
@ -438,4 +438,69 @@ public class ReflectionTest extends WalaTestCase {
|
|||
nodes = cg.getNodes(mr);
|
||||
assertFalse(nodes.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that when analyzing Reflect16, the call graph includes a node for java.lang.Integer.toString()
|
||||
*/
|
||||
public void testReflect16() throws WalaException, IllegalArgumentException, CancelException, IOException {
|
||||
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, "Java60RegressionExclusions.txt");
|
||||
ClassHierarchy cha = ClassHierarchy.make(scope);
|
||||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
|
||||
TestConstants.REFLECT16_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
TypeReference tr = TypeReference.findOrCreate(ClassLoaderReference.Primordial, "Ljava/lang/Integer");
|
||||
MethodReference mr = MethodReference.findOrCreate(tr, "toString", "()Ljava/lang/String;");
|
||||
Set<CGNode> nodes = cg.getNodes(mr);
|
||||
assertFalse(nodes.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that when analyzing Reflect17, the call graph does not include a node for java.lang.Integer.toString()
|
||||
*/
|
||||
public void testReflect17() throws WalaException, IllegalArgumentException, CancelException, IOException {
|
||||
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, "Java60RegressionExclusions.txt");
|
||||
ClassHierarchy cha = ClassHierarchy.make(scope);
|
||||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
|
||||
TestConstants.REFLECT17_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
TypeReference tr = TypeReference.findOrCreate(ClassLoaderReference.Primordial, "Ljava/lang/Integer");
|
||||
MethodReference mr = MethodReference.findOrCreate(tr, "toString", "()Ljava/lang/String;");
|
||||
Set<CGNode> nodes = cg.getNodes(mr);
|
||||
assertTrue(nodes.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that when analyzing Reflect18, the call graph includes a node for java.lang.Integer.toString()
|
||||
*/
|
||||
public void testReflect18() throws WalaException, IllegalArgumentException, CancelException, IOException {
|
||||
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, "Java60RegressionExclusions.txt");
|
||||
ClassHierarchy cha = ClassHierarchy.make(scope);
|
||||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
|
||||
TestConstants.REFLECT18_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
TypeReference tr = TypeReference.findOrCreate(ClassLoaderReference.Primordial, "Ljava/lang/Integer");
|
||||
MethodReference mr = MethodReference.findOrCreate(tr, "toString", "()Ljava/lang/String;");
|
||||
Set<CGNode> nodes = cg.getNodes(mr);
|
||||
assertFalse(nodes.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that when analyzing Reflect19, the call graph includes a node for java.lang.Integer.toString()
|
||||
*/
|
||||
public void testReflect19() throws WalaException, IllegalArgumentException, CancelException, IOException {
|
||||
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, "Java60RegressionExclusions.txt");
|
||||
ClassHierarchy cha = ClassHierarchy.make(scope);
|
||||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
|
||||
TestConstants.REFLECT19_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
System.err.println(cg);
|
||||
TypeReference tr = TypeReference.findOrCreate(ClassLoaderReference.Primordial, "Ljava/lang/Integer");
|
||||
MethodReference mr = MethodReference.findOrCreate(tr, "toString", "()Ljava/lang/String;");
|
||||
Set<CGNode> nodes = cg.getNodes(mr);
|
||||
assertFalse(nodes.isEmpty());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public interface TestConstants {
|
|||
public final static String MULTI_DIM_MAIN = "LmultiDim/TestMultiDim";
|
||||
|
||||
public final static String ARRAY_ALIAS_MAIN = "LarrayAlias/TestArrayAlias";
|
||||
|
||||
|
||||
public final static String REFLECT1_MAIN = "Lreflection/Reflect1";
|
||||
|
||||
public final static String REFLECT2_MAIN = "Lreflection/Reflect2";
|
||||
|
@ -59,17 +59,25 @@ public interface TestConstants {
|
|||
public final static String REFLECT9_MAIN = "Lreflection/Reflect9";
|
||||
|
||||
public final static String REFLECT10_MAIN = "Lreflection/Reflect10";
|
||||
|
||||
|
||||
public final static String REFLECT11_MAIN = "Lreflection/Reflect11";
|
||||
|
||||
|
||||
public final static String REFLECT12_MAIN = "Lreflection/Reflect12";
|
||||
|
||||
|
||||
public final static String REFLECT13_MAIN = "Lreflection/Reflect13";
|
||||
|
||||
|
||||
public final static String REFLECT14_MAIN = "Lreflection/Reflect14";
|
||||
|
||||
|
||||
public final static String REFLECT15_MAIN = "Lreflection/Reflect15";
|
||||
|
||||
public final static String REFLECT16_MAIN = "Lreflection/Reflect16";
|
||||
|
||||
public final static String REFLECT17_MAIN = "Lreflection/Reflect17";
|
||||
|
||||
public final static String REFLECT18_MAIN = "Lreflection/Reflect18";
|
||||
|
||||
public final static String REFLECT19_MAIN = "Lreflection/Reflect19";
|
||||
|
||||
public final static String SLICE1_MAIN = "Lslice/Slice1";
|
||||
|
||||
public final static String SLICE2_MAIN = "Lslice/Slice2";
|
||||
|
|
Loading…
Reference in New Issue