AbstractFrameModelingVisitor.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
FUNCTIONSNumber of function declarations
PARAMSNumber of formal parameter declarations
INTERFACE_COMPLEXITYInterface complexity
RETURNSNumber of return points from functions
BLOCKSNumber of blocks
CYCLOMATICCyclomatic complexity
UNIQUE_OPERANDSNumber of unique operands
PROGRAM_VOCABHalstead program vocabulary
LOCLines of code
LINESNumber of lines in the source file
ELOCEffective lines of code
WHITESPACENumber of whitespace lines
OPERANDSNumber of operands
PROGRAM_LENGTHHalstead program length
SIZESize of the file in bytes
OPERATORSNumber of operators
LOGICAL_LINESNumber of statements
JAVA0108JAVA0108 Incorrect javadoc: no @param tag for 'parameter'
DECL_COMMENTSComments in declarations
JAVA0036JAVA0036 Missing braces in while statement
JAVA0110JAVA0110 Incorrect javadoc: no @return tag
JAVA0034JAVA0034 Missing braces in if statement
JAVA0117JAVA0117 Missing javadoc: method 'method'
JAVA0144JAVA0144 Line exceeds maximum M characters
PROGRAM_VOLUMEHalstead program volume
JAVA0136JAVA0136 N methods defined in class (maximum: M)
JAVA0266JAVA0266 Use of System.out
JAVA0126JAVA0126 Method declares unchecked exception in throws
EXEC_COMMENTSComments in executable code
COMMENTSComment lines
JAVA0265JAVA0265 Use of Throwable.printStackTrace()
COMPARISONSNumber of comparison operators
DOC_COMMENTNumber of javadoc comment lines
LINE_COMMENTNumber of line comments
JAVA0130JAVA0130 Non-static method does not use instance fields
JAVA0145JAVA0145 Tab character used in source file
/* * Bytecode Analysis Framework * Copyright (C) 2003-2005 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 org.apache.bcel.Constants; import org.apache.bcel.generic.*; /** * A common base class for frame modeling visitors. * This class provides a default implementation which copies values * between frame slots whenever appropriate. For example, its handler * for the ALOAD bytecode will get the value from the referenced * local in the frame and push it onto the stack. Bytecodes which * do something other than copying values are modeled by popping * values as appropriate, and pushing the "default" value onto the stack * for each stack slot produced, where the default value is the one * returned by the getDefaultValue() method. * <p/> * <p> Subclasses should override the visit methods for any bytecode instructions * which require special handling. * </p> * <p> * Users of AbstractFrameModelingVisitors should call the * analyzeInstruction() method instead of directly using the accept() * method of the instruction. This allows a checked DataflowAnalysisException * to be thrown when invalid bytecode is detected. E.g., * stack underflows. * </p> * * @author David Hovemeyer * @see Frame * @see DataflowAnalysis */ public abstract class AbstractFrameModelingVisitor <Value, FrameType extends Frame<Value>> implements Visitor { private FrameType frame; private Location location; protected ConstantPoolGen cpg; /** * Constructor. * * @param cpg the ConstantPoolGen of the method to be analyzed */ public AbstractFrameModelingVisitor(ConstantPoolGen cpg) { this.frame = null; this.cpg = cpg; } /** * Analyze the given Instruction. * * @param ins the Instruction * @throws DataflowAnalysisException if an error occurs analyzing the instruction; * in most cases, this indicates that the bytecode * for the method being analyzed is invalid */ public void analyzeInstruction(Instruction ins) throws DataflowAnalysisException { try { ins.accept(this); } catch (InvalidBytecodeException e) { System.out.println("Could not analyze " + ins); e.printStackTrace(System.out); throw new DataflowAnalysisException("Invalid bytecode", e); } } /** * Get the ConstantPoolGen for the method. */ public ConstantPoolGen getCPG() { return cpg; } /** * Set the frame and Location for the instruction about to * be modeled. * * @param frame the Frame * @param location the Location */ public void setFrameAndLocation(FrameType frame, Location location) { this.frame = frame; this.location = location; } /** * Get the frame. * * @return the Frame object */ public FrameType getFrame() { return frame; } /** * Get the Location. * * @return the Location */ public Location getLocation() { return location; } /** * Produce a "default" value. * This is what is pushed onto the stack by the * handleNormalInstruction() method for instructions which produce stack values. */ public abstract Value getDefaultValue(); /** * Get the number of words consumed by given instruction. */ public int getNumWordsConsumed(Instruction ins) { int numWordsConsumed = ins.consumeStack(cpg); if (numWordsConsumed == Constants.UNPREDICTABLE) throw new InvalidBytecodeException("Unpredictable stack consumption"); return numWordsConsumed; } /** * Get the number of words produced by given instruction. */ public int getNumWordsProduced(Instruction ins) { int numWordsProduced = ins.produceStack(cpg); if (numWordsProduced == Constants.UNPREDICTABLE) throw new InvalidBytecodeException("Unpredictable stack productions"); return numWordsProduced; } /** * This is called for illegal bytecodes. * * @throws InvalidBytecodeException */ private void illegalBytecode(Instruction ins) { throw new InvalidBytecodeException("Illegal bytecode: " + ins); } /* ---------------------------------------------------------------------- * Empty visit methods * ---------------------------------------------------------------------- */ public void visitStackInstruction(StackInstruction obj) { } public void visitLocalVariableInstruction(LocalVariableInstruction obj) { } public void visitBranchInstruction(BranchInstruction obj) { } public void visitLoadClass(LoadClass obj) { } public void visitFieldInstruction(FieldInstruction obj) { } public void visitIfInstruction(IfInstruction obj) { } public void visitConversionInstruction(ConversionInstruction obj) { } public void visitPopInstruction(PopInstruction obj) { } public void visitJsrInstruction(JsrInstruction obj) { } public void visitGotoInstruction(GotoInstruction obj) { } public void visitStoreInstruction(StoreInstruction obj) { } public void visitTypedInstruction(TypedInstruction obj) { } public void visitSelect(Select obj) { } public void visitUnconditionalBranch(UnconditionalBranch obj) { } public void visitPushInstruction(PushInstruction obj) { } public void visitArithmeticInstruction(ArithmeticInstruction obj) { } public void visitCPInstruction(CPInstruction obj) { } public void visitInvokeInstruction(InvokeInstruction obj) { } public void visitArrayInstruction(ArrayInstruction obj) { } public void visitAllocationInstruction(AllocationInstruction obj) { } public void visitReturnInstruction(ReturnInstruction obj) { } public void visitFieldOrMethod(FieldOrMethod obj) { } public void visitConstantPushInstruction(ConstantPushInstruction obj) { } public void visitExceptionThrower(ExceptionThrower obj) { } public void visitLoadInstruction(LoadInstruction obj) { } public void visitVariableLengthInstruction(VariableLengthInstruction obj) { } public void visitStackProducer(StackProducer obj) { } public void visitStackConsumer(StackConsumer obj) { } /* ---------------------------------------------------------------------- * General instruction handlers * ---------------------------------------------------------------------- */ /** * Handler for all instructions which pop values from the stack * and store them in a local variable. Note that two locals * are stored into for long and double stores. */ public void handleStoreInstruction(StoreInstruction obj) { try { int numConsumed = obj.consumeStack(cpg); if (numConsumed == Constants.UNPREDICTABLE) throw new InvalidBytecodeException("Unpredictable stack consumption"); int index = obj.getIndex(); // Store values into consecutive locals corresponding // to the order in which the values appeared on the stack. while (numConsumed-- > 0) { Value value = frame.popValue(); frame.setValue(index++, value); } } catch (DataflowAnalysisException e) { throw new InvalidBytecodeException(e.toString()); } } /** * Handler for all instructions which load values from a local variable * and push them on the stack. Note that two locals are loaded for * long and double loads. */ public void handleLoadInstruction(LoadInstruction obj) { int numProduced = obj.produceStack(cpg); if (numProduced == Constants.UNPREDICTABLE) throw new InvalidBytecodeException("Unpredictable stack production"); int index = obj.getIndex() + numProduced; // Load values from locals in reverse order. // This restores them to the stack in a way consistent // with visitStoreInstruction(). while (numProduced-- > 0) { Value value = frame.getValue(--index); frame.pushValue(value); } } /** * This is called to handle any instruction which does not simply * copy values between stack slots. The default value * is pushed (if the instruction is a stack producer). */ public void handleNormalInstruction(Instruction ins) { modelNormalInstruction(ins, getNumWordsConsumed(ins), getNumWordsProduced(ins)); } /** * Model the stack for instructions handled by handleNormalInstruction(). * Subclasses may override to provide analysis-specific behavior. * * @param ins the Instruction to model * @param numWordsConsumed number of stack words consumed * @param numWordsProduced number of stack words produced */ public void modelNormalInstruction( Instruction ins, int numWordsConsumed, int numWordsProduced) { modelInstruction(ins, numWordsConsumed, numWordsProduced, getDefaultValue()); } /** * Primitive to model the stack effect of a single instruction, * explicitly specifying the value to be pushed on the stack. * * @param ins the Instruction to model * @param numWordsConsumed number of stack words consumed * @param numWordsProduced number of stack words produced * @param pushValue value to push on the stack */ public void modelInstruction( Instruction ins, int numWordsConsumed, int numWordsProduced, Value pushValue) { if (frame.getStackDepth() < numWordsConsumed) { try { throw new IllegalArgumentException(" asked to pop " + numWordsConsumed + " stack elements but only " + frame.getStackDepth() + " elements remain in " + frame + " while processing " + ins); } catch (Exception e) { throw new IllegalArgumentException(" asked to pop " + numWordsConsumed + " stack elements but only " + frame.getStackDepth() + " elements remain while processing " + ins); } } try { while (numWordsConsumed-- > 0) frame.popValue(); } catch (DataflowAnalysisException e) { throw new InvalidBytecodeException("Not enough values on the stack", e); } while (numWordsProduced-- > 0) frame.pushValue(pushValue); } /* ---------------------------------------------------------------------- * Visit methods for scalar STORE instructions * ---------------------------------------------------------------------- */ public void visitASTORE(ASTORE obj) { handleStoreInstruction(obj); } public void visitDSTORE(DSTORE obj) { handleStoreInstruction(obj); } public void visitFSTORE(FSTORE obj) { handleStoreInstruction(obj); } public void visitISTORE(ISTORE obj) { handleStoreInstruction(obj); } public void visitLSTORE(LSTORE obj) { handleStoreInstruction(obj); } /* ---------------------------------------------------------------------- * Visit methods for scalar LOAD instructions * ---------------------------------------------------------------------- */ public void visitALOAD(ALOAD obj) { handleLoadInstruction(obj); } public void visitDLOAD(DLOAD obj) { handleLoadInstruction(obj); } public void visitFLOAD(FLOAD obj) { handleLoadInstruction(obj); } public void visitILOAD(ILOAD obj) { handleLoadInstruction(obj); } public void visitLLOAD(LLOAD obj) { handleLoadInstruction(obj); } /* ---------------------------------------------------------------------- * Visit methods for POP, DUP, and SWAP instructions * ---------------------------------------------------------------------- */ public void visitPOP(POP obj) { handleNormalInstruction(obj); } public void visitPOP2(POP2 obj) { handleNormalInstruction(obj); } public void visitDUP(DUP obj) { try { Value value = frame.popValue(); frame.pushValue(value); frame.pushValue(value); } catch (DataflowAnalysisException e) { throw new InvalidBytecodeException(e.toString()); } } public void visitDUP_X1(DUP_X1 obj) { try { Value value1 = frame.popValue(); Value value2 = frame.popValue(); frame.pushValue(value1); frame.pushValue(value2); frame.pushValue(value1); } catch (DataflowAnalysisException e) { throw new InvalidBytecodeException(e.toString()); } } public void visitDUP_X2(DUP_X2 obj) { try { Value value1 = frame.popValue(); Value value2 = frame.popValue(); Value value3 = frame.popValue(); frame.pushValue(value1); frame.pushValue(value3); frame.pushValue(value2); frame.pushValue(value1); } catch (DataflowAnalysisException e) { throw new InvalidBytecodeException(e.toString()); } } public void visitDUP2(DUP2 obj) { try { Value value1 = frame.popValue(); Value value2 = frame.popValue(); frame.pushValue(value2); frame.pushValue(value1); frame.pushValue(value2); frame.pushValue(value1); } catch (DataflowAnalysisException e) { throw new InvalidBytecodeException(e.toString()); } } public void visitDUP2_X1(DUP2_X1 obj) { try { Value value1 = frame.popValue(); Value value2 = frame.popValue(); Value value3 = frame.popValue(); frame.pushValue(value2); frame.pushValue(value1); frame.pushValue(value3); frame.pushValue(value2); frame.pushValue(value1); } catch (DataflowAnalysisException e) { throw new InvalidBytecodeException(e.toString()); } } public void visitDUP2_X2(DUP2_X2 obj) { try { Value value1 = frame.popValue(); Value value2 = frame.popValue(); Value value3 = frame.popValue(); Value value4 = frame.popValue(); frame.pushValue(value2); frame.pushValue(value1); frame.pushValue(value4); frame.pushValue(value3); frame.pushValue(value2); frame.pushValue(value1); } catch (DataflowAnalysisException e) { throw new InvalidBytecodeException(e.toString()); } } public void visitSWAP(SWAP obj) { try { Value value1 = frame.popValue(); Value value2 = frame.popValue(); frame.pushValue(value1); frame.pushValue(value2); } catch (DataflowAnalysisException e) { throw new InvalidBytecodeException(e.toString()); } } /* ---------------------------------------------------------------------- * Illegal bytecodes * ---------------------------------------------------------------------- */ public void visitIMPDEP1(IMPDEP1 obj) { illegalBytecode(obj); } public void visitIMPDEP2(IMPDEP2 obj) { illegalBytecode(obj); } public void visitBREAKPOINT(BREAKPOINT obj) { illegalBytecode(obj); } /* ---------------------------------------------------------------------- * Bytecodes that have "default" semantics * ---------------------------------------------------------------------- */ public void visitACONST_NULL(ACONST_NULL obj) { handleNormalInstruction(obj); } public void visitGETSTATIC(GETSTATIC obj) { handleNormalInstruction(obj); } public void visitIF_ICMPLT(IF_ICMPLT obj) { handleNormalInstruction(obj); } public void visitMONITOREXIT(MONITOREXIT obj) { handleNormalInstruction(obj); } public void visitIFLT(IFLT obj) { handleNormalInstruction(obj); } public void visitBASTORE(BASTORE obj) { handleNormalInstruction(obj); } public void visitCHECKCAST(CHECKCAST obj) { handleNormalInstruction(obj); } public void visitFCMPG(FCMPG obj) { handleNormalInstruction(obj); } public void visitI2F(I2F obj) { handleNormalInstruction(obj); } public void visitATHROW(ATHROW obj) { handleNormalInstruction(obj); } public void visitDCMPL(DCMPL obj) { handleNormalInstruction(obj); } public void visitARRAYLENGTH(ARRAYLENGTH obj) { handleNormalInstruction(obj); } public void visitINVOKESTATIC(INVOKESTATIC obj) { handleNormalInstruction(obj); } public void visitLCONST(LCONST obj) { handleNormalInstruction(obj); } public void visitDREM(DREM obj) { handleNormalInstruction(obj); } public void visitIFGE(IFGE obj) { handleNormalInstruction(obj); } public void visitCALOAD(CALOAD obj) { handleNormalInstruction(obj); } public void visitLASTORE(LASTORE obj) { handleNormalInstruction(obj); } public void visitI2D(I2D obj) { handleNormalInstruction(obj); } public void visitDADD(DADD obj) { handleNormalInstruction(obj); } public void visitINVOKESPECIAL(INVOKESPECIAL obj) { handleNormalInstruction(obj); } public void visitIAND(IAND obj) { handleNormalInstruction(obj); } public void visitPUTFIELD(PUTFIELD obj) { handleNormalInstruction(obj); } public void visitDCONST(DCONST obj) { handleNormalInstruction(obj); } public void visitNEW(NEW obj) { handleNormalInstruction(obj); } public void visitIFNULL(IFNULL obj) { handleNormalInstruction(obj); } public void visitLSUB(LSUB obj) { handleNormalInstruction(obj); } public void visitL2I(L2I obj) { handleNormalInstruction(obj); } public void visitISHR(ISHR obj) { handleNormalInstruction(obj); } public void visitTABLESWITCH(TABLESWITCH obj) { handleNormalInstruction(obj); } public void visitIINC(IINC obj) { handleNormalInstruction(obj); } public void visitDRETURN(DRETURN obj) { handleNormalInstruction(obj); } public void visitDASTORE(DASTORE obj) { handleNormalInstruction(obj); } public void visitIALOAD(IALOAD obj) { handleNormalInstruction(obj); } public void visitDDIV(DDIV obj) { handleNormalInstruction(obj); } public void visitIF_ICMPGE(IF_ICMPGE obj) { handleNormalInstruction(obj); } public void visitLAND(LAND obj) { handleNormalInstruction(obj); } public void visitIDIV(IDIV obj) { handleNormalInstruction(obj); } public void visitLOR(LOR obj) { handleNormalInstruction(obj); } public void visitCASTORE(CASTORE obj) { handleNormalInstruction(obj); } public void visitFREM(FREM obj) { handleNormalInstruction(obj); } public void visitLDC(LDC obj) { handleNormalInstruction(obj); } public void visitBIPUSH(BIPUSH obj) { handleNormalInstruction(obj); } public void visitF2L(F2L obj) { handleNormalInstruction(obj); } public void visitFMUL(FMUL obj) { handleNormalInstruction(obj); } public void visitJSR(JSR obj) { handleNormalInstruction(obj); } public void visitFSUB(FSUB obj) { handleNormalInstruction(obj); } public void visitSASTORE(SASTORE obj) { handleNormalInstruction(obj); } public void visitRETURN(RETURN obj) { handleNormalInstruction(obj); } public void visitDALOAD(DALOAD obj) { handleNormalInstruction(obj); } public void visitSIPUSH(SIPUSH obj) { handleNormalInstruction(obj); } public void visitDSUB(DSUB obj) { handleNormalInstruction(obj); } public void visitL2F(L2F obj) { handleNormalInstruction(obj); } public void visitIF_ICMPGT(IF_ICMPGT obj) { handleNormalInstruction(obj); } public void visitF2D(F2D obj) { handleNormalInstruction(obj); } public void visitI2L(I2L obj) { handleNormalInstruction(obj); } public void visitIF_ACMPNE(IF_ACMPNE obj) { handleNormalInstruction(obj); } public void visitI2S(I2S obj) { handleNormalInstruction(obj); } public void visitIFEQ(IFEQ obj) { handleNormalInstruction(obj); } public void visitIOR(IOR obj) { handleNormalInstruction(obj); } public void visitIREM(IREM obj) { handleNormalInstruction(obj); } public void visitIASTORE(IASTORE obj) { handleNormalInstruction(obj); } public void visitNEWARRAY(NEWARRAY obj) { handleNormalInstruction(obj); } public void visitINVOKEINTERFACE(INVOKEINTERFACE obj) { handleNormalInstruction(obj); } public void visitINEG(INEG obj) { handleNormalInstruction(obj); } public void visitLCMP(LCMP obj) { handleNormalInstruction(obj); } public void visitJSR_W(JSR_W obj) { handleNormalInstruction(obj); } public void visitMULTIANEWARRAY(MULTIANEWARRAY obj) { handleNormalInstruction(obj); } public void visitSALOAD(SALOAD obj) { handleNormalInstruction(obj); } public void visitIFNONNULL(IFNONNULL obj) { handleNormalInstruction(obj); } public void visitDMUL(DMUL obj) { handleNormalInstruction(obj); } public void visitIFNE(IFNE obj) { handleNormalInstruction(obj); } public void visitIF_ICMPLE(IF_ICMPLE obj) { handleNormalInstruction(obj); } public void visitLDC2_W(LDC2_W obj) { handleNormalInstruction(obj); } public void visitGETFIELD(GETFIELD obj) { handleNormalInstruction(obj); } public void visitLADD(LADD obj) { handleNormalInstruction(obj); } public void visitNOP(NOP obj) { handleNormalInstruction(obj); } public void visitFALOAD(FALOAD obj) { handleNormalInstruction(obj); } public void visitINSTANCEOF(INSTANCEOF obj) { handleNormalInstruction(obj); } public void visitIFLE(IFLE obj) { handleNormalInstruction(obj); } public void visitLXOR(LXOR obj) { handleNormalInstruction(obj); } public void visitLRETURN(LRETURN obj) { handleNormalInstruction(obj); } public void visitFCONST(FCONST obj) { handleNormalInstruction(obj); } public void visitIUSHR(IUSHR obj) { handleNormalInstruction(obj); } public void visitBALOAD(BALOAD obj) { handleNormalInstruction(obj); } public void visitIF_ACMPEQ(IF_ACMPEQ obj) { handleNormalInstruction(obj); } public void visitMONITORENTER(MONITORENTER obj) { handleNormalInstruction(obj); } public void visitLSHL(LSHL obj) { handleNormalInstruction(obj); } public void visitDCMPG(DCMPG obj) { handleNormalInstruction(obj); } public void visitD2L(D2L obj) { handleNormalInstruction(obj); } public void visitL2D(L2D obj) { handleNormalInstruction(obj); } public void visitRET(RET obj) { handleNormalInstruction(obj); } public void visitIFGT(IFGT obj) { handleNormalInstruction(obj); } public void visitIXOR(IXOR obj) { handleNormalInstruction(obj); } public void visitINVOKEVIRTUAL(INVOKEVIRTUAL obj) { handleNormalInstruction(obj); } public void visitFASTORE(FASTORE obj) { handleNormalInstruction(obj); } public void visitIRETURN(IRETURN obj) { handleNormalInstruction(obj); } public void visitIF_ICMPNE(IF_ICMPNE obj) { handleNormalInstruction(obj); } public void visitLDIV(LDIV obj) { handleNormalInstruction(obj); } public void visitPUTSTATIC(PUTSTATIC obj) { handleNormalInstruction(obj); } public void visitAALOAD(AALOAD obj) { handleNormalInstruction(obj); } public void visitD2I(D2I obj) { handleNormalInstruction(obj); } public void visitIF_ICMPEQ(IF_ICMPEQ obj) { handleNormalInstruction(obj); } public void visitAASTORE(AASTORE obj) { handleNormalInstruction(obj); } public void visitARETURN(ARETURN obj) { handleNormalInstruction(obj); } public void visitFNEG(FNEG obj) { handleNormalInstruction(obj); } public void visitGOTO_W(GOTO_W obj) { handleNormalInstruction(obj); } public void visitD2F(D2F obj) { handleNormalInstruction(obj); } public void visitGOTO(GOTO obj) { handleNormalInstruction(obj); } public void visitISUB(ISUB obj) { handleNormalInstruction(obj); } public void visitF2I(F2I obj) { handleNormalInstruction(obj); } public void visitDNEG(DNEG obj) { handleNormalInstruction(obj); } public void visitICONST(ICONST obj) { handleNormalInstruction(obj); } public void visitFDIV(FDIV obj) { handleNormalInstruction(obj); } public void visitI2B(I2B obj) { handleNormalInstruction(obj); } public void visitLNEG(LNEG obj) { handleNormalInstruction(obj); } public void visitLREM(LREM obj) { handleNormalInstruction(obj); } public void visitIMUL(IMUL obj) { handleNormalInstruction(obj); } public void visitIADD(IADD obj) { handleNormalInstruction(obj); } public void visitLSHR(LSHR obj) { handleNormalInstruction(obj); } public void visitLOOKUPSWITCH(LOOKUPSWITCH obj) { handleNormalInstruction(obj); } public void visitFCMPL(FCMPL obj) { handleNormalInstruction(obj); } public void visitI2C(I2C obj) { handleNormalInstruction(obj); } public void visitLMUL(LMUL obj) { handleNormalInstruction(obj); } public void visitLUSHR(LUSHR obj) { handleNormalInstruction(obj); } public void visitISHL(ISHL obj) { handleNormalInstruction(obj); } public void visitLALOAD(LALOAD obj) { handleNormalInstruction(obj); } public void visitANEWARRAY(ANEWARRAY obj) { handleNormalInstruction(obj); } public void visitFRETURN(FRETURN obj) { handleNormalInstruction(obj); } public void visitFADD(FADD obj) { handleNormalInstruction(obj); } } // vim:ts=4

The table below shows all metrics for AbstractFrameModelingVisitor.java.

MetricValueDescription
BLOCKS219.00Number of blocks
BLOCK_COMMENT39.00Number of block comment lines
COMMENTS152.00Comment lines
COMMENT_DENSITY 0.32Comment density
COMPARISONS12.00Number of comparison operators
CYCLOMATIC214.00Cyclomatic complexity
DECL_COMMENTS25.00Comments in declarations
DOC_COMMENT107.00Number of javadoc comment lines
ELOC473.00Effective lines of code
EXEC_COMMENTS 2.00Comments in executable code
EXITS21.00Procedure exits
FUNCTIONS195.00Number of function declarations
HALSTEAD_DIFFICULTY33.89Halstead difficulty
HALSTEAD_EFFORT 0.00Halstead effort
INTERFACE_COMPLEXITY405.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 0.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 1.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
JAVA0034 4.00JAVA0034 Missing braces in if statement
JAVA0035 0.00JAVA0035 Missing braces in for statement
JAVA0036 2.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 0.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 0.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 0.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 0.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 0.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 6.00JAVA0108 Incorrect javadoc: no @param tag for 'parameter'
JAVA0109 0.00JAVA0109 Incorrect javadoc: no parameter 'parameter'
JAVA0110 4.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
JAVA0115 0.00JAVA0115 Incorrect javadoc: no @throws or @exception tag for 'exception'
JAVA0116 0.00JAVA0116 Missing javadoc: field 'field'
JAVA0117 0.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 1.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 0.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 2.00JAVA0144 Line exceeds maximum M characters
JAVA01451172.00JAVA0145 Tab character used in source file
JAVA0150 0.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 0.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 1.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 0.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 0.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 0.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()
JAVA0266 2.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
LINES1045.00Number of lines in the source file
LINE_COMMENT 6.00Number of line comments
LOC682.00Lines of code
LOGICAL_LINES238.00Number of statements
LOOPS 4.00Number of loops
NEST_DEPTH 3.00Maximum nesting depth
OPERANDS1233.00Number of operands
OPERATORS2232.00Number of operators
PARAMS197.00Number of formal parameter declarations
PROGRAM_LENGTH3465.00Halstead program length
PROGRAM_VOCAB710.00Halstead program vocabulary
PROGRAM_VOLUME 0.00Halstead program volume
RETURNS208.00Number of return points from functions
SIZE24597.00Size of the file in bytes
UNIQUE_OPERANDS673.00Number of unique operands
UNIQUE_OPERATORS37.00Number of unique operators
WHITESPACE211.00Number of whitespace lines