pietrobraione / jbse

A symbolic Java virtual machine for program analysis, verification and test generation
http://pietrobraione.github.io/jbse/
GNU General Public License v3.0
101 stars 29 forks source link

jbse seems to have problems dealing with abstract methods #40

Closed y553546436 closed 3 years ago

y553546436 commented 3 years ago

I encounter a problem running jbse today. I find where the problem is, and prepare a simple example to show the bug. The code below runs fine on regular JVM, but when run on jbse, it raised an AbstractMethodError. I guess the jbse does not properly handle abstract class or something. Just run the method main in SubBug class on jbse, and you can see the result.


import java.util.Arrays;
import java.util.List;
abstract class Bug {                                                                                                                   
    List<String> l = new ArrayList<>();                                                              
    Bug(List<String> a) {                                                                                                    
        l.addAll(a);                                                                                                                   
    }                                                                                                                                  
}                                                                                                                                      
class SubBug extends Bug {                                                                                                             
    static String s = "foobar";                                                                                           
    SubBug() {                                                                                                                         
        super(Arrays.asList(s));                                                                                             
    }                                                                                                                                  
    static void main() {                                                                                                        
        new SubBug();                                                                                                                  
    }                                                                                                                                  
}
pietrobraione commented 3 years ago

I tried the example with the current master version of JBSE, and I did not obtain the reported error: The example runs just fine, and builds a SubBug object with an ArrayList l member containing the "foobar" String as expected.