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

src.samples.java.ex.UCC_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.awt.Color;
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;

import javax.swing.JFrame;

public class UCC_Sample {
    private Object[] arrayData;
    private List listData = new ArrayList<>();
    private Bean1 b1;
    private Bean2 b2;

    public void test0() {
        TreeSet tm = new TreeSet<>();
        tm.add(new Date());
        tm.add(new Date());
    }

    public void test1() {
        arrayData = new Object[3];
        arrayData[0] = new Integer(1);
        arrayData[1] = new StringTokenizer("this");
        arrayData[2] = new JFrame();
        listData.add(new GregorianCalendar());

    }

    public void test2() {
        listData.add(new UCC_Sample() {
        });
    }

    public void test3() {
        Set s = new HashSet<>();
        s.add(new int[] { 3, 2 });
        s.add(new Color(0, 128, 255));
    }

    public void bug1678805() {
        final File[] files = new File[5];
        for (int i = 0; i < 5; i++) {
            files[i] = getPath();
        }
    }

    public void fpTwoDifferentFieldSources() {
        b1.data.add("Hello");
        b2.data.add(5);
    }

    public void fpTwoDifferentFieldSources2(Holder h) {
        for (int i = 0; i < 10; i++) {
            h.ic.ts.add(Integer.valueOf(i));
        }
        for (int i = 0; i < 10; i++) {
            h.lc.ts.add(Long.valueOf(i));
        }
    }

    private File getPath() {
        return new File("c:\\temp");
    }

    static class Bean1 {
        List data;
    }

    static class Bean2 {
        List data;
    }

    static class Holder {
        public Container ic;
        public Container lc;
    }

    static class Container {
        public Set ts;
    }
}