Skip to content

Commit 5c3f488

Browse files
committed
Replace builder with simpler create method
1 parent f2f3db3 commit 5c3f488

File tree

5 files changed

+7
-33
lines changed

5 files changed

+7
-33
lines changed

firebase-crashlytics/src/androidTest/java/com/google/firebase/crashlytics/internal/common/SessionReportingCoordinatorTest.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -486,9 +486,6 @@ private static CrashlyticsReport mockReport(String sessionId, String orgId) {
486486

487487
private static CrashlyticsReportWithSessionId mockReportWithSessionId(
488488
String sessionId, String orgId) {
489-
return CrashlyticsReportWithSessionId.builder()
490-
.setReport(mockReport(sessionId, orgId))
491-
.setSessionId(sessionId)
492-
.build();
489+
return CrashlyticsReportWithSessionId.create(mockReport(sessionId, orgId), sessionId);
493490
}
494491
}

firebase-crashlytics/src/androidTest/java/com/google/firebase/crashlytics/internal/send/DataTransportCrashlyticsReportSenderTest.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,6 @@ private static Answer<Void> callbackAnswer(Exception failure) {
132132
}
133133

134134
private static CrashlyticsReportWithSessionId mockReportWithSessionId() {
135-
return CrashlyticsReportWithSessionId.builder()
136-
.setSessionId("sessionId")
137-
.setReport(mock(CrashlyticsReport.class))
138-
.build();
135+
return CrashlyticsReportWithSessionId.create(mock(CrashlyticsReport.class), "sessionId");
139136
}
140137
}

firebase-crashlytics/src/main/java/com/google/firebase/crashlytics/internal/common/CrashlyticsReportWithSessionId.java

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,8 @@ public abstract class CrashlyticsReportWithSessionId {
2525

2626
public abstract String getSessionId();
2727

28-
@AutoValue.Builder
29-
public abstract static class Builder {
30-
31-
@NonNull
32-
public abstract CrashlyticsReportWithSessionId.Builder setReport(
33-
@NonNull CrashlyticsReport value);
34-
35-
@NonNull
36-
public abstract CrashlyticsReportWithSessionId.Builder setSessionId(@NonNull String value);
37-
38-
@NonNull
39-
public abstract CrashlyticsReportWithSessionId build();
40-
}
41-
4228
@NonNull
43-
public static CrashlyticsReportWithSessionId.Builder builder() {
44-
return new AutoValue_CrashlyticsReportWithSessionId.Builder();
29+
public static CrashlyticsReportWithSessionId create(CrashlyticsReport report, String sessionId) {
30+
return new AutoValue_CrashlyticsReportWithSessionId(report, sessionId);
4531
}
4632
}

firebase-crashlytics/src/main/java/com/google/firebase/crashlytics/internal/common/SessionReportingCoordinator.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,8 @@ public void sendReports(
182182
}
183183
reportsSender
184184
.sendReport(
185-
CrashlyticsReportWithSessionId.builder()
186-
.setReport(report.getReport().withOrganizationId(organizationId))
187-
.setSessionId(report.getSessionId())
188-
.build())
185+
CrashlyticsReportWithSessionId.create(
186+
report.getReport().withOrganizationId(organizationId), report.getSessionId()))
189187
.continueWith(reportSendCompleteExecutor, this::onReportSendComplete);
190188
}
191189
}

firebase-crashlytics/src/main/java/com/google/firebase/crashlytics/internal/persistence/CrashlyticsReportPersistence.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,7 @@ public List<CrashlyticsReportWithSessionId> loadFinalizedReports() {
223223
for (File reportFile : getAllFinalizedReportFiles()) {
224224
// TODO: Handle null value in jsonReport in a way that eventually cleans up file.
225225
CrashlyticsReport jsonReport = TRANSFORM.reportFromJson(readTextFile(reportFile));
226-
allReports.add(
227-
CrashlyticsReportWithSessionId.builder()
228-
.setReport(jsonReport)
229-
.setSessionId(reportFile.getName())
230-
.build());
226+
allReports.add(CrashlyticsReportWithSessionId.create(jsonReport, reportFile.getName()));
231227
}
232228
return allReports;
233229
}

0 commit comments

Comments
 (0)