try { JavaClass toClass = Repository.lookupClass(toDot); JavaClass signatureClass = Repository.lookupClass(signatureDot); if  ( !castTo.contains(to) && !Repository.instanceOf( signatureClass, toClass)) { if ( !Repository.instanceOf( toClass, signatureClass) && ( (!toClass.isInterface() && !signatureClass.isInterface()) || signatureClass.isFinal() || toClass.isFinal() )) bugReporter.reportBug(new BugInstance(this, "BC_IMPOSSIBLE_CAST", HIGH_PRIORITY) .addClassAndMethod(this) .addSourceLine(this) .addClass(signatureDot) .addClass(toDot)); else { int priority = NORMAL_PRIORITY; if (DEBUG)  { System.out.println("Checking BC in " + getFullyQualifiedMethodName()); System.out.println("to class: " + toClass); System.out.println("from class: " + signatureClass); System.out.println("instanceof : " + Repository.instanceOf( toClass, signatureClass)) ; } if (Repository.instanceOf( toClass, signatureClass)) priority+=2; if (getThisClass().equals(toClass) || getThisClass().equals(signatureClass)) priority+=1; if (DEBUG) System.out.println(" priority: " + priority); if (toClass.isInterface()) priority++; if (DEBUG) System.out.println(" priority: " + priority); if (signatureClass.isInterface() || signatureClass.isAbstract()) priority++; if (DEBUG) System.out.println(" priority: " + priority); if (abstractCollectionClasses.contains(to)) priority--; if (DEBUG) System.out.println(" priority: " + priority); int reg = it.getRegisterNumber(); if (reg >= 0 && reg < parameters && getMethod().isPublic()) priority--; if (DEBUG) System.out.println(" priority: " + priority); if (priority < HIGH_PRIORITY) priority = HIGH_PRIORITY; if (priority <= LOW_PRIORITY) bugReporter.reportBug(new BugInstance(this, "BC_UNCONFIRMED_CAST", priority) .addClassAndMethod(this) .addSourceLine(this) .addClass(signatureDot) .addClass(toDot)); }  }   } catch (Exception e) { }
	public void sawOpcode(int seen) {		if (stack.getStackDepth() > 0) {		if (seen == CHECKCAST) {		OpcodeStack.Item it = stack.getStackItem(0);		String signature = it.getSignature();		String to = getClassConstantOperand();		if (signature.length() > 0 && signature.charAt(0) == 'L')			signature = signature.substring(1,signature.length()-1);		if (signature.length() > 0 			&& !signature.equals("java/lang/Object") 			&& !signature.equals(to)			&& doNotDowncastTo.contains(to)					&& !castTo.contains(to)) {  bugReporter.reportBug(new BugInstance(this, "BC_BAD_CAST_TO_CONCRETE_COLLECTION", NORMAL_PRIORITY)                                .addClassAndMethod(this)                                .addSourceLine(this)                                .addClass(signature.replace('/','.'))                                .addClass(to.replace('/','.'))				);			}		}		else if (seen == INSTANCEOF) {			String to = getClassConstantOperand();			castTo.add(to);			}		}		stack.sawOpcode(this,seen);	}