void (Class<? extends Trap> aClass) { if (!aClass.isInstance(myTrapStack.getHead())) { throw new IllegalStateException("Unexpected trap-stack head (wanted: "+aClass.getSimpleName()+"); stack: "+myTrapStack); } myTrapStack = myTrapStack.getTail(); }