From: Marc-Andre Laperle Date: Thu, 25 Feb 2016 18:19:03 +0000 (-0500) Subject: lttng: Fix null annotation error on Eclipse 4.5.x X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=b6fb4b5e0a81830a8623c96124bbe4413df7ff11;p=deliverable%2Ftracecompass.git lttng: Fix null annotation error on Eclipse 4.5.x getAnalysisModuleOfClass returns a Nullable module, this nullable should be kept all the way to the Optional returned by findFirst. In 4.5.x, this works correctly and the result of findFirst cannot be assigned to an Optional<@NonNull>, hence the error. In 4.6, the @Nullable is lost along the way and the result of findFirst can be assigned without error to an Optional<@NonNull>. Change-Id: If544f9372e2132f5796074f197a7ae01679fe1da Signed-off-by: Marc-Andre Laperle Reviewed-on: https://git.eclipse.org/r/67355 Reviewed-by: Hudson CI Reviewed-by: Patrick Tasse Tested-by: Patrick Tasse --- diff --git a/lttng/org.eclipse.tracecompass.lttng2.kernel.core/src/org/eclipse/tracecompass/internal/lttng2/kernel/core/analysis/graph/model/LttngWorker.java b/lttng/org.eclipse.tracecompass.lttng2.kernel.core/src/org/eclipse/tracecompass/internal/lttng2/kernel/core/analysis/graph/model/LttngWorker.java index a5c252c42b..08e0eeaa47 100644 --- a/lttng/org.eclipse.tracecompass.lttng2.kernel.core/src/org/eclipse/tracecompass/internal/lttng2/kernel/core/analysis/graph/model/LttngWorker.java +++ b/lttng/org.eclipse.tracecompass.lttng2.kernel.core/src/org/eclipse/tracecompass/internal/lttng2/kernel/core/analysis/graph/model/LttngWorker.java @@ -77,7 +77,7 @@ public class LttngWorker implements IGraphWorker { if (tid == -1) { return Collections.EMPTY_MAP; } - Optional kam = TmfTraceManager.getInstance().getActiveTraceSet().stream() + Optional<@Nullable KernelAnalysisModule> kam = TmfTraceManager.getInstance().getActiveTraceSet().stream() .filter(trace -> trace.getHostId().equals(getHostId())) .map(trace -> TmfTraceUtils.getAnalysisModuleOfClass(trace, KernelAnalysisModule.class, KernelAnalysisModule.ID)) .filter(mod -> mod != null)