Class ControlFlowTck

java.lang.Object
io.micronaut.sourcegen.bytecode.tck.AbstractByteCodeWriterTck
io.micronaut.sourcegen.bytecode.tck.ControlFlowTck

public abstract class ControlFlowTck extends AbstractByteCodeWriterTck
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 Details

    • ControlFlowTck

      public ControlFlowTck()
  • Method Details

    • writesWhileLoopsAndFinallyOnReturnAndThrow

      @Test public void writesWhileLoopsAndFinallyOnReturnAndThrow() throws Exception
      Throws:
      Exception
    • writesSwitchesSharingOneBodyAcrossManyKeys

      @Test public void writesSwitchesSharingOneBodyAcrossManyKeys() throws Exception
      Throws:
      Exception
    • writesTryWhoseCatchCompletesInsideAnIfBranch

      @Test public void writesTryWhoseCatchCompletesInsideAnIfBranch() throws Exception
      Throws:
      Exception
    • writesStaticFinalFieldsAssignedInTryAndCatch

      @Test public void writesStaticFinalFieldsAssignedInTryAndCatch() throws Exception
      Throws:
      Exception
    • writesReturnedVoidCallsAndFallbacksAfterExhaustiveStatements

      @Test public void writesReturnedVoidCallsAndFallbacksAfterExhaustiveStatements() throws Exception
      Throws:
      Exception
    • innerHandlerWinsOverAnOuterHandlerOfTheSameType

      @Test public void innerHandlerWinsOverAnOuterHandlerOfTheSameType() throws Exception
      Throws:
      Exception
    • innerFinallyRunsBeforeTheOuterCatch

      @Test public void innerFinallyRunsBeforeTheOuterCatch() throws Exception
      Throws:
      Exception
    • synchronizedBlockReleasesItsMonitorWhenAnOuterCatchHandlesTheException

      @Test public void synchronizedBlockReleasesItsMonitorWhenAnOuterCatchHandlesTheException() throws Exception
      Throws:
      Exception
    • everyMonitorExitOfASynchronizedBlockIsProtected

      @Test public void everyMonitorExitOfASynchronizedBlockIsProtected()
    • finallyReturnOverridesTheReturnOfTheTry

      @Test public void finallyReturnOverridesTheReturnOfTheTry() throws Exception
      Throws:
      Exception
    • finallyThatReturnsRunsOnceAfterACatchCompletes

      @Test public void finallyThatReturnsRunsOnceAfterACatchCompletes() throws Exception
      Throws:
      Exception
    • finallyThatThrowsAfterAReturnRunsOnce

      @Test public void finallyThatThrowsAfterAReturnRunsOnce() throws Exception
      Throws:
      Exception
    • finallyThatThrowsAfterAReturnInACatchRunsOnce

      @Test public void finallyThatThrowsAfterAReturnInACatchRunsOnce() throws Exception
      Throws:
      Exception
    • returnInAnInnerTryRunsTheInnerAndTheOuterFinally

      @Test public void returnInAnInnerTryRunsTheInnerAndTheOuterFinally() throws Exception
      Throws:
      Exception
    • returnInATryWithoutFinallyRunsTheOuterFinally

      @Test public void returnInATryWithoutFinallyRunsTheOuterFinally() throws Exception
      Throws:
      Exception
    • innerFinallyThatThrowsAfterAReturnRunsOnceAndThenTheOuterFinally

      @Test public void innerFinallyThatThrowsAfterAReturnRunsOnceAndThenTheOuterFinally() throws Exception
      Throws:
      Exception
    • outerFinallyThatThrowsAfterAReturnInAnInnerTryRunsOnce

      @Test public void outerFinallyThatThrowsAfterAReturnInAnInnerTryRunsOnce() throws Exception
      Throws:
      Exception
    • returnInATryInsideASynchronizedBlockReleasesTheMonitor

      @Test public void returnInATryInsideASynchronizedBlockReleasesTheMonitor() throws Exception
      Throws:
      Exception
    • synchronizedBlockReleasesItsMonitorOnceWhenTheFinallyAfterAReturnThrows

      @Test public void synchronizedBlockReleasesItsMonitorOnceWhenTheFinallyAfterAReturnThrows() throws Exception
      Throws:
      Exception
    • finallyThatThrowsAfterAYieldRunsOnce

      @Test public void finallyThatThrowsAfterAYieldRunsOnce() throws Exception
      Throws:
      Exception
    • stringSwitchDistinguishesCasesWithTheSameHashCode

      @Test public void stringSwitchDistinguishesCasesWithTheSameHashCode() throws Exception
      Throws:
      Exception
    • switchYieldCasesMayDeclareTheSameLocalName

      @Test public void switchYieldCasesMayDeclareTheSameLocalName() throws Exception
      Throws:
      Exception
    • 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