Enforce that CompilerInput::getId() equals CompilerInput::getAst().getInputId()
I'll delete the deprecated constructors after the next compiler release.
@@ -86,20 +86,29 @@ public class CompilerInput extends DependencyInfo.Base implements SourceAst {
}
public CompilerInput(SourceAst ast, boolean isExtern) {
- this(ast, ast.getInputId(), isExtern);
+ this.ast = ast;
+ this.id = ast.getInputId();
+
+ if (isExtern) {
+ setIsExtern();
+ }
}
+ /** @deprecated the inputId is read from the SourceAst. Use CompilerInput(ast, isExtern) */
+ @Deprecated
public CompilerInput(SourceAst ast, String inputId, boolean isExtern) {
this(ast, new InputId(inputId), isExtern);
}
+ /** @deprecated the inputId is read from the SourceAst. Use CompilerInput(ast, isExtern) */
+ @Deprecated
public CompilerInput(SourceAst ast, InputId inputId, boolean isExtern) {
- this.ast = ast;
- this.id = inputId;
-
- if (isExtern) {
- setIsExtern();
- }
+ this(ast, isExtern);
+ checkArgument(
+ inputId.equals(ast.getInputId()),
+ "mismatched input ids\nctor param: %s\nast.getInputId(): %s",
+ inputId,
+ ast.getInputId());
}
public CompilerInput(SourceFile file) {
