Skip to content

Commit

Permalink
enable tests for java onepointfive
Browse files Browse the repository at this point in the history
  • Loading branch information
jkhaliqi committed Jan 29, 2025
1 parent de5b4f3 commit 35ea1b2
Show file tree
Hide file tree
Showing 3 changed files with 283 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,278 @@
package com.ibm.wala.cast.java.test;

import com.ibm.wala.cast.java.client.ECJJavaSourceAnalysisEngine;
import com.ibm.wala.cast.java.client.JavaSourceAnalysisEngine;
import com.ibm.wala.cast.java.ipa.callgraph.JavaSourceAnalysisScope;
import com.ibm.wala.client.AbstractAnalysisEngine;
import com.ibm.wala.core.tests.callGraph.CallGraphTestUtil;
import com.ibm.wala.ipa.callgraph.CallGraphBuilder;
import com.ibm.wala.ipa.callgraph.Entrypoint;
import com.ibm.wala.ipa.callgraph.impl.Util;
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.util.CancelException;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import org.junit.jupiter.api.Test;

public class ECJJava15IRTest extends IRTests {

public ECJJava15IRTest() {
super(null);
dump = true;
}

@Override
protected AbstractAnalysisEngine<InstanceKey, CallGraphBuilder<InstanceKey>, ?> getAnalysisEngine(
final String[] mainClassDescriptors, Collection<String> sources, List<String> libs) {
JavaSourceAnalysisEngine engine =
new ECJJavaSourceAnalysisEngine() {
@Override
protected Iterable<Entrypoint> makeDefaultEntrypoints(IClassHierarchy cha) {
return Util.makeMainEntrypoints(
JavaSourceAnalysisScope.SOURCE, cha, mainClassDescriptors);
}
};
engine.setExclusionsFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS);
populateScope(engine, sources, libs);
return engine;
}

@Test
public void testVarargsOverriding()
throws IllegalArgumentException, CancelException, IOException {
runTest(
singlePkgTestSrc("javaonepointfive"),
rtJar,
simplePkgTestEntryPoint("javaonepointfive"),
emptyList,
true,
null);
}

@Test
public void testEnumSwitch()
throws IllegalArgumentException, CancelException, IOException {
runTest(
singlePkgTestSrc("javaonepointfive"),
rtJar,
simplePkgTestEntryPoint("javaonepointfive"),
emptyList,
true,
null);
}

@Test
public void testOverridesOnePointFour()
throws IllegalArgumentException, CancelException, IOException {
runTest(
singlePkgTestSrc("javaonepointfive"),
rtJar,
simplePkgTestEntryPoint("javaonepointfive"),
emptyList,
true,
null);
}

@Test
public void testVarargsCovariant()
throws IllegalArgumentException, CancelException, IOException {
runTest(
singlePkgTestSrc("javaonepointfive"),
rtJar,
simplePkgTestEntryPoint("javaonepointfive"),
emptyList,
true,
null);
}

@Test
public void testSimpleEnums()
throws IllegalArgumentException, CancelException, IOException {
runTest(
singlePkgTestSrc("javaonepointfive"),
rtJar,
simplePkgTestEntryPoint("javaonepointfive"),
emptyList,
true,
null);
}

@Test
public void testGenericSuperSink()
throws IllegalArgumentException, CancelException, IOException {
runTest(
singlePkgTestSrc("javaonepointfive"),
rtJar,
simplePkgTestEntryPoint("javaonepointfive"),
emptyList,
true,
null);
}

@Test
public void testAnonGeneNullarySimple() throws IllegalArgumentException, CancelException, IOException {
runTest(
singlePkgTestSrc("javaonepointfive"),
rtJar,
simplePkgTestEntryPoint("javaonepointfive"),
emptyList,
true,
null);
}

@Test
public void testAnonymousGenerics() throws IllegalArgumentException, CancelException, IOException {
runTest(
singlePkgTestSrc("javaonepointfive"),
rtJar,
simplePkgTestEntryPoint("javaonepointfive"),
emptyList,
true,
null);
}

@Test
public void testNotSoSimpleEnums() throws IllegalArgumentException, CancelException, IOException {
runTest(
singlePkgTestSrc("javaonepointfive"),
rtJar,
simplePkgTestEntryPoint("javaonepointfive"),
emptyList,
true,
null);
}

@Test
public void testVarargs() throws IllegalArgumentException, CancelException, IOException {
runTest(
singlePkgTestSrc("javaonepointfive"),
rtJar,
simplePkgTestEntryPoint("javaonepointfive"),
emptyList,
true,
null);
}

@Test
public void testGenericArrays() throws IllegalArgumentException, CancelException, IOException {
runTest(
singlePkgTestSrc("javaonepointfive"),
rtJar,
simplePkgTestEntryPoint("javaonepointfive"),
emptyList,
true,
null);
}

@Test
public void testAnnotations() throws IllegalArgumentException, CancelException, IOException {
runTest(
singlePkgTestSrc("javaonepointfive"),
rtJar,
simplePkgTestEntryPoint("javaonepointfive"),
emptyList,
true,
null);
}

@Test
public void testCocovariant() throws IllegalArgumentException, CancelException, IOException {
runTest(
singlePkgTestSrc("javaonepointfive"),
rtJar,
simplePkgTestEntryPoint("javaonepointfive"),
emptyList,
true,
null);
}

@Test
public void testExplicitBoxingTest() throws IllegalArgumentException, CancelException, IOException {
runTest(
singlePkgTestSrc("javaonepointfive"),
rtJar,
simplePkgTestEntryPoint("javaonepointfive"),
emptyList,
true,
null);
}

@Test
public void testWildcards() throws IllegalArgumentException, CancelException, IOException {
runTest(
singlePkgTestSrc("javaonepointfive"),
rtJar,
simplePkgTestEntryPoint("javaonepointfive"),
emptyList,
true,
null);
}

@Test
public void testBasicsGenerics() throws IllegalArgumentException, CancelException, IOException {
runTest(
singlePkgTestSrc("javaonepointfive"),
rtJar,
simplePkgTestEntryPoint("javaonepointfive"),
emptyList,
true,
null);
}

@Test
public void testCustomGenericsAndFields() throws IllegalArgumentException, CancelException, IOException {
runTest(
singlePkgTestSrc("javaonepointfive"),
rtJar,
simplePkgTestEntryPoint("javaonepointfive"),
emptyList,
true,
null);
}

@Test
public void testTypeInferencePrimAndStringOp() throws IllegalArgumentException, CancelException, IOException {
runTest(
singlePkgTestSrc("javaonepointfive"),
rtJar,
simplePkgTestEntryPoint("javaonepointfive"),
emptyList,
true,
null);
}

@Test
public void testSimpleEnums2() throws IllegalArgumentException, CancelException, IOException {
runTest(
singlePkgTestSrc("javaonepointfive"),
rtJar,
simplePkgTestEntryPoint("javaonepointfive"),
emptyList,
true,
null);
}

@Test
public void testGenericMemberClasses() throws IllegalArgumentException, CancelException, IOException {
runTest(
singlePkgTestSrc("javaonepointfive"),
rtJar,
simplePkgTestEntryPoint("javaonepointfive"),
emptyList,
true,
null);
}

@Test
public void testMoreOverriddenGenerics() throws IllegalArgumentException, CancelException, IOException {
runTest(
singlePkgTestSrc("javaonepointfive"),
rtJar,
simplePkgTestEntryPoint("javaonepointfive"),
emptyList,
true,
null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ private void doit() {
System.out.println(x);
Direction y = Direction.myValues()[0];
System.out.println(y);
Direction.NORTH.hello();
}

// public static class Foo {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

public class TypeInferencePrimAndStringOp {
public static void main(String[] args) {
(new TypeInferencePrimAndStringOp()).doit();
}

private void doit() {
int a = 2;
String result = "a" + a;
}
Expand Down

0 comments on commit 35ea1b2

Please sign in to comment.