ClassContext.java

Index Score
edu.umd.cs.findbugs.ba
FindBugs

View: Reasons, Metrics, Source Code

These are the metrics that contribute to the Enerjy Score for this file, ranked by impact. So the metrics listed at the top influence the score to a greater extent that the metrics listed at the bottom.

MetricDescription
DECL_COMMENTSComments in declarations
JAVA0034JAVA0034 Missing braces in if statement
RETURNSNumber of return points from functions
EXITSProcedure exits
INTERFACE_COMPLEXITYInterface complexity
JAVA0115JAVA0115 Incorrect javadoc: no @throws or @exception tag for 'exception'
UNIQUE_OPERANDSNumber of unique operands
DOC_COMMENTNumber of javadoc comment lines
SIZESize of the file in bytes
PROGRAM_VOCABHalstead program vocabulary
JAVA0266JAVA0266 Use of System.out
COMMENTSComment lines
OPERANDSNumber of operands
PARAMSNumber of formal parameter declarations
CYCLOMATICCyclomatic complexity
PROGRAM_LENGTHHalstead program length
FUNCTIONSNumber of function declarations
OPERATORSNumber of operators
LINESNumber of lines in the source file
COMPARISONSNumber of comparison operators
JAVA0144JAVA0144 Line exceeds maximum M characters
LOGICAL_LINESNumber of statements
ELOCEffective lines of code
BLOCKSNumber of blocks
LINE_COMMENTNumber of line comments
LOCLines of code
JAVA0254JAVA0254 Use enhanced for loop construct instead of Iterator
JAVA0117JAVA0117 Missing javadoc: method 'method'
JAVA0068JAVA0068 Modifiers not declared in recommended order
UNIQUE_OPERATORSNumber of unique operators
JAVA0035JAVA0035 Missing braces in for statement
JAVA0150JAVA0150 java.lang.Error (or subclass) thrown
JAVA0116JAVA0116 Missing javadoc: field 'field'
JAVA0076JAVA0076 Use of magic number
NEST_DEPTHMaximum nesting depth
PROGRAM_VOLUMEHalstead program volume
JAVA0145JAVA0145 Tab character used in source file
JAVA0259JAVA0259 Return of collection/array field
JAVA0136JAVA0136 N methods defined in class (maximum: M)
JAVA0160JAVA0160 Method does not throw specified exception
JAVA0126JAVA0126 Method declares unchecked exception in throws
JAVA0061JAVA0061 Inaccessible member in anonymous class
JAVA0171JAVA0171 Unused local variable
JAVA0265JAVA0265 Use of Throwable.printStackTrace()
LOOPSNumber of loops
EXEC_COMMENTSComments in executable code
JAVA0110JAVA0110 Incorrect javadoc: no @return tag
JAVA0108JAVA0108 Incorrect javadoc: no @param tag for 'parameter'
/* * Bytecode Analysis Framework * Copyright (C) 2003-2007 University of Maryland * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package edu.umd.cs.findbugs.ba; import java.util.Arrays; import java.util.BitSet; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.TreeSet; import org.apache.bcel.Constants; import org.apache.bcel.classfile.Code; import org.apache.bcel.classfile.CodeException; import org.apache.bcel.classfile.JavaClass; import org.apache.bcel.classfile.LineNumber; import org.apache.bcel.classfile.LineNumberTable; import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.INVOKESTATIC; import org.apache.bcel.generic.Instruction; import org.apache.bcel.generic.InvokeInstruction; import org.apache.bcel.generic.MethodGen; import edu.umd.cs.findbugs.SystemProperties; import edu.umd.cs.findbugs.annotations.CheckForNull; import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.ba.ca.CallListDataflow; import edu.umd.cs.findbugs.ba.constant.ConstantDataflow; import edu.umd.cs.findbugs.ba.deref.UnconditionalValueDerefDataflow; import edu.umd.cs.findbugs.ba.heap.LoadDataflow; import edu.umd.cs.findbugs.ba.heap.StoreDataflow; import edu.umd.cs.findbugs.ba.npe.IsNullValueDataflow; import edu.umd.cs.findbugs.ba.npe.ReturnPathTypeDataflow; import edu.umd.cs.findbugs.ba.npe.UsagesRequiringNonNullValues; import edu.umd.cs.findbugs.ba.npe2.DefinitelyNullSetDataflow; import edu.umd.cs.findbugs.ba.type.ExceptionSetFactory; import edu.umd.cs.findbugs.ba.type.TypeDataflow; import edu.umd.cs.findbugs.ba.vna.LoadedFieldSet; import edu.umd.cs.findbugs.ba.vna.ValueNumberDataflow; import edu.umd.cs.findbugs.bcel.BCELUtil; import edu.umd.cs.findbugs.classfile.CheckedAnalysisException; import edu.umd.cs.findbugs.classfile.ClassDescriptor; import edu.umd.cs.findbugs.classfile.DescriptorFactory; import edu.umd.cs.findbugs.classfile.Global; import edu.umd.cs.findbugs.classfile.MethodDescriptor; import edu.umd.cs.findbugs.classfile.ResourceNotFoundException; import edu.umd.cs.findbugs.classfile.analysis.ClassInfo; import edu.umd.cs.findbugs.classfile.engine.SelfMethodCalls; import edu.umd.cs.findbugs.classfile.engine.bcel.NonExceptionPostdominatorsAnalysis; import edu.umd.cs.findbugs.classfile.engine.bcel.NonImplicitExceptionPostDominatorsAnalysis; import edu.umd.cs.findbugs.classfile.engine.bcel.UnpackedBytecodeCallback; import edu.umd.cs.findbugs.classfile.engine.bcel.UnpackedCode; import edu.umd.cs.findbugs.util.MapCache; import edu.umd.cs.findbugs.util.MultiMap; import edu.umd.cs.findbugs.util.TopologicalSort; import edu.umd.cs.findbugs.util.TopologicalSort.OutEdges; /** * A ClassContext caches all of the auxiliary objects used to analyze * the methods of a class. That way, these objects don't need to * be created over and over again. * * @author David Hovemeyer */ public class ClassContext { public static final boolean DEBUG = SystemProperties.getBoolean("classContext.debug"); public static final boolean TIME_ANALYSES = SystemProperties.getBoolean("classContext.timeAnalyses"); public static final boolean DUMP_DATAFLOW_ANALYSIS = SystemProperties.getBoolean("dataflow.dump"); public static int depth; public static void indent() { for (int i = 0; i < depth; ++i) System.out.print(" "); } private final JavaClass jclass; private final ClassInfo classInfo; private final AnalysisContext analysisContext; private final Map<Class<?>, Map<MethodDescriptor, Object>> methodAnalysisObjectMap; /* ---------------------------------------------------------------------- * Public methods * ---------------------------------------------------------------------- */ /** * Constructor. * * @param jclass the JavaClass */ public ClassContext(JavaClass jclass, AnalysisContext analysisContext) { this.jclass = jclass; this.analysisContext = analysisContext; this.methodAnalysisObjectMap = new HashMap<Class<?>, Map<MethodDescriptor,Object>>(); try { classInfo = (ClassInfo) Global.getAnalysisCache().getClassAnalysis(XClass.class, DescriptorFactory.createClassDescriptor(jclass)); } catch (CheckedAnalysisException e) { throw new AssertionError("No ClassInfo for " + jclass); } } public Map<MethodDescriptor, Object> getObjectMap(Class<?> analysisClass) { Map<MethodDescriptor, Object> objectMap = methodAnalysisObjectMap.get(analysisClass); if (objectMap == null) { if (analysisClass == ValueNumberDataflow.class) objectMap = new MapCache<MethodDescriptor, Object>(300); else if (Dataflow.class.isAssignableFrom(analysisClass)) objectMap = new MapCache<MethodDescriptor, Object>(500); else objectMap = new HashMap<MethodDescriptor, Object>(); methodAnalysisObjectMap.put(analysisClass, objectMap); } return objectMap; } /** * Store a method analysis object. * Note that the cached analysis object could be a special value * (indicating null or an exception). * * @param analysisClass class the method analysis object belongs to * @param methodDescriptor method descriptor identifying the analyzed method * @param object the analysis object to cache */ public void putMethodAnalysis(Class<?> analysisClass, MethodDescriptor methodDescriptor, Object object) { if (object == null) { throw new IllegalArgumentException(); } Map<MethodDescriptor, Object> objectMap = getObjectMap(analysisClass); objectMap.put(methodDescriptor, object); } /** * Retrieve a method analysis object. * * @param analysisClass class the method analysis object should belong to * @param methodDescriptor method descriptor identifying the analyzed method * @return the analysis object * @throws CheckedAnalysisException */ public Object getMethodAnalysis(Class<?> analysisClass, MethodDescriptor methodDescriptor) throws CheckedAnalysisException { Map<MethodDescriptor, Object> objectMap = getObjectMap(analysisClass); return objectMap.get(methodDescriptor); } public void purgeAllMethodAnalyses() { methodAnalysisObjectMap.clear(); } /** * Purge all CFG-based method analyses for given method. * * @param methodDescriptor method descriptor identifying method to purge */ public void purgeMethodAnalyses(MethodDescriptor methodDescriptor) { Set<Map.Entry<Class<?>, Map<MethodDescriptor, Object>>> entrySet = methodAnalysisObjectMap.entrySet(); for (Iterator<Map.Entry<Class<?>, Map<MethodDescriptor, Object>>> i = entrySet.iterator(); i.hasNext();) { Map.Entry<Class<?>, Map<MethodDescriptor, Object>> entry = i.next(); Class<?> cls = entry.getKey(); // FIXME: hack if (!DataflowAnalysis.class.isAssignableFrom(cls) && !Dataflow.class.isAssignableFrom(cls)) { // There is really no need to purge analysis results // that aren't CFG-based. // Currently, only dataflow analyses need // to be purged. continue; } entry.getValue().remove(methodDescriptor); } } /** * Get the JavaClass. */ public JavaClass getJavaClass() { return jclass; } public XClass getXClass() { return classInfo; } public ClassDescriptor getClassDescriptor() { return classInfo; } /** * Look up the Method represented by given MethodGen. * * @param methodGen a MethodGen * @return the Method represented by the MethodGen */ public Method getMethod(MethodGen methodGen) { Method[] methodList = jclass.getMethods(); for (Method method : methodList) { if (method.getName().equals(methodGen.getName()) && method.getSignature().equals(methodGen.getSignature()) && method.getAccessFlags() == methodGen.getAccessFlags()) { return method; } } return null; } @CheckForNull List<Method> methodsInCallOrder = null; public @NonNull List<Method> getMethodsInCallOrder() { if (methodsInCallOrder != null) return methodsInCallOrder; List<Method> methodList = Arrays.asList(getJavaClass().getMethods()); final Map<String, Method> map = new HashMap<String, Method>(); for (Method m : methodList) { map.put(m.getName() + m.getSignature() + m.isStatic(), m); } final MultiMap<Method, Method> multiMap = SelfMethodCalls.getSelfCalls(getClassDescriptor(), map); OutEdges<Method> edges1 = new OutEdges<Method>() { public Collection<Method> getOutEdges(Method method) { return multiMap.get(method); } }; if (false) { OutEdges<Method> edges2 = new OutEdges<Method>() { final ConstantPoolGen cpg = getConstantPoolGen(); final String thisClassName = getJavaClass().getClassName(); public Collection<Method> getOutEdges(Method method) { HashSet<Method> result = new HashSet<Method>(); try { CFG cfg = getCFG(method); for (Iterator<Location> i = cfg.locationIterator(); i.hasNext();) { Instruction ins = i.next().getHandle().getInstruction(); if (ins instanceof InvokeInstruction) { InvokeInstruction inv = (InvokeInstruction) ins; String className = inv.getClassName(cpg); if (!thisClassName.equals(className)) continue; String signature = inv.getSignature(cpg); if (signature.indexOf('L') < 0 && signature.indexOf('[') < 0) continue; String methodKey = inv.getMethodName(cpg) + signature + (inv instanceof INVOKESTATIC); Method method2 = map.get(methodKey); if (method2 != null) result.add(method2); } } } catch (CFGBuilderException e) { AnalysisContext.logError("Error getting methods called by " + thisClassName + "." + method.getName() + ":" + method.getSignature(), e); } return result; } }; } methodsInCallOrder = TopologicalSort.sortByCallGraph(methodList, edges1); assert methodList.size() == methodsInCallOrder.size(); return methodsInCallOrder; } /** * Get the AnalysisContext. */ public AnalysisContext getAnalysisContext() { return analysisContext; } /** * Get the RepositoryLookupFailureCallback. * * @return the RepositoryLookupFailureCallback */ public RepositoryLookupFailureCallback getLookupFailureCallback() { return analysisContext.getLookupFailureCallback(); } /** * Get a MethodGen object for given method. * * @param method the method * @return the MethodGen object for the method, or null * if the method has no Code attribute (and thus cannot be analyzed) * or if the method seems unprofitable to analyze */ @CheckForNull public MethodGen getMethodGen(Method method) { return getMethodAnalysisNoException(MethodGen.class, method); } /** * Get a CFG for given method. * If pruning options are in effect, pruning will be done. * Because the CFG pruning can involve interprocedural analysis, * it is done on a best-effort basis, so the CFG returned might * not actually be pruned. * * @param method the method * @return the CFG * @throws CFGBuilderException if a CFG cannot be constructed for the method */ public CFG getCFG(Method method) throws CFGBuilderException { return getMethodAnalysisNoDataflowAnalysisException(CFG.class, method); } /** * Get the ConstantPoolGen used to create the MethodGens * for this class. * * @return the ConstantPoolGen */ public @NonNull ConstantPoolGen getConstantPoolGen() { return getClassAnalysisNoException(ConstantPoolGen.class); } /** * Get a UsagesRequiringNonNullValues for given method. * * @param method the method * @return the UsagesRequiringNonNullValues */ public UsagesRequiringNonNullValues getUsagesRequiringNonNullValues(Method method) throws DataflowAnalysisException, CFGBuilderException { return getMethodAnalysis(UsagesRequiringNonNullValues.class, method); } /** * Get a ValueNumberDataflow for given method. * * @param method the method * @return the ValueNumberDataflow */ public ValueNumberDataflow getValueNumberDataflow(Method method) throws DataflowAnalysisException, CFGBuilderException { return getMethodAnalysis(ValueNumberDataflow.class, method); } /** * Get an IsNullValueDataflow for given method. * * @param method the method * @return the IsNullValueDataflow */ public IsNullValueDataflow getIsNullValueDataflow(Method method) throws DataflowAnalysisException, CFGBuilderException { return getMethodAnalysis(IsNullValueDataflow.class, method); } /** * Get a TypeDataflow for given method. * * @param method the method * @return the TypeDataflow */ public TypeDataflow getTypeDataflow(Method method) throws DataflowAnalysisException, CFGBuilderException { return getMethodAnalysis(TypeDataflow.class, method); } /** * Get a DepthFirstSearch for given method. * * @param method the method * @return the DepthFirstSearch */ public DepthFirstSearch getDepthFirstSearch(Method method) throws CFGBuilderException { return getMethodAnalysisNoDataflowAnalysisException(DepthFirstSearch.class, method); } /** * Get a ReverseDepthFirstSearch for given method. * * @param method the method * @return the ReverseDepthFirstSearch */ public ReverseDepthFirstSearch getReverseDepthFirstSearch(Method method) throws CFGBuilderException { return getMethodAnalysisNoDataflowAnalysisException(ReverseDepthFirstSearch.class, method); } static MapCache<XMethod,BitSet> cachedBitsets = new MapCache<XMethod, BitSet>(64); static MapCache<XMethod,Set<Integer>> cachedLoopExits = new MapCache<XMethod, Set<Integer>>(13); /** * Get a BitSet representing the bytecodes that are used in the given method. * This is useful for prescreening a method for the existence of particular instructions. * Because this step doesn't require building a MethodGen, it is very * fast and memory-efficient. It may allow a Detector to avoid some * very expensive analysis, which is a Big Win for the user. * * @param method the method * @return the BitSet containing the opcodes which appear in the method, * or null if the method has no code */ @CheckForNull public BitSet getBytecodeSet(Method method) { return getBytecodeSet(jclass, method); } /** * Get a BitSet representing the bytecodes that are used in the given method. * This is useful for prescreening a method for the existence of particular instructions. * Because this step doesn't require building a MethodGen, it is very * fast and memory-efficient. It may allow a Detector to avoid some * very expensive analysis, which is a Big Win for the user. * * @param method the method * @return the BitSet containing the opcodes which appear in the method, * or null if the method has no code */ @CheckForNull static public BitSet getBytecodeSet(JavaClass clazz, Method method) { XMethod xmethod = XFactory.createXMethod(clazz, method); if (cachedBitsets.containsKey(xmethod)) { return cachedBitsets.get(xmethod); } Code code = method.getCode(); if (code == null) return null; byte[] instructionList = code.getCode(); // Create callback UnpackedBytecodeCallback callback = new UnpackedBytecodeCallback(instructionList.length); // Scan the method. BytecodeScanner scanner = new BytecodeScanner(); scanner.scan(instructionList, callback); UnpackedCode unpackedCode = callback.getUnpackedCode(); BitSet result = null; if (unpackedCode != null) result = unpackedCode.getBytecodeSet(); cachedBitsets.put(xmethod, result); return result; } @CheckForNull static public Set<Integer> getLoopExitBranches(Method method, MethodGen methodGen) { XMethod xmethod = XFactory.createXMethod(methodGen); if (cachedLoopExits.containsKey(xmethod)) { return cachedLoopExits.get(xmethod); } Code code = method.getCode(); if (code == null) return null; byte[] instructionList = code.getCode(); Set<Integer> result = new HashSet<Integer>(); for(int i = 0; i < instructionList.length; i++) if (checkForBranchExit(instructionList,i)) result.add(i); if (result.size() == 0) result = Collections.<Integer>emptySet(); cachedLoopExits.put(xmethod, result); return result; } static short getBranchOffset(byte [] codeBytes, int pos) { int branchByte1 = 0xff & codeBytes[pos]; int branchByte2 = 0xff & codeBytes[pos+1]; int branchOffset = (short) (branchByte1 << 8 | branchByte2); return (short) branchOffset; } static boolean checkForBranchExit(byte [] codeBytes, int pos) { if (pos < 0 || pos+2 >= codeBytes.length) return false; switch(0xff & codeBytes[pos]) { case Constants.IF_ACMPEQ: case Constants.IF_ACMPNE: case Constants.IF_ICMPEQ: case Constants.IF_ICMPGE: case Constants.IF_ICMPGT: case Constants.IF_ICMPLE: case Constants.IF_ICMPLT: case Constants.IF_ICMPNE: break; default: return false; } int branchTarget = pos+getBranchOffset(codeBytes, pos+1); if (branchTarget-3 < pos || branchTarget >= codeBytes.length) return false; if ((codeBytes[branchTarget-3] & 0xff) != Constants.GOTO) return false; int backBranchTarget = branchTarget + getBranchOffset(codeBytes, branchTarget-2); if (backBranchTarget <= pos && backBranchTarget + 12 >= pos) return true; return false; } /** * Get array mapping bytecode offsets to opcodes for given method. * Array elements containing zero are either not valid instruction offsets, * or contain a NOP instruction. (It is convenient not to distinguish * these cases.) * * @param method the method * @return map of bytecode offsets to opcodes, or null if the method has no code */ public short[] getOffsetToOpcodeMap(Method method) { UnpackedCode unpackedCode = getMethodAnalysisNoException(UnpackedCode.class, method); return unpackedCode != null ? unpackedCode.getOffsetToBytecodeMap() : null; } /** * Get dataflow for LockAnalysis for given method. * * @param method the method * @return the LockDataflow */ public LockDataflow getLockDataflow(Method method) throws CFGBuilderException, DataflowAnalysisException { return getMethodAnalysis(LockDataflow.class, method); } /** * Get LockChecker for method. * This is like LockDataflow, but may be able to avoid performing * the actual dataflow analyses if the method doesn't contain * explicit monitorenter/monitorexit instructions. * * @param method the method * @return the LockChecker * @throws CFGBuilderException * @throws DataflowAnalysisException */ public LockChecker getLockChecker(Method method) throws CFGBuilderException, DataflowAnalysisException { return getMethodAnalysis(LockChecker.class, method); } /** * Get ReturnPathDataflow for method. * * @param method the method * @return the ReturnPathDataflow */ public ReturnPathDataflow getReturnPathDataflow(Method method) throws CFGBuilderException, DataflowAnalysisException { return getMethodAnalysis(ReturnPathDataflow.class, method); } /** * Get DominatorsAnalysis for given method, * where exception edges are ignored. * * @param method the method * @return the DominatorsAnalysis */ public DominatorsAnalysis getNonExceptionDominatorsAnalysis(Method method) throws CFGBuilderException, DataflowAnalysisException { return getMethodAnalysis(DominatorsAnalysis.class, method); } /** * Get DominatorsAnalysis for given method, * where implicit exception edges are ignored. * * @param method the method * @return the DominatorsAnalysis */ public PostDominatorsAnalysis getNonImplicitExceptionDominatorsAnalysis(Method method) throws CFGBuilderException, DataflowAnalysisException { return getMethodAnalysis(NonImplicitExceptionPostDominatorsAnalysis.class, method); } /** * Get PostDominatorsAnalysis for given method, * where exception edges are ignored. * * @param method the method * @return the PostDominatorsAnalysis */ public PostDominatorsAnalysis getNonExceptionPostDominatorsAnalysis(Method method) throws CFGBuilderException, DataflowAnalysisException { return getMethodAnalysis(NonExceptionPostdominatorsAnalysis.class, method); } /** * Get ExceptionSetFactory for given method. * * @param method the method * @return the ExceptionSetFactory */ public ExceptionSetFactory getExceptionSetFactory(Method method) { return getMethodAnalysisNoException(ExceptionSetFactory.class, method); } /** * Get array of type signatures of parameters for given method. * * @param method the method * @return an array of type signatures indicating the types * of the method's parameters */ public String[] getParameterSignatureList(Method method) { return getMethodAnalysisNoException(String[].class, method);// XXX } /** * Get the set of fields loaded by given method. * * @param method the method * @return the set of fields loaded by the method */ public LoadedFieldSet getLoadedFieldSet(Method method) { return getMethodAnalysisNoException(LoadedFieldSet.class, method); } /** * Get LiveLocalStoreAnalysis dataflow for given method. * * @param method the method * @return the Dataflow object for LiveLocalStoreAnalysis on the method */ public LiveLocalStoreDataflow getLiveLocalStoreDataflow(Method method) throws DataflowAnalysisException, CFGBuilderException { return getMethodAnalysis(LiveLocalStoreDataflow.class, method); } /** * Get BlockType dataflow for given method. * * @param method the method * @return the Dataflow object for BlockTypeAnalysis on the method */ public BlockTypeDataflow getBlockTypeDataflow(Method method) throws DataflowAnalysisException, CFGBuilderException { return getMethodAnalysis(BlockTypeDataflow.class, method); } // /** // * Get the assigned field map for the class. // * // * @return the AssignedFieldMap // * @throws ClassNotFoundException if a class lookup prevents // * the class's superclasses from being searched for // * assignable fields // */ // public AssignedFieldMap getAssignedFieldMap() throws ClassNotFoundException { // return getClassAnalysisPossibleClassNotFoundException(AssignedFieldMap.class); // } /** * Get AssertionMethods for class. * * @return the AssertionMethods */ public AssertionMethods getAssertionMethods() { return getClassAnalysisNoException(AssertionMethods.class); } /** * Get ConstantDataflow for method. * * @param method the method * @return the ConstantDataflow * @throws CFGBuilderException * @throws DataflowAnalysisException */ public ConstantDataflow getConstantDataflow(Method method) throws CFGBuilderException, DataflowAnalysisException { return getMethodAnalysis(ConstantDataflow.class, method); } /** * Get load dataflow. * * @param method the method * @return the LoadDataflow * @throws CFGBuilderException * @throws DataflowAnalysisException */ public LoadDataflow getLoadDataflow(Method method) throws CFGBuilderException, DataflowAnalysisException { return getMethodAnalysis(LoadDataflow.class, method); } /** * Get store dataflow. * * @param method the method * @return the StoreDataflow * @throws CFGBuilderException * @throws DataflowAnalysisException */ public StoreDataflow getStoreDataflow(Method method) throws CFGBuilderException, DataflowAnalysisException { return getMethodAnalysis(StoreDataflow.class, method); } /** * Get CallListDataflow for method. * * @param method the method * @return the CallListDataflow * @throws CFGBuilderException * @throws DataflowAnalysisException */ public CallListDataflow getCallListDataflow(Method method) throws CFGBuilderException, DataflowAnalysisException { return getMethodAnalysis(CallListDataflow.class, method); } public static BitSet linesMentionedMultipleTimes(Method method) { BitSet lineMentionedMultipleTimes = new BitSet(); Code code = method.getCode(); if (code == null) return lineMentionedMultipleTimes; CodeException[] exceptionTable = code.getExceptionTable(); if (exceptionTable == null || exceptionTable.length == 0) return lineMentionedMultipleTimes; int firstHandler = Integer.MAX_VALUE; for(CodeException e : exceptionTable) if (e.getCatchType() == 0){ firstHandler = Math.min(firstHandler, e.getHandlerPC()); } BitSet foundOnce = new BitSet(); BitSet afterHandler = new BitSet(); LineNumberTable lineNumberTable = method.getLineNumberTable(); int lineNum = -1; if (lineNumberTable != null) for(LineNumber line : lineNumberTable.getLineNumberTable()) { int newLine = line.getLineNumber(); if (newLine == lineNum || newLine == -1) continue; lineNum = newLine; if (line.getStartPC() >= firstHandler) afterHandler.set(lineNum); if (foundOnce.get(lineNum) ) { lineMentionedMultipleTimes.set(lineNum); } else { foundOnce.set(lineNum); } } lineMentionedMultipleTimes.and(afterHandler); return lineMentionedMultipleTimes; } /** * Get the UnconditionalValueDerefDataflow for a method. * * @param method the method * @return the UnconditionalValueDerefDataflow * @throws CFGBuilderException * @throws DataflowAnalysisException */ public UnconditionalValueDerefDataflow getUnconditionalValueDerefDataflow(Method method) throws CFGBuilderException, DataflowAnalysisException { return getMethodAnalysis(UnconditionalValueDerefDataflow.class, method); } /** * Get a CompactLocationNumbering for a method. * * @param method a method * @return the CompactLocationNumbering for the method * @throws CFGBuilderException */ public CompactLocationNumbering getCompactLocationNumbering(Method method) throws CFGBuilderException { return getMethodAnalysisNoDataflowAnalysisException(CompactLocationNumbering.class, method); } /** * Get DefinitelyNullSetDataflow for a method. * * @param method a method * @return the DefinitelyNullSetDataflow for the method * @throws DataflowAnalysisException * @throws CFGBuilderException */ public DefinitelyNullSetDataflow getDefinitelyNullSetDataflow(Method method) throws CFGBuilderException, DataflowAnalysisException { return getMethodAnalysis(DefinitelyNullSetDataflow.class, method); } /** * Get ReturnPathTypeDataflow for a method. * * @param method the method * @return the ReturnPathTypeDataflow for the method * @throws CFGBuilderException * @throws DataflowAnalysisException */ public ReturnPathTypeDataflow getReturnPathTypeDataflow(Method method) throws CFGBuilderException, DataflowAnalysisException { return getMethodAnalysis(ReturnPathTypeDataflow.class, method); } public void dumpSimpleDataflowInformation(Method method) { try { dumpDataflowInformation(method, getCFG(method), getValueNumberDataflow(method), getIsNullValueDataflow(method), null, null); } catch (DataflowAnalysisException e) { AnalysisContext.logError("Could not dump data information for " + getJavaClass().getClassName() +"." + method.getName(), e); } catch (CFGBuilderException e) { AnalysisContext.logError("Could not dump data information for " + getJavaClass().getClassName() +"." + method.getName(), e); } } public void dumpDataflowInformation(Method method) { try { dumpDataflowInformation(method, getCFG(method), getValueNumberDataflow(method), getIsNullValueDataflow(method), getUnconditionalValueDerefDataflow(method), getTypeDataflow(method)); } catch (DataflowAnalysisException e) { AnalysisContext.logError("Could not dump data information for " + getJavaClass().getClassName() +"." + method.getName(), e); } catch (CFGBuilderException e) { AnalysisContext.logError("Could not dump data information for " + getJavaClass().getClassName() +"." + method.getName(), e); } } /** * @param method * @param cfg * @param vnd * @param inv * @param dataflow * @param typeDataflow TODO * @throws DataflowAnalysisException */ public static void dumpDataflowInformation(Method method, CFG cfg, ValueNumberDataflow vnd, IsNullValueDataflow inv, @CheckForNull UnconditionalValueDerefDataflow dataflow, @CheckForNull TypeDataflow typeDataflow) throws DataflowAnalysisException { System.out.println("\n\n{ UnconditionalValueDerefAnalysis analysis for " + method.getName()); TreeSet<Location> tree = new TreeSet<Location>(); for(Iterator<Location> locs = cfg.locationIterator(); locs.hasNext(); ) { Location loc = locs.next(); tree.add(loc); } for(Location loc : tree) { System.out.println(); if (dataflow != null) System.out.println("\n Pre: " + dataflow.getFactAfterLocation(loc)); System.out.println("Vna: " + vnd.getFactAtLocation(loc)); System.out.println("inv: " + inv.getFactAtLocation(loc)); if (typeDataflow != null) System.out.println("type: " + typeDataflow.getFactAtLocation(loc)); System.out.println("Location: " + loc); if (dataflow != null) System.out.println("Post: " + dataflow.getFactAtLocation(loc)); System.out.println("Vna: " + vnd.getFactAfterLocation(loc)); System.out.println("inv: " + inv.getFactAfterLocation(loc)); if (typeDataflow != null) System.out.println("type: " + typeDataflow.getFactAfterLocation(loc)); } System.out.println("}\n\n"); } /** * @param method * @param cfg * @param typeDataflow * @throws DataflowAnalysisException */ public static void dumpTypeDataflow(Method method, CFG cfg, TypeDataflow typeDataflow) throws DataflowAnalysisException { System.out.println("\n\n{ Type analysis for " + cfg.getMethodGen().getClassName() + "." + method.getName()); TreeSet<Location> tree = new TreeSet<Location>(); for(Iterator<Location> locs = cfg.locationIterator(); locs.hasNext(); ) { Location loc = locs.next(); tree.add(loc); } for(Location loc : tree) { System.out.println("\n Pre: " + typeDataflow.getFactAtLocation(loc)); System.out.println("Location: " + loc); System.out.println("Post: " + typeDataflow.getFactAfterLocation(loc)); } System.out.println("}\n\n"); } /* ---------------------------------------------------------------------- * Helper methods for getting an analysis object from the analysis cache. * ---------------------------------------------------------------------- */ private<Analysis> Analysis getMethodAnalysisNoException(Class<Analysis> analysisClass, Method method) { try { return getMethodAnalysis(analysisClass, method); } catch (CheckedAnalysisException e) { IllegalStateException ise = new IllegalStateException("should not happen"); ise.initCause(e); throw ise; } } private<Analysis> Analysis getMethodAnalysisNoDataflowAnalysisException(Class<Analysis> analysisClass, Method method) throws CFGBuilderException { try { return getMethodAnalysis(analysisClass, method); } catch (CFGBuilderException e) { throw e; } catch (CheckedAnalysisException e) { IllegalStateException ise = new IllegalStateException("should not happen"); ise.initCause(e); throw ise; } } private<Analysis> Analysis getMethodAnalysis(Class<Analysis> analysisClass, Method method) throws DataflowAnalysisException, CFGBuilderException { try { MethodDescriptor methodDescriptor = BCELUtil.getMethodDescriptor(jclass, method); return Global.getAnalysisCache().getMethodAnalysis(analysisClass, methodDescriptor); } catch (DataflowAnalysisException e) { throw e; } catch (CFGBuilderException e) { throw e; } catch (CheckedAnalysisException e) { Throwable cause = e.getCause(); if (cause instanceof CFGBuilderException) { throw (CFGBuilderException)cause; } System.out.println("Bad CAE: " + e.getClass().getName() + " for " + analysisClass.getName() + " of " + method); e.printStackTrace(System.out); IllegalStateException ise = new IllegalStateException("should not happen"); ise.initCause(e); throw ise; } } private<Analysis> Analysis getClassAnalysis(Class<Analysis> analysisClass) throws CheckedAnalysisException { ClassDescriptor classDescriptor = BCELUtil.getClassDescriptor(jclass); return Global.getAnalysisCache().getClassAnalysis(analysisClass, classDescriptor); } private<Analysis> Analysis getClassAnalysisNoException(Class<Analysis> analysisClass) { try { return getClassAnalysis(analysisClass); } catch (CheckedAnalysisException e) { IllegalStateException ise = new IllegalStateException("should not happen"); ise.initCause(e); throw ise; } } // private<Analysis> Analysis getClassAnalysisPossibleClassNotFoundException(Class<Analysis> analysisClass) // throws ClassNotFoundException { // try { // return Global.getAnalysisCache().getClassAnalysis(analysisClass, BCELUtil.getClassDescriptor(jclass)); // } catch (ResourceNotFoundException e) { // throw e.toClassNotFoundException(); // } catch (CheckedAnalysisException e) { // throw new AnalysisException("Unexpected exception", e); // } // } } // vim:ts=3

The table below shows all metrics for ClassContext.java.

MetricValueDescription
BLOCKS103.00Number of blocks
BLOCK_COMMENT24.00Number of block comment lines
COMMENTS354.00Comment lines
COMMENT_DENSITY 0.85Comment density
COMPARISONS81.00Number of comparison operators
CYCLOMATIC133.00Cyclomatic complexity
DECL_COMMENTS68.00Comments in declarations
DOC_COMMENT301.00Number of javadoc comment lines
ELOC417.00Effective lines of code
EXEC_COMMENTS 4.00Comments in executable code
EXITS144.00Procedure exits
FUNCTIONS61.00Number of function declarations
HALSTEAD_DIFFICULTY92.89Halstead difficulty
HALSTEAD_EFFORT 0.00Halstead effort
INTERFACE_COMPLEXITY202.00Interface complexity
JAVA0001 0.00JAVA0001 Package name does not contain only lower case letters
JAVA0002 0.00JAVA0002 Package name does not begin with a top level domain name or country code
JAVA0003 0.00JAVA0003 Minimize use of on-demand (.*) imports
JAVA0004 0.00JAVA0004 Unnecessary import from java.lang
JAVA0005 0.00JAVA0005 Imports not in specified order
JAVA0006 0.00JAVA0006 Empty finally block
JAVA0007 1.00JAVA0007 Should not declare public field
JAVA0008 0.00JAVA0008 Empty catch block
JAVA0009 0.00JAVA0009 Protected member in final class
JAVA0010 0.00JAVA0010 Non-instantiable class does not contain a non-private static member
JAVA0011 0.00JAVA0011 Abstract class does not contain an abstract method
JAVA0012 0.00JAVA0012 Non-constructor method with same name as declaring class
JAVA0013 0.00JAVA0013 Non-blank final field is not static
JAVA0014 0.00JAVA0014 Class with only static members has non-private constructor
JAVA0015 0.00JAVA0015 Package class contains public nested type
JAVA0016 0.00JAVA0016 Abstract class contains public constructor
JAVA0017 0.00JAVA0017 Class name does not have required form
JAVA0018 0.00JAVA0018 Method name does not have required form
JAVA0019 0.00JAVA0019 Interface name does not have required form
JAVA0020 0.00JAVA0020 Field name does not have required form
JAVA0021 0.00JAVA0021 Interface method name does not have required form
JAVA0022 0.00JAVA0022 Static final field name does not have required form
JAVA0023 0.00JAVA0023 Empty finalize method
JAVA0024 0.00JAVA0024 Empty class
JAVA0025 0.00JAVA0025 Method override is empty
JAVA0026 0.00JAVA0026 Finalize method with parameters
JAVA0029 0.00JAVA0029 Private method not used
JAVA0030 0.00JAVA0030 Private field not used
JAVA0031 0.00JAVA0031 Case statement not properly closed
JAVA0032 0.00JAVA0032 Switch statement missing default
JAVA0033 0.00JAVA0033 default: not last case in switch statement
JAVA003425.00JAVA0034 Missing braces in if statement
JAVA0035 2.00JAVA0035 Missing braces in for statement
JAVA0036 0.00JAVA0036 Missing braces in while statement
JAVA0038 0.00JAVA0038 Non-case label in switch statement
JAVA0039 0.00JAVA0039 Break statement with label
JAVA0040 0.00JAVA0040 Switch statement contains N cases (maximum: M)
JAVA0041 0.00JAVA0041 Nested synchronized block
JAVA0042 0.00JAVA0042 Empty synchronized statement
JAVA0043 0.00JAVA0043 Inner class does not use outer class
JAVA0044 0.00JAVA0044 Serializable class with no instance variables
JAVA0045 0.00JAVA0045 Serializable class with only transient fields
JAVA0046 0.00JAVA0046 Name of class not derived from Exception ends with 'Exception'
JAVA0047 0.00JAVA0047 Serializable class derives from invalid base class
JAVA0048 0.00JAVA0048 Name of class derived from Exception does not end with 'Exception'
JAVA0049 1.00JAVA0049 Nested block at depth N (maximum: M)
JAVA0050 0.00JAVA0050 Class derives from java.lang.Error
JAVA0051 0.00JAVA0051 Class derives from java.lang.RuntimeException
JAVA0052 0.00JAVA0052 Class derives from java.lang.Throwable
JAVA0053 0.00JAVA0053 Unused label
JAVA0054 0.00JAVA0054 Inheritance depth N exceeds maximum M
JAVA0055 0.00JAVA0055 Class should be interface
JAVA0056 0.00JAVA0056 Unnecessary abstract modifier for interface or annotation
JAVA0057 0.00JAVA0057 Unnecessary default constructor
JAVA0058 0.00JAVA0058 Constructor calls super()
JAVA0059 0.00JAVA0059 Method override only calls super()
JAVA0061 2.00JAVA0061 Inaccessible member in anonymous class
JAVA0062 0.00JAVA0062 Public class missing public member or protected constructor
JAVA0063 0.00JAVA0063 Identifier name should not contain '$'
JAVA0064 0.00JAVA0064 N variations of identifier name (maximum: M)
JAVA0065 0.00JAVA0065 Unnecessary final modifier for method in final class
JAVA0066 0.00JAVA0066 Unnecessary modifier for interface nested type
JAVA0067 0.00JAVA0067 Array descriptor on identifier name
JAVA0068 4.00JAVA0068 Modifiers not declared in recommended order
JAVA0071 0.00JAVA0071 Strings compared with ==
JAVA0073 0.00JAVA0073 Integer division in floating-point context
JAVA0074 0.00JAVA0074 Use of Object.notify()
JAVA0075 0.00JAVA0075 Method parameter hides field
JAVA0076 4.00JAVA0076 Use of magic number
JAVA0077 0.00JAVA0077 Private field not used in declaring class
JAVA0078 0.00JAVA0078 Floating point values compared with ==
JAVA0079 0.00JAVA0079 Use of instance to reference static member
JAVA0080 1.00JAVA0080 Import declaration not used
JAVA0081 0.00JAVA0081 Boolean literal in comparison
JAVA0082 0.00JAVA0082 Unnecessary widening cast
JAVA0083 0.00JAVA0083 Unnecessary instanceof test
JAVA0084 0.00JAVA0084 Should use compound assignment operator
JAVA0085 0.00JAVA0085 Use of sun.* class
JAVA0087 0.00JAVA0087 Use of Thread.sleep()
JAVA0089 0.00JAVA0089 Use of restricted package
JAVA0092 0.00JAVA0092 Use of restricted type
JAVA0093 0.00JAVA0093 Redundant assignment
JAVA0094 0.00JAVA0094 Field hides a superclass field
JAVA0095 0.00JAVA0095 Uninitialized private field
JAVA0096 0.00JAVA0096 Field in nested class hides outer field
JAVA0098 0.00JAVA0098 Minimize use of implicit field initializers
JAVA0100 0.00JAVA0100 Class contains N non-final fields (maximum: M)
JAVA0101 0.00JAVA0101 Unnecessary modifier for field in interface
JAVA0102 0.00JAVA0102 Last statement in finalize() not super.finalize()
JAVA0103 0.00JAVA0103 Explicit call to finalize()
JAVA0104 0.00JAVA0104 finalize() only calls super.finalize()
JAVA0105 0.00JAVA0105 Duplicate import declaration
JAVA0106 0.00JAVA0106 Unnecessary import from current package
JAVA0108 2.00JAVA0108 Incorrect javadoc: no @param tag for 'parameter'
JAVA0109 0.00JAVA0109 Incorrect javadoc: no parameter 'parameter'
JAVA0110 2.00JAVA0110 Incorrect javadoc: no @return tag
JAVA0111 0.00JAVA0111 Incorrect javadoc: @return tag for void method
JAVA0112 0.00JAVA0112 Incorrect javadoc: no exception 'exception' in throws
JAVA0113 0.00JAVA0113 Incorrect javadoc: no @author tag
JAVA0114 1.00JAVA0114 Incorrect javadoc: no @version tag
JAVA011524.00JAVA0115 Incorrect javadoc: no @throws or @exception tag for 'exception'
JAVA0116 4.00JAVA0116 Missing javadoc: field 'field'
JAVA011710.00JAVA0117 Missing javadoc: method 'method'
JAVA0118 0.00JAVA0118 Missing javadoc: type 'type'
JAVA0119 0.00JAVA0119 Control variable changed within body of for loop
JAVA0123 0.00JAVA0123 Use all three components of for loop
JAVA0125 0.00JAVA0125 Continue statement with label
JAVA0126 0.00JAVA0126 Method declares unchecked exception in throws
JAVA0128 0.00JAVA0128 Public constructor in non-public class
JAVA0130 0.00JAVA0130 Non-static method does not use instance fields
JAVA0131 0.00JAVA0131 Compatible method does not override base
JAVA0132 0.00JAVA0132 Method overload with compatible signature
JAVA0133 0.00JAVA0133 Non-synchronized method overrides synchronized method
JAVA0135 0.00JAVA0135 Only one of Object.equals and Object.hashCode defined: missing 'method'
JAVA0136 1.00JAVA0136 N methods defined in class (maximum: M)
JAVA0137 0.00JAVA0137 Non-abstract class missing constructor
JAVA0138 1.00JAVA0138 N parameters defined for method (maximum: M)
JAVA0139 0.00JAVA0139 Definition of main other than public static void main(java.lang.String[])
JAVA0141 0.00JAVA0141 Unnecessary modifier for method in interface
JAVA0143 0.00JAVA0143 Synchronized method
JAVA0144 9.00JAVA0144 Line exceeds maximum M characters
JAVA01451333.00JAVA0145 Tab character used in source file
JAVA0150 1.00JAVA0150 java.lang.Error (or subclass) thrown
JAVA0153 0.00JAVA0153 Inefficient conversion of integer to string
JAVA0159 0.00JAVA0159 Inefficient conversion of string to integer
JAVA0160 1.00JAVA0160 Method does not throw specified exception
JAVA0161 0.00JAVA0161 Conditional wait() not in loop
JAVA0163 0.00JAVA0163 Empty statement
JAVA0165 0.00JAVA0165 Conflicting return statement in finally block
JAVA0166 0.00JAVA0166 Generic exception caught
JAVA0167 0.00JAVA0167 ThreadDeath not rethrown
JAVA0169 0.00JAVA0169 Unnecessary catch block: exception 'exception'
JAVA0170 0.00JAVA0170 Caught exception not derived from java.lang.Exception
JAVA0171 1.00JAVA0171 Unused local variable
JAVA0173 0.00JAVA0173 Unused method parameter
JAVA0174 0.00JAVA0174 Assigned local variable never used
JAVA0175 0.00JAVA0175 Successive assignment to variable
JAVA0176 0.00JAVA0176 Local variable name does not have required form
JAVA0177 0.00JAVA0177 Variable declaration missing initializer
JAVA0179 0.00JAVA0179 Local variable hides visible field
JAVA0233 0.00JAVA0233 Definition of serialVersionUID other than 'private static final long serialVersionUID'
JAVA0234 0.00JAVA0234 Class is Serializable but does not define serialVersionUID
JAVA0235 0.00JAVA0235 Class defines serialVersionUID but does not implement Serializable
JAVA0236 0.00JAVA0236 Attempt to clone an object which does not implement Cloneable
JAVA0237 0.00JAVA0237 Class implements Cloneable but does not have public clone method
JAVA0238 0.00JAVA0238 Clone method does not call super.clone()
JAVA0239 0.00JAVA0239 Class declares 'readObject' or 'writeObject' but does not implement Serializable
JAVA0240 0.00JAVA0240 Serializable class which declares readObject or writeObject but not both
JAVA0241 0.00JAVA0241 'readObject' or 'writeObject' should be declared private in Serializable class
JAVA0242 0.00JAVA0242 Transient field in non-Serializable class
JAVA0243 0.00JAVA0243 'readResolve' or 'writeReplace' should be declared private or protected
JAVA0244 0.00JAVA0244 Field or method name in subclass differs only by case from inherited field or method
JAVA0245 0.00JAVA0245 JUnit TestCase with non-trivial constructor
JAVA0246 0.00JAVA0246 JUnit assertXXX statement missing message parameter
JAVA0247 0.00JAVA0247 JUnit 'setUp()' and 'tearDown()' should call super method
JAVA0248 0.00JAVA0248 JUnit method 'setUp' or 'tearDown' with incorrect signature
JAVA0249 0.00JAVA0249 JUnit TestCase 'suite()' should be declared static
JAVA0250 0.00JAVA0250 JUnit TestCase declares testXXX method with incorrect signature
JAVA0251 0.00JAVA0251 Use '%n' for line breaks in printf/format for platform independence
JAVA0252 0.00JAVA0252 'enum' is a Java 1.5 reserved word
JAVA0253 0.00JAVA0253 Not all enum constants consumed in switch statement
JAVA0254 4.00JAVA0254 Use enhanced for loop construct instead of Iterator
JAVA0255 0.00JAVA0255 Result of method invocation not used
JAVA0256 0.00JAVA0256 Assignment of external collection/array to field
JAVA0257 0.00JAVA0257 Use of 'Constant Interface' anti-pattern
JAVA0258 0.00JAVA0258 Implement Iterable for foreach compatibility
JAVA0259 2.00JAVA0259 Return of collection/array field
JAVA0260 0.00JAVA0260 Use 'enum' instead of Enumerated Type pattern
JAVA0261 0.00JAVA0261 Use specialized Enum collection types
JAVA0262 0.00JAVA0262 Use of char in integer context
JAVA0263 0.00JAVA0263 Long literal ends with 'l' instead of 'L'
JAVA0264 0.00JAVA0264 Integer math in long context - check for overflow
JAVA0265 1.00JAVA0265 Use of Throwable.printStackTrace()
JAVA026620.00JAVA0266 Use of System.out
JAVA0267 0.00JAVA0267 Use of System.err
JAVA0269 0.00JAVA0269 Contents of StringBuffer never used
JAVA0270 0.00JAVA0270 Use Java 5.0 enhanced for loop construct to iterate over all elements in an array
JAVA0271 0.00JAVA0271 Minimize use of on-demand (.*) static imports
JAVA0272 0.00JAVA0272 Thread.run() called
JAVA0273 0.00JAVA0273 Non-final derivative of Thread calls start() in constructor
JAVA0274 0.00JAVA0274 Serializable class has a synchronized readObject()
JAVA0275 0.00JAVA0275 Serializable class has a synchronized writeObject() and no other synchronized methods
JAVA0276 0.00JAVA0276 Unnecessary use of String constructor
JAVA0277 0.00JAVA0277 Iterator.next() implementation does not throw NoSuchElementException
JAVA0278 0.00JAVA0278 Unnecessary use of Boolean constructor
JAVA0279 0.00JAVA0279 Serialization method readObject or readObjectNoData calls an overridable method
JAVA0280 0.00JAVA0280 IllegalMonitorStateException caught
JAVA0281 0.00JAVA0281 Iterator.next() not called in loop
JAVA0282 0.00JAVA0282 Call to Iterator.next() in loop which does not test Iterator.hasNext()
JAVA0283 0.00JAVA0283 Control variable not updated in loop body
JAVA0284 0.00JAVA0284 Explicit garbage collection
JAVA0285 0.00JAVA0285 Dereference of potentially null variable
JAVA0286 0.00JAVA0286 Dereference of null variable
JAVA0287 0.00JAVA0287 Unnecessary null check
JAVA0288 0.00JAVA0288 Inconsistent null check
LINES957.00Number of lines in the source file
LINE_COMMENT29.00Number of line comments
LOC509.00Lines of code
LOGICAL_LINES279.00Number of statements
LOOPS 6.00Number of loops
NEST_DEPTH 6.00Maximum nesting depth
OPERANDS1648.00Number of operands
OPERATORS2711.00Number of operators
PARAMS69.00Number of formal parameter declarations
PROGRAM_LENGTH4359.00Halstead program length
PROGRAM_VOCAB612.00Halstead program vocabulary
PROGRAM_VOLUME 0.00Halstead program volume
RETURNS133.00Number of return points from functions
SIZE34998.00Size of the file in bytes
UNIQUE_OPERANDS550.00Number of unique operands
UNIQUE_OPERATORS62.00Number of unique operators
WHITESPACE94.00Number of whitespace lines