pascal-lab / Tai-e-assignments

Tai-e assignments for static program analysis
https://tai-e.pascal-lab.net/
GNU Lesser General Public License v3.0
1.01k stars 234 forks source link

About A4 test cases #9

Closed FantasqueX closed 1 year ago

FantasqueX commented 1 year ago

Hi! Can anyone provide more tips about test cases of A2.

Your submission correctly analyzes 84 out of 85 call sites in test cases for CHA,
and 1065 out of 1065 Stmts in test cases for interprocedural constant propagation.

It seems that I do something wrong on CHA, however, I have no idea where I make mistakes. Any suggestion is welcome. Thanks in advance. :)

FantasqueX commented 1 year ago

I have figured out the problem. The declaring class of an interface method may be a normal class. A simple reproduction example is list below.

interface Number {
    int get();
}

public class MyTest {

    public static void main(String[] args) {
        Number n = new One();
        n.get();
    }
}

class Zero implements Number {

    public int get() {
        return 0;
    }
}

class One implements Number {

    public int get() {
        return 1;
    }
}

class Two implements Number {

    public int get() {
        return 2;
    }
}

class Three extends Two {
    @Override
    public int get() {
        return 3;
    }
}