All Downloads are FREE. Search and download functionalities are using the official Maven repository.

src.samples.java.ex.AWCBR_Sample Maven / Gradle / Ivy

Go to download

An auxiliary findbugs.sourceforge.net plugin for java bug detectors that fall outside the narrow scope of detectors to be packaged with the product itself.

There is a newer version: 7.6.8
Show newest version
package ex;
import java.lang.reflect.Method;
import java.util.HashSet;
import java.util.Set;

public class AWCBR_Sample {
    public void m(int[] v) {
        v[0]++;
    }

    public int testuninitedalloc(int i) {
        int[] data = new int[1];
        data[0] = i;
        m(data);
        i = data[0];
        return i;
    }

    public int testinitedalloc(int i) {
        int[] data = new int[] { i };
        m(data);
        i = data[0];
        return i;
    }

    public int testNoCall(int i) {
        // while silly don't report this, as there is no arg usage
        int[] data = new int[] { i };
        i = data[0];
        return i;
    }
    
    public boolean testFPInvoke(Method m) throws Exception {
        
        Set s = new HashSet();
        Object[] args = new Object[] { s };
        m.invoke(this, args);
        
        s = (Set) args[0];
        
        return s.isEmpty();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy