Skip to content

Commit

Permalink
Replace uses of public fields with their associated getter methods. (b…
Browse files Browse the repository at this point in the history
  • Loading branch information
nreid260 authored and sgammon committed Oct 17, 2019
1 parent daf5b04 commit 4d8e593
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion java/com/google/javascript/jscomp/JsChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public CheckLevel level(JSError error) {
}
// Ignore linter warnings on generated sources.
if (groupNames.contains("lintChecks")
&& JsCheckerHelper.isGeneratedPath(error.sourceName)) {
&& JsCheckerHelper.isGeneratedPath(error.getSourceName())) {
return CheckLevel.OFF;
}
return null;
Expand Down
14 changes: 8 additions & 6 deletions java/com/google/javascript/jscomp/JsCheckerErrorFormatter.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public void setColorize(boolean colorize) {

private String format(JSError error, boolean warning) {
SourceExcerptProvider source = getSource();
String sourceName = error.sourceName;
int lineNumber = error.lineNumber;
String sourceName = error.getSourceName();
int lineNumber = error.getLineNumber();
int charno = error.getCharno();

// Format the non-reverse-mapped position.
Expand All @@ -75,8 +75,10 @@ private String format(JSError error, boolean warning) {
String nonMappedPosition = formatPosition(sourceName, lineNumber);

// Check if we can reverse-map the source.
OriginalMapping mapping = source == null ? null : source.getSourceMapping(
error.sourceName, error.lineNumber, error.getCharno());
OriginalMapping mapping =
source == null
? null
: source.getSourceMapping(error.getSourceName(), error.getLineNumber(), error.getCharno());
if (mapping == null) {
boldLine.append(nonMappedPosition);
} else {
Expand All @@ -96,7 +98,7 @@ private String format(JSError error, boolean warning) {

boldLine.append(getLevelName(warning ? CheckLevel.WARNING : CheckLevel.ERROR));
boldLine.append(" - ");
boldLine.append(error.description);
boldLine.append(error.getDescription());

b.append(maybeEmbolden(boldLine.toString()));

Expand All @@ -122,7 +124,7 @@ private String format(JSError error, boolean warning) {
}

// Help the user know how to suppress this warning.
String module = convertPathToModuleName(nullToEmpty(error.sourceName), roots).or("");
String module = convertPathToModuleName(nullToEmpty(error.getSourceName()), roots).or("");
String label = labels.get(module);
if (label == null) {
if (colorize) {
Expand Down
4 changes: 2 additions & 2 deletions java/com/google/javascript/jscomp/JsCheckerHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ static ClosureJsLibrary loadClosureJsLibraryInfo(Path path) throws IOException {

/** Returns {@code true} if error was produced by code generated by compiler passes. */
static boolean isInSyntheticCode(JSError error) {
return error.sourceName != null
&& error.sourceName.startsWith(" [synthetic:");
return error.getSourceName() != null
&& error.getSourceName().startsWith(" [synthetic:");
}

private JsCheckerHelper() {}
Expand Down
4 changes: 2 additions & 2 deletions java/com/google/javascript/jscomp/JsCompilerWarnings.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ public CheckLevel level(JSError error) {
}

// Some errors are independent of code, e.g. flag misuse.
if (error.sourceName == null) {
if (error.getSourceName() == null) {
return CheckLevel.ERROR;
}

for (String module : convertPathToModuleName(error.sourceName, roots).asSet()) {
for (String module : convertPathToModuleName(error.getSourceName(), roots).asSet()) {
if (legacyModules.contains(module)) {
// Ignore it entirely if it's very noisy.
if (Diagnostics.IGNORE_FOR_LEGACY.contains(error.getType())) {
Expand Down

0 comments on commit 4d8e593

Please sign in to comment.