Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources,
+ org.eclipse.tracecompass.common.core,
org.eclipse.tracecompass.tmf.core;bundle-version="0.1.0"
Export-Package: org.eclipse.tracecompass.btf.core,
org.eclipse.tracecompass.btf.core.analysis,
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.tracecompass.btf.core.event.BtfEvent;
+import org.eclipse.tracecompass.common.core.NonNullUtils;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
import org.eclipse.tracecompass.tmf.core.event.aspect.TmfEventFieldAspect;
private BtfEventAspects() {}
- @SuppressWarnings("null")
- private static final @NonNull Iterable<ITmfEventAspect> BTF_ASPECTS = ImmutableList.of(
- ITmfEventAspect.BaseAspects.TIMESTAMP,
- new BtfSourceAspect(),
- new BtfSourceInstanceAspect(),
- ITmfEventAspect.BaseAspects.EVENT_TYPE,
- new BtfTargetAspect(),
- new BtfTargetInstanceAspect(),
- new BtfEventAspect(),
- new BtfNotesAspect()
- );
+ private static final @NonNull Iterable<ITmfEventAspect> BTF_ASPECTS =
+ NonNullUtils.checkNotNull(ImmutableList.of(
+ ITmfEventAspect.BaseAspects.TIMESTAMP,
+ new BtfSourceAspect(),
+ new BtfSourceInstanceAspect(),
+ ITmfEventAspect.BaseAspects.EVENT_TYPE,
+ new BtfTargetAspect(),
+ new BtfTargetInstanceAspect(),
+ new BtfEventAspect(),
+ new BtfNotesAspect()
+ ));
/**
* The "source" aspect, whose value comes from {@link ITmfEvent#getSource()}
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.tracecompass.ctf.parser;bundle-version="0.1.0",
- org.eclipse.tracecompass.common.core
+ org.eclipse.tracecompass.common.core,
+ org.eclipse.tracecompass.ctf.parser;bundle-version="0.1.0"
Export-Package: org.eclipse.tracecompass.ctf.core,
org.eclipse.tracecompass.ctf.core.event,
org.eclipse.tracecompass.ctf.core.event.io,
package org.eclipse.tracecompass.ctf.core.event.io;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.nio.BufferUnderflowException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
/**
* Default constructor, makes a big-endian buffer
*/
- @SuppressWarnings("null")
public BitBuffer() {
- this(ByteBuffer.allocateDirect(0), ByteOrder.BIG_ENDIAN);
+ this(checkNotNull(ByteBuffer.allocateDirect(0)), ByteOrder.BIG_ENDIAN);
}
/**
package org.eclipse.tracecompass.ctf.core.event.scope;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
* @param name
* the name of the field
*/
- @SuppressWarnings("null")
public LexicalScope(@Nullable LexicalScope parent, String name) {
fName = name;
if (parent != null) {
- String pathString = Joiner.on('.').skipNulls().join(parent.fPath, parent.getName());
+ @NonNull String pathString = checkNotNull(Joiner.on('.').skipNulls().join(parent.fPath, parent.getName()));
/*
* if joiner return null, we get an NPE... so we won't assign fPath
* to null
* substring throws an exception or returns a string, it won't
* return null
*/
- pathString = pathString.substring(1);
+ pathString = checkNotNull(pathString.substring(1));
}
fPath = pathString;
parent.addChild(fName, this);
package org.eclipse.tracecompass.ctf.core.event.types;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.math.BigInteger;
import java.nio.ByteOrder;
-import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
fSigned = signed;
fBase = base;
- @SuppressWarnings("null")
- @NonNull
- ByteOrder actualByteOrder = (byteOrder == null ? ByteOrder.nativeOrder() : byteOrder);
- fByteOrder = actualByteOrder;
+ fByteOrder = (byteOrder == null ? checkNotNull(ByteOrder.nativeOrder()) : byteOrder);
fEncoding = encoding;
fClock = clock;
* For a given N significant bits, compute the maximal value which is (1
* << N) - 1.
*/
-
- @SuppressWarnings("null")
- @NonNull
- BigInteger ret = BigInteger.ONE.shiftLeft(significantBits).subtract(BigInteger.ONE);
- return ret;
+ return checkNotNull(BigInteger.ONE.shiftLeft(significantBits).subtract(BigInteger.ONE));
}
/**
*/
public BigInteger getMinValue() {
if (!fSigned) {
- @SuppressWarnings("null")
- @NonNull
- BigInteger ret = BigInteger.ZERO;
- return ret;
+ return checkNotNull(BigInteger.ZERO);
}
/*
* For a given N significant bits, compute the minimal value which is -
* (1 << N).
*/
- @SuppressWarnings("null")
- @NonNull
- BigInteger ret = BigInteger.ONE.shiftLeft(significantBits).negate();
- return ret;
+ return checkNotNull(BigInteger.ONE.shiftLeft(significantBits).negate());
}
private long read(BitBuffer input) throws CTFReaderException {
package org.eclipse.tracecompass.ctf.core.event.types;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
LexicalScope fieldScope, @NonNull BitBuffer input) throws CTFReaderException {
alignRead(input);
final Definition[] myFields = new Definition[fFieldMap.size()];
- /*
- * Key set is NOT null
- */
- @SuppressWarnings("null")
- StructDefinition structDefinition = new StructDefinition(this, definitionScope, fieldScope, fieldScope.getName(), fFieldMap.keySet(), myFields);
+
+ StructDefinition structDefinition = new StructDefinition(this,definitionScope,
+ fieldScope, fieldScope.getName(), checkNotNull(fFieldMap.keySet()), myFields);
fillStruct(input, myFields, structDefinition);
return structDefinition;
}
fMaxAlign = Math.max(fMaxAlign, declaration.getAlignment());
}
- @SuppressWarnings("null")
private void fillStruct(@NonNull BitBuffer input, final Definition[] myFields, StructDefinition structDefinition) throws CTFReaderException {
Iterator<Map.Entry<String, IDeclaration>> iter = fFieldMap.entrySet().iterator();
for (int i = 0; i < fFieldMap.size(); i++) {
Map.Entry<String, IDeclaration> entry = iter.next();
- myFields[i] = entry.getValue().createDefinition(structDefinition, entry.getKey(), input);
+ /* We should not have inserted null keys... */
+ String key = checkNotNull(entry.getKey());
+ myFields[i] = entry.getValue().createDefinition(structDefinition, key, input);
}
}
package org.eclipse.tracecompass.internal.ctf.core.event.types;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.util.List;
import org.eclipse.jdt.annotation.NonNull;
}
definitions.add(fElemType.createDefinition(definitionScope, name, input));
}
- @SuppressWarnings("null")
- @NonNull
- ImmutableList<Definition> ret = definitions.build();
- return ret;
+ return checkNotNull(definitions.build());
}
@Override
package org.eclipse.tracecompass.internal.ctf.core.event.types;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.util.List;
-import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
// Attributes
// ------------------------------------------------------------------------
- private final ImmutableList<Definition> fDefinitions;
+ private final List<Definition> fDefinitions;
// ------------------------------------------------------------------------
// Constructors
String fieldName,
List<Definition> definitions) {
super(declaration, definitionScope, fieldName);
- @SuppressWarnings("null")
- @NonNull ImmutableList<Definition> list = ImmutableList.copyOf(definitions);
- fDefinitions = list;
+ fDefinitions = checkNotNull(ImmutableList.copyOf(definitions));
}
// ------------------------------------------------------------------------
Joiner joiner = Joiner.on(", ").skipNulls(); //$NON-NLS-1$
b.append(joiner.join(fDefinitions));
b.append(']');
- @SuppressWarnings("null")
- @NonNull String ret = b.toString();
- return ret;
+ return checkNotNull(b.toString());
}
}
\ No newline at end of file
import java.util.Arrays;
import java.util.List;
-import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.common.core.NonNullUtils;
import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
import org.eclipse.tracecompass.ctf.core.event.types.AbstractArrayDefinition;
import org.eclipse.tracecompass.ctf.core.event.types.CompoundDeclaration;
byte fieldValue = fContent[i];
builder.add(new IntegerDefinition(charDecl, getDefinitionScope(), fieldName, fieldValue));
}
- @SuppressWarnings("null")
- @NonNull List<Definition> ret = builder.build();
- fDefs = ret;
- return ret;
+ fDefs = NonNullUtils.checkNotNull(builder.build());
+ return fDefs;
}
return defs;
package org.eclipse.tracecompass.internal.ctf.core.event.types;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.util.Collection;
import java.util.List;
-import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
List<String> paths = (List<String>) fPaths.get(fieldName);
Builder<Definition> definitions = new ImmutableList.Builder<>();
for (int i = 0; i < length; i++) {
- @SuppressWarnings("null")
- @NonNull
- String elemName = paths.get(i);
+ /* We should not have inserted any null values */
+ String elemName = checkNotNull(paths.get(i));
definitions.add(fElemType.createDefinition(definitionScope, elemName, input));
}
- @SuppressWarnings("null")
- @NonNull ImmutableList<Definition> build = definitions.build();
- return new ArrayDefinition(this, definitionScope, fieldName, build);
+ List<Definition> list = checkNotNull(definitions.build());
+ return new ArrayDefinition(this, definitionScope, fieldName, list);
}
@Override
org.eclipse.ui.ide,
org.eclipse.debug.core,
org.eclipse.debug.ui,
+ org.eclipse.tracecompass.common.core,
org.eclipse.tracecompass.tmf.core;bundle-version="0.1.0",
org.eclipse.tracecompass.tmf.ui;bundle-version="0.1.0",
org.eclipse.cdt.dsf,
package org.eclipse.tracecompass.internal.gdbtrace.core.trace;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.tracecompass.internal.gdbtrace.core.event.GdbTraceEvent;
import org.eclipse.tracecompass.internal.gdbtrace.core.event.GdbTraceEventContent;
private GdbEventAspects() {}
- @SuppressWarnings("null")
- private static final @NonNull Iterable<ITmfEventAspect> GDB_ASPECTS = ImmutableList.of(
- new GdbTraceFrameAspect(),
- new GdbTracepointAspect(),
- new GdbFileAspect()
- );
+ private static final @NonNull Iterable<ITmfEventAspect> GDB_ASPECTS =
+ checkNotNull(ImmutableList.of(
+ new GdbTraceFrameAspect(),
+ new GdbTracepointAspect(),
+ new GdbFileAspect()
+ ));
private static class GdbTraceFrameAspect extends TmfEventFieldAspect {
public GdbTraceFrameAspect() {
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources,
+ org.eclipse.tracecompass.common.core,
org.eclipse.tracecompass.ctf.core;bundle-version="0.1.0",
org.eclipse.tracecompass.tmf.core;bundle-version="0.1.0",
org.eclipse.tracecompass.tmf.ctf.core,
package org.eclipse.tracecompass.internal.lttng2.kernel.core.trace.layout;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.util.Collection;
import org.eclipse.jdt.annotation.NonNull;
private static final String SOFTIRQ_RAISE = "softirq_raise";
private static final String SCHED_SWITCH = "sched_switch";
- @SuppressWarnings("null")
- private static final @NonNull Collection<String> SCHED_WAKEUP_EVENTS = ImmutableList.of("sched_wakeup", "sched_wakeup_new");
+ private static final Collection<String> SCHED_WAKEUP_EVENTS =
+ checkNotNull(ImmutableList.of("sched_wakeup", "sched_wakeup_new"));
private static final String SCHED_PROCESS_FORK = "sched_process_fork";
private static final String SCHED_PROCESS_EXIT = "sched_process_exit";
package org.eclipse.tracecompass.internal.lttng2.kernel.core.trace.layout;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.util.Collection;
-import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import com.google.common.collect.ImmutableList;
return "sched:sched_switch"; //$NON-NLS-1$
}
- @SuppressWarnings("null")
- private static final @NonNull Collection<String> WAKEUP_EVENTS = ImmutableList.of(
- "sched:sched_wakeup", "sched:sched_wakeup_new"); //$NON-NLS-1$ //$NON-NLS-2$
+ private static final Collection<String> WAKEUP_EVENTS =
+ checkNotNull(ImmutableList.of("sched:sched_wakeup", "sched:sched_wakeup_new")); //$NON-NLS-1$ //$NON-NLS-2$
@Override
public Collection<String> eventsSchedWakeup() {
package org.eclipse.tracecompass.lttng2.kernel.core.analysis.kernel;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
+import java.util.Set;
+
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.common.core.NonNullUtils;
import org.eclipse.tracecompass.internal.lttng2.kernel.core.trace.layout.IKernelAnalysisEventLayout;
import org.eclipse.tracecompass.internal.lttng2.kernel.core.trace.layout.LttngEventLayout;
import org.eclipse.tracecompass.lttng2.control.core.session.SessionConfigStrings;
);
/** The requirements as an immutable set */
- private static final @NonNull ImmutableSet<TmfAnalysisRequirement> REQUIREMENTS;
+ private static final @NonNull Set<TmfAnalysisRequirement> REQUIREMENTS;
static {
/* initialize the requirement: domain and events */
TmfAnalysisRequirement eventReq = new TmfAnalysisRequirement(SessionConfigStrings.CONFIG_ELEMENT_EVENT, REQUIRED_EVENTS, ValuePriorityLevel.MANDATORY);
eventReq.addValues(OPTIONAL_EVENTS, ValuePriorityLevel.OPTIONAL);
-
- @SuppressWarnings("null")
- @NonNull ImmutableSet<TmfAnalysisRequirement> reqSet = ImmutableSet.of(domainReq, eventReq);
- REQUIREMENTS = reqSet;
+ REQUIREMENTS = checkNotNull(ImmutableSet.of(domainReq, eventReq));
}
@Override
@Override
protected String getFullHelpText() {
- @SuppressWarnings("null")
- @NonNull String helpText = Messages.LttngKernelAnalysisModule_Help;
- return helpText;
+ return NonNullUtils.nullToEmptyString(Messages.LttngKernelAnalysisModule_Help);
}
@Override
org.eclipse.ui.ide,
org.eclipse.core.resources,
org.eclipse.core.runtime,
+ org.eclipse.tracecompass.common.core,
org.eclipse.tracecompass.tmf.core;bundle-version="0.1.0",
org.eclipse.tracecompass.tmf.ui;bundle-version="0.1.0",
org.eclipse.tracecompass.tmf.ctf.core;bundle-version="0.1.0",
package org.eclipse.tracecompass.internal.lttng2.kernel.ui.views.cpuusage;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
-import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.osgi.util.NLS;
for (ITmfTreeViewerEntry entry : rootEntry.getChildren()) {
if (entry instanceof CpuUsageEntry) {
if (selectedThread.equals(((CpuUsageEntry) entry).getTid())) {
- @SuppressWarnings("null")
- @NonNull List<ITmfTreeViewerEntry> list = Collections.singletonList(entry);
+ List<ITmfTreeViewerEntry> list = checkNotNull(Collections.singletonList(entry));
super.setSelection(list);
return;
}
org.eclipse.tracecompass.lttng2.ust.core.trace
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources,
+ org.eclipse.tracecompass.common.core,
org.eclipse.tracecompass.ctf.core;bundle-version="0.1.0",
org.eclipse.tracecompass.tmf.core;bundle-version="0.1.0",
org.eclipse.tracecompass.tmf.ctf.core,
package org.eclipse.tracecompass.lttng2.ust.core.analysis.memory;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
+import java.util.Set;
+
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.tracecompass.internal.lttng2.ust.core.memoryusage.MemoryUsageStateProvider;
import org.eclipse.tracecompass.internal.lttng2.ust.core.memoryusage.UstMemoryStrings;
);
/** The requirements as an immutable set */
- private static final @NonNull ImmutableSet<TmfAnalysisRequirement> REQUIREMENTS;
+ private static final @NonNull Set<TmfAnalysisRequirement> REQUIREMENTS;
static {
/* Initialize the requirements for the analysis: domain and events */
TmfAnalysisRequirement domainReq = new TmfAnalysisRequirement(SessionConfigStrings.CONFIG_ELEMENT_DOMAIN);
domainReq.addValue(SessionConfigStrings.CONFIG_DOMAIN_TYPE_UST, ValuePriorityLevel.MANDATORY);
- @SuppressWarnings("null")
- @NonNull ImmutableSet<TmfAnalysisRequirement> reqSet = ImmutableSet.of(domainReq, eventsReq);
- REQUIREMENTS = reqSet;
+ REQUIREMENTS = checkNotNull(ImmutableSet.of(domainReq, eventsReq));
}
@Override
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.core.resources
+ org.eclipse.core.resources,
+ org.eclipse.tracecompass.common.core
Export-Package: org.eclipse.tracecompass.internal.pcap.core;x-friends:="org.eclipse.tracecompass.pcap.core.tests",
org.eclipse.tracecompass.internal.pcap.core.endpoint;x-friends:="org.eclipse.tracecompass.tmf.pcap.core",
org.eclipse.tracecompass.internal.pcap.core.filter;x-internal:=true,
package org.eclipse.tracecompass.internal.pcap.core.protocol.ethernet2;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Arrays;
import java.util.Map;
-import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.internal.pcap.core.packet.BadPacketException;
import org.eclipse.tracecompass.internal.pcap.core.packet.Packet;
private @Nullable EthernetIIEndpoint fSourceEndpoint;
private @Nullable EthernetIIEndpoint fDestinationEndpoint;
- private @Nullable ImmutableMap<String, String> fFields;
+ private @Nullable Map<String, String> fFields;
/**
* Constructor of the Ethernet Packet class.
* @return The source MAC address.
*/
public byte[] getSourceMacAddress() {
- @SuppressWarnings("null")
- @NonNull byte[] mac = Arrays.copyOf(fSourceMacAddress, fSourceMacAddress.length);
- return mac;
+ return checkNotNull(Arrays.copyOf(fSourceMacAddress, fSourceMacAddress.length));
}
/**
* @return The destination MAC address.
*/
public byte[] getDestinationMacAddress() {
- @SuppressWarnings("null")
- @NonNull byte[] mac = Arrays.copyOf(fDestinationMacAddress, fDestinationMacAddress.length);
- return mac;
+ return checkNotNull(Arrays.copyOf(fDestinationMacAddress, fDestinationMacAddress.length));
}
/**
@Override
public Map<String, String> getFields() {
- ImmutableMap<String, String> map = fFields;
+ Map<String, String> map = fFields;
if (map == null) {
- @SuppressWarnings("null")
- @NonNull ImmutableMap<String, String> newMap = ImmutableMap.<String, String> builder()
- .put("Source MAC Address", ConversionHelper.toMacAddress(fSourceMacAddress)) //$NON-NLS-1$
- .put("Destination MAC Address", ConversionHelper.toMacAddress(fDestinationMacAddress)) //$NON-NLS-1$
- .put("Ethertype", String.valueOf(EthertypeHelper.toEtherType(fType))) //$NON-NLS-1$
- .build();
- fFields = newMap;
- return newMap;
+ ImmutableMap.Builder<String, String> builder = ImmutableMap.<String, String> 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$
+
+ fFields = checkNotNull(builder.build());
+ return fFields;
}
return map;
}
package org.eclipse.tracecompass.internal.pcap.core.protocol.ipv4;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.net.Inet4Address;
-import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.internal.pcap.core.endpoint.ProtocolEndpoint;
public String toString() {
ProtocolEndpoint endpoint = getParentEndpoint();
if (endpoint == null) {
- @SuppressWarnings("null")
- @NonNull String ret = fIPAddress.getHostAddress();
- return ret;
+ return checkNotNull(fIPAddress.getHostAddress());
}
return endpoint.toString() + '/' + fIPAddress.getHostAddress();
}
package org.eclipse.tracecompass.internal.pcap.core.protocol.ipv4;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;
import java.util.Map;
-import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.internal.pcap.core.packet.BadPacketException;
import org.eclipse.tracecompass.internal.pcap.core.packet.Packet;
private @Nullable IPv4Endpoint fSourceEndpoint;
private @Nullable IPv4Endpoint fDestinationEndpoint;
- private @Nullable ImmutableMap<String, String> fFields;
+ private @Nullable Map<String, String> fFields;
// TODO Interpret options. See
// http://www.iana.org/assignments/ip-parameters/ip-parameters.xhtml
packet.get(destination);
try {
- @SuppressWarnings("null")
- @NonNull Inet4Address sourceIP = (Inet4Address) InetAddress.getByAddress(source);
- @SuppressWarnings("null")
- @NonNull Inet4Address destinationIP = (Inet4Address) InetAddress.getByAddress(destination);
- fSourceIpAddress = sourceIP;
- fDestinationIpAddress = destinationIP;
+ fSourceIpAddress = (Inet4Address) checkNotNull(InetAddress.getByAddress(source));
+ fDestinationIpAddress = (Inet4Address) checkNotNull(InetAddress.getByAddress(destination));
} catch (UnknownHostException e) {
throw new BadPacketException("The IP Address size is not valid!"); //$NON-NLS-1$
}
@Override
public Map<String, String> getFields() {
- ImmutableMap<String, String> map = fFields;
+ Map<String, String> map = fFields;
if (map == null) {
Builder<String, String> builder = ImmutableMap.<String, String> builder()
.put("Version", String.valueOf(fVersion)) //$NON-NLS-1$
builder.put("Options", ConversionHelper.bytesToHex(options, true)); //$NON-NLS-1$
}
- @SuppressWarnings("null")
- @NonNull
- ImmutableMap<String, String> newMap = builder.build();
- fFields = newMap;
- return newMap;
+ fFields = checkNotNull(builder.build());
+ return fFields;
}
return map;
}
import java.nio.ByteOrder;
import java.util.Map;
-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.packet.Packet;
import org.eclipse.tracecompass.internal.pcap.core.protocol.PcapProtocol;
private @Nullable PcapEndpoint fSourceEndpoint;
private @Nullable PcapEndpoint fDestinationEndpoint;
- private @Nullable ImmutableMap<String, String> fFields;
+ private @Nullable Map<String, String> fFields;
/**
* Constructor of the Pcap Packet class.
// TODO microsec
@Override
public Map<String, String> getFields() {
- ImmutableMap<String, String> map = fFields;
+ Map<String, String> map = fFields;
if (map == null) {
- @SuppressWarnings("null")
- @NonNull ImmutableMap<String, String> newMap = ImmutableMap.<String, String> builder()
- .put("Frame", String.valueOf(fPacketIndex)) //$NON-NLS-1$
- .put("Frame Length", String.valueOf(fOriginalLength) + " bytes") //$NON-NLS-1$ //$NON-NLS-2$
- .put("Capture Length", String.valueOf(fIncludedLength) + " bytes") //$NON-NLS-1$ //$NON-NLS-2$
- .put("Capture Time", ConversionHelper.toGMTTime(fTimestamp, getTimestampScale())) //$NON-NLS-1$
- .build();
- fFields = newMap;
- return newMap;
+ ImmutableMap.Builder<String, String> builder = ImmutableMap.<String, String> builder();
+ builder.put("Frame", String.valueOf(fPacketIndex)); //$NON-NLS-1$
+ builder.put("Frame Length", String.valueOf(fOriginalLength) + " bytes"); //$NON-NLS-1$ //$NON-NLS-2$
+ builder.put("Capture Length", String.valueOf(fIncludedLength) + " bytes"); //$NON-NLS-1$ //$NON-NLS-2$
+ builder.put("Capture Time", ConversionHelper.toGMTTime(fTimestamp, getTimestampScale())); //$NON-NLS-1$
+
+ fFields = NonNullUtils.checkNotNull(builder.build());
+ return fFields;
}
return map;
}
package org.eclipse.tracecompass.internal.pcap.core.protocol.tcp;
-import org.eclipse.jdt.annotation.NonNull;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.internal.pcap.core.endpoint.ProtocolEndpoint;
public String toString() {
ProtocolEndpoint endpoint = getParentEndpoint();
if (endpoint == null) {
- @SuppressWarnings("null")
- @NonNull
- String ret = String.valueOf(fPort);
- return ret;
+ return checkNotNull(String.valueOf(fPort));
}
return endpoint.toString() + '/' + fPort;
}
package org.eclipse.tracecompass.internal.pcap.core.protocol.tcp;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Arrays;
import java.util.Map;
-import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.internal.pcap.core.packet.BadPacketException;
import org.eclipse.tracecompass.internal.pcap.core.packet.Packet;
private @Nullable TCPEndpoint fSourceEndpoint;
private @Nullable TCPEndpoint fDestinationEndpoint;
- private @Nullable ImmutableMap<String, String> fFields;
+ private @Nullable Map<String, String> fFields;
/**
* Constructor of the TCP Packet class.
@Override
public Map<String, String> getFields() {
- ImmutableMap<String, String> map = fFields;
+ Map<String, String> map = fFields;
if (map == null) {
Builder<String, String> builder = ImmutableMap.<String, String> builder()
.put("Source Port", String.valueOf(fSourcePort)) //$NON-NLS-1$
builder.put("Options", ConversionHelper.bytesToHex(options, true)); //$NON-NLS-1$
}
- @SuppressWarnings("null")
- @NonNull ImmutableMap<String, String> newMap = builder.build();
- fFields = newMap;
- return newMap;
+ fFields = checkNotNull(builder.build());
+ return fFields;
}
return map;
}
package org.eclipse.tracecompass.internal.pcap.core.protocol.udp;
-import org.eclipse.jdt.annotation.NonNull;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.internal.pcap.core.endpoint.ProtocolEndpoint;
public String toString() {
ProtocolEndpoint endpoint = getParentEndpoint();
if (endpoint == null) {
- @SuppressWarnings("null")
- @NonNull String ret = String.valueOf(fPort);
- return ret;
+ return checkNotNull(String.valueOf(fPort));
}
return endpoint.toString() + '/' + fPort;
}
import java.nio.ByteOrder;
import java.util.Map;
-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.packet.Packet;
import org.eclipse.tracecompass.internal.pcap.core.protocol.PcapProtocol;
private @Nullable UDPEndpoint fSourceEndpoint;
private @Nullable UDPEndpoint fDestinationEndpoint;
- private @Nullable ImmutableMap<String, String> fFields;
+ private @Nullable Map<String, String> fFields;
/**
* Constructor of the UDP Packet class.
@Override
public Map<String, String> getFields() {
- ImmutableMap<String, String> map = fFields;
+ Map<String, String> map = fFields;
if (map == null) {
- @SuppressWarnings("null")
- @NonNull ImmutableMap<String, String> newMap = ImmutableMap.<String, String> builder()
+ ImmutableMap.Builder<String, String> builder = ImmutableMap.<String, String> builder()
.put("Source Port", String.valueOf(fSourcePort)) //$NON-NLS-1$
.put("Destination Port", String.valueOf(fDestinationPort)) //$NON-NLS-1$
.put("Length", String.valueOf(fTotalLength) + " bytes") //$NON-NLS-1$ //$NON-NLS-2$
- .put("Checksum", String.format("%s%04x", "0x", fChecksum)) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- .build();
- fFields = newMap;
- return newMap;
+ .put("Checksum", String.format("%s%04x", "0x", fChecksum)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ fFields = NonNullUtils.checkNotNull(builder.build());
+ return fFields;
}
return map;
}
package org.eclipse.tracecompass.internal.pcap.core.protocol.unknown;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.util.Map;
-import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.internal.pcap.core.packet.Packet;
import org.eclipse.tracecompass.internal.pcap.core.protocol.PcapProtocol;
private @Nullable UnknownEndpoint fSourceEndpoint;
private @Nullable UnknownEndpoint fDestinationEndpoint;
- private @Nullable ImmutableMap<String, String> fFields;
+ private @Nullable Map<String, String> fFields;
/**
* Constructor of an Unknown Packet object.
@Override
public String toString() {
- @SuppressWarnings("null")
- @NonNull byte[] array = fPayload.array();
+ byte[] array = checkNotNull(fPayload.array());
String string = "Payload: " + ConversionHelper.bytesToHex(array, true); //$NON-NLS-1$
final Packet child = fChildPacket;
if (child != null) {
@Override
public Map<String, String> getFields() {
- ImmutableMap<String, String> map = fFields;
+ Map<String, String> map = fFields;
if (map == null) {
- @SuppressWarnings("null")
- @NonNull byte[] array = fPayload.array();
+ byte[] array = checkNotNull(fPayload.array());
Builder<String, String> builder = ImmutableMap.<String, String> builder()
.put("Binary", ConversionHelper.bytesToHex(array, true)); //$NON-NLS-1$
} catch (UnsupportedEncodingException e) {
// Do nothing. The string won't be added to the map anyway.
}
- @SuppressWarnings("null")
- @NonNull ImmutableMap<String, String> newMap = builder.build();
- fFields = newMap;
- return newMap;
+ fFields = checkNotNull(builder.build());
+ return fFields;
}
return map;
}
package org.eclipse.tracecompass.internal.pcap.core.stream;
-import org.eclipse.jdt.annotation.NonNull;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import org.eclipse.tracecompass.internal.pcap.core.endpoint.ProtocolEndpointPair;
import org.eclipse.tracecompass.internal.pcap.core.packet.Packet;
import org.eclipse.tracecompass.internal.pcap.core.protocol.PcapProtocol;
StringBuilder sb = new StringBuilder();
sb.append("Stream " + getUniqueID() + ", Number of Packets: " + getNbPackets() + "\n"); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
- @SuppressWarnings("null")
- @NonNull String string = sb.toString();
- return string;
+ return checkNotNull(sb.toString());
}
package org.eclipse.tracecompass.internal.pcap.core.trace;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.io.Closeable;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.file.Path;
import java.util.TreeMap;
-import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.internal.pcap.core.packet.BadPacketException;
import org.eclipse.tracecompass.internal.pcap.core.protocol.pcap.PcapPacket;
}
// File is not empty. Try to open.
- @SuppressWarnings("null")
- @NonNull SeekableByteChannel channel = Files.newByteChannel(fPcapFilePath);
- fFileChannel = channel;
+ fFileChannel = checkNotNull(Files.newByteChannel(fPcapFilePath));
// Parse the global header.
// Read the magic number (4 bytes) from the input stream
globalHeader.flip();
int magicNumber = globalHeader.getInt();
- @SuppressWarnings("null")
- @NonNull ByteOrder be = ByteOrder.BIG_ENDIAN;
- @SuppressWarnings("null")
- @NonNull ByteOrder le = ByteOrder.LITTLE_ENDIAN;
-
switch (magicNumber) {
case PcapFileValues.MAGIC_BIG_ENDIAN_MICRO: // file is big endian
- fByteOrder = be;
+ fByteOrder = checkNotNull(ByteOrder.BIG_ENDIAN);
fTimestampPrecision = PcapTimestampScale.MICROSECOND;
break;
case PcapFileValues.MAGIC_LITTLE_ENDIAN_MICRO: // file is little endian
- fByteOrder = le;
+ fByteOrder = checkNotNull(ByteOrder.LITTLE_ENDIAN);
fTimestampPrecision = PcapTimestampScale.MICROSECOND;
break;
case PcapFileValues.MAGIC_BIG_ENDIAN_NANO: // file is big endian
- fByteOrder = be;
+ fByteOrder = checkNotNull(ByteOrder.BIG_ENDIAN);
fTimestampPrecision = PcapTimestampScale.NANOSECOND;
break;
case PcapFileValues.MAGIC_LITTLE_ENDIAN_NANO: // file is little endian
- fByteOrder = le;
+ fByteOrder = checkNotNull(ByteOrder.LITTLE_ENDIAN);
fTimestampPrecision = PcapTimestampScale.NANOSECOND;
break;
default:
package org.eclipse.tracecompass.internal.pcap.core.util;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
-import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.tracecompass.internal.pcap.core.protocol.ethernet2.EthernetIIValues;
/**
*/
public final class ConversionHelper {
- @SuppressWarnings("null")
- private static final @NonNull char[] HEX_ARRAY = "0123456789abcdef".toCharArray(); //$NON-NLS-1$
+ private static final char[] HEX_ARRAY = checkNotNull("0123456789abcdef".toCharArray()); //$NON-NLS-1$
private static final String EMPTY_STRING = ""; //$NON-NLS-1$
private static final String DEFAULT_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss.SSS"; //$NON-NLS-1$
private static final DateFormat DATE_FORMATTER = new SimpleDateFormat(DEFAULT_TIME_PATTERN);
<feature url="features/org.eclipse.tracecompass.rcp_0.0.0.qualifier.jar" id="org.eclipse.tracecompass.rcp" version="0.0.0"/>
<feature url="features/org.eclipse.tracecompass.rcp.branding.feature_0.0.0.qualifier.jar" id="org.eclipse.tracecompass.rcp.branding.feature" version="0.0.0"/>
<feature url="features/org.eclipse.tracecompass.testing_0.0.0.qualifier.jar" id="org.eclipse.tracecompass.testing" version="0.0.0"/>
+ <bundle id="org.eclipse.tracecompass.common.core" version="0.1.0.qualifier"/>
<category-def name="Trace Compass" label="Trace Compass Main Features"/>
</site>
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.tracecompass.common.core,
org.eclipse.tracecompass.tmf.core
Export-Package: org.eclipse.tracecompass.internal.tmf.analysis.xml.core;x-friends:="org.eclipse.tracecompass.tmf.analysis.xml.core.tests",
org.eclipse.tracecompass.tmf.analysis.xml.core.model,
package org.eclipse.tracecompass.tmf.analysis.xml.core.model;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.util.List;
import org.eclipse.jdt.annotation.NonNull;
/*
* Stack Actions : allow to define a stack with PUSH/POP/PEEK methods
*/
- @SuppressWarnings("null")
- @NonNull String stack = node.getAttribute(TmfXmlStrings.ATTRIBUTE_STACK);
+ String stack = checkNotNull(node.getAttribute(TmfXmlStrings.ATTRIBUTE_STACK));
fStackType = ValueTypeStack.getTypeFromString(stack);
}
package org.eclipse.tracecompass.tmf.analysis.xml.core.model.readonly;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.util.Collections;
import java.util.List;
*/
public TmfXmlReadOnlyStateValue(TmfXmlReadOnlyModelFactory modelFactory, Element node,
IXmlStateSystemContainer container, String eventField) {
- super(modelFactory, node, container, Collections.EMPTY_LIST, eventField);
+ super(modelFactory, node, container, checkNotNull(Collections.EMPTY_LIST), eventField);
}
}
Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
+ org.eclipse.tracecompass.common.core,
org.eclipse.tracecompass.tmf.core,
org.eclipse.tracecompass.tmf.ui,
org.eclipse.tracecompass.tmf.analysis.xml.core
package org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.xychart;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
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;
/** Timeout between updates in the updateData thread */
private static final long BUILD_UPDATE_TIMEOUT = 500;
- @SuppressWarnings("null")
- private static final @NonNull Pattern WILDCARD_PATTERN = Pattern.compile("\\*"); //$NON-NLS-1$
+ private static final Pattern WILDCARD_PATTERN = checkNotNull(Pattern.compile("\\*")); //$NON-NLS-1$
private final ITmfXmlModelFactory fFactory = TmfXmlReadOnlyModelFactory.getInstance();
private final Map<Integer, SeriesData> fSeriesData = new HashMap<>();
public List<Integer> getQuarks() {
/* Get the list of quarks to process with this path */
String[] paths = fPath.split(SPLIT_STRING);
- @SuppressWarnings("null")
- @NonNull List<Integer> quarks = Collections.singletonList(IXmlStateSystemContainer.ROOT_QUARK);
+ List<Integer> quarks = checkNotNull(Collections.singletonList(IXmlStateSystemContainer.ROOT_QUARK));
try {
for (String path : paths) {
package org.eclipse.tracecompass.tmf.analysis.xml.ui.module;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.io.File;
import java.util.Collections;
import java.util.List;
* The attribute ID cannot be null because the XML has been validated
* and it is mandatory
*/
- @SuppressWarnings("null")
- @NonNull String id = fSourceElement.getAttribute(TmfXmlStrings.ID);
- return id;
+ return checkNotNull(fSourceElement.getAttribute(TmfXmlStrings.ID));
}
@Override
Require-Bundle: org.junit;bundle-version="4.0.0",
org.eclipse.core.runtime,
org.eclipse.core.resources,
+ org.eclipse.tracecompass.common.core,
org.eclipse.tracecompass.tmf.core;bundle-version="0.1.0",
org.eclipse.test.performance
Export-Package: org.eclipse.tracecompass.tmf.core.tests,
org.eclipse.tracecompass.tmf.tests.stubs.trace,
org.eclipse.tracecompass.tmf.tests.stubs.trace.xml
Import-Package: com.google.common.collect,
- com.google.common.primitives;version="15.0.0"
+ com.google.common.primitives
package org.eclipse.tracecompass.tmf.tests.stubs.analysis;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.util.Collections;
import org.eclipse.core.runtime.Platform;
@Override
public String getName() {
- @SuppressWarnings("null")
- @NonNull String name = fModule.name();
- return name;
+ return checkNotNull(fModule.name());
}
@Override
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources,
+ org.eclipse.tracecompass.common.core,
org.eclipse.tracecompass.statesystem.core;visibility:=reexport
Export-Package: org.eclipse.tracecompass.internal.tmf.core;x-friends:="org.eclipse.tracecompass.tmf.core.tests,org.eclipse.tracecompass.tmf.ui.swtbot.tests",
org.eclipse.tracecompass.internal.tmf.core.analysis;x-friends:="org.eclipse.tracecompass.tmf.core.tests",
package org.eclipse.tracecompass.internal.tmf.core.analysis;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModuleHelper;
import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModuleSource;
import org.eclipse.tracecompass.tmf.core.analysis.TmfAnalysisModuleHelperConfigElement;
typeElements.add(element);
}
}
- @SuppressWarnings("null")
- @NonNull IConfigurationElement[] typeElems = typeElements.toArray(new IConfigurationElement[typeElements.size()]);
- return typeElems;
+ return checkNotNull(typeElements.toArray(new IConfigurationElement[typeElements.size()]));
}
/**
package org.eclipse.tracecompass.internal.tmf.core.parsers.custom;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.util.List;
import org.eclipse.jdt.annotation.NonNull;
builder.add(new CustomEventFieldAspect(name, i));
}
}
- @SuppressWarnings("null")
- @NonNull Iterable<ITmfEventAspect> ret = builder.build();
- return ret;
+ return checkNotNull(builder.build());
}
}
package org.eclipse.tracecompass.tmf.core.analysis;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.osgi.util.NLS;
+import org.eclipse.tracecompass.common.core.NonNullUtils;
import org.eclipse.tracecompass.internal.tmf.core.Activator;
import org.eclipse.tracecompass.tmf.core.analysis.TmfAnalysisRequirement.ValuePriorityLevel;
import org.eclipse.tracecompass.tmf.core.component.TmfComponent;
* @return An iterable list of analysis this analyzes depends on.
*/
protected Iterable<IAnalysisModule> getDependentAnalyses() {
- @SuppressWarnings("null")
- @NonNull Set<IAnalysisModule> emptySet = Collections.EMPTY_SET;
- return emptySet;
+ return checkNotNull(Collections.EMPTY_LIST);
}
private void execute(final ITmfTrace trace) {
/*
* Actual analysis will be run on a separate thread
*/
- @SuppressWarnings("null")
- @NonNull String jobName = NLS.bind(Messages.TmfAbstractAnalysisModule_RunningAnalysis, getName());
+ String jobName = checkNotNull(NLS.bind(Messages.TmfAbstractAnalysisModule_RunningAnalysis, getName()));
fJob = new Job(jobName) {
@Override
protected @Nullable IStatus run(final @Nullable IProgressMonitor monitor) {
execute(trace);
}
- @SuppressWarnings("null")
- @NonNull IStatus status = Status.OK_STATUS;
- return status;
+ return checkNotNull(Status.OK_STATUS);
}
@Override
* @return Full help text for the module
*/
protected String getFullHelpText() {
- @SuppressWarnings("null")
- @NonNull String text = NLS.bind(Messages.TmfAbstractAnalysisModule_AnalysisModule, getName());
- return text;
+ return NonNullUtils.nullToEmptyString(NLS.bind(
+ Messages.TmfAbstractAnalysisModule_AnalysisModule,
+ getName()));
}
/**
* @return Short help text describing the module
*/
protected String getShortHelpText(ITmfTrace trace) {
- @SuppressWarnings("null")
- @NonNull String text = NLS.bind(Messages.TmfAbstractAnalysisModule_AnalysisForTrace, getName(), trace.getName());
- return text;
+ return NonNullUtils.nullToEmptyString(NLS.bind(
+ Messages.TmfAbstractAnalysisModule_AnalysisForTrace,
+ getName(), trace.getName()));
}
/**
}
}
}
- @SuppressWarnings("null")
- @NonNull String helpText = builder.toString();
- return helpText;
+ return checkNotNull(builder.toString());
}
@Override
@Override
public Iterable<TmfAnalysisRequirement> getAnalysisRequirements() {
- @SuppressWarnings("null")
- @NonNull Iterable<TmfAnalysisRequirement> emptySet = Collections.EMPTY_SET;
- return emptySet;
+ return checkNotNull(Collections.EMPTY_SET);
}
}
package org.eclipse.tracecompass.tmf.core.analysis;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.util.ArrayList;
-import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.internal.tmf.core.Activator;
import org.eclipse.tracecompass.internal.tmf.core.analysis.TmfAnalysisModuleSources;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
+import com.google.common.collect.ImmutableMap;
+
/**
* Manages the available analysis helpers from different sources and their
* parameter providers.
}
}
}
- @SuppressWarnings("null")
- @NonNull Map<String, IAnalysisModuleHelper> map = Collections.unmodifiableMap(fAnalysisModules);
- return map;
+ return checkNotNull(ImmutableMap.copyOf(fAnalysisModules));
}
/**
map.put(module.getId(), module);
}
}
- @SuppressWarnings("null")
- @NonNull Map<String, IAnalysisModuleHelper> retMap = Collections.unmodifiableMap(map);
- return retMap;
+ return checkNotNull(ImmutableMap.copyOf(map));
}
/**
import java.util.TimerTask;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.common.core.NonNullUtils;
import org.eclipse.tracecompass.internal.tmf.core.TmfCoreTracer;
import org.eclipse.tracecompass.internal.tmf.core.component.TmfEventThread;
import org.eclipse.tracecompass.internal.tmf.core.component.TmfProviderManager;
return null;
}
- @SuppressWarnings("null")
@Override
public ITmfEventProvider getChild(int index) {
- return fChildren.get(index);
+ return NonNullUtils.checkNotNull(fChildren.get(index));
}
@Override
package org.eclipse.tracecompass.tmf.core.event;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.util.Collection;
+import java.util.Map;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
private final @NonNull String fName;
private final @Nullable Object fValue;
- private final @NonNull ImmutableMap<String, ITmfEventField> fFields;
+ private final @NonNull Map<String, ITmfEventField> fFields;
// ------------------------------------------------------------------------
// Constructors
* @throws IllegalArgumentException
* If 'name' is null, or if 'fields' has duplicate field names.
*/
- @SuppressWarnings("null") /* ImmutableMap methods do not return @NonNull */
public TmfEventField(String name, @Nullable Object value, @Nullable ITmfEventField[] fields) {
if (name == null) {
throw new IllegalArgumentException();
fValue = value;
if (fields == null) {
- fFields = ImmutableMap.of();
+ fFields = checkNotNull(ImmutableMap.<String, ITmfEventField> of());
} else {
/* Java 8 streams will make this even more simple! */
ImmutableMap.Builder<String, ITmfEventField> mapBuilder = new ImmutableMap.Builder<>();
final String curName = field.getName();
mapBuilder.put(curName, field);
}
- fFields = mapBuilder.build();
+ fFields = checkNotNull(mapBuilder.build());
}
}
package org.eclipse.tracecompass.tmf.core.event.aspect;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.osgi.util.NLS;
public String resolve(ITmfEvent event) {
try {
ITmfStateValue value = fSS.querySingleState(event.getTimestamp().getValue(), fAttribute).getStateValue();
-
- @SuppressWarnings("null")
- @NonNull String ret = value.toString();
- return ret;
+ return checkNotNull(value.toString());
} catch (AttributeNotFoundException | StateSystemDisposedException e) {
return EMPTY_STRING;
}
package org.eclipse.tracecompass.tmf.core.event.matching;
-import org.eclipse.jdt.annotation.NonNull;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
@NonNullByDefault
public class TcpEventKey implements IEventMatchingKey {
- @SuppressWarnings("null")
- private static final @NonNull HashFunction HF = Hashing.goodFastHash(32);
+ private static final HashFunction HF = checkNotNull(Hashing.goodFastHash(32));
private final long fSeq;
private final long fAckseq;
private final long fFlags;
package org.eclipse.tracecompass.tmf.core.statesystem;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.io.File;
import java.io.IOException;
import java.util.Collections;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.internal.tmf.core.statesystem.backends.partial.PartialHistoryBackend;
this.sci = sp;
// sci.getTrace() will eventually return a @NonNull
- @SuppressWarnings("null")
- @NonNull ITmfTrace tr = sci.getTrace();
- trace = tr;
+ trace = checkNotNull(sci.getTrace());
}
@Override
public Iterable<ITmfStateSystem> getStateSystems() {
- @SuppressWarnings("null")
- @NonNull Iterable<ITmfStateSystem> ret = Collections.singleton((ITmfStateSystem) fStateSystem);
- return ret;
+ return checkNotNull(Collections.<ITmfStateSystem> singleton(fStateSystem));
}
/**
package org.eclipse.tracecompass.tmf.core.trace;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.io.File;
import java.util.Collection;
import java.util.Collections;
/**
* Basic aspects that should be valid for all trace types.
*/
- @SuppressWarnings("null")
public static final @NonNull Collection<ITmfEventAspect> BASE_ASPECTS =
- ImmutableList.of(
+ checkNotNull(ImmutableList.of(
ITmfEventAspect.BaseAspects.TIMESTAMP,
ITmfEventAspect.BaseAspects.EVENT_TYPE,
ITmfEventAspect.BaseAspects.CONTENTS
- );
+ ));
// ------------------------------------------------------------------------
// Instance attributes
protected IStatus executeAnalysis() {
MultiStatus status = new MultiStatus(Activator.PLUGIN_ID, IStatus.OK, null, null);
- @SuppressWarnings("null")
- @NonNull Class<? extends TmfTrace> className = this.getClass();
+ Class<? extends TmfTrace> className = checkNotNull(this.getClass());
Map<String, IAnalysisModuleHelper> modules = TmfAnalysisManager.getAnalysisModules(className);
for (IAnalysisModuleHelper helper : modules.values()) {
try {
package org.eclipse.tracecompass.tmf.core.trace;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.io.File;
import java.net.URISyntaxException;
import java.util.Collections;
/**
* Gets the filter applied to the current trace
*
- * @return
- * a filter, or <code>null</code>
+ * @return a filter, or <code>null</code>
* @since 2.2
*/
public synchronized ITmfFilter getCurrentFilter() {
*/
public static @NonNull Set<ITmfTrace> getTraceSetWithExperiment(ITmfTrace trace) {
if (trace == null) {
- @SuppressWarnings("null")
- @NonNull Set<ITmfTrace> emptySet = Collections.EMPTY_SET;
- return emptySet;
+ return checkNotNull(Collections.EMPTY_SET);
}
if (trace instanceof TmfExperiment) {
TmfExperiment exp = (TmfExperiment) trace;
alltraces.add(exp);
return alltraces;
}
- @SuppressWarnings("null")
- @NonNull Set<ITmfTrace> singleton = Collections.singleton(trace);
- return singleton;
+ return checkNotNull(Collections.singleton(trace));
}
/**
fCurrentTrace = trace;
}
-
/**
* Handler for the TmfTraceSelectedSignal.
*
/**
* Signal handler for the TmfRangeSynchSignal signal.
*
- * The current window time range of *all* valid traces will be updated
- * to the new requested times.
+ * The current window time range of *all* valid traces will be updated to
+ * the new requested times.
*
* @param signal
* The incoming signal
package org.eclipse.tracecompass.tmf.core.trace.text;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
private TextTraceEventContent(@NonNull String fieldName) {
fName = fieldName;
fValue = null;
- @SuppressWarnings("null")
- @NonNull List<TextTraceEventContent> fields = Collections.EMPTY_LIST;
- fFields = fields;
+ fFields = checkNotNull(Collections.EMPTY_LIST);
}
// ------------------------------------------------------------------------
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources,
+ org.eclipse.tracecompass.common.core,
org.eclipse.tracecompass.ctf.core;bundle-version="0.1.0",
org.eclipse.tracecompass.tmf.core;bundle-version="0.1.0"
Export-Package: org.eclipse.tracecompass.internal.tmf.ctf.core;x-internal:=true,
package org.eclipse.tracecompass.tmf.ctf.core.trace;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.nio.BufferOverflowException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
/**
* Event aspects available for all CTF traces
*/
- @SuppressWarnings("null")
private static final @NonNull Collection<ITmfEventAspect> CTF_ASPECTS =
- ImmutableList.of(
+ checkNotNull(ImmutableList.of(
ITmfEventAspect.BaseAspects.TIMESTAMP,
new CtfChannelAspect(),
new CtfCpuAspect(),
ITmfEventAspect.BaseAspects.EVENT_TYPE,
ITmfEventAspect.BaseAspects.CONTENTS
- );
+ ));
/**
* The Ctf clock unique identifier field
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources,
+ org.eclipse.tracecompass.common.core,
org.eclipse.tracecompass.tmf.core;bundle-version="0.1.0",
org.eclipse.tracecompass.pcap.core;bundle-version="0.1.0"
Export-Package: org.eclipse.tracecompass.internal.tmf.pcap.core;x-internal:=true,
package org.eclipse.tracecompass.internal.tmf.pcap.core.event;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.nio.ByteBuffer;
import java.util.Collection;
import java.util.Collections;
-import java.util.List;
import java.util.Map;
-import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.internal.pcap.core.packet.Packet;
import org.eclipse.tracecompass.internal.pcap.core.protocol.PcapProtocol;
}
if (packet == null) {
- @SuppressWarnings("null")
- @NonNull List<TmfPcapProtocol> emptyList = Collections.EMPTY_LIST;
- fProtocols = emptyList;
+ fProtocols = checkNotNull(Collections.EMPTY_LIST);
return fProtocols;
}
// Go through all the packets and add them to list.
}
}
- @SuppressWarnings("null")
- @NonNull ImmutableList<TmfPcapProtocol> immutableList = builder.build();
- fProtocols = immutableList;
- return immutableList;
+ fProtocols = checkNotNull(builder.build());
+ return fProtocols;
}
/**
package org.eclipse.tracecompass.internal.tmf.pcap.core.event;
-import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.common.core.NonNullUtils;
import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
import org.eclipse.tracecompass.tmf.core.event.TmfEventType;
*/
public class PcapEventType extends TmfEventType {
- private static final String EMPTY_STRING = ""; //$NON-NLS-1$
-
/**
* The default Pcap Type ID for a PcapEvent
*/
- @SuppressWarnings("null")
- public static final @NonNull String DEFAULT_PCAP_TYPE_ID = Messages.PcapEventType_DefaultTypeID == null ? EMPTY_STRING : Messages.PcapEventType_DefaultTypeID;
+ public static final String DEFAULT_PCAP_TYPE_ID = NonNullUtils.nullToEmptyString(Messages.PcapEventType_DefaultTypeID);
/**
* Default constructor
package org.eclipse.tracecompass.internal.tmf.pcap.core.event.aspect;
-import org.eclipse.jdt.annotation.NonNull;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.internal.tmf.pcap.core.event.PcapEvent;
import org.eclipse.tracecompass.internal.tmf.pcap.core.protocol.TmfPcapProtocol;
PcapEvent pcapEvent = (PcapEvent) event;
TmfPcapProtocol protocol = pcapEvent.getMostEncapsulatedProtocol();
- @SuppressWarnings("null")
- @NonNull String proto = protocol.getShortName().toUpperCase();
- return proto;
+ return checkNotNull(protocol.getShortName().toUpperCase());
}
@Override
package org.eclipse.tracecompass.internal.tmf.pcap.core.trace;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.io.IOException;
import java.nio.channels.ClosedChannelException;
-import java.nio.file.FileSystems;
import java.nio.file.Path;
+import java.nio.file.Paths;
import java.util.Collection;
+import java.util.Collections;
import java.util.Map;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
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.pcap.core.packet.BadPacketException;
import org.eclipse.tracecompass.internal.pcap.core.protocol.pcap.PcapPacket;
*/
public class PcapTrace extends TmfTrace implements ITmfEventParser, ITmfTraceProperties, AutoCloseable {
- @SuppressWarnings("null")
- private static final @NonNull Collection<ITmfEventAspect> PCAP_ASPECTS = ImmutableList.of(
- ITmfEventAspect.BaseAspects.TIMESTAMP,
- new PcapSourceAspect(),
- new PcapDestinationAspect(),
- new PcapReferenceAspect(),
- new PcapProtocolAspect(),
- ITmfEventAspect.BaseAspects.CONTENTS
- );
+ private static final Collection<ITmfEventAspect> PCAP_ASPECTS =
+ checkNotNull(ImmutableList.of(
+ ITmfEventAspect.BaseAspects.TIMESTAMP,
+ new PcapSourceAspect(),
+ new PcapDestinationAspect(),
+ new PcapReferenceAspect(),
+ new PcapProtocolAspect(),
+ ITmfEventAspect.BaseAspects.CONTENTS
+ ));
- @SuppressWarnings("null")
- private static final @NonNull Map<String, String> EMPTY_MAP = ImmutableMap.of();
private static final String EMPTY_STRING = ""; //$NON-NLS-1$
private static final int CONFIDENCE = 50;
private @Nullable PcapFile fPcapFile;
- private @Nullable ImmutableMap<String, String> fTraceProperties = null;
+ private @Nullable Map<String, String> fTraceProperties = null;
@Override
public synchronized ITmfLocation getCurrentLocation() {
if (path == null) {
throw new TmfTraceException("No path has been specified."); //$NON-NLS-1$
}
- @SuppressWarnings("null")
- @NonNull Path filePath = FileSystems.getDefault().getPath(path);
+ Path filePath = checkNotNull(Paths.get(path));
try {
fPcapFile = new PcapFile(filePath);
} catch (IOException | BadPcapFileException e) {
if (path == null) {
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, EMPTY_STRING);
}
- @SuppressWarnings("null")
- @NonNull Path filePath = FileSystems.getDefault().getPath(path);
+ Path filePath = checkNotNull(Paths.get(path));
try (PcapFile file = new PcapFile(filePath)) {
} catch (IOException | BadPcapFileException e) {
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.toString());
public synchronized Map<String, String> getTraceProperties() {
PcapFile pcap = fPcapFile;
if (pcap == null) {
- return EMPTY_MAP;
+ return checkNotNull(Collections.<String, String> emptyMap());
}
- ImmutableMap<String, String> properties = fTraceProperties;
+ Map<String, String> properties = fTraceProperties;
if (properties == null) {
- @SuppressWarnings("null")
- @NonNull ImmutableMap<String, String> newProperties = ImmutableMap.<String, String> builder()
- .put(Messages.PcapTrace_Version, String.format("%d%c%d", pcap.getMajorVersion(), '.', pcap.getMinorVersion())) //$NON-NLS-1$
- .put(Messages.PcapTrace_TimeZoneCorrection, pcap.getTimeZoneCorrection() + " s") //$NON-NLS-1$
- .put(Messages.PcapTrace_TimestampAccuracy, String.valueOf(pcap.getTimeAccuracy()))
- .put(Messages.PcapTrace_MaxSnapLength, pcap.getSnapLength() + " bytes") //$NON-NLS-1$
- .put(Messages.PcapTrace_LinkLayerHeaderType, LinkTypeHelper.toString((int) pcap.getDataLinkType()) + " (" + pcap.getDataLinkType() + ")") //$NON-NLS-1$ //$NON-NLS-2$
- .put(Messages.PcapTrace_FileEndianness, pcap.getByteOrder().toString())
- .build();
- fTraceProperties = newProperties;
- return newProperties;
+ 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());
+
+ return checkNotNull(builder.build());
}
package org.eclipse.tracecompass.internal.tmf.pcap.core.util;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashMap;
throw new IllegalArgumentException("The timestamp precision is not valid!"); //$NON-NLS-1$
}
Path filePath = pcap.getPath().getFileName();
- @SuppressWarnings("null") // for .toString()
- @NonNull String fileName = (filePath == null ? EMPTY_STRING : filePath.toString());
+ @NonNull String fileName = (filePath == null ? EMPTY_STRING : checkNotNull(filePath.toString()));
String dataLink = Messages.PcapEventFactory_LinkType + ':' + LinkTypeHelper.toString((int) pcapPacket.getPcapFile().getDataLinkType());
while (localPacket != null) {
subfieldList.clear();
for (Map.Entry<String, String> entry : localPacket.getFields().entrySet()) {
-
- @SuppressWarnings("null")
- @NonNull String key = entry.getKey();
-
- @SuppressWarnings("null")
- @NonNull String value = entry.getValue();
+ String key = entry.getKey();
+ String value = entry.getValue();
subfieldList.add(new TmfEventField(key, value, null));
}
ITmfEventField[] subfieldArray = subfieldList.toArray(new ITmfEventField[subfieldList.size()]);
org.eclipse.core.resources,
org.eclipse.ui,
org.eclipse.ui.ide,
+ org.eclipse.tracecompass.common.core,
org.eclipse.tracecompass.tmf.core;bundle-version="0.1.0",
org.eclipse.tracecompass.tmf.ui;bundle-version="0.1.0",
org.eclipse.tracecompass.tmf.pcap.core;bundle-version="0.1.0"
package org.eclipse.tracecompass.internal.tmf.pcap.ui;
-import org.eclipse.jdt.annotation.NonNull;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.internal.tmf.pcap.ui.stream.StreamListView;
import org.eclipse.tracecompass.tmf.ui.project.wizards.NewTmfProjectWizard;
public static final String ID = "org.eclipse.linuxtools.tmf.pcap.ui.perspective.network"; //$NON-NLS-1$
// Views
- @SuppressWarnings("null")
- private static final @NonNull String PROJECT_VIEW_ID = IPageLayout.ID_PROJECT_EXPLORER;
- @SuppressWarnings("null")
- private static final @NonNull String PROPERTIES_VIEW_ID = IPageLayout.ID_PROP_SHEET;
- @SuppressWarnings("null")
- private static final @NonNull String BOOKMARKS_VIEW_ID = IPageLayout.ID_BOOKMARKS;
+ private static final String PROJECT_VIEW_ID = checkNotNull(IPageLayout.ID_PROJECT_EXPLORER);
+ private static final String PROPERTIES_VIEW_ID = checkNotNull(IPageLayout.ID_PROP_SHEET);
+ private static final String BOOKMARKS_VIEW_ID = checkNotNull(IPageLayout.ID_BOOKMARKS);
private static final String FILTER_VIEW_ID = FilterView.ID;
private static final String HISTOGRAM_VIEW_ID = HistogramView.ID;
private static final String STATISTICS_VIEW_ID = TmfStatisticsView.ID;
import java.util.List;
import java.util.Map;
-import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CTabFolder;
if (tables == null) {
return;
}
- for (TmfPcapProtocol p : tables.keySet()) {
- @SuppressWarnings("null")
- @NonNull TmfPcapProtocol protocol = p;
+ for (TmfPcapProtocol protocol : tables.keySet()) {
+ if (protocol == null) {
+ throw new IllegalStateException();
+ }
TmfPacketStreamBuilder builder = analysis.getBuilder(protocol);
if (builder != null && !(tables.get(protocol).isDisposed())) {
for (TmfPacketStream stream : builder.getStreams()) {
org.eclipse.core.filesystem,
org.eclipse.core.resources,
org.eclipse.core.runtime,
+ org.eclipse.tracecompass.common.core,
org.eclipse.tracecompass.tmf.core;bundle-version="0.1.0",
org.eclipse.ui,
org.eclipse.ui.ide,
package org.eclipse.tracecompass.tmf.ui.editors;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.util.List;
import org.eclipse.core.resources.IFile;
builder.addAll(traceAspects);
}
}
-
- @SuppressWarnings("null")
- @NonNull Iterable<ITmfEventAspect> ret = builder.build();
- return ret;
+ return checkNotNull(builder.build());
}
/**
package org.eclipse.tracecompass.tmf.ui.viewers.events;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Collection;
builder.add(new TmfEventFieldAspect(fieldName, fieldName));
}
}
- @SuppressWarnings("null")
- @NonNull Iterable<ITmfEventAspect> ret = builder.build();
- return ret;
+ return checkNotNull(builder.build());
}
/**
package org.eclipse.tracecompass.tmf.ui.viewers.events.columns;
-import org.eclipse.jdt.annotation.NonNull;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
* @return The string to display in the column for this event
*/
public String getItemString(ITmfEvent event) {
- /* resolve() is NonNull. toString() is not, but should never return null */
- @SuppressWarnings("null")
- @NonNull String ret = fAspect.resolve(event).toString();
- return ret;
+ return checkNotNull(fAspect.resolve(event).toString());
}
/**
package org.eclipse.tracecompass.tmf.ui.views.timegraph;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
* @since 3.0
*/
protected @NonNull Iterable<ITmfTrace> getTracesToBuild(@NonNull ITmfTrace trace) {
- @SuppressWarnings("null")
- @NonNull List<ITmfTrace> list = Arrays.asList(TmfTraceManager.getTraceSet(trace));
- return list;
+ return checkNotNull(Arrays.asList(TmfTraceManager.getTraceSet(trace)));
}
/**