mistupv / JavaSlicer

A program slicer for Java, based on the system dependence graph (SDG).
https://mist.dsic.upv.es/JavaSlicer/demo/
GNU Affero General Public License v3.0
52 stars 18 forks source link

Usage of option '-i', '--includes' #44

Closed miguelvelezmj25 closed 3 years ago

miguelvelezmj25 commented 3 years ago

I cannot figure out how to use the -i option to include additional directories. This is my folder structure

./
|___Exampe.java
|___Hello.java

Example.java

public class Example {
    public static void main(String[] args) {
        int number = Hello.number();
        int prod = 0;
        int i;
        int n = 10;
        for (i = 0; i < 10; i++) {
            sum += 1;
            prod += n;
        }
        System.out.println(sum);
        System.out.println(prod);
    }
}

Hello.java

public class Example {
    public static int number() {
        return 25;
    }
}

If I run

java -jar sdg-cli/target/sdg-cli-1.2.5-jar-with-dependencies.jar -c Example.java#11:sum -i ./ -t SDG

I get the following error message

Error parsing the arguments!
. (Is a directory)

I have also tried passing the absolute path, but I also get the (Is a directory) error message. Am I using the option incorrectly?

Thanks!

cargaji commented 3 years ago

Am I using the option incorrectly?

No, -i is intended to add directories, such that the given directory is the root package. I'll investigate this bug, as your usage seems correct.

miguelvelezmj25 commented 3 years ago

Thank you very much!