### Question:
Stack extends java.util.Stack<E> { @Override public E push(E item) { if (this.size() >= maxSize) { throw new IllegalStateException("stack overflow"); } return super.push(item); } Stack(int maxSize); @Override E push(E item); @Override synchronized E pop(); final int maxSize; }### Answer:
@Test public void test() { Stack<Frame> stack = new Stack<>(1024); KMethod method = new KMethod(1, "x", "x", 1, 1, null, null, null); stack.push(new Frame(method, null)); assertEquals(1, stack.size()); assertEquals(1024, stack.maxSize); }