+ * Implementations are expected to call {@link #noSensitiveSubstatements()} to actually traverse substatement sets.
+ *
+ * @return True if no substatements require copy-sensitive handling
+ */
+ abstract boolean noSensitiveSubstatements();
+
+ /**
+ * Determine whether any of the provided substatements are context-sensitive for purposes of implementing
+ * {@link #noSensitiveSubstatements()}.
+ *
+ * @param substatements Substatements to check
+ * @return True if no substatements require context-sensitive handling
+ */
+ static boolean noSensitiveSubstatements(final Collection extends ReactorStmtCtx, ?, ?>> substatements) {
+ for (ReactorStmtCtx, ?, ?> stmt : substatements) {
+ if (stmt.isSupportedToBuildEffective()) {
+ if (!stmt.allSubstatementsContextIndependent()) {
+ // This is a recursive property
+ return false;
+ }
+
+ switch (stmt.definition().support().copyPolicy()) {
+ case CONTEXT_INDEPENDENT:
+ case EXACT_REPLICA:
+ case IGNORE:
+ break;
+ default:
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
private void runPhaseListeners(final ModelProcessingPhase phase, final Collection
- * This method maintains a resolution cache, so once we have returned a result, we will keep on returning the same
- * result without performing any lookups, solely to support {@link SubstatementContext#isConfiguration()}.
- *
- *
- * Note: use of this method implies that {@link #isIgnoringConfig()} is realized with
- * {@link #isIgnoringConfig(StatementContextBase)}.
- */
- final boolean isConfiguration(final StatementContextBase, ?, ?> parent) {
- final int fl = flags & SET_CONFIGURATION;
- if (fl != 0) {
- return fl == SET_CONFIGURATION;
- }
- if (isIgnoringConfig(parent)) {
- // Note: SET_CONFIGURATION has been stored in flags
- return true;
- }
-
- final boolean isConfig;
- final Optional
- * Note: use of this method implies that {@link #isConfiguration()} is realized with
- * {@link #isConfiguration(StatementContextBase)}.
- */
- final boolean isIgnoringConfig(final StatementContextBase, ?, ?> parent) {
- final int fl = flags & SET_IGNORE_CONFIG;
- if (fl != 0) {
- return fl == SET_IGNORE_CONFIG;
- }
- if (definition.support().isIgnoringConfig() || parent.isIgnoringConfig()) {
- flags |= SET_IGNORE_CONFIG;
- return true;
- }
-
- flags |= HAVE_IGNORE_CONFIG;
- return false;
- }
-
- protected abstract boolean isIgnoringIfFeatures();
-
- /**
- * This method maintains a resolution cache for ignore if-feature, so once we have returned a result, we will
- * keep on returning the same result without performing any lookups. Exists only to support
- * {@link SubstatementContext#isIgnoringIfFeatures()}.
- */
- final boolean isIgnoringIfFeatures(final StatementContextBase, ?, ?> parent) {
- final int fl = flags & SET_IGNORE_IF_FEATURE;
- if (fl != 0) {
- return fl == SET_IGNORE_IF_FEATURE;
- }
- if (definition.support().isIgnoringIfFeatures() || parent.isIgnoringIfFeatures()) {
- flags |= SET_IGNORE_IF_FEATURE;
- return true;
- }
-
- flags |= HAVE_IGNORE_IF_FEATURE;
- return false;
- }
-
- abstract @NonNull Optional