use of edu.umd.cs.findbugs.OpcodeStack in project fb-contrib by mebigfatguy.
the class DubiousMapCollection method visitClassContext.
@Override
public void visitClassContext(ClassContext classContext) {
if ((mapInterface == null) || (propertiesClass == null)) {
return;
}
try {
stack = new OpcodeStack();
mapFields = new HashMap<>();
super.visitClassContext(classContext);
for (FieldAnnotation mapField : mapFields.values()) {
bugReporter.reportBug(new BugInstance(this, BugType.DMC_DUBIOUS_MAP_COLLECTION.toString(), NORMAL_PRIORITY).addClass(this).addField(mapField));
}
} finally {
mapFields = null;
stack = null;
}
}
use of edu.umd.cs.findbugs.OpcodeStack in project fb-contrib by mebigfatguy.
the class PossibleMemoryBloat method visitClassContext.
/**
* collects static fields that are likely bloatable objects and if found allows the visitor to proceed, at the end report all leftover fields
*
* @param classContext
* the class context object of the currently parsed java class
*/
@Override
public void visitClassContext(ClassContext classContext) {
try {
bloatableCandidates = new HashMap<>();
bloatableFields = new HashMap<>();
threadLocalNonStaticFields = new HashSet<>();
parseFields(classContext);
if (!bloatableCandidates.isEmpty()) {
stack = new OpcodeStack();
super.visitClassContext(classContext);
reportMemoryBloatBugs();
reportThreadLocalBugs();
}
} catch (StopOpcodeParsingException e) {
// no more bloatable candidates
} finally {
stack = null;
bloatableCandidates = null;
bloatableFields = null;
threadLocalNonStaticFields = null;
}
}
use of edu.umd.cs.findbugs.OpcodeStack in project fb-contrib by mebigfatguy.
the class PossibleUnsuspectedSerialization method visitClassContext.
/**
* implements the visitor to setup and tear down the opcode stack
*
* @param classContext
* the context object of the currently parsed class
*/
@Override
public void visitClassContext(ClassContext classContext) {
try {
stack = new OpcodeStack();
super.visitClassContext(classContext);
} finally {
stack = null;
}
}
use of edu.umd.cs.findbugs.OpcodeStack in project fb-contrib by mebigfatguy.
the class PresizeCollections method visitClassContext.
/**
* overrides the visitor to initialize the opcode stack
*
* @param classContext
* the context object that holds the JavaClass being parsed
*/
@Override
public void visitClassContext(ClassContext classContext) {
try {
stack = new OpcodeStack();
storeToUserValue = new HashMap<>();
allocLocation = new HashMap<>();
allocToAddPCs = new HashMap<>();
optionalRanges = new ArrayList<>();
super.visitClassContext(classContext);
} finally {
stack = null;
storeToUserValue = null;
allocLocation = null;
allocToAddPCs = null;
optionalRanges = null;
}
}
use of edu.umd.cs.findbugs.OpcodeStack in project fb-contrib by mebigfatguy.
the class ReflectionOnObjectMethods method visitClassContext.
/**
* implements the visitor to create the stack and local and field maps for Class arrays to be used for getting the reflection method
*
* @param classContext
* the context object of the currently parse class
*/
@Override
public void visitClassContext(ClassContext classContext) {
try {
stack = new OpcodeStack();
localClassTypes = new HashMap<>();
fieldClassTypes = new HashMap<>();
JavaClass cls = classContext.getJavaClass();
Method staticInit = findStaticInitializer(cls);
if (staticInit != null) {
setupVisitorForClass(cls);
doVisitMethod(staticInit);
}
super.visitClassContext(classContext);
} finally {
stack = null;
localClassTypes = null;
fieldClassTypes = null;
}
}
Aggregations