Package com.cloudbees.groovy.cps.impl
Class TryBlockEnv
java.lang.Object
com.cloudbees.groovy.cps.impl.ProxyEnv
com.cloudbees.groovy.cps.impl.TryBlockEnv
- All Implemented Interfaces:
DepthTrackingEnv,Env,Serializable
Environment for evaluating the body of a try/catch block.
- Author:
- Kohsuke Kawaguchi
- See Also:
-
Field Summary
Fields inherited from interface com.cloudbees.groovy.cps.DepthTrackingEnv
MAX_LEGAL_DEPTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddHandler(Class<? extends Throwable> type, Continuation k) Handlers can be only added immediately after instantiation.getBreakAddress(String label) If we see a break statement, where should we go?getContinueAddress(String label) If we see a continue statement, where should we go?getExceptionHandler(Class<? extends Throwable> type) Finds the exception handler that catches aThrowableinstance of this type.Where should the return statement return to?Methods inherited from class com.cloudbees.groovy.cps.impl.ProxyEnv
buildStackTraceElements, closureOwner, declareVariable, getDepth, getInvoker, getLocalVariable, getLocalVariableType, setLocalVariable
-
Constructor Details
-
TryBlockEnv
-
-
Method Details
-
addHandler
Handlers can be only added immediately after instantiation. -
getExceptionHandler
Description copied from interface:EnvFinds the exception handler that catches aThrowableinstance of this type.- Specified by:
getExceptionHandlerin interfaceEnv- Overrides:
getExceptionHandlerin classProxyEnv- Returns:
- never null. Even if there's no user-specified exception handler, the default 'unhandled exception handler' must be returned.
-
getReturnAddress
Description copied from interface:EnvWhere should the return statement return to?- Specified by:
getReturnAddressin interfaceEnv- Overrides:
getReturnAddressin classProxyEnv
-
getBreakAddress
Description copied from interface:EnvIf we see a break statement, where should we go?- Specified by:
getBreakAddressin interfaceEnv- Overrides:
getBreakAddressin classProxyEnv- Parameters:
label- Specifies the loop to break from. null for nearest loop.- Returns:
- For semantically correct Groovy code, the return value is never null, because not having the matching label is a compile-time error.
-
getContinueAddress
Description copied from interface:EnvIf we see a continue statement, where should we go?- Specified by:
getContinueAddressin interfaceEnv- Overrides:
getContinueAddressin classProxyEnv- Parameters:
label- Specifies the loop to repeat. null for nearest loop.- Returns:
- For semantically correct Groovy code, the return value is never null, because not having the matching label is a compile-time error.
-