switch (state) { case SEEN_NOTHING: if ((seen == NEW) && "java/lang/StringBuffer".equals(getClassConstantOperand())) { state = SEEN_NEW; createPC = getPC(); } break;  case SEEN_NEW: if (seen == DUP) state = SEEN_DUP; else reset(); break;  case SEEN_DUP: if ((seen == INVOKESPECIAL) &&  ("<init>".equals(getNameConstantOperand())) &&	("java/lang/StringBuffer".equals(getClassConstantOperand()))) {  if ("()V".equals(getSigConstantOperand())) { state = SEEN_INVOKESPECIAL; } else if ("(Ljava/lang/String;)V".equals(getSigConstantOperand())) {   state = SEEN_INVOKESPECIAL; appendPC = getPC(); } else { reset(); } } else reset(); break;  case SEEN_INVOKESPECIAL: if ((seen == ASTORE_0) ||  (seen == ASTORE_1) ||  (seen == ASTORE_2) ||  (seen == ASTORE_3) ||  (seen == ASTORE)) { reset(); break; } else state = POSSIBLE_CASE;   case POSSIBLE_CASE: if ((seen == GOTO) && (appendPC >= 0)) { if (getBranchTarget() < getPC() &&	getBranchTarget() < createPC &&	getBranchTarget() < appendPC) { bugReporter.reportBug(new BugInstance("SBSC_USE_STRINGBUFFER_CONCATENATION", NORMAL_PRIORITY) .addClassAndMethod(this) .addSourceLine(this, appendPC)); } reset(); } else if (seen == INVOKEVIRTUAL) {
if (reportedThisMethod) return; int oldState = state; if (DEBUG) System.out.println("Opcode: " + OPCODE_NAMES[seen]); switch (state) { case SEEN_NOTHING: if ((seen == NEW) && getClassConstantOperand().startsWith("java/lang/StringBu")) { state = SEEN_NEW; createPC = getPC(); } break;
	public void sawOpcode(int seen) {		switch (state)		{		case SEEN_NOTHING:			if ((seen == NEW) && "java/lang/StringBuffer".equals(getClassConstantOperand())) {				state = SEEN_NEW;				createPC = getPC();			}			break;				case SEEN_NEW:			if (seen == DUP)				state = SEEN_DUP;			else				reset();			break;				case SEEN_DUP:			if ((seen == INVOKESPECIAL) 			&&  ("<init>".equals(getNameConstantOperand()))			&&	("java/lang/StringBuffer".equals(getClassConstantOperand()))) {				// A StringBuffer is being constructed				if ("()V".equals(getSigConstantOperand())) {					state = SEEN_INVOKESPECIAL;				} else if ("(Ljava/lang/String;)V".equals(getSigConstantOperand())) {					// The StringBuffer constructor can start with the					// value of an existing string.					state = SEEN_INVOKESPECIAL;					appendPC = getPC();				} else {					reset();				}			} else				reset();			break;				case SEEN_INVOKESPECIAL:			if ((seen == ASTORE_0)			||  (seen == ASTORE_1)			||  (seen == ASTORE_2)			||  (seen == ASTORE_3)			||  (seen == ASTORE)) {				reset();				break;			} else				state = POSSIBLE_CASE;			// FALL THROUGH						case POSSIBLE_CASE:			if ((seen == GOTO) && (appendPC >= 0)) {				if (getBranchTarget() < getPC()				&&	getBranchTarget() < createPC				&&	getBranchTarget() < appendPC) {					bugReporter.reportBug(new BugInstance("SBSC_USE_STRINGBUFFER_CONCATENATION", NORMAL_PRIORITY)						.addClassAndMethod(this)						.addSourceLine(this, appendPC));				}				reset();			}			else if (seen == INVOKEVIRTUAL) {				if ("append".equals(getNameConstantOperand())				&&	"(Ljava/lang/String;)Ljava/lang/StringBuffer;".equals(getSigConstantOperand())) {					appendPC = getPC();				} else if ("Ljava/lang/StringBuffer;".equals(getClassConstantOperand())				&&	"toString".equals(getNameConstantOperand())				&&	"()Ljava/lang/String;".equals(getSigConstantOperand())) {					// The StringBuffer appears to be consumed in the loop.					// In the pattern we're looking for, the StringBuffer					// is consumed AFTER the exit from the loop.					reset();				}			} else if ((seen == NEW) && "java/lang/StringBuffer".equals(getClassConstantOperand())) {				reset();				state = SEEN_NEW;			}							break;							default:			reset();			break;		}	}