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

src.samples.java.ex.AI_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.io.IOException;
import java.lang.reflect.Constructor;
import java.security.AccessController;
import java.security.PrivilegedAction;

import javax.annotation.Nullable;

public class AI_Sample {

    @Nullable
    public String getFoo() {
        return null;
    }

    public String getFoo2() {
        return getFoo();
    }

    public String getFoo3() {
        return "";
    }

    public String nullBecauseOfConditional() throws IOException {
        String f = getFoo3();
        if (f == null) {
            return f;
        }

        return "";
    }

    public String fpNullChecked() throws IOException {
        String f = getFoo();
        if (f == null) {
            throw new IOException();
        }

        return f;
    }

    public String fpAnon() {

        return new Stringer() {
            @Override
            public String get() {
                return null;
            }
        }.get();
    }

    public void fpLambda(Constructor c) {
        AccessController.doPrivileged((PrivilegedAction) () -> {
            c.setAccessible(true);
            return null;
        });
    }

    interface Stringer {
        String get();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy