Buggy code:
public abstract class MarkupContainer extends Component { private static final long serialVersionUID = 1L ; private static final Log log = LogFactory . getLog ( MarkupContainer . class ) ; private Object children ; private transient MarkupStream markupStream ; public MarkupContainer ( final String id ) { } public MarkupContainer ( final String id , IModel model ) { } public final MarkupContainer add ( final Component child ) { } public final MarkupContainer addOrReplace ( final Component child ) { } public final boolean autoAdd ( final Component component ) { } public final boolean contains ( final Component component , final boolean recurse ) { } public final Component get ( final String path ) { } public final MarkupStream getAssociatedMarkupStream ( final boolean throwException ) { } public final MarkupStream getMarkupStream ( ) { } public String getMarkupType ( ) { } public void internalAdd ( final Component child ) { } public boolean isTransparentResolver ( ) { } public final Iterator iterator ( ) { } public final Iterator iterator ( Comparator comparator ) { } public final IResourceStream newMarkupResourceStream ( Class containerClass ) { } public void remove ( final Component component ) { } public final void remove ( final String id ) { } public final void removeAll ( ) { } public final void renderAssociatedMarkup ( final String openTagName , final String exceptionMessage ) { } public final MarkupContainer replace ( final Component child ) { } public Component setModel ( final IModel model ) { <START_BUG> final IModel previous = getModel ( ) ; <END_BUG> super . setModel ( model ) ; if ( previous instanceof IComponentInheritedModel ) { visitChildren ( new IVisitor ( ) { public Object component ( Component component ) { IModel compModel = component . getModel ( ) ; if ( compModel instanceof IWrapModel ) { compModel = ( ( IWrapModel ) ( compModel ) ) . getWrappedModel ( ) ; } if ( compModel == previous ) { component . setModel ( null ) ; } else if ( compModel == model ) { component . modelChanged ( ) ; } return IVisitor . CONTINUE_TRAVERSAL ; } } ) ; } return this ; } public final int size ( ) { } public String toString ( ) { } public String toString ( final boolean detailed ) { } public final Object visitChildren ( final Class clazz , final IVisitor visitor ) { } public final Object visitChildren ( final IVisitor visitor ) { } private final void addedComponent ( final Component component ) { } private final void children_add ( final Component child ) { } private final Component children_get ( int index ) { } private final Component children_get ( final String id ) { } private final int children_indexOf ( Component child ) { } private final Component children_remove ( Component component ) { } private final Component children_remove ( int index ) { } private final Component children_set ( int index , Component child ) { } private final int children_size ( ) { } private final Component put ( final Component child ) { } private final void removedComponent ( final Component component ) { } private final void renderNext ( final MarkupStream markupStream ) { } protected final MarkupStream findMarkupStream ( ) { } protected void onComponentTagBody ( final MarkupStream markupStream , final ComponentTag openTag ) { } protected void onRender ( final MarkupStream markupStream ) { } protected void renderAll ( final MarkupStream markupStream ) { } protected final void renderComponentTagBody ( final MarkupStream markupStream , final ComponentTag openTag ) { } protected final void setMarkupStream ( final MarkupStream markupStream ) { } void attachChildren ( ) { } void detachChildren ( ) { } final boolean hasAssociatedMarkup ( ) { } }

Fix:
final IModel previous = this . model ;