@ SuppressWarnings ( "unchecked" ) public < T > T peek ( Class < T > declarationClass ) { Object declaration = declarationStack . peek ( ) ; if ( declaration == null ) { throw new IllegalStateException ( "Declaration stack is empty" ) ; } if ( declarationClass . isAssignableFrom ( declaration . getClass ( ) ) ) { return ( T ) declaration ; } return fail ( declaration , declarationClass ) ; }
Peek an element from a declaration stack . Used by parse listeners .