Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import liquidjava.specification.Refinement;

@SuppressWarnings("unused")
public class SimpleTest {
public class CorrectSimple {
public static void main(String[] args) {
// Arithmetic Binary Operations
@Refinement("a >= 10")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
import liquidjava.specification.ExternalRefinementsFor;

@ExternalRefinementsFor("non.existent.Class")
public interface ErrorExtRefNonExistentClass {
public interface WarningExtRefNonExistentClass {
public void NonExistentClass();
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import liquidjava.specification.StateRefinement;

@ExternalRefinementsFor("java.util.ArrayList")
public interface ErrorExtRefNonExistentMethod<E> {
public interface WarningExtRefNonExistentMethod<E> {

@RefinementPredicate("int size(ArrayList l)")
@StateRefinement(to = "size(this) == 0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import liquidjava.specification.StateRefinement;

@ExternalRefinementsFor("java.util.ArrayList")
public interface ErrorExtRefWrongConstructor<E> {
public interface WarningExtRefWrongConstructor<E> {

@RefinementPredicate("int size(ArrayList l)")
@StateRefinement(to = "size(this) == 0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import liquidjava.specification.StateRefinement;

@ExternalRefinementsFor("java.util.ArrayList")
public interface ErrorExtRefWrongParameterType<E> {
public interface WarningExtRefWrongParameterType<E> {

@RefinementPredicate("int size(ArrayList l)")
@StateRefinement(to = "size(this) == 0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import liquidjava.specification.StateRefinement;

@ExternalRefinementsFor("java.util.ArrayList")
public interface ErrorExtRefWrongRetType<E> {
public interface WarningExtRefWrongRetType<E> {

@RefinementPredicate("int size(ArrayList l)")
@StateRefinement(to = "size(this) == 0")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package liquidjava.api;

import static liquidjava.diagnostics.LJDiagnostics.diagnostics;

import java.io.File;
import java.util.Arrays;
import java.util.List;

import liquidjava.diagnostics.ErrorEmitter;
import liquidjava.diagnostics.errors.CustomError;
import liquidjava.processor.RefinementProcessor;
import spoon.Launcher;
import spoon.processing.ProcessingManager;
Expand All @@ -14,51 +16,44 @@

public class CommandLineLauncher {
public static void main(String[] args) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add these examples in the javadoc of the method

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I don't think those comments are accurate, the path liquidjava-example/src/main/java/ works fine on VS Code.

// String allPath = "C://Regen/test-projects/src/Main.java";
// In eclipse only needed this:"../liquidjava-example/src/main/java/"
// In VSCode needs:
// "../liquidjava/liquidjava-umbrella/liquidjava-example/src/main/java/liquidjava/test/project";

if (args.length == 0) {
System.out.println("No input files or directories provided");
System.out.println("No input paths provided");
System.out.println("\nUsage: ./liquidjava <...paths>");
System.out.println(" <...paths>: Paths to files or directories to be verified by LiquidJava");
System.out.println(" <...paths>: Paths to be verified by LiquidJava");
System.out.println(
"\nExample: ./liquidjava liquidjava-example/src/main/java/test/currentlyTesting liquidjava-example/src/main/java/testingInProgress/Account.java");
"\nExample: ./liquidjava liquidjava-example/src/main/java/test liquidjava-example/src/main/java/testingInProgress/Account.java");
return;
}
List<String> paths = Arrays.asList(args);
ErrorEmitter ee = launch(paths.toArray(new String[0]));
System.out.println(ee.foundError() ? (ee.getFullMessage()) : ("Correct! Passed Verification."));
launch(paths.toArray(new String[0]));
if (diagnostics.foundError()) {
System.out.println(diagnostics.getErrorOutput());
} else {
System.out.println(diagnostics.getWarningOutput());
System.out.println("Correct! Passed Verification.");
}
}

public static ErrorEmitter launch(String... paths) {
public static void launch(String... paths) {
System.out.println("Running LiquidJava on: " + Arrays.toString(paths).replaceAll("[\\[\\]]", ""));

ErrorEmitter ee = new ErrorEmitter();
Launcher launcher = new Launcher();
for (String path : paths) {
if (!new File(path).exists()) {
ee.addError("Path not found", "The path " + path + " does not exist", 1);
return ee;
diagnostics.add(new CustomError("The path " + path + " was not found"));
return;
}
launcher.addInputResource(path);
}
launcher.getEnvironment().setNoClasspath(true);

// Get the current classpath from the system
// String classpath = System.getProperty("java.class.path");
// launcher.getEnvironment().setSourceClasspath(classpath.split(File.pathSeparator));

// optional
// launcher.getEnvironment().setSourceClasspath(
// "lib1.jar:lib2.jar".split(":"));
launcher.getEnvironment().setNoClasspath(true);
launcher.getEnvironment().setComplianceLevel(8);
launcher.run();
diagnostics.clear();

final Factory factory = launcher.getFactory();
final ProcessingManager processingManager = new QueueProcessingManager(factory);
final RefinementProcessor processor = new RefinementProcessor(factory, ee);
final RefinementProcessor processor = new RefinementProcessor(factory);
processingManager.addProcessor(processor);

try {
Expand All @@ -71,6 +66,6 @@ public static ErrorEmitter launch(String... paths) {
throw e;
}

return ee;
return;
}
}

This file was deleted.

Loading