Skip to content

Commit

Permalink
Fix problems with the @immutable annotation
Browse files Browse the repository at this point in the history
Summary: Fixed classes that were marked as @immutable but clearly weren't

Test Plan: unit tests, re-run findbugs
  • Loading branch information
Roy Williams authored and oconnor663 committed Apr 7, 2014
1 parent a2bf373 commit 1647cda
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 23 deletions.
3 changes: 0 additions & 3 deletions src/com/facebook/buck/rules/DependencyGraph.java
Expand Up @@ -23,9 +23,6 @@

import java.util.Map;

import javax.annotation.concurrent.Immutable;

@Immutable
public class DependencyGraph extends DefaultImmutableDirectedAcyclicGraph<BuildRule> {

private Map<BuildTarget, BuildRule> index;
Expand Down
48 changes: 31 additions & 17 deletions src/com/facebook/buck/test/TestResultSummary.java
Expand Up @@ -19,38 +19,35 @@
import com.facebook.buck.test.result.type.ResultType;
import com.facebook.buck.util.Ansi;
import com.facebook.buck.util.TimeFormat;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;

@Immutable
public class TestResultSummary {

private String testCaseName;
private final String testCaseName;

private String testName;
private final String testName;

private ResultType type;
private final ResultType type;

private long time;
private final long time;

@Nullable
private String message;
private final String message;

@Nullable
private String stacktrace;
private final String stacktrace;

@Nullable
private String stdOut;
private final String stdOut;

@Nullable
private String stdErr;

/**
* Default constructor so this class can be deserialized by Jackson.
*/
public TestResultSummary() {}
private final String stdErr;

public TestResultSummary(
String testCaseName,
Expand All @@ -71,6 +68,27 @@ public TestResultSummary(
this.stdErr = stdErr;
}

@JsonCreator
public static TestResultSummary fromJson(
@JsonProperty("testCaseName") String testCaseName,
@JsonProperty("testCase") String testName,
@JsonProperty("type") String type,
@JsonProperty("time") long time,
@JsonProperty("message") @Nullable String message,
@JsonProperty("stacktrace") @Nullable String stacktrace,
@JsonProperty("stdOut") @Nullable String stdOut,
@JsonProperty("stdErr") @Nullable String stdErr) {
return new TestResultSummary(
testCaseName,
testName,
ResultType.valueOf(type),
time,
message,
stacktrace,
stdOut,
stdErr);
}

public String getTestName() {
return testName;
}
Expand All @@ -86,10 +104,6 @@ public boolean isSuccess() {
return type != ResultType.FAILURE;
}

public void setType(String stringType) {
type = ResultType.valueOf(stringType);
}

public ResultType getType() {
return type;
}
Expand Down
3 changes: 0 additions & 3 deletions src/com/facebook/buck/test/TestResults.java
Expand Up @@ -26,12 +26,9 @@

import java.util.List;

import javax.annotation.concurrent.Immutable;

/**
* Represents the test results from multiple test cases.
*/
@Immutable
public class TestResults {

private static final BuildTarget DUMMY_TARGET_FOR_TESTING = new BuildTarget("//foo/bar", "baz");
Expand Down

0 comments on commit 1647cda

Please sign in to comment.