Buggy code:
public final String getString ( final String key ) { } public final String getString ( final String key , final IModel model ) { } public final String getString ( final String key , final IModel model , final String defaultValue ) { } public final String getStyle ( ) { } public String getVariation ( ) { } public final boolean hasErrorMessage ( ) { } public final boolean hasFeedbackMessage ( ) { } public final void info ( final String message ) { } public final boolean isActionAuthorized ( Action action ) { } public final boolean isAncestorOf ( final Component component ) { } public boolean isEnabled ( ) { } public boolean isVersioned ( ) { } public boolean isVisible ( ) { } public final boolean isVisibleInHierarchy ( ) { } public final void modelChanged ( ) { } public final void modelChanging ( ) { } public final Page newPage ( final Class c ) { } public final Page newPage ( final Class c , final PageParameters parameters ) { } public final void redirectToInterceptPage ( final Page page ) { } public final void remove ( ) { } public final void render ( ) { } public final void render ( final MarkupStream markupStream ) { } public final void renderComponent ( final MarkupStream markupStream ) { } public void renderHead ( final HtmlHeaderContainer container ) { } public final void rendered ( ) { } public final boolean sameRootModel ( final Component component ) { } public final boolean sameRootModel ( final IModel model ) { } public final Component setEnabled ( final boolean enabled ) { } public final Component setEscapeModelStrings ( final boolean escapeMarkup ) { } public final void setMetaData ( final MetaDataKey key , final Serializable object ) { } public Component setModel ( final IModel model ) { } public final Component setModelObject ( final Object object ) { } public final Component setOutputMarkupId ( final boolean output ) { } public final void setRedirect ( final boolean redirect ) { } public final Component setRenderBodyOnly ( final boolean renderTag ) { } public final void setResponsePage ( final Class cls ) { } public final void setResponsePage ( final Class cls , PageParameters parameters ) { } public final void setResponsePage ( final Page page ) { } public Component setVersioned ( boolean versioned ) { } public final Component setVisible ( final boolean visible ) { } public String toString ( ) { } public String toString ( final boolean detailed ) { } public final String urlFor ( final RequestListenerInterface listener ) { } public final String urlFor ( final IRequestTarget requestTarget ) { } public final String urlFor ( final ResourceReference resourceReference ) { } public final String urlFor ( final PageMap pageMap , final Class pageClass , final PageParameters parameters ) { } public final String urlFor ( final Class pageClass , final PageParameters parameters ) { } public final void warn ( final String message ) { } protected final void addStateChange ( final Change change ) { } protected final void checkComponentTag ( final ComponentTag tag , final String name ) { } protected final void checkComponentTagAttribute ( final ComponentTag tag , final String key , final String value ) { } protected void detachModel ( ) { } protected final String exceptionMessage ( final String message ) { } protected MarkupStream findMarkupStream ( ) { } protected final Page findPage ( ) { } protected final List getBehaviors ( Class type ) { } protected final boolean getFlag ( final short flag ) { } protected IModelComparator getModelComparator ( ) { } protected IModel initModel ( ) { } protected void internalBeginRequest ( ) { } protected void internalEndRequest ( ) { } protected void internalOnBeginRequest ( ) { } protected void internalOnEndRequest ( ) { } protected void internalOnModelChanged ( ) { } protected boolean isBehaviorAccepted ( final IBehavior behavior ) { } protected final boolean isIgnoreAttributeModifier ( ) { } protected void onBeginRequest ( ) { } protected void onComponentTag ( final ComponentTag tag ) { } protected void onComponentTagBody ( final MarkupStream markupStream , final ComponentTag openTag ) { } protected void onEndRequest ( ) { } protected void onModelChanged ( ) { } protected void onModelChanging ( ) { } protected final void onRender ( ) { } protected abstract void onRender ( final MarkupStream markupStream ) { } protected final void renderComponentTag ( ComponentTag tag ) { } protected final void replaceComponentTagBody ( final MarkupStream markupStream , final ComponentTag tag , final String body ) { } protected final void setFlag ( final short flag , final boolean set ) { } protected void setMarkupStream ( final MarkupStream markupStream ) { } protected final Component setIgnoreAttributeModifier ( final boolean ignore ) { } protected final Object visitParents ( final Class c , final Component . IVisitor visitor ) { } Component get ( final String path ) { } final boolean isAuto ( ) { } final void renderClosingComponentTag ( final MarkupStream markupStream , final ComponentTag openTag , final boolean renderTagOnly ) { } final void setAuto ( final boolean auto ) { } final void setId ( final String id ) { } final void setParent ( final MarkupContainer parent ) { } final void setRenderAllowed ( boolean renderAllowed ) { } final boolean isRenderAllowed ( ) { } private final IModel getRootModel ( final IModel model ) { IModel nestedModelObject = model ; while ( true ) { <START_BUG> final IModel next = ( ( IModel ) ( nestedModelObject ) ) . getNestedModel ( ) ; <END_BUG> if ( next == null ) { break ; } if ( nestedModelObject == next ) { throw new WicketRuntimeException ( ( ( "Model<seq2seq4repair_space>for<seq2seq4repair_space>" + nestedModelObject ) + "<seq2seq4repair_space>is<seq2seq4repair_space>self-referential" ) ) ; } nestedModelObject = next ; } return nestedModelObject ; } private final MarkupStream initializeMarkupStream ( ) { } }

Fix:
final IModel next = nestedModelObject . getNestedModel ( ) ;