diff options
author | tomlu <tomlu@google.com> | 2017-08-15 23:21:25 +0200 |
---|---|---|
committer | Irina Iancu <elenairina@google.com> | 2017-08-16 11:06:03 +0200 |
commit | 59f1d889f71d6d203ca061787d4ea16465df1916 (patch) | |
tree | d0e52ac5be0fe8eed9c0e6886127919e156a2c85 /src/main/java/com/google/devtools/build/lib/analysis/actions/ParamFileInfo.java | |
parent | ff746b4aaa5bb7109ff543a72c165fa6e785916f (diff) |
Add more type safety to CustomCommandLine.
Allowing add(Object) is too loose and can easily lead to programmer mistakes.
Because of type erasure, we can't use the same overload name for (eg.) add(NestedSet<String>) and add(NestedSet<Artifact>). The API is overhauled to use the same terms everywhere, eg. "add", "addPaths", "addExecPaths". This is similar to how it used to be a few CLs ago.
The API is overhauled to make sure it's consistent for all types. While tedious, the facade methods immediately dispatch to internal helpers, so implementation wise it's not too heavy.
While large, this CL is almost entirely an automated refactor.
PiperOrigin-RevId: 165358287
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/analysis/actions/ParamFileInfo.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/analysis/actions/ParamFileInfo.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/actions/ParamFileInfo.java b/src/main/java/com/google/devtools/build/lib/analysis/actions/ParamFileInfo.java index 8d3b0e5316..32ec7a8506 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/actions/ParamFileInfo.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/actions/ParamFileInfo.java @@ -16,6 +16,7 @@ package com.google.devtools.build.lib.analysis.actions; import com.google.devtools.build.lib.actions.ParameterFile.ParameterFileType; import com.google.devtools.build.lib.util.Preconditions; +import com.google.errorprone.annotations.CompileTimeConstant; import java.nio.charset.Charset; import java.util.Objects; import javax.annotation.concurrent.Immutable; @@ -31,7 +32,11 @@ public final class ParamFileInfo { private final String flag; private final boolean always; - public ParamFileInfo(ParameterFileType fileType, Charset charset, String flag, boolean always) { + public ParamFileInfo( + ParameterFileType fileType, + Charset charset, + @CompileTimeConstant String flag, + boolean always) { this.fileType = Preconditions.checkNotNull(fileType); this.charset = Preconditions.checkNotNull(charset); this.flag = Preconditions.checkNotNull(flag); |