pascal-lab/Tai-e-assignments

About A4 test cases

Closed this issue · 1 comments

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. :)

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;
    }
}