The Java run time system causes the run time stack to undergo a stack inspection, wherein frames executing non trusted code are identified and appropriate run time decisions are made based on the state of the stack frames. The stack inspection approach is useful as it allows flexible security policies.