assertEquals("Node timestamps", v1.getTs(), v2.getTs());
/* Check each edge */
for (EdgeDirection dir : EdgeDirection.values()) {
- if (dir == null) {
- throw new NullPointerException();
- }
TmfEdge edge1 = v1.getEdge(dir);
TmfEdge edge2 = v2.getEdge(dir);
if (edge1 == null) {
/* find vertical links */
graph.scanLineTraverse(vertex, new VerticalLinksVisitor(graph, graphLinks, entryMap));
- fLinks.put(trace, fCurrentObject, graphLinks);
+ fLinks.put(trace, checkNotNull(fCurrentObject), graphLinks);
links = graphLinks;
List<ILinkEvent> linksInRange = new ArrayList<>();
}
@Override
- public @Nullable ITimeGraphEntry[] getChildren(@Nullable Object parentElement) {
+ public ITimeGraphEntry @Nullable [] getChildren(@Nullable Object parentElement) {
if (parentElement instanceof CriticalPathEntry) {
List<? extends ITimeGraphEntry> children = ((CriticalPathEntry) parentElement).getChildren();
return children.toArray(new TimeGraphEntry[children.size()]);
import java.util.TreeSet;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.common.core.NonNullUtils;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
int threadQuark;
try {
threadQuark = ss.getQuarkAbsolute(Attributes.THREADS);
- Set<Integer> tids = new TreeSet<>();
+ Set<@NonNull Integer> tids = new TreeSet<>();
for (Integer quark : ss.getSubAttributes(threadQuark, false)) {
tids.add(Integer.parseInt(ss.getAttributeName(quark)));
}
/**
* @author France Lapointe Nguyen
*/
-@NonNullByDefault(false)
+@NonNullByDefault({})
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.latency.messages"; //$NON-NLS-1$
return new ITmfTreeColumnDataProvider() {
@Override
- public List<TmfTreeColumnData> getColumnData() {
+ public List<@Nullable TmfTreeColumnData> getColumnData() {
/* All columns are sortable */
- List<TmfTreeColumnData> columns = new ArrayList<>();
+ List<@Nullable TmfTreeColumnData> columns = new ArrayList<>();
TmfTreeColumnData column = new TmfTreeColumnData(COLUMN_NAMES[0]);
column.setComparator(new ViewerComparator() {
@Override
*
* @author Bernd Hufmann
*/
-@NonNullByDefault(false)
+@NonNullByDefault({})
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.latency.statistics.messages"; //$NON-NLS-1$
* @author France Lapointe Nguyen
* @since 2.0
*/
-@NonNullByDefault(false)
+@NonNullByDefault({})
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.tracecompass.internal.analysis.timing.ui.views.segmentstore.messages"; //$NON-NLS-1$
/**
* Array of all the segments in the segment store of the current trace
*/
- private @Nullable ISegment[] fSegmentArray = null;
+ private ISegment @Nullable [] fSegmentArray = null;
/**
* Table viewer of the latency table viewer
@Override
public void inputChanged(@Nullable Viewer viewer, @Nullable Object oldInput, @Nullable Object newInput) {
fTableViewer = (TableViewer) viewer;
- if (newInput instanceof ISegmentStore<?>) {
- ISegmentStore<?> segmentStore = (ISegmentStore<?>) newInput;
+ if (newInput instanceof ISegmentStore) {
+ ISegmentStore<ISegment> segmentStore = (ISegmentStore<ISegment>) newInput;
fSegmentArray = Iterables.toArray(segmentStore, ISegment.class);
if (fComparator != null) {
Arrays.sort(fSegmentArray, fComparator);
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 1.2.0.qualifier
+Bundle-Version: 2.0.0.qualifier
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.tracecompass.common.core;singleton:=true
Bundle-Activator: org.eclipse.tracecompass.internal.common.core.Activator
</parent>
<artifactId>org.eclipse.tracecompass.common.core</artifactId>
- <version>1.2.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<name>Trace Compass Common Utilities Core Plug-in</name>
package org.eclipse.tracecompass.common.core;
+import java.util.Map;
+
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
return (str == null ? "" : str); //$NON-NLS-1$
}
+ /**
+ * Checks equality with two nullable objects
+ *
+ * @param o1
+ * the first object to compare
+ * @param o2
+ * the second object to compare
+ * @return true if o1.equals(o2) or o1 == o2
+ * @since 1.0
+ */
+ public static boolean equalsNullable(final @Nullable Object o1, final @Nullable Object o2) {
+ if (o1 == o2) {
+ return true;
+ }
+ if (o1 == null) {
+ return false;
+ }
+ return o1.equals(o2);
+ }
+
+ // ------------------------------------------------------------------------
+ // checkNotNull() methods, to convert @Nullable references to @NonNull ones
+ // ------------------------------------------------------------------------
+
/**
* Convert a non-annotated object reference to a {@link NonNull} one.
*
* @throws NullPointerException
* If the reference was actually null
*/
- public static <T> T checkNotNull(@Nullable T obj) {
+ public static <T> @NonNull T checkNotNull(@Nullable T obj) {
if (obj == null) {
throw new NullPointerException();
}
}
/**
- * Checks equality with two nullable objects
+ * Convert a non-annotated [] array reference to a @NonNull one.
*
- * @param o1
- * the first object to compare
- * @param o2
- * the second object to compare
- * @return true if o1.equals(o2) or o1 == o2
- * @since 1.0
+ * Note that this method does not check the array contents itself, which can
+ * still contain null elements.
+ *
+ * @param array
+ * The array whose reference should not be null
+ * @return A {@link NonNull} reference to the array
+ * @throws NullPointerException
+ * If the reference was actually null
+ * @since 2.0
*/
- public static boolean equalsNullable(final @Nullable Object o1, final @Nullable Object o2) {
- if (o1 == o2) {
- return true;
+ public static <@Nullable T> T[] checkNotNull(T @Nullable [] array) {
+ if (array == null) {
+ throw new NullPointerException();
}
- if (o1 == null) {
- return false;
+ return array;
+ }
+
+ /**
+ * Convert a non-annotated {@link Iterable} to a NonNull one.
+ *
+ * Note that, unlike {{@link #checkNotNull(Object)}}, this method does not
+ * check the contents itself, which can still contain null elements.
+ *
+ * @param container
+ * The iterable whose reference should not be null
+ * @return A {@link NonNull} reference to the Iterable. The original class
+ * type is preserved.
+ * @throws NullPointerException
+ * If the reference was actually null
+ * @since 2.0
+ */
+ public static <@Nullable T, C extends Iterable<T>> C checkNotNull(@Nullable C container) {
+ if (container == null) {
+ throw new NullPointerException();
}
- return o1.equals(o2);
+ return container;
}
+
+ /**
+ * Convert a non-annotated {@link Map} to a NonNull one.
+ *
+ * Note that, unlike {{@link #checkNotNull(Object)}}, this method does not
+ * check the keys or values themselves, which can still contain null
+ * elements.
+ *
+ * @param map
+ * The map whose reference should not be null
+ * @return A {@link NonNull} reference to the Map
+ * @throws NullPointerException
+ * If the reference was actually null
+ * @since 2.0
+ */
+ public static <@Nullable K, @Nullable V, M extends Map<K, V>> M checkNotNull(@Nullable M map) {
+ if (map == null) {
+ throw new NullPointerException();
+ }
+ return map;
+ }
+
+
}
* Utility methods for arbitrary objects.
*
* @author Patrick Tasse
- * @since 1.2
+ * @since 2.0
*/
public final class ObjectUtils {
@Override
public T next() {
if (hasNext()) {
- T next = fNext;
+ @Nullable T next = fNext;
if (next != null) {
fNext = null;
return next;
*/
@Test
public void testGetBytes() {
- @NonNull
- byte[] data = new byte[2];
+ byte @NonNull [] data = new byte[2];
ByteBuffer bb = ByteBuffer.allocate(10);
bb.put((byte) 0);
bb.put((byte) 1);
*/
@Test
public void testGetBytesMiddle() throws CTFException {
- @NonNull
- byte[] data = new byte[5];
+ byte @NonNull [] data = new byte[5];
// this string has been carefully selected and tested... don't change
// the string and expect the result to be the same.
fixture = new BitBuffer(Util.testMemory(ByteBuffer.wrap(new String("hello world").getBytes())));
* - If there are fewer than length bytes remaining in this
* buffer
*/
- public void get(@NonNull byte[] dst) {
+ public void get(byte @NonNull [] dst) {
fBuffer.position((int) (fPosition / BIT_CHAR));
fBuffer.get(dst);
fPosition += dst.length * BIT_CHAR;
*
* @return the definitions
*/
- public abstract List<Definition> getDefinitions();
+ public abstract List<@Nullable Definition> getDefinitions();
/**
* Get the the number of elements in the array
* @throws CTFException
* error in reading
*/
- Definition createDefinition(IDefinitionScope definitionScope, @NonNull String fieldName, @NonNull BitBuffer input) throws CTFException;
+ @NonNull Definition createDefinition(IDefinitionScope definitionScope, @NonNull String fieldName, @NonNull BitBuffer input) throws CTFException;
/**
* Get the path of a definition
/**
* Maps event ids to events
*/
- private final ArrayList<IEventDeclaration> fEvents = new ArrayList<>();
+ private final ArrayList<@Nullable IEventDeclaration> fEvents = new ArrayList<>();
private boolean fEventUnsetId = false;
private boolean fStreamIdSet = false;
}
}
- private static void ensureSize(ArrayList<? extends Object> list, int index) {
+ private static void ensureSize(ArrayList<@Nullable ? extends Object> list, int index) {
list.ensureCapacity(index);
while (list.size() <= index) {
list.add(null);
return "[declaration] array[" + Integer.toHexString(hashCode()) + ']'; //$NON-NLS-1$
}
- private @NonNull List<Definition> read(@NonNull BitBuffer input, @Nullable IDefinitionScope definitionScope, String fieldName) throws CTFException {
- Builder<Definition> definitions = new ImmutableList.Builder<>();
+ private @NonNull List<@NonNull Definition> read(@NonNull BitBuffer input, @Nullable IDefinitionScope definitionScope, String fieldName) throws CTFException {
+ Builder<@NonNull Definition> definitions = new ImmutableList.Builder<>();
if (!fChildrenNames.containsKey(fieldName)) {
for (int i = 0; i < fLength; i++) {
fChildrenNames.put(fieldName, fieldName + '[' + i + ']');
}
}
for (LttngWorker k : kernelWorker) {
- if (k == null) {
- throw new NullPointerException();
- }
List<TmfVertex> nodes = graph.getNodesOf(k);
for (TmfVertex node : nodes) {
/*
* @author Francis Giraldeau <francis.giraldeau@gmail.com>
*
*/
-@NonNullByDefault(false)
+@NonNullByDefault({})
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.tracecompass.internal.lttng2.kernel.core.analysis.graph.handlers.messages"; //$NON-NLS-1$
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
+import java.util.Map;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.annotation.Nullable;
private final Table<String, Integer, LttngWorker> fKernel;
private final IMatchProcessingUnit fMatchProcessing;
- private HashMap<ITmfEvent, TmfVertex> fTcpNodes;
+ private Map<ITmfEvent, TmfVertex> fTcpNodes;
private TmfEventMatching fTcpMatching;
/**
}
@Override
- public void init(@Nullable Collection<ITmfTrace> fTraces) {
+ public void init(Collection<ITmfTrace> fTraces) {
}
return LttngInterruptContext.DEFAULT_CONTEXT;
}
LttngInterruptContext peek = stack.peek();
- if (peek == null) {
- peek = LttngInterruptContext.DEFAULT_CONTEXT;
- }
return peek;
}
package org.eclipse.tracecompass.internal.lttng2.kernel.core.analysis.vm.model;
+import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.common.core.NonNullUtils;
import com.google.common.collect.HashBasedTable;
*/
public class VirtualCPU {
- private static final Table<VirtualMachine, Long, VirtualCPU> VIRTUAL_CPU_TABLE = NonNullUtils.checkNotNull(HashBasedTable.<VirtualMachine, Long, VirtualCPU> create());
+ private static final Table<VirtualMachine, Long, @Nullable VirtualCPU> VIRTUAL_CPU_TABLE = NonNullUtils.checkNotNull(HashBasedTable.<VirtualMachine, Long, VirtualCPU> create());
private final VirtualMachine fVm;
private final Long fCpuId;
* Create the multimap for threads with the appropriate comparator
* objects for keys and values
*/
- final Multimap<Integer, ITmfStateInterval> map = NonNullUtils.checkNotNull(TreeMultimap.<Integer, ITmfStateInterval> create(
+ final Multimap<Integer, ITmfStateInterval> map = NonNullUtils.checkNotNull(TreeMultimap.<@NonNull Integer, @NonNull ITmfStateInterval> create(
new Comparator<Integer>() {
@Override
public int compare(@Nullable Integer arg0, @Nullable Integer arg1) {
* module
*/
for (Integer tid : KernelThreadInformationProvider.getThreadIds(kernelModule)) {
- if (tid == null) {
- throw new IllegalStateException();
- }
map.putAll(tid, KernelThreadInformationProvider.getStatusIntervalsForThread(kernelModule, tid, start, end, resolution, monitor));
if (monitor.isCanceled()) {
return map;
/* TODO: An analysis should support many hypervisor models */
private IVirtualMachineModel fModel;
- private final Table<ITmfTrace, String, Integer> fEventNames;
+ private final Table<ITmfTrace, String, @Nullable Integer> fEventNames;
private final Map<ITmfTrace, IKernelAnalysisEventLayout> fLayouts;
// ------------------------------------------------------------------------
super(experiment, "Virtual Machine State Provider"); //$NON-NLS-1$
fModel = new QemuKvmVmModel(experiment);
- Table<ITmfTrace, String, Integer> table = NonNullUtils.checkNotNull(HashBasedTable.<ITmfTrace, String, Integer> create());
+ Table<ITmfTrace, String, @Nullable Integer> table = NonNullUtils.checkNotNull(HashBasedTable.<ITmfTrace, String, Integer> create());
fEventNames = table;
fLayouts = new HashMap<>();
}
return new HostThread(hostId, currentTid);
}
-}
\ No newline at end of file
+}
*/
public class TcpLttngEventMatching implements ITmfMatchEventDefinition {
- private static final @NonNull String[] KEY_SEQ = { TcpEventStrings.TRANSPORT_FIELDS, TcpEventStrings.TYPE_TCP, TcpEventStrings.SEQ };
- private static final @NonNull String[] KEY_ACKSEQ = { TcpEventStrings.TRANSPORT_FIELDS, TcpEventStrings.TYPE_TCP, TcpEventStrings.ACKSEQ };
- private static final @NonNull String[] KEY_FLAGS = { TcpEventStrings.TRANSPORT_FIELDS, TcpEventStrings.TYPE_TCP, TcpEventStrings.FLAGS };
+ private static final String @NonNull [] KEY_SEQ = { TcpEventStrings.TRANSPORT_FIELDS, TcpEventStrings.TYPE_TCP, TcpEventStrings.SEQ };
+ private static final String @NonNull [] KEY_ACKSEQ = { TcpEventStrings.TRANSPORT_FIELDS, TcpEventStrings.TYPE_TCP, TcpEventStrings.ACKSEQ };
+ private static final String @NonNull [] KEY_FLAGS = { TcpEventStrings.TRANSPORT_FIELDS, TcpEventStrings.TYPE_TCP, TcpEventStrings.FLAGS };
private static final ImmutableSet<String> REQUIRED_EVENTS = ImmutableSet.of(
TcpEventStrings.NET_DEV_QUEUE,
public Map<String, String> getFields() {
Map<String, String> map = fFields;
if (map == null) {
- ImmutableMap.Builder<String, String> builder = ImmutableMap.<String, String> builder();
+ ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
builder.put("Source MAC Address", ConversionHelper.toMacAddress(fSourceMacAddress)); //$NON-NLS-1$
builder.put("Destination MAC Address", ConversionHelper.toMacAddress(fDestinationMacAddress)); //$NON-NLS-1$
builder.put("Ethertype", String.valueOf(EthertypeHelper.toEtherType(fType))); //$NON-NLS-1$
private final int fHeaderChecksum;
private final Inet4Address fSourceIpAddress;
private final Inet4Address fDestinationIpAddress;
- private final @Nullable byte[] fOptions;
+ private final byte @Nullable [] fOptions;
private @Nullable IPv4Endpoint fSourceEndpoint;
private @Nullable IPv4Endpoint fDestinationEndpoint;
*
* @return The options of the packet.
*/
- public @Nullable byte[] getOptions() {
+ public byte @Nullable [] getOptions() {
final byte[] options = fOptions;
if (options == null) {
return null;
private final int fWindowSize;
private final int fChecksum;
private final int fUrgentPointer;
- private final @Nullable byte[] fOptions; // TODO Interpret options.
+ private final byte @Nullable [] fOptions; // TODO Interpret options.
private @Nullable TCPEndpoint fSourceEndpoint;
private @Nullable TCPEndpoint fDestinationEndpoint;
*
* @return The options of the packet.
*/
- public @Nullable byte[] getOptions() {
+ public byte @Nullable [] getOptions() {
byte[] options = fOptions;
if (options == null) {
return null;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.osgi.util.NLS;
-@NonNullByDefault(false)
+@NonNullByDefault({})
@SuppressWarnings("javadoc")
public class Messages extends NLS {
package org.eclipse.tracecompass.internal.tmf.pcap.core.event;
import java.util.ArrayList;
-import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.StreamSupport;
import org.eclipse.tracecompass.internal.pcap.core.packet.Packet;
import org.eclipse.tracecompass.internal.pcap.core.protocol.PcapProtocol;
import org.eclipse.tracecompass.internal.pcap.core.protocol.pcap.PcapPacket;
-import org.eclipse.tracecompass.internal.pcap.core.stream.PacketStream;
import org.eclipse.tracecompass.internal.pcap.core.stream.PacketStreamBuilder;
import org.eclipse.tracecompass.internal.tmf.pcap.core.protocol.TmfPcapProtocol;
import org.eclipse.tracecompass.internal.tmf.pcap.core.util.ProtocolConversion;
public synchronized Iterable<TmfPacketStream> getStreams() {
// We can't store in immutable list since the stream number/content can
// change dynamically.
- List<TmfPacketStream> list = new ArrayList<>();
- for (PacketStream stream : fBuilder.getStreams()) {
- if (stream != null) {
- list.add(new TmfPacketStream(stream));
- }
- }
- return list;
+ return StreamSupport.stream(fBuilder.getStreams().spliterator(), false)
+ .map(e -> new TmfPacketStream(e))
+ .collect(Collectors.toCollection(ArrayList::new));
}
-
}
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.common.core.NonNullUtils;
import org.eclipse.tracecompass.internal.pcap.core.packet.BadPacketException;
import org.eclipse.tracecompass.internal.pcap.core.protocol.pcap.PcapPacket;
import org.eclipse.tracecompass.internal.pcap.core.trace.BadPcapFileException;
Map<String, String> properties = fTraceProperties;
if (properties == null) {
- ImmutableMap.Builder<String, String> builder = ImmutableMap.<String, String> builder();
- builder.put(Messages.PcapTrace_Version, String.format("%d%c%d", pcap.getMajorVersion(), '.', pcap.getMinorVersion())); //$NON-NLS-1$
- builder.put(Messages.PcapTrace_TimeZoneCorrection, pcap.getTimeZoneCorrection() + " s"); //$NON-NLS-1$
- builder.put(Messages.PcapTrace_TimestampAccuracy, String.valueOf(pcap.getTimeAccuracy()));
- builder.put(Messages.PcapTrace_MaxSnapLength, pcap.getSnapLength() + " bytes"); //$NON-NLS-1$
- builder.put(Messages.PcapTrace_LinkLayerHeaderType, LinkTypeHelper.toString((int) pcap.getDataLinkType()) + " (" + pcap.getDataLinkType() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- builder.put(Messages.PcapTrace_FileEndianness, pcap.getByteOrder().toString());
+ ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
+ builder.put(NonNullUtils.nullToEmptyString(Messages.PcapTrace_Version), String.format("%d%c%d", pcap.getMajorVersion(), '.', pcap.getMinorVersion())); //$NON-NLS-1$
+ builder.put(NonNullUtils.nullToEmptyString(Messages.PcapTrace_TimeZoneCorrection), pcap.getTimeZoneCorrection() + " s"); //$NON-NLS-1$
+ builder.put(NonNullUtils.nullToEmptyString(Messages.PcapTrace_TimestampAccuracy), String.valueOf(pcap.getTimeAccuracy()));
+ builder.put(NonNullUtils.nullToEmptyString(Messages.PcapTrace_MaxSnapLength), pcap.getSnapLength() + " bytes"); //$NON-NLS-1$
+ builder.put(NonNullUtils.nullToEmptyString(Messages.PcapTrace_LinkLayerHeaderType), LinkTypeHelper.toString((int) pcap.getDataLinkType()) + " (" + pcap.getDataLinkType() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+ builder.put(NonNullUtils.nullToEmptyString(Messages.PcapTrace_FileEndianness), pcap.getByteOrder().toString());
return checkNotNull(builder.build());
}
for (Entry<TmfPcapProtocol, Table> protocolEntry : tables.entrySet()) {
TmfPcapProtocol protocol = protocolEntry.getKey();
- if (protocol == null) {
- throw new IllegalStateException();
- }
TmfPacketStreamBuilder builder = analysis.getBuilder(protocol);
Table table = protocolEntry.getValue();
if (builder != null && !(table.isDisposed())) {
<version>2.0.0</version>
</artifact>
</target>
- <filters>
- <filter>
- <type>eclipse-plugin</type>
- <id>org.eclipse.jdt.annotation</id>
- <restrictTo>
- <versionRange>[1.0,2.0)</versionRange>
- </restrictTo>
- </filter>
- </filters>
</configuration>
</plugin>
<plugin>
<configuration>
<encoding>UTF-8</encoding>
<useProjectSettings>true</useProjectSettings>
+ <compilerArguments>
+ <annotationpath>common/org.eclipse.tracecompass.common.core/annotations</annotationpath>
+ </compilerArguments>
</configuration>
</plugin>
<plugin>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<?pde version="3.8"?><target name="tracecompass-e4.5" sequenceNumber="56">
+<?pde version="3.8"?><target name="tracecompass-e4.5" sequenceNumber="57">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.cdt.gnu.dsf.feature.group" version="0.0.0"/>
<unit id="org.eclipse.pde.runtime" version="0.0.0"/>
<unit id="org.eclipse.pde.junit.runtime" version="0.0.0"/>
<unit id="org.eclipse.test.feature.group" version="0.0.0"/>
-<unit id="org.eclipse.jdt.annotation" version="1.1.100.v20140704-0625"/>
+<unit id="org.eclipse.jdt.annotation" version="2.0.100.v20150311-1658"/>
<unit id="org.eclipse.ui.views.log" version="0.0.0"/>
<repository location="http://download.eclipse.org/eclipse/updates/4.5/"/>
</location>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<?pde version="3.8"?><target name="tracecompass-eStaging" sequenceNumber="49">
+<?pde version="3.8"?><target name="tracecompass-eStaging" sequenceNumber="50">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.cdt.gnu.dsf.feature.group" version="0.0.0"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.test.feature.group" version="0.0.0"/>
-<unit id="org.eclipse.jdt.annotation" version="1.1.100.v20140704-0625"/>
+<unit id="org.eclipse.jdt.annotation" version="2.0.100.v20150311-1658"/>
<repository location="http://download.eclipse.org/eclipse/updates/4.5/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
import java.util.Arrays;
import java.util.List;
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.tracecompass.segmentstore.core.BasicSegment;
import org.eclipse.tracecompass.segmentstore.core.ISegment;
import org.eclipse.tracecompass.segmentstore.core.treemap.TreeMapStore;
*/
public class TreeMapStoreTest {
- private TreeMapStore<ISegment> fSegmentStore;
+ private TreeMapStore<@NonNull ISegment> fSegmentStore;
private static final ISegment SEGMENT_2_6 = new BasicSegment(2, 6);
private static final ISegment SEGMENT_4_6 = new BasicSegment(4, 6);
*/
@Test
public void testToSpecifyArraySubtype() {
- TreeMapStore<BasicSegment> tms2 = new TreeMapStore<>();
+ TreeMapStore<@NonNull BasicSegment> tms2 = new TreeMapStore<>();
BasicSegment otherSegment = new BasicSegment(2, 6);
tms2.add(otherSegment);
BasicSegment[] array = tms2.toArray(new BasicSegment[0]);
@Test
public void testIterationOrderNonSortedInsertion() {
/* Prepare the segment store, we don't use the 'fixture' in this test */
- TreeMapStore<ISegment> store = new TreeMapStore<>();
+ TreeMapStore<@NonNull ISegment> store = new TreeMapStore<>();
for (ISegment segment : REVERSE_SEGMENTS) {
store.add(checkNotNull(segment));
}
*/
@Test
public void testDispose() {
- TreeMapStore<ISegment> store = new TreeMapStore<>();
+ TreeMapStore<@NonNull ISegment> store = new TreeMapStore<>();
store.add(SEGMENT_2_6);
store.dispose();
assertEquals(0, store.size());
}
@Override
- public <T> T[] toArray(@Nullable T[] a) {
+ public <T> T[] toArray(T @Nullable[] a) {
fLock.readLock().lock();
try {
return checkNotNull(fStartTimesIndex.values().toArray(a));
*
* @return The full attribute path elements
*/
- public @NonNull String[] getFullAttribute() {
+ public String @NonNull [] getFullAttribute() {
LinkedList<String> list = new LinkedList<>();
Attribute curNode = this;
* The quark of the attribute
* @return The path elements of the full path
*/
- public synchronized @NonNull String[] getFullAttributePathArray(int quark) {
+ public synchronized String @NonNull [] getFullAttributePathArray(int quark) {
return attributeList.get(quark).getFullAttribute();
}
fRWLock.readLock().lock();
try {
checkValidAttribute(quark);
- ITmfStateValue ret = fOngoingStateInfo.get(quark);
- if (ret == null) {
- throw new IllegalStateException("Null interval stored in transient state"); //$NON-NLS-1$
- }
- return ret;
+ return fOngoingStateInfo.get(quark);
} finally {
fRWLock.readLock().unlock();
}
* If the attribute quark is out of range
* @since 1.0
*/
- @NonNull String[] getFullAttributePathArray(int attributeQuark);
+ String @NonNull [] getFullAttributePathArray(int attributeQuark);
/**
* Returns the parent quark of the attribute.
Element rootNode = node;
/* Process the conditions: in each case, only process Element nodes */
- List<Element> childElements = XmlUtils.getChildElements(rootNode);
+ List<@Nullable Element> childElements = XmlUtils.getChildElements(rootNode);
/*
* If the node is an if, take the child as the root condition
childElements = XmlUtils.getChildElements(rootNode);
}
+ if (rootNode == null) {
+ throw new IllegalArgumentException();
+ }
+
switch (rootNode.getNodeName()) {
case TmfXmlStrings.CONDITION:
fOperator = LogicalOperator.NONE;
* A state value is either preceded by an eventField or a number of
* state attributes
*/
- if (childElements.size() == 1 && childElements.get(0).getNodeName().equals(TmfXmlStrings.ELEMENT_FIELD)) {
- String attribute = childElements.get(0).getAttribute(TmfXmlStrings.NAME);
+ @Nullable Element firstChild = childElements.get(0);
+ if (firstChild == null) {
+ throw new IllegalStateException();
+ }
+
+ if (childElements.size() == 1 && firstChild.getNodeName().equals(TmfXmlStrings.ELEMENT_FIELD)) {
+ String attribute = firstChild.getAttribute(TmfXmlStrings.NAME);
if (attribute == null) {
throw new IllegalArgumentException();
}
} else {
List<ITmfXmlStateAttribute> attributes = new ArrayList<>();
for (Element element : childElements) {
- if (!element.getNodeName().equals(TmfXmlStrings.STATE_ATTRIBUTE)) {
+ if (element == null || !element.getNodeName().equals(TmfXmlStrings.STATE_ATTRIBUTE)) {
throw new IllegalArgumentException("TmfXmlCondition: a condition either has a eventField element or a number of TmfXmlStateAttribute elements before the state value"); //$NON-NLS-1$
}
ITmfXmlStateAttribute attribute = modelFactory.createStateAttribute(element, fContainer);
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.Activator;
import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
}
fName = name;
- List<Element> childElements = XmlUtils.getChildElements(node, TmfXmlStrings.STATE_CHANGE);
+ List<@NonNull Element> childElements = XmlUtils.getChildElements(node, TmfXmlStrings.STATE_CHANGE);
/* load state changes */
for (Element childElem : childElements) {
- if (childElem == null) {
- continue;
- }
TmfXmlStateChange stateChange = modelFactory.createStateChange(childElem, fParent);
fStateChangeList.add(stateChange);
}
fId = id;
fContainer = container;
- List<Element> childElements = XmlUtils.getChildElements(location);
+ List<@Nullable Element> childElements = XmlUtils.getChildElements(location);
for (Element attribute : childElements) {
if (attribute == null) {
continue;
fName = fContainer.getAttributeValue(attribute.getAttribute(TmfXmlStrings.VALUE));
break;
case TmfXmlStrings.TYPE_QUERY:
- List<Element> childElements = XmlUtils.getChildElements(attribute);
+ List<@Nullable Element> childElements = XmlUtils.getChildElements(attribute);
for (Element subAttributeNode : childElements) {
if (subAttributeNode == null) {
continue;
private final ITmfXmlStateValue fValue;
public XmlStateValueChange(ITmfXmlModelFactory modelFactory, Element statechange) {
- List<Element> childElements = XmlUtils.getChildElements(statechange);
+ List<@Nullable Element> childElements = XmlUtils.getChildElements(statechange);
/*
* Last child element is the state value, the others are attributes
}
List<ITmfXmlStateAttribute> attributes = new ArrayList<>();
for (Element element : childElements) {
- if (!element.getNodeName().equals(TmfXmlStrings.STATE_ATTRIBUTE)) {
+ if (element == null || !element.getNodeName().equals(TmfXmlStrings.STATE_ATTRIBUTE)) {
throw new IllegalArgumentException("TmfXmlStateChange: a state change must have only TmfXmlStateAttribute elements before the state value"); //$NON-NLS-1$
}
ITmfXmlStateAttribute attribute = modelFactory.createStateAttribute(element, fContainer);
break;
case TmfXmlStrings.TYPE_QUERY:
/* Value is the result of a query */
- List<Element> children = XmlUtils.getChildElements(node);
+ List<@Nullable Element> children = XmlUtils.getChildElements(node);
List<ITmfXmlStateAttribute> childAttributes = new ArrayList<>();
for (Element child : children) {
if (child == null) {
package org.eclipse.tracecompass.tmf.analysis.xml.core.module;
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
import org.eclipse.tracecompass.tmf.analysis.xml.core.model.TmfXmlLocation;
*
* @return The list of {@link TmfXmlLocation}
*/
- Iterable<TmfXmlLocation> getLocations();
+ @NonNull Iterable<@NonNull TmfXmlLocation> getLocations();
}
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.osgi.util.NLS;
import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.Activator;
import org.eclipse.tracecompass.tmf.analysis.xml.core.stateprovider.TmfXmlStrings;
* The parent element to get children from
* @return The list of children Element of the parent
*/
- public static List<Element> getChildElements(Element parent) {
+ public static List<@Nullable Element> getChildElements(Element parent) {
NodeList childNodes = parent.getChildNodes();
- List<Element> childElements = new ArrayList<>();
+ List<@Nullable Element> childElements = new ArrayList<>();
for (int index = 0; index < childNodes.getLength(); index++) {
if (childNodes.item(index).getNodeType() == Node.ELEMENT_NODE) {
childElements.add((Element) childNodes.item(index));
* The tag of the elements to return
* @return The list of children {@link Element} of the parent
*/
- public static List<Element> getChildElements(Element parent, String elementTag) {
+ public static List<@NonNull Element> getChildElements(Element parent, String elementTag) {
/* get the state providers and find the corresponding one */
NodeList nodes = parent.getElementsByTagName(elementTag);
- List<Element> childElements = new ArrayList<>();
+ List<@NonNull Element> childElements = new ArrayList<>();
for (int i = 0; i < nodes.getLength(); i++) {
Element node = (Element) nodes.item(i);
plugin.xml,\
test_xml_files/
src.includes = about.html
+additional.bundles = org.eclipse.jdt.annotation
+jars.extra.classpath = platform:/plugin/org.eclipse.jdt.annotation
org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.xychart;x-internal:=true,
org.eclipse.tracecompass.tmf.analysis.xml.ui.module,
org.eclipse.tracecompass.tmf.analysis.xml.ui.views.timegraph
+Import-Package: com.google.common.collect
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.Activator;
private class SeriesData {
private final double[] fYValues;
- private final @Nullable double[] fYAbsoluteValues;
+ private final double @Nullable [] fYAbsoluteValues;
private final Integer fDisplayQuark;
private final String fName;
private final DisplayType fType;
}
@Override
- public @Nullable Iterable<TmfXmlLocation> getLocations() {
+ public @NonNull Iterable<@NonNull TmfXmlLocation> getLocations() {
return Collections.EMPTY_SET;
}
((TmfStateSystemAnalysisModule) module).waitForInitialization();
}
for (ITmfStateSystem ssq : module.getStateSystems()) {
- if (ssq != null) {
- ss = ssq;
- break;
- }
+ ss = ssq;
+ break;
}
}
if (ss == null) {
fEntry = entry;
/* Get the display element to use */
- List<Element> displayElements = XmlUtils.getChildElements(entryElement, TmfXmlUiStrings.DISPLAY_ELEMENT);
+ List<@NonNull Element> displayElements = XmlUtils.getChildElements(entryElement, TmfXmlUiStrings.DISPLAY_ELEMENT);
if (displayElements.isEmpty()) {
Activator.logWarning(String.format("XML view: entry for %s should have a display element", path)); //$NON-NLS-1$
return;
}
Element displayElement = displayElements.get(0);
- if (displayElement == null) {
- throw new IllegalStateException();
- }
fDisplay = fFactory.createStateAttribute(displayElement, entry);
/* Get the series name element to use */
List<Element> seriesNameElements = XmlUtils.getChildElements(entryElement, TmfXmlUiStrings.NAME_ELEMENT);
if (!seriesNameElements.isEmpty()) {
Element seriesNameElement = seriesNameElements.get(0);
- if (seriesNameElement == null) {
- throw new IllegalStateException();
- }
fSeriesName = fFactory.createStateAttribute(seriesNameElement, entry);
}
((TmfStateSystemAnalysisModule) module).waitForInitialization();
}
for (ITmfStateSystem ssq : module.getStateSystems()) {
- if (ssq == null) {
- return;
- }
ssq.waitUntilBuilt();
long startTime = ssq.getStartTime();
org.eclipse.core.resources,
org.eclipse.tracecompass.common.core,
org.eclipse.tracecompass.tmf.core,
- org.eclipse.test.performance
+ org.eclipse.test.performance,
+ org.eclipse.cdt.core
Export-Package: org.eclipse.tracecompass.tmf.core.tests,
org.eclipse.tracecompass.tmf.core.tests.perf,
org.eclipse.tracecompass.tmf.core.tests.shared,
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.File;
public void testTraceParsing() {
ITmfContext context = fTrace.seekEvent(0);
SyslogEvent event = fTrace.getNext(context);
+ assertNotNull(event);
TextTraceEventContent content = event.getContent();
assertEquals("getTimestamp", "Jan 1 01:01:01", event.getTimestamp().toString());
assertEquals("getField:HOST", "HostA", content.getFieldValue(Field.HOST));
assertEquals("getField:LINE", "4", content.getFieldValue(Field.LINE));
assertEquals("getField:MESSAGE", "Message A", content.getFieldValue(Field.MESSAGE).toString());
event = fTrace.getNext(context);
+ assertNotNull(event);
content = event.getContent();
assertEquals("getTimestamp", "Jan 1 02:02:02", event.getTimestamp().toString());
assertEquals("getField:HOST", "HostB", content.getFieldValue(Field.HOST));
assertEquals("getField:LINE", "5", content.getFieldValue(Field.LINE));
assertEquals("getField:MESSAGE", "Message B", content.getFieldValue(Field.MESSAGE).toString());
event = fTrace.getNext(context);
+ assertNotNull(event);
content = event.getContent();
assertEquals("getTimestamp", "Jan 1 03:03:03", event.getTimestamp().toString());
assertEquals("getField:HOST", "HostC", content.getFieldValue(Field.HOST));
assertEquals("getField:LINE", "6", content.getFieldValue(Field.LINE));
assertEquals("getField:MESSAGE", "Message C", content.getFieldValue(Field.MESSAGE).toString());
event = fTrace.getNext(context);
+ assertNotNull(event);
content = event.getContent();
assertEquals("getTimestamp", "Jan 1 04:04:04", event.getTimestamp().toString());
assertEquals("getField:HOST", "HostD", content.getFieldValue(Field.HOST));
assertEquals("getField:LINE", "7", content.getFieldValue(Field.LINE));
assertEquals("getField:MESSAGE", "Message D", content.getFieldValue(Field.MESSAGE).toString());
event = fTrace.getNext(context);
+ assertNotNull(event);
content = event.getContent();
assertEquals("getTimestamp", "Jan 1 05:05:05", event.getTimestamp().toString());
assertEquals("getField:HOST", "HostE", content.getFieldValue(Field.HOST));
assertEquals("getField:LINE", "8", content.getFieldValue(Field.LINE));
assertEquals("getField:MESSAGE", "", content.getFieldValue(Field.MESSAGE).toString());
event = fTrace.getNext(context);
+ assertNotNull(event);
content = event.getContent();
assertEquals("getTimestamp", "Jan 1 06:06:06", event.getTimestamp().toString());
assertEquals("getField:HOST", "HostF", content.getFieldValue(Field.HOST));
ITmfContext context = fTrace.seekEvent(3);
double ratio = fTrace.getLocationRatio(context.getLocation());
SyslogEvent event = fTrace.getNext(context);
+ assertNotNull(event);
TextTraceEventContent content = event.getContent();
Object logger = content.getFieldValue(Field.LOGGER);
context.dispose();
context = fTrace.seekEvent(ratio);
event = fTrace.getNext(context);
+ assertNotNull(event);
content = event.getContent();
assertEquals("getField:LOGGER", logger.toString(), content.getFieldValue(Field.LOGGER).toString());
context.dispose();
context = fTrace.seekEvent(0.0);
event = fTrace.getNext(context);
+ assertNotNull(event);
content = event.getContent();
assertEquals("getField:LOGGER", "LoggerA", content.getFieldValue(Field.LOGGER));
context.dispose();
package org.eclipse.tracecompass.internal.tmf.core.analysis;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
continue;
}
if (analysisId.equals(id)) {
- if (fParamProviderInstances.containsKey(className)) {
- providers.add(fParamProviderInstances.get(className));
+ IAnalysisParameterProvider provider = fParamProviderInstances.get(className);
+ if (provider != null) {
+ providers.add(provider);
} else {
- IAnalysisParameterProvider provider = (IAnalysisParameterProvider) ce.createExecutableExtension(CLASS_ATTR);
+ provider = checkNotNull((IAnalysisParameterProvider) ce.createExecutableExtension(CLASS_ATTR));
fParamProviderInstances.put(className, provider);
providers.add(provider);
}
return REMOVE_ZEROS_PATTERN.matcher(address).replaceFirst(""); //$NON-NLS-1$
}
- private static @Nullable IBinaryParser.IBinaryObject getBinaryObject(File file) {
+ private static IBinaryParser.@Nullable IBinaryObject getBinaryObject(File file) {
IPath filePath = new Path(file.toString());
/* Get all the available binary parsers */
package org.eclipse.tracecompass.tmf.core.analysis;
+import org.eclipse.jdt.annotation.NonNull;
/**
* Interface that module sources must implement. A module source provides a list
*
* @return The analysis module helpers in iterable format
*/
- Iterable<IAnalysisModuleHelper> getAnalysisModules();
+ @NonNull Iterable<IAnalysisModuleHelper> getAnalysisModules();
}
package org.eclipse.tracecompass.tmf.core.analysis;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
/**
* Interface that provides the necessary methods for an analysis to define its
* requirements.
* @author Guilliano Molaire
* @author Mathieu Rail
*/
+@NonNullByDefault
public interface IAnalysisRequirementProvider {
/**
private @Nullable String fId;
private boolean fAutomatic = false, fStarted = false;
private volatile @Nullable ITmfTrace fTrace;
- private final Map<String, Object> fParameters = new HashMap<>();
+ private final Map<String, @Nullable Object> fParameters = new HashMap<>();
private final List<String> fParameterNames = new ArrayList<>();
private final List<IAnalysisOutput> fOutputs = new ArrayList<>();
private Set<IAnalysisParameterProvider> fParameterProviders = new HashSet<>();
provider = providerClass.newInstance();
fParamProviderInstances.put(providerClass, provider);
}
- if (provider != null && provider.appliesToTrace(trace)) {
+ if (provider.appliesToTrace(trace)) {
providerSet.add(provider);
}
} catch (IllegalArgumentException | SecurityException | InstantiationException | IllegalAccessException e) {
import java.util.Set;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+
/**
* Interface for events to implement to provide information about custom
* attributes.
*
* @author Simon Delisle
*/
+@NonNullByDefault
public interface ITmfCustomAttributes {
/**
* @return Value of this attribute, or null if there is no attribute with
* that name
*/
- String getCustomAttribute(String name);
+ @Nullable String getCustomAttribute(String name);
}
\ No newline at end of file
* @param path The path to the subfield
* @return a specific subfield by path (null if inexistent)
*/
- ITmfEventField getField(@NonNull String... path);
+ ITmfEventField getField(String @NonNull ... path);
}
import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Map;
* @throws IllegalArgumentException
* If 'name' is null, or if 'fields' has duplicate field names.
*/
- public TmfEventField(@NonNull String name, @Nullable Object value, @Nullable ITmfEventField[] fields) {
+ public TmfEventField(@NonNull String name, @Nullable Object value, ITmfEventField @Nullable [] fields) {
fName = name;
fValue = value;
if (fields == null) {
fFields = checkNotNull(ImmutableMap.<String, ITmfEventField> of());
} else {
- /* Java 8 streams will make this even more simple! */
ImmutableMap.Builder<String, ITmfEventField> mapBuilder = new ImmutableMap.Builder<>();
- for (ITmfEventField field : fields) {
- final String curName = field.getName();
- mapBuilder.put(curName, field);
- }
+ Arrays.stream(fields).forEach(t -> mapBuilder.put(t.getName(), t));
fFields = checkNotNull(mapBuilder.build());
}
}
import java.util.Collection;
+import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
/**
*
* @author Geneviève Bastien
*/
+@NonNullByDefault
public interface IMatchProcessingUnit {
/**
import java.util.Map;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
/**
* Interface for trace types to implement when they can provide additional
* trace-wide properties.
*
* @author Alexandre Montplaisir
*/
+@NonNullByDefault
public interface ITmfTraceProperties {
/**
import java.util.Map.Entry;
import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.jdt.annotation.Nullable;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
Collection<Entry<Class<? extends ITmfTrace>, IAdapterFactory>> entries = fFactoriesByClass.entries();
List<T> adapters = new ArrayList<>(factoriesById.size() + entries.size());
for (IAdapterFactory factory : factoriesById) {
- T adapter = factory.getAdapter(trace, adapterType);
+ @Nullable T adapter = factory.getAdapter(trace, adapterType);
if (adapter != null) {
adapters.add(adapter);
}
}
for (Entry<Class<? extends ITmfTrace>, IAdapterFactory> entry : entries) {
if (entry.getKey().isInstance(trace)) {
- T adapter = entry.getValue().getAdapter(trace, adapterType);
+ @Nullable T adapter = entry.getValue().getAdapter(trace, adapterType);
if (adapter != null) {
adapters.add(adapter);
}
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.internal.tmf.core.Activator;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
}
@Override
- public synchronized T getNext(ITmfContext context) {
+ public synchronized @Nullable T getNext(ITmfContext context) {
if (!(context instanceof TextTraceContext)) {
throw new IllegalArgumentException();
}
TextTraceContext savedContext = new TextTraceContext(context.getLocation(), context.getRank());
- T event = parse((TextTraceContext) context);
+ @Nullable T event = parse((TextTraceContext) context);
if (event != null) {
updateAttributes(savedContext, event);
context.increaseRank();
* the context
* @return the next event or null
*/
- protected synchronized T parse(TextTraceContext tmfContext) {
+ protected synchronized @Nullable T parse(TextTraceContext tmfContext) {
if (fFile == null) {
return null;
}
* @throws IllegalArgumentException
* if any one of the field names is null
*/
- public TextTraceEventContent(@NonNull String[] fieldNames) {
+ public TextTraceEventContent(String @NonNull [] fieldNames) {
fName = ITmfEventField.ROOT_FIELD_ID;
fValue = null;
fFields = new ArrayList<>(fieldNames.length);
public class CommandInputTest {
private static final @NonNull String COMMAND = "my-command";
- private static final @NonNull String[] CMD_INPUT = { "This", "are", "the", "params" };
+ private static final String @NonNull [] CMD_INPUT = { "This", "are", "the", "params" };
/**
* Test suite for the {@link CommandInput#add(String)} and {@link CommandInput#addAll(List)}
*/
public class CommandResultTest {
- private static final @NonNull String[] CMD_OUTPUT = { "This", "is", "the", "output" };
- private static final @NonNull String[] CMD_NO_ERROR_OUTPUT = {};
- private static final @NonNull String[] CMD_ERROR_OUTPUT = { "This", "is", "the", "error", "output" };
+ private static final String @NonNull [] CMD_OUTPUT = { "This", "is", "the", "output" };
+ private static final String @NonNull [] CMD_NO_ERROR_OUTPUT = {};
+ private static final String @NonNull [] CMD_ERROR_OUTPUT = { "This", "is", "the", "error", "output" };
/**
* Test suite for the {@link CommandResult} class
private static final boolean IS_UNIX = !Platform.getOS().equals(Platform.OS_WIN32);
- private static final @NonNull String[] CMD_INPUT_UNIX = { "ls", "-l" };
- private static final @NonNull String[] CMD_ERROR_INPUT_UNIX = { "ls", "blablablabla" };
- private static final @NonNull String[] CMD_UNKNOWN_COMMAND_UNIX = { "blablablabla" };
+ private static final String @NonNull [] CMD_INPUT_UNIX = { "ls", "-l" };
+ private static final String @NonNull [] CMD_ERROR_INPUT_UNIX = { "ls", "blablablabla" };
+ private static final String @NonNull [] CMD_UNKNOWN_COMMAND_UNIX = { "blablablabla" };
private static final IRemoteConnection LOCAL_CONNECTION = TmfRemoteConnectionFactory.getLocalConnection();
private static final RemoteSystemProxy LOCAL_PROXY = new RemoteSystemProxy(checkNotNull(LOCAL_CONNECTION));
return new CommandResult(result, output, error);
}
- private static @NonNull String[] splitLines(String output) {
+ private static String @NonNull [] splitLines(String output) {
return checkNotNull(output.split("\\r?\\n")); //$NON-NLS-1$
}
}
org.eclipse.ui.navigator,
org.eclipse.ui.navigator.resources,
org.eclipse.jface.text,
+ org.eclipse.cdt.core,
org.swtchart,
com.ibm.icu,
org.eclipse.linuxtools.dataviewers.piechart,
/* Display custom attributes, if available */
if (fEvent instanceof ITmfCustomAttributes) {
ITmfCustomAttributes event = (ITmfCustomAttributes) fEvent;
- if (event.listCustomAttributes() != null && !event.listCustomAttributes().isEmpty()) {
+ if (!event.listCustomAttributes().isEmpty()) {
descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_CUSTOM_ATTRIBUTE, NAME_CUSTOM_ATTRIBUTES));
}
}
/**
* Empty string array, used by {@link #getItemStrings}.
*/
- protected static final @NonNull String[] EMPTY_STRING_ARRAY = new String[0];
+ protected static final String @NonNull [] EMPTY_STRING_ARRAY = new String[0];
/**
* Empty string
import java.util.List;
+import org.eclipse.jdt.annotation.NonNull;
+
/**
* Basic methods that must be implemented in a column data provider. Tree
* viewers will use class implementing this to populate the columns.
*
* @return columns list
*/
- List<TmfTreeColumnData> getColumnData();
+ @NonNull List<TmfTreeColumnData> getColumnData();
}
\ No newline at end of file
import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseEvent;
* @author Bernd Hufmann
* @since 2.0
*/
-@NonNullByDefault(false)
public class TmfClosestDataPointTooltipProvider extends TmfBaseProvider implements MouseTrackListener, MouseMoveListener, PaintListener {
// ------------------------------------------------------------------------
((TmfStateSystemAnalysisModule) module).waitForInitialization();
}
for (ITmfStateSystem ss : module.getStateSystems()) {
- if (ss != null) {
- traceEntry.addChild(new StateSystemEntry(ss));
- }
+ traceEntry.addChild(new StateSystemEntry(ss));
}
}
return traceEntry;
* The progress monitor object
* @return The list of events for the entry
*/
- protected abstract @Nullable List<ITimeEvent> getEventList(@NonNull TimeGraphEntry entry,
+ protected abstract @Nullable List<@NonNull ITimeEvent> getEventList(@NonNull TimeGraphEntry entry,
long startTime, long endTime, long resolution,
@NonNull IProgressMonitor monitor);
* The progress monitor object
* @return The list of link events
*/
- protected @Nullable List<ILinkEvent> getLinkList(long startTime, long endTime,
+ protected @Nullable List<@NonNull ILinkEvent> getLinkList(long startTime, long endTime,
long resolution, @NonNull IProgressMonitor monitor) {
return new ArrayList<>();
}
@Override
public <T> T getAdapter(Class<T> adapter) {
- T obj = super.getAdapter(adapter);
if (fSdPropertiesProvider != null && adapter.equals(IPropertySheetPage.class)) {
return adapter.cast(fSdPropertiesProvider.getPropertySheetEntry());
}
-
- return obj;
+ return super.getAdapter(adapter);
}
/**