Package org.apache.bcel.util
Class BCELFactory
- java.lang.Object
-
- org.apache.bcel.generic.EmptyVisitor
-
- org.apache.bcel.util.BCELFactory
-
- All Implemented Interfaces:
Visitor
final class BCELFactory extends EmptyVisitor
Factory creates il.append() statements, and sets instruction targets. A helper class for BCELifier.- See Also:
BCELifier
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<BranchInstruction>branchesprivate java.util.Map<Instruction,InstructionHandle>branchMapprivate static java.lang.StringCONSTANT_PREFIXprivate ConstantPoolGenconstantPoolGenprivate MethodGenmethodGenprivate java.io.PrintWriterprintWriter
-
Constructor Summary
Constructors Constructor Description BCELFactory(MethodGen mg, java.io.PrintWriter out)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcreateConstant(java.lang.Object value)voidstart()private voidupdateBranchTargets()private voidupdateExceptionHandlers()voidvisitAllocationInstruction(AllocationInstruction i)Visits an AllocationInstruction.voidvisitArrayInstruction(ArrayInstruction i)Visits an ArrayInstruction.voidvisitBranchInstruction(BranchInstruction bi)Visits a BranchInstruction.voidvisitCHECKCAST(CHECKCAST i)Visits a CHECKCAST instruction.voidvisitConstantPushInstruction(ConstantPushInstruction i)Visits a ConstantPushInstruction.voidvisitFieldInstruction(FieldInstruction i)Visits a FieldInstruction.voidvisitINSTANCEOF(INSTANCEOF i)Visits an INSTANCEOF instruction.private booleanvisitInstruction(Instruction i)voidvisitInvokeInstruction(InvokeInstruction i)Visits an InvokeInstruction.voidvisitLDC(LDC i)Visits an LDC instruction.voidvisitLDC2_W(LDC2_W i)Visits an LDC2_W instruction.voidvisitLocalVariableInstruction(LocalVariableInstruction i)Visits a LocalVariableInstruction.voidvisitRET(RET i)Visits a RET instruction.voidvisitReturnInstruction(ReturnInstruction i)Visits a ReturnInstruction.-
Methods inherited from class org.apache.bcel.generic.EmptyVisitor
visitAALOAD, visitAASTORE, visitACONST_NULL, visitALOAD, visitANEWARRAY, visitARETURN, visitArithmeticInstruction, visitARRAYLENGTH, visitASTORE, visitATHROW, visitBALOAD, visitBASTORE, visitBIPUSH, visitBREAKPOINT, visitCALOAD, visitCASTORE, visitConversionInstruction, visitCPInstruction, visitD2F, visitD2I, visitD2L, visitDADD, visitDALOAD, visitDASTORE, visitDCMPG, visitDCMPL, visitDCONST, visitDDIV, visitDLOAD, visitDMUL, visitDNEG, visitDREM, visitDRETURN, visitDSTORE, visitDSUB, visitDUP, visitDUP_X1, visitDUP_X2, visitDUP2, visitDUP2_X1, visitDUP2_X2, visitExceptionThrower, visitF2D, visitF2I, visitF2L, visitFADD, visitFALOAD, visitFASTORE, visitFCMPG, visitFCMPL, visitFCONST, visitFDIV, visitFieldOrMethod, visitFLOAD, visitFMUL, visitFNEG, visitFREM, visitFRETURN, visitFSTORE, visitFSUB, visitGETFIELD, visitGETSTATIC, visitGOTO, visitGOTO_W, visitGotoInstruction, visitI2B, visitI2C, visitI2D, visitI2F, visitI2L, visitI2S, visitIADD, visitIALOAD, visitIAND, visitIASTORE, visitICONST, visitIDIV, visitIF_ACMPEQ, visitIF_ACMPNE, visitIF_ICMPEQ, visitIF_ICMPGE, visitIF_ICMPGT, visitIF_ICMPLE, visitIF_ICMPLT, visitIF_ICMPNE, visitIFEQ, visitIFGE, visitIFGT, visitIfInstruction, visitIFLE, visitIFLT, visitIFNE, visitIFNONNULL, visitIFNULL, visitIINC, visitILOAD, visitIMPDEP1, visitIMPDEP2, visitIMUL, visitINEG, visitINVOKEDYNAMIC, visitINVOKEINTERFACE, visitINVOKESPECIAL, visitINVOKESTATIC, visitINVOKEVIRTUAL, visitIOR, visitIREM, visitIRETURN, visitISHL, visitISHR, visitISTORE, visitISUB, visitIUSHR, visitIXOR, visitJSR, visitJSR_W, visitJsrInstruction, visitL2D, visitL2F, visitL2I, visitLADD, visitLALOAD, visitLAND, visitLASTORE, visitLCMP, visitLCONST, visitLDIV, visitLLOAD, visitLMUL, visitLNEG, visitLoadClass, visitLoadInstruction, visitLOOKUPSWITCH, visitLOR, visitLREM, visitLRETURN, visitLSHL, visitLSHR, visitLSTORE, visitLSUB, visitLUSHR, visitLXOR, visitMONITORENTER, visitMONITOREXIT, visitMULTIANEWARRAY, visitNEW, visitNEWARRAY, visitNOP, visitPOP, visitPOP2, visitPopInstruction, visitPushInstruction, visitPUTFIELD, visitPUTSTATIC, visitRETURN, visitSALOAD, visitSASTORE, visitSelect, visitSIPUSH, visitStackConsumer, visitStackInstruction, visitStackProducer, visitStoreInstruction, visitSWAP, visitTABLESWITCH, visitTypedInstruction, visitUnconditionalBranch, visitVariableLengthInstruction
-
-
-
-
Field Detail
-
CONSTANT_PREFIX
private static final java.lang.String CONSTANT_PREFIX
-
methodGen
private final MethodGen methodGen
-
printWriter
private final java.io.PrintWriter printWriter
-
constantPoolGen
private final ConstantPoolGen constantPoolGen
-
branchMap
private final java.util.Map<Instruction,InstructionHandle> branchMap
-
branches
private final java.util.List<BranchInstruction> branches
-
-
Constructor Detail
-
BCELFactory
BCELFactory(MethodGen mg, java.io.PrintWriter out)
-
-
Method Detail
-
createConstant
private void createConstant(java.lang.Object value)
-
start
public void start()
-
updateBranchTargets
private void updateBranchTargets()
-
updateExceptionHandlers
private void updateExceptionHandlers()
-
visitAllocationInstruction
public void visitAllocationInstruction(AllocationInstruction i)
Description copied from interface:VisitorVisits an AllocationInstruction.- Specified by:
visitAllocationInstructionin interfaceVisitor- Overrides:
visitAllocationInstructionin classEmptyVisitor- Parameters:
i- the instruction.
-
visitArrayInstruction
public void visitArrayInstruction(ArrayInstruction i)
Description copied from interface:VisitorVisits an ArrayInstruction.- Specified by:
visitArrayInstructionin interfaceVisitor- Overrides:
visitArrayInstructionin classEmptyVisitor- Parameters:
i- the instruction.
-
visitBranchInstruction
public void visitBranchInstruction(BranchInstruction bi)
Description copied from interface:VisitorVisits a BranchInstruction.- Specified by:
visitBranchInstructionin interfaceVisitor- Overrides:
visitBranchInstructionin classEmptyVisitor- Parameters:
bi- the instruction.
-
visitCHECKCAST
public void visitCHECKCAST(CHECKCAST i)
Description copied from interface:VisitorVisits a CHECKCAST instruction.- Specified by:
visitCHECKCASTin interfaceVisitor- Overrides:
visitCHECKCASTin classEmptyVisitor- Parameters:
i- the instruction.
-
visitConstantPushInstruction
public void visitConstantPushInstruction(ConstantPushInstruction i)
Description copied from interface:VisitorVisits a ConstantPushInstruction.- Specified by:
visitConstantPushInstructionin interfaceVisitor- Overrides:
visitConstantPushInstructionin classEmptyVisitor- Parameters:
i- the instruction.
-
visitFieldInstruction
public void visitFieldInstruction(FieldInstruction i)
Description copied from interface:VisitorVisits a FieldInstruction.- Specified by:
visitFieldInstructionin interfaceVisitor- Overrides:
visitFieldInstructionin classEmptyVisitor- Parameters:
i- the instruction.
-
visitINSTANCEOF
public void visitINSTANCEOF(INSTANCEOF i)
Description copied from interface:VisitorVisits an INSTANCEOF instruction.- Specified by:
visitINSTANCEOFin interfaceVisitor- Overrides:
visitINSTANCEOFin classEmptyVisitor- Parameters:
i- the instruction.
-
visitInstruction
private boolean visitInstruction(Instruction i)
-
visitInvokeInstruction
public void visitInvokeInstruction(InvokeInstruction i)
Description copied from interface:VisitorVisits an InvokeInstruction.- Specified by:
visitInvokeInstructionin interfaceVisitor- Overrides:
visitInvokeInstructionin classEmptyVisitor- Parameters:
i- the instruction.
-
visitLDC
public void visitLDC(LDC i)
Description copied from interface:VisitorVisits an LDC instruction.- Specified by:
visitLDCin interfaceVisitor- Overrides:
visitLDCin classEmptyVisitor- Parameters:
i- the instruction.
-
visitLDC2_W
public void visitLDC2_W(LDC2_W i)
Description copied from interface:VisitorVisits an LDC2_W instruction.- Specified by:
visitLDC2_Win interfaceVisitor- Overrides:
visitLDC2_Win classEmptyVisitor- Parameters:
i- the instruction.
-
visitLocalVariableInstruction
public void visitLocalVariableInstruction(LocalVariableInstruction i)
Description copied from interface:VisitorVisits a LocalVariableInstruction.- Specified by:
visitLocalVariableInstructionin interfaceVisitor- Overrides:
visitLocalVariableInstructionin classEmptyVisitor- Parameters:
i- the instruction.
-
visitRET
public void visitRET(RET i)
Description copied from interface:VisitorVisits a RET instruction.- Specified by:
visitRETin interfaceVisitor- Overrides:
visitRETin classEmptyVisitor- Parameters:
i- the instruction.
-
visitReturnInstruction
public void visitReturnInstruction(ReturnInstruction i)
Description copied from interface:VisitorVisits a ReturnInstruction.- Specified by:
visitReturnInstructionin interfaceVisitor- Overrides:
visitReturnInstructionin classEmptyVisitor- Parameters:
i- the instruction.
-
-