switch (seen) { case IFNONNULL: case IFNULL: stage1 = 3; break; case ICONST_1: if (stage1 != 3) stage1 = 1; else stage1 = 0; break; case GOTO: if (stage1 == 1) stage1 = 2; else stage1 = 0; break; case ICONST_0: if (stage1 == 2) { distance = 0;  } stage1 = 0; break; case INVOKEINTERFACE: case INVOKEVIRTUAL: case INVOKESPECIAL: case INVOKESTATIC: String sig = getSigConstantOperand(); if (sig.endsWith(")Z")) distance = 0; stage1 = 0; break; default: stage1 = 0; } switch (seen) { case IAND: case IOR:   if (distance < 4) { operator = seen;  stage2 = 1; } else stage2 = 0; break; case IFEQ: case IFNE: if (stage2 == 1) {  bugReporter.reportBug(new BugInstance(this, "NS_NON_SHORT_CIRCUIT", NORMAL_PRIORITY) .addClassAndMethod(this) .addSourceLine(this, getPC())); } stage2 = 0; break; case PUTFIELD: case PUTSTATIC: case IRETURN: if (operator == IAND && stage2 == 1) {  bugReporter.reportBug(new BugInstance(this, "NS_NON_SHORT_CIRCUIT", NORMAL_PRIORITY) .addClassAndMethod(this) .addSourceLine(this, getPC())); } stage2 = 0; break; default: stage2 = 0; break; }
scanForBooleanValue(seen); scanForDanger(seen); scanForShortCircuit(seen);
         public void sawOpcode(int seen) {		/* prototype for short-circuit bug */		distance++;		switch (seen) {		case IFNONNULL:		case IFNULL:			stage1 = 3;			break;		case ICONST_1:			if (stage1 != 3)				stage1 = 1;			else stage1 = 0;			break;		case GOTO:			if (stage1 == 1)				stage1 = 2;			else				stage1 = 0;			break;		case ICONST_0:			if (stage1 == 2) {				distance = 0;				// System.out.println("saw 1; goto X; 0");			}			stage1 = 0;			break;		case INVOKEINTERFACE:		case INVOKEVIRTUAL:		case INVOKESPECIAL:		case INVOKESTATIC:			String sig = getSigConstantOperand();			if (sig.endsWith(")Z"))					distance = 0;			stage1 = 0;			break;		default:			stage1 = 0;		}		switch (seen) {		case IAND:		case IOR:			// System.out.println("Saw IOR or IAND at distance " + distance);			if (distance < 4) {				operator = seen;				//distance2 = distance;				stage2 = 1;			} else				stage2 = 0;			break;		case IFEQ:		case IFNE:			if (stage2 == 1) {				// System.out.println("Found nsc");				bugReporter.reportBug(new BugInstance(this, "NS_NON_SHORT_CIRCUIT",				        NORMAL_PRIORITY)				        .addClassAndMethod(this)				        .addSourceLine(this, getPC()));			}			stage2 = 0;			break;		case PUTFIELD:		case PUTSTATIC:		case IRETURN:			if (operator == IAND && stage2 == 1) {				// System.out.println("Found nsc");				bugReporter.reportBug(new BugInstance(this, "NS_NON_SHORT_CIRCUIT",				        NORMAL_PRIORITY)				        .addClassAndMethod(this)				        .addSourceLine(this, getPC()));			}			stage2 = 0;			break;		default:			stage2 = 0;			break;		}	}