Class ControlFlowTck
java.lang.Object
io.micronaut.sourcegen.bytecode.tck.AbstractByteCodeWriterTck
io.micronaut.sourcegen.bytecode.tck.ControlFlowTck
Loops, switches, try, catch and finally, and the statements that complete them, compared with what javac
writes for the same source.
A backend runs these tests by extending this class and implementing
AbstractByteCodeWriterTck.write(io.micronaut.sourcegen.model.ObjectDef).
- Since:
- 2.3
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidswitchOnANarrowOrBoxedSelectorWidensItToInt(TypeDef selector, List<ExpressionDef.Constant> keys, List<Object> inputs, List<String> expected) voidvoidvoidvoidvoidvoidvoidvoidMethods inherited from class AbstractByteCodeWriterTck
assertCall, caller, callWithParameter, classShape, declaredFields, declaredMethods, define, defineInPackage, genericShape, invoke, list, load, outcome, run, run, run, selection, selection, shape, write
-
Constructor Details
-
ControlFlowTck
public ControlFlowTck()
-
-
Method Details
-
writesWhileLoopsAndFinallyOnReturnAndThrow
-
writesSwitchesSharingOneBodyAcrossManyKeys
-
writesTryWhoseCatchCompletesInsideAnIfBranch
-
writesStaticFinalFieldsAssignedInTryAndCatch
-
writesReturnedVoidCallsAndFallbacksAfterExhaustiveStatements
-
innerHandlerWinsOverAnOuterHandlerOfTheSameType
-
innerFinallyRunsBeforeTheOuterCatch
-
synchronizedBlockReleasesItsMonitorWhenAnOuterCatchHandlesTheException
-
everyMonitorExitOfASynchronizedBlockIsProtected
@Test public void everyMonitorExitOfASynchronizedBlockIsProtected() -
finallyReturnOverridesTheReturnOfTheTry
-
finallyThatReturnsRunsOnceAfterACatchCompletes
-
finallyThatThrowsAfterAReturnRunsOnce
-
finallyThatThrowsAfterAReturnInACatchRunsOnce
-
returnInAnInnerTryRunsTheInnerAndTheOuterFinally
-
returnInATryWithoutFinallyRunsTheOuterFinally
-
innerFinallyThatThrowsAfterAReturnRunsOnceAndThenTheOuterFinally
-
outerFinallyThatThrowsAfterAReturnInAnInnerTryRunsOnce
-
returnInATryInsideASynchronizedBlockReleasesTheMonitor
-
synchronizedBlockReleasesItsMonitorOnceWhenTheFinallyAfterAReturnThrows
-
finallyThatThrowsAfterAYieldRunsOnce
-
stringSwitchDistinguishesCasesWithTheSameHashCode
-
switchYieldCasesMayDeclareTheSameLocalName
-
switchOnANarrowOrBoxedSelectorWidensItToInt
@ParameterizedTest(name="a switch on a {0} selector widens it to int, as javac switches on it") @MethodSource("switchSelectors") public void switchOnANarrowOrBoxedSelectorWidensItToInt(TypeDef selector, List<ExpressionDef.Constant> keys, List<Object> inputs, List<String> expected) throws Exception - Throws:
Exception
-