}
StatementContextBase(final StatementContextBase<A, D, E> original) {
- this.definition = Preconditions
- .checkNotNull(original.definition, "Statement context definition cannot be null");
- this.identifier = Preconditions
- .checkNotNull(original.identifier, "Statement context identifier cannot be null");
+ this.definition = Preconditions.checkNotNull(original.definition,
+ "Statement context definition cannot be null copying from: %s", original.getStatementSourceReference());
+ this.identifier = Preconditions.checkNotNull(original.identifier,
+ "Statement context identifier cannot be null copying from: %s", original.getStatementSourceReference());
this.statementDeclSource = Preconditions.checkNotNull(original.statementDeclSource,
- "Statement context statementDeclSource cannot be null");
+ "Statement context statementDeclSource cannot be null copying from: %s",
+ original.getStatementSourceReference());
this.completedPhase = null;
this.copyHistory.add(TypeOfCopy.ORIGINAL);
}
final ModelProcessingPhase inProgressPhase = getRoot().getSourceContext().getInProgressPhase();
Preconditions.checkState(inProgressPhase == ModelProcessingPhase.FULL_DECLARATION
|| inProgressPhase == ModelProcessingPhase.EFFECTIVE_MODEL,
- "Effective statement cannot be added in declared phase");
+ "Effective statement cannot be added in declared phase at: %s", getStatementSourceReference());
effective.add(Preconditions.checkNotNull(substatement,
- "StatementContextBase effective substatement cannot be null"));
+ "StatementContextBase effective substatement cannot be null at: %s", getStatementSourceReference()));
}
/**
final ModelProcessingPhase inProgressPhase = getRoot().getSourceContext().getInProgressPhase();
Preconditions.checkState(inProgressPhase != ModelProcessingPhase.EFFECTIVE_MODEL,
- "Declared statement cannot be added in effective phase");
+ "Declared statement cannot be added in effective phase at: %s", getStatementSourceReference());
declared.add(Preconditions.checkNotNull(substatement,
- "StatementContextBase declared substatement cannot be null"));
+ "StatementContextBase declared substatement cannot be null at: %s", getStatementSourceReference()));
}
/**
final SourceSpecificContext sourceContext = getRoot().getSourceContext();
Preconditions.checkState(sourceContext.getInProgressPhase() != ModelProcessingPhase.EFFECTIVE_MODEL,
- "Declared statements list cannot be cleared in effective phase");
+ "Declared statements list cannot be cleared in effective phase at: %s", getStatementSourceReference());
declared.clear();
}
*/
void addPhaseCompletedListener(final ModelProcessingPhase phase, final OnPhaseFinished listener) throws SourceException {
- Preconditions.checkNotNull(phase, "Statement context processing phase cannot be null");
- Preconditions.checkNotNull(listener, "Statement context phase listener cannot be null");
+ Preconditions.checkNotNull(phase, "Statement context processing phase cannot be null at: %s",
+ getStatementSourceReference());
+ Preconditions.checkNotNull(listener, "Statement context phase listener cannot be null at: %s",
+ getStatementSourceReference());
ModelProcessingPhase finishedPhase = completedPhase;
while (finishedPhase != null) {
ModelProcessingPhase finishedPhase = completedPhase;
while (finishedPhase != null) {
if (phase.equals(finishedPhase)) {
- throw new IllegalStateException("Mutation registered after phase was completed.");
+ throw new IllegalStateException("Mutation registered after phase was completed at: " +
+ getStatementSourceReference());
}
finishedPhase = finishedPhase.getPreviousPhase();
}