Skip to content

Commit be8866a

Browse files
committed
Passing tests
1 parent 352f10e commit be8866a

File tree

5 files changed

+22
-25
lines changed

5 files changed

+22
-25
lines changed

liquidjava-verifier/pom.xml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,6 @@
7474
<groupId>org.apache.maven.plugins</groupId>
7575
<artifactId>maven-surefire-plugin</artifactId>
7676
<version>${pVersion.surefire}</version>
77-
<configuration>
78-
<!-- the following is required to have the same execution semantics
79-
as eclipse (hence all tests passing) -->
80-
<useSystemClassLoader>false</useSystemClassLoader>
81-
<forkCount>1</forkCount>
82-
<argLine>-Dgumtree.match.gt.minh=1</argLine>
83-
<!-- we put the tests in src/main/java so that it's easier to navigate
84-
and understand on Github (recall that's an example code project, not a production
85-
app or library ) -->
86-
<testSourceDirectory>${basedir}/test/main/java/</testSourceDirectory>
87-
<testClassesDirectory>${project.build.directory}/classes/</testClassesDirectory>
88-
</configuration>
8977
</plugin>
9078

9179
<plugin>

liquidjava-verifier/src/main/java/liquidjava/api/CommandLineLauncher.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,17 @@ public static ErrorEmitter launch(String file) {
6060
processingManager.addProcessor(processor);
6161

6262
System.out.println("before process");
63-
64-
// To only search the last package - less time spent
65-
CtPackage v = factory.Package().getAll().stream().reduce((first, second) -> second).orElse(null);
66-
if (v != null)
67-
processingManager.process(v);
68-
// To search all previous packages
69-
// processingManager.process(factory.Package().getRootPackage());
63+
try {
64+
// To only search the last package - less time spent
65+
CtPackage v = factory.Package().getAll().stream().reduce((first, second) -> second).orElse(null);
66+
if (v != null)
67+
processingManager.process(v);
68+
// To search all previous packages
69+
// processingManager.process(factory.Package().getRootPackage());
70+
} catch (Exception e) {
71+
e.printStackTrace();
72+
throw e;
73+
}
7074

7175
return ee;
7276
}

liquidjava-verifier/src/main/java/liquidjava/errors/ErrorHandler.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ public static <T> void printError(CtElement var, Predicate expectedType, Predica
2727

2828
public static <T> void printError(CtElement var, String moreInfo, Predicate expectedType, Predicate cSMT,
2929
HashMap<String, PlacementInCode> map, ErrorEmitter errorl) {
30-
3130
String resumeMessage = "Type expected:" + expectedType.toString(); // + "; " +"Refinement found:" +
3231
// cSMT.toString();
3332

liquidjava-verifier/src/main/java/liquidjava/processor/refinement_checker/general_checkers/MethodsFunctionsChecker.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import spoon.reflect.declaration.CtMethod;
3434
import spoon.reflect.declaration.CtParameter;
3535
import spoon.reflect.reference.CtExecutableReference;
36+
import spoon.reflect.reference.CtTypeReference;
3637

3738
public class MethodsFunctionsChecker {
3839

@@ -254,12 +255,13 @@ public RefinedFunction getRefinementFunction(String methodName, String className
254255
}
255256

256257
private void searchMethodInLibrary(CtExecutableReference<?> ctr, CtInvocation<?> invocation) {
257-
String ctype = "";
258-
if (ctr.getDeclaringType() == null && invocation.getTarget() != null) {
258+
CtTypeReference<?> ctref = ctr.getDeclaringType();
259+
if (ctref == null) {
260+
// Plan B: get us get the definition from the invocation.
259261
CtExpression<?> o = invocation.getTarget();
260-
ctype = o.getType().toString();
261-
} else
262-
ctype = ctr.getDeclaringType().toString(); // missing
262+
ctref = o.getType();
263+
}
264+
String ctype = (ctref != null) ? ctref.toString() : null;
263265

264266
String name = ctr.getSimpleName(); // missing
265267
if (rtc.getContext().getFunction(name, ctype) != null) { // inside rtc.context

liquidjava-verifier/src/test/java/liquidjava/api/tests/TestExamples.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@
66
import java.nio.file.Files;
77
import java.nio.file.Paths;
88

9+
import org.junit.Test;
10+
911
import liquidjava.api.CommandLineLauncher;
1012
import liquidjava.errors.ErrorEmitter;
1113

1214
public class TestExamples {
15+
16+
@Test
1317
public void testFile() {
1418
try {
1519
Files.find(Paths.get("../liquidjava-example/src/main/java/"), Integer.MAX_VALUE,

0 commit comments

Comments
 (0)