*
* @return The aspects
*/
- public static Iterable<ITmfEventAspect> getAspects() {
+ public static @NonNull Iterable<ITmfEventAspect> getAspects() {
return BTF_ASPECTS;
}
}
\ No newline at end of file
*
* @return The set of aspects
*/
- public static Iterable<ITmfEventAspect> getAspects() {
+ public static @NonNull Iterable<ITmfEventAspect> getAspects() {
return GDB_ASPECTS;
}
}
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
private static class TmfTraceStubWithAspects extends TmfTraceStub {
- private static final Collection<ITmfEventAspect> EVENT_ASPECTS;
+ private static final @NonNull Collection<ITmfEventAspect> EVENT_ASPECTS;
static {
ImmutableList.Builder<ITmfEventAspect> builder = ImmutableList.builder();
builder.add(new TmfCpuAspect() {
}
});
builder.addAll(TmfTrace.BASE_ASPECTS);
- EVENT_ASPECTS = builder.build();
+ @SuppressWarnings("null")
+ @NonNull Collection<ITmfEventAspect> ret = builder.build();
+ EVENT_ASPECTS = ret;
}
public TmfTraceStubWithAspects(String path) throws TmfTraceException {
* want the aspects
* @return The set of event aspects for the given trace
*/
- public static Iterable<ITmfEventAspect> generateAspects(CustomTraceDefinition definition) {
+ public static @NonNull Iterable<ITmfEventAspect> generateAspects(CustomTraceDefinition definition) {
ImmutableList.Builder<ITmfEventAspect> builder = new ImmutableList.Builder<>();
List<OutputColumn> outputs = definition.outputs;
for (int i = 0; i < outputs.size(); i++) {
builder.add(new CustomEventFieldAspect(name, i));
}
}
- return builder.build();
+ @SuppressWarnings("null")
+ @NonNull Iterable<ITmfEventAspect> ret = builder.build();
+ return ret;
}
}
/**
* Return the pre-defined set of event aspects exposed by this trace.
*
+ * It should not be null, but could be empty. You are suggested to use at
+ * least the ones defined in {@link TmfTrace#BASE_ASPECTS}.
+ *
* @return The event aspects for this trace
*/
- Iterable<ITmfEventAspect> getEventAspects();
+ @NonNull Iterable<ITmfEventAspect> getEventAspects();
// ------------------------------------------------------------------------
// Trace characteristics getters
/**
* Basic aspects that should be valid for all trace types.
*/
- public static final Collection<ITmfEventAspect> BASE_ASPECTS =
+ @SuppressWarnings("null")
+ public static final @NonNull Collection<ITmfEventAspect> BASE_ASPECTS =
ImmutableList.of(
ITmfEventAspect.BaseAspects.TIMESTAMP,
ITmfEventAspect.BaseAspects.EVENT_TYPE,
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.tracecompass.ctf.core.event.CTFClock;
import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
import org.eclipse.tracecompass.ctf.core.trace.CTFReaderException;
/**
* Event aspects available for all CTF traces
*/
- private static final Collection<ITmfEventAspect> CTF_ASPECTS =
+ @SuppressWarnings("null")
+ private static final @NonNull Collection<ITmfEventAspect> CTF_ASPECTS =
ImmutableList.of(
ITmfEventAspect.BaseAspects.TIMESTAMP,
new CtfChannelAspect(),
* The trace type did not specify an event table, we will use a standard
* table with the trace's advertised aspects (if any).
*/
- Iterable<ITmfEventAspect> aspects = trace.getEventAspects();
- if (aspects != null) {
- return new TmfEventsTable(parent, cacheSize, aspects);
- }
-
- /*
- * No columns were defined either, use a default table with the default
- * columns.
- */
- return new TmfEventsTable(parent, cacheSize);
-
+ return new TmfEventsTable(parent, cacheSize, trace.getEventAspects());
}
/**
for (ITmfTrace trace : traces) {
Iterable<ITmfEventAspect> traceAspects = trace.getEventAspects();
- if (traceAspects == null) {
- aspects.addAll(TmfTrace.BASE_ASPECTS);
- } else {
- for (ITmfEventAspect aspect : traceAspects) {
- aspects.add(aspect);
- }
+ for (ITmfEventAspect aspect : traceAspects) {
+ aspects.add(aspect);
}
}
}
@Deprecated
- private static Iterable<ITmfEventAspect> convertFromColumnData(
+ private static @NonNull Iterable<ITmfEventAspect> convertFromColumnData(
org.eclipse.tracecompass.tmf.ui.widgets.virtualtable.ColumnData[] columnData) {
ImmutableList.Builder<ITmfEventAspect> builder = new ImmutableList.Builder<>();
builder.add(new TmfEventFieldAspect(fieldName, fieldName));
}
}
- return builder.build();
+ @SuppressWarnings("null")
+ @NonNull Iterable<ITmfEventAspect> ret = builder.build();
+ return ret;
}
/**
* @since 3.1
*/
public TmfEventsTable(final Composite parent, int cacheSize,
- Iterable<ITmfEventAspect> aspects) {
+ @NonNull Iterable<ITmfEventAspect> aspects) {
super("TmfEventsTable"); //$NON-NLS-1$
fComposite = new Composite(parent, SWT.NONE);
fTable.setLinesVisible(true);
// Setup the columns
- if (aspects != null) {
- for (ITmfEventAspect aspect : aspects) {
- if (aspect != null) {
- fColumns.add(new TmfEventTableColumn(aspect));
- }
+ for (ITmfEventAspect aspect : aspects) {
+ if (aspect != null) {
+ fColumns.add(new TmfEventTableColumn(aspect));
}
}