src.samples.java.ex.IMC_Sample Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sb-contrib Show documentation
Show all versions of sb-contrib Show documentation
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.
The newest version!
package ex;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import javax.persistence.Entity;
import org.junit.Assert;
import org.junit.Test;
import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.Opcodes;
public class IMC_Sample implements Serializable {
private static final long serialVersionUID = 5213802770984511942L;
private String reportMe;
private String var;
private static final int OUT_OF_PLACE_STATIC = 0;
@SuperSecret
class FPClassIMC {
private String dontReportMe;
}
class FPFieldIMC {
@SuperSecret
private String dontReportMe;
}
public void psf(File f) {
try (InputStream is = new FileInputStream(f)) {
is.read();
} catch (IOException e) {
e.printStackTrace();
}
}
public void hasVar() {
int var = 0;
}
}
class NeedsEquals {
String key;
String value;
@Override
public String toString() {
return key + value;
}
}
class Numbers359 {
String key;
double value;
}
class IMCFPHasAToString {
@SuperSecret
private String fooo;
@Override
public String toString() {
return fooo;
}
}
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE, ElementType.FIELD })
@interface SuperSecret {
}
class FPIMCTestClass {
private int data1, data2;
@Test
public void doTest() {
Assert.assertEquals(data1, data2);
}
}
@Entity
class FPIMCEntity {
private int id;
private String name;
}
class MyVisitor extends AnnotationVisitor {
String name;
public MyVisitor() {
super(Opcodes.ASM4);
}
@Override
public AnnotationVisitor visitAnnotation(String arg0, String arg1) {
name = arg0;
return super.visitAnnotation(arg0, arg1);
}
}