All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.checkerframework.dataflow.cfg.builder.ExtendedNode Maven / Gradle / Ivy

Go to download

The Checker Framework enhances Java's type system to make it more powerful and useful. This lets software developers detect and prevent errors in their Java programs. The Checker Framework includes compiler plug-ins ("checkers") that find bugs or verify their absence. It also permits you to write your own compiler plug-ins.

There is a newer version: 3.44.0
Show newest version
package org.checkerframework.dataflow.cfg.builder;

import org.checkerframework.dataflow.cfg.block.BlockImpl;
import org.checkerframework.dataflow.cfg.builder.ExtendedNode.ExtendedNodeType;
import org.checkerframework.dataflow.cfg.node.Node;
import org.checkerframework.javacutil.BugInCF;

/**
 * An extended node can be one of several things (depending on its {@code type}):
 *
 * 
    *
  • NODE: {@link CFGBuilder.NodeHolder}. An extended node of this type is just a * wrapper for a {@link Node} (that cannot throw exceptions). *
  • EXCEPTION_NODE: {@link CFGBuilder.NodeWithExceptionsHolder}. A wrapper for a * {@link Node} which can throw exceptions. It contains a label for every possible exception * type the node might throw. *
  • UNCONDITIONAL_JUMP: {@link CFGBuilder.UnconditionalJump}. An unconditional jump to * a label. *
  • TWO_TARGET_CONDITIONAL_JUMP: {@link CFGBuilder.ConditionalJump}. A conditional * jump with two targets for both the 'then' and 'else' branch. *
*/ @SuppressWarnings("nullness") // TODO abstract class ExtendedNode { /** The basic block this extended node belongs to (as determined in phase two). */ protected BlockImpl block; /** Type of this node. */ protected final ExtendedNodeType type; /** Does this node terminate the execution? (e.g., "System.exit()") */ protected boolean terminatesExecution = false; /** * Create a new ExtendedNode. * * @param type the type of this node */ protected ExtendedNode(ExtendedNodeType type) { this.type = type; } /** Extended node types (description see above). */ public enum ExtendedNodeType { NODE, EXCEPTION_NODE, UNCONDITIONAL_JUMP, CONDITIONAL_JUMP } public ExtendedNodeType getType() { return type; } public boolean getTerminatesExecution() { return terminatesExecution; } public void setTerminatesExecution(boolean terminatesExecution) { this.terminatesExecution = terminatesExecution; } /** * Returns the node contained in this extended node (only applicable if the type is {@code NODE} * or {@code EXCEPTION_NODE}). * * @return the node contained in this extended node (only applicable if the type is {@code NODE} * or {@code EXCEPTION_NODE}) */ public Node getNode() { throw new BugInCF("Do not call"); } /** * Returns the label associated with this extended node (only applicable if type is {@link * ExtendedNodeType#CONDITIONAL_JUMP} or {@link ExtendedNodeType#UNCONDITIONAL_JUMP}). * * @return the label associated with this extended node (only applicable if type is {@link * ExtendedNodeType#CONDITIONAL_JUMP} or {@link ExtendedNodeType#UNCONDITIONAL_JUMP}) */ public Label getLabel() { throw new BugInCF("Do not call"); } public BlockImpl getBlock() { return block; } public void setBlock(BlockImpl b) { this.block = b; } @Override public String toString() { throw new BugInCF("DO NOT CALL ExtendedNode.toString(). Write your own."); } /** * Returns a verbose string representation of this, useful for debugging. * * @return a string representation of this */ public abstract String toStringDebug(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy