opprop / checker-framework-inference

Inference of pluggable types for Java
6 stars 13 forks source link

No VarAnnot insert if reserve class order #432

Open Ao-senXiong opened 9 months ago

Ao-senXiong commented 9 months ago

take the two examples and run with debug solver. For explanation, we just changed the order of class.

class List{
    Object[] elems;

    int a;
    List() {
        Object[] t = new Object[10];
        this.elems = t;
    }
}

class MyA {
    String f;
}
class MyA {
    String f;
}

class List{
    Object[] elems;
    int count;
    List() {
        Object[] t = new Object[10];
        this.elems = t;
    }
}
import checkers.inference.qual.VarAnnot;
@VarAnnot(9)
class List{
    @VarAnnot(5)
    Object @VarAnnot(4) [] elems;

    @VarAnnot(6)
    int a;
    List() {
        @VarAnnot(14)
        Object[] t = new @VarAnnot(12) Object @VarAnnot(11) [((@VarAnnot(10) int) (10))];
        this.elems = t;
    }
}

@VarAnnot(20)
class MyA {
    @VarAnnot(17)
    String f;
}
import checkers.inference.qual.VarAnnot;
@VarAnnot(7)
class MyA {
    @VarAnnot(4)
    String f;
}

@VarAnnot(13)
class List{
    @VarAnnot(9)
    Object @VarAnnot(8) [] elems;
    @VarAnnot(10)
    int count;
    List() {
        Object[] t = new Object[10];
        this.elems = t;
    }
}

With MyA appear ahead, there is no VarAnnot generation in for t but the other case has.