Fixes compile errors in Eclipse due to generics

PersistentTasksCustomMetadata was using a generic param named `Params`. This conflicted with the imported interface `ToXContent.Params`. The java compiler was preferring the generic param over the interface so everything was fine but Eclipse apparently prefers the interface int his case which was screwing up the Hierarchy and causing compile errors in Eclipse. This changes fixes it by renaming the Generic param to `P`
This commit is contained in:
Colin Goodheart-Smithe 2017-04-18 12:50:05 +01:00 committed by Martijn van Groningen
parent fc524bc9b5
commit 76cd7b1eb2
No known key found for this signature in database
GPG Key ID: AB236F4FCF2AF12A
1 changed files with 8 additions and 8 deletions

View File

@ -266,12 +266,12 @@ public final class PersistentTasksCustomMetaData extends AbstractNamedDiffable<M
/** /**
* A record that represents a single running persistent task * A record that represents a single running persistent task
*/ */
public static class PersistentTask<Params extends PersistentTaskParams> implements Writeable, ToXContent { public static class PersistentTask<P extends PersistentTaskParams> implements Writeable, ToXContent {
private final String id; private final String id;
private final long allocationId; private final long allocationId;
private final String taskName; private final String taskName;
@Nullable @Nullable
private final Params params; private final P params;
@Nullable @Nullable
private final Status status; private final Status status;
private final Assignment assignment; private final Assignment assignment;
@ -279,21 +279,21 @@ public final class PersistentTasksCustomMetaData extends AbstractNamedDiffable<M
private final Long allocationIdOnLastStatusUpdate; private final Long allocationIdOnLastStatusUpdate;
public PersistentTask(String id, String taskName, Params params, long allocationId, Assignment assignment) { public PersistentTask(String id, String taskName, P params, long allocationId, Assignment assignment) {
this(id, allocationId, taskName, params, null, assignment, null); this(id, allocationId, taskName, params, null, assignment, null);
} }
public PersistentTask(PersistentTask<Params> task, long allocationId, Assignment assignment) { public PersistentTask(PersistentTask<P> task, long allocationId, Assignment assignment) {
this(task.id, allocationId, task.taskName, task.params, task.status, this(task.id, allocationId, task.taskName, task.params, task.status,
assignment, task.allocationId); assignment, task.allocationId);
} }
public PersistentTask(PersistentTask<Params> task, Status status) { public PersistentTask(PersistentTask<P> task, Status status) {
this(task.id, task.allocationId, task.taskName, task.params, status, this(task.id, task.allocationId, task.taskName, task.params, status,
task.assignment, task.allocationId); task.assignment, task.allocationId);
} }
private PersistentTask(String id, long allocationId, String taskName, Params params, private PersistentTask(String id, long allocationId, String taskName, P params,
Status status, Assignment assignment, Long allocationIdOnLastStatusUpdate) { Status status, Assignment assignment, Long allocationIdOnLastStatusUpdate) {
this.id = id; this.id = id;
this.allocationId = allocationId; this.allocationId = allocationId;
@ -321,7 +321,7 @@ public final class PersistentTasksCustomMetaData extends AbstractNamedDiffable<M
id = in.readString(); id = in.readString();
allocationId = in.readLong(); allocationId = in.readLong();
taskName = in.readString(); taskName = in.readString();
params = (Params) in.readOptionalNamedWriteable(PersistentTaskParams.class); params = (P) in.readOptionalNamedWriteable(PersistentTaskParams.class);
status = in.readOptionalNamedWriteable(Task.Status.class); status = in.readOptionalNamedWriteable(Task.Status.class);
assignment = new Assignment(in.readOptionalString(), in.readString()); assignment = new Assignment(in.readOptionalString(), in.readString());
allocationIdOnLastStatusUpdate = in.readOptionalLong(); allocationIdOnLastStatusUpdate = in.readOptionalLong();
@ -377,7 +377,7 @@ public final class PersistentTasksCustomMetaData extends AbstractNamedDiffable<M
} }
@Nullable @Nullable
public Params getParams() { public P getParams() {
return params; return params;
} }