From 0126a8ca6be223b6bce5ddd0ea6d269a1ca7ee76 Mon Sep 17 00:00:00 2001 From: Alexandre Montplaisir Date: Fri, 21 Feb 2014 18:42:30 -0500 Subject: [PATCH] tmf: Fix most Number unboxing problems Based on the patch at https://git.eclipse.org/r/#/c/19470/ Don't enable the new warnings, but at least fix the most obvious problems that the patch exposed. Change-Id: I3f5d9165cb6db8a2697c87193ea35cf90c89a9b0 Signed-off-by: Alexandre Montplaisir Reviewed-on: https://git.eclipse.org/r/22398 Tested-by: Hudson CI Reviewed-by: Bernd Hufmann IP-Clean: Bernd Hufmann Tested-by: Bernd Hufmann --- .../tests/ctfadaptor/CtfLocationTest.java | 15 +++----- .../tests/ctfadaptor/CtfTmfContextTest.java | 4 +-- .../tests/ctfadaptor/headless/Benchmark.java | 4 +-- .../tests/statistics/TmfStatisticsTest.java | 4 +-- .../AbstractCheckpointCollectionTest.java | 4 +-- .../core/tests/trace/indexer/BTreeTest.java | 2 +- .../tests/trace/indexer/FlatArrayTest.java | 5 +-- .../indexer/checkpoint/TmfCheckpointTest.java | 12 +++---- .../tests/stubs/analysis/TestAnalysis.java | 2 +- .../tests/stubs/trace/TmfEventParserStub.java | 4 +-- .../tmf/tests/stubs/trace/TmfTraceStub.java | 2 +- .../internal/tmf/core/TmfCoreTracer.java | 8 ++--- .../tmf/core/statesystem/StateSystem.java | 14 ++++---- .../tmf/core/trace/TmfLocationArray.java | 11 +++--- .../TmfAnalysisModuleHelperConfigElement.java | 4 +-- .../tmf/core/ctfadaptor/CtfTmfEventField.java | 2 +- .../filter/model/TmfFilterCompareNode.java | 10 +++--- .../core/parsers/custom/CustomTxtTrace.java | 2 +- .../custom/CustomTxtTraceDefinition.java | 2 +- .../core/parsers/custom/CustomXmlTrace.java | 2 +- .../statesystem/TmfStateSystemOperations.java | 34 ++++++++++++++----- .../core/trace/location/TmfLongLocation.java | 12 ++++++- .../TmfTreeContentProviderTest.java | 2 +- .../internal/tmf/ui/TmfUiTracer.java | 12 +++---- .../handlers/DeleteExperimentHandler.java | 2 +- ...teExperimentSupplementaryFilesHandler.java | 4 +-- .../DeleteTraceSupplementaryFilesHandler.java | 4 +-- .../handlers/NewExperimentHandler.java | 2 +- .../handlers/SynchronizeTracesHandler.java | 4 +-- .../ExportTracePackageHandler.java | 2 +- .../ImportTracePackageHandler.java | 2 +- .../importtrace/BatchImportTraceWizard.java | 2 +- .../tmf/ui/viewers/events/TmfEventsTable.java | 12 +++---- .../tmf/ui/views/colors/ColorSettingsXML.java | 18 +++++----- 34 files changed, 123 insertions(+), 102 deletions(-) diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfLocationTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfLocationTest.java index 9ae5053614..e2d8bff55b 100644 --- a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfLocationTest.java +++ b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfLocationTest.java @@ -51,7 +51,7 @@ public class CtfLocationTest { CtfLocation result = new CtfLocation(location); assertNotNull(result); - assertEquals(Long.valueOf(1), (Long)result.getLocationInfo().getTimestamp()); + assertEquals(1L, result.getLocationInfo().getTimestamp()); } /** @@ -63,7 +63,7 @@ public class CtfLocationTest { CtfLocation result = new CtfLocation(timestamp); assertNotNull(result); - assertEquals(new Long(0L), (Long)result.getLocationInfo().getTimestamp()); + assertEquals(0L, result.getLocationInfo().getTimestamp()); } /** @@ -72,15 +72,8 @@ public class CtfLocationTest { @Test public void testGetLocation() { CtfLocationInfo location = fixture.getLocationInfo(); - Long result = location.getTimestamp(); - assertNotNull(result); - assertEquals("1", result.toString()); - assertEquals((byte) 1, result.byteValue()); - assertEquals((short) 1, result.shortValue()); - assertEquals(1, result.intValue()); - assertEquals(1L, result.longValue()); - assertEquals(1.0f, result.floatValue(), 1.0f); - assertEquals(1.0, result.doubleValue(), 1.0); + long result = location.getTimestamp(); + assertEquals(1L, result); } /** diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfContextTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfContextTest.java index cf69f3c54b..d429230446 100644 --- a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfContextTest.java +++ b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfContextTest.java @@ -114,11 +114,11 @@ public class CtfTmfContextTest { thread.start(); } - for( Thread t: threads){ + for (Thread t: threads){ t.join(); } - for( Long val : vals){ + for (long val : vals){ assertTrue(val >= begin); assertTrue(val <= end); } diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/headless/Benchmark.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/headless/Benchmark.java index 9bb3dced6f..35cbe110bc 100644 --- a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/headless/Benchmark.java +++ b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/headless/Benchmark.java @@ -39,7 +39,7 @@ public class Benchmark { final boolean USE_TEXT = true; // Work variables - Long nbEvent = 0L; + long nbEvent = 0L; final Vector benchs = new Vector<>(); CtfTmfTrace trace = null; long start, stop; @@ -82,7 +82,7 @@ public class Benchmark { } System.out.println(""); double avg = 0; - for (final Double val : benchs) { + for (final double val : benchs) { avg += val; } avg /= benchs.size(); diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/statistics/TmfStatisticsTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/statistics/TmfStatisticsTest.java index 383537143f..86031f7bb8 100644 --- a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/statistics/TmfStatisticsTest.java +++ b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/statistics/TmfStatisticsTest.java @@ -101,7 +101,7 @@ public abstract class TmfStatisticsTest { /* Check the total number of events */ long count = 0; - for (Long val : results) { + for (long val : results) { count += val; } assertEquals(totalNbEvents, count); @@ -356,7 +356,7 @@ public abstract class TmfStatisticsTest { private static long sumOfEvents(Map map) { long count = 0; - for (Long val : map.values()) { + for (long val : map.values()) { count += val; } return count; diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/AbstractCheckpointCollectionTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/AbstractCheckpointCollectionTest.java index 3fcb715be4..b5433d617c 100644 --- a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/AbstractCheckpointCollectionTest.java +++ b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/AbstractCheckpointCollectionTest.java @@ -353,12 +353,12 @@ public abstract class AbstractCheckpointCollectionTest { public void testBinarySearchInBetweenSameTimestamp() { int checkpointNum = 0; for (; checkpointNum < 100; checkpointNum++) { - TmfCheckpoint checkpoint = new TmfCheckpoint(new TmfTimestamp(0), new TmfLongLocation((long) checkpointNum), checkpointNum); + TmfCheckpoint checkpoint = new TmfCheckpoint(new TmfTimestamp(0), new TmfLongLocation(checkpointNum), checkpointNum); fCheckpointCollection.insert(checkpoint); } for (; checkpointNum < 200; checkpointNum++) { - TmfCheckpoint checkpoint = new TmfCheckpoint(new TmfTimestamp(1), new TmfLongLocation((long) checkpointNum), checkpointNum); + TmfCheckpoint checkpoint = new TmfCheckpoint(new TmfTimestamp(1), new TmfLongLocation(checkpointNum), checkpointNum); fCheckpointCollection.insert(checkpoint); } diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/BTreeTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/BTreeTest.java index 2c2c975b84..aeeb7845a3 100644 --- a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/BTreeTest.java +++ b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/BTreeTest.java @@ -54,7 +54,7 @@ public class BTreeTest extends AbstractCheckpointCollectionTest { @Test public void testAccept() { for (int i = 0; i < CHECKPOINTS_INSERT_NUM; i++) { - TmfCheckpoint checkpoint = new TmfCheckpoint(new TmfTimestamp(i), new TmfLongLocation((long) i), 0); + TmfCheckpoint checkpoint = new TmfCheckpoint(new TmfTimestamp(i), new TmfLongLocation(i), 0); fBTree.insert(checkpoint); } diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/FlatArrayTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/FlatArrayTest.java index 583c2d98ad..5965a0cb66 100644 --- a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/FlatArrayTest.java +++ b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/FlatArrayTest.java @@ -76,8 +76,9 @@ public class FlatArrayTest extends AbstractCheckpointCollectionTest { fFlatArray = createCollection(); for (int i = 0; i < CHECKPOINTS_INSERT_NUM; i++) { - Integer checkpointIndex = list.get(i); - TmfCheckpoint checkpoint = new TmfCheckpoint(new TmfTimestamp(12345 + checkpointIndex), new TmfLongLocation(123456L + checkpointIndex), checkpointIndex); + int checkpointIndex = list.get(i); + TmfCheckpoint checkpoint = new TmfCheckpoint(new TmfTimestamp(12345 + checkpointIndex), + new TmfLongLocation(123456L + checkpointIndex), checkpointIndex); ITmfCheckpoint found = fFlatArray.get(checkpointIndex); assertEquals(checkpoint, found); } diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/checkpoint/TmfCheckpointTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/checkpoint/TmfCheckpointTest.java index 925084a7d3..cf07d35792 100644 --- a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/checkpoint/TmfCheckpointTest.java +++ b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/checkpoint/TmfCheckpointTest.java @@ -41,12 +41,12 @@ public class TmfCheckpointTest { private ITmfTimestamp fTimestamp2 = TmfTimestamp.BIG_BANG; private ITmfTimestamp fTimestamp3 = TmfTimestamp.BIG_CRUNCH; - private Long aLong1 = 12345L; - private Long aLong2 = 23456L; - private Long aLong3 = 34567L; - private Long RANK1 = 1L; - private Long RANK2 = 2L; - private Long RANK3 = 3L; + private long aLong1 = 12345L; + private long aLong2 = 23456L; + private long aLong3 = 34567L; + private long RANK1 = 1L; + private long RANK2 = 2L; + private long RANK3 = 3L; private ITmfLocation fLocation1 = new TmfLongLocation(aLong1); private ITmfLocation fLocation2 = new TmfLongLocation(aLong2); diff --git a/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/analysis/TestAnalysis.java b/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/analysis/TestAnalysis.java index 9879ac3b21..f963f7deed 100644 --- a/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/analysis/TestAnalysis.java +++ b/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/analysis/TestAnalysis.java @@ -69,7 +69,7 @@ public class TestAnalysis extends TmfAbstractAnalysisModule { public Object getParameter(String name) { Object value = super.getParameter(name); if ((value != null) && name.equals(PARAM_TEST) && (value instanceof String)) { - return Integer.parseInt((String) value); + return Integer.decode((String) value); } return value; } diff --git a/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/trace/TmfEventParserStub.java b/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/trace/TmfEventParserStub.java index 75f89e9ab5..e9f02a9c19 100644 --- a/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/trace/TmfEventParserStub.java +++ b/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/trace/TmfEventParserStub.java @@ -94,7 +94,7 @@ public class TmfEventParserStub implements ITmfEventParser { final long ts = stream.readLong(); final String source = stream.readUTF(); final String type = stream.readUTF(); - final Integer reference = stream.readInt(); + final int reference = stream.readInt(); final int typeIndex = Integer.parseInt(type.substring(typePrefix.length())); final String[] fields = new String[typeIndex]; for (int i = 0; i < typeIndex; i++) { @@ -113,7 +113,7 @@ public class TmfEventParserStub implements ITmfEventParser { final TmfEventField root = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, content.toString(), null); final ITmfEvent event = new TmfEvent(fEventStream, new TmfTimestamp(ts, -3, 0), // millisecs - source, fTypes[typeIndex], root, reference.toString()); + source, fTypes[typeIndex], root, String.valueOf(reference)); return event; } catch (final EOFException e) { } catch (final IOException e) { diff --git a/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/trace/TmfTraceStub.java b/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/trace/TmfTraceStub.java index aad505f2f0..a072a9b270 100644 --- a/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/trace/TmfTraceStub.java +++ b/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/trace/TmfTraceStub.java @@ -261,7 +261,7 @@ public class TmfTraceStub extends TmfTrace implements ITmfEventParser, ITmfPersi try { if (fTrace != null) { if (location.getLocationInfo() instanceof Long) { - return (double) ((Long) location.getLocationInfo()) / fTrace.length(); + return ((Long) location.getLocationInfo()).doubleValue() / fTrace.length(); } } } catch (final IOException e) { diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/TmfCoreTracer.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/TmfCoreTracer.java index d40f15db03..7e94c9a204 100644 --- a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/TmfCoreTracer.java +++ b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/TmfCoreTracer.java @@ -63,10 +63,10 @@ public class TmfCoreTracer { // ------------------------------------------------------------------------ // Classes tracing flags - static Boolean COMPONENT_CLASS_ENABLED = Boolean.FALSE; - static Boolean REQUEST_CLASS_ENABLED = Boolean.FALSE; - static Boolean SIGNAL_CLASS_ENABLED = Boolean.FALSE; - static Boolean EVENT_CLASS_ENABLED = Boolean.FALSE; + static boolean COMPONENT_CLASS_ENABLED = false; + static boolean REQUEST_CLASS_ENABLED = false; + static boolean SIGNAL_CLASS_ENABLED = false; + static boolean EVENT_CLASS_ENABLED = false; // Trace log file private static BufferedWriter fTraceFile; diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/StateSystem.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/StateSystem.java index 02d6ef64b3..a3dce2aa4b 100644 --- a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/StateSystem.java +++ b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/StateSystem.java @@ -376,7 +376,7 @@ public class StateSystem implements ITmfStateSystemBuilder { public void pushAttribute(long t, ITmfStateValue value, int attributeQuark) throws TimeRangeException, AttributeNotFoundException, StateValueTypeException { - Integer stackDepth; + int stackDepth; int subAttributeQuark; ITmfStateValue previousSV = transState.getOngoingStateValue(attributeQuark); @@ -404,7 +404,7 @@ public class StateSystem implements ITmfStateSystemBuilder { } stackDepth++; - subAttributeQuark = getQuarkRelativeAndAdd(attributeQuark, stackDepth.toString()); + subAttributeQuark = getQuarkRelativeAndAdd(attributeQuark, String.valueOf(stackDepth)); modifyAttribute(t, TmfStateValue.newValueInt(stackDepth), attributeQuark); modifyAttribute(t, value, subAttributeQuark); @@ -434,7 +434,7 @@ public class StateSystem implements ITmfStateSystemBuilder { throw new StateValueTypeException(); } - Integer stackDepth = previousSV.unboxInt(); + int stackDepth = previousSV.unboxInt(); if (stackDepth <= 0) { /* This on the other hand should not happen... */ @@ -444,7 +444,7 @@ public class StateSystem implements ITmfStateSystemBuilder { } /* The attribute should already exist at this point */ - int subAttributeQuark = getQuarkRelative(attributeQuark, stackDepth.toString()); + int subAttributeQuark = getQuarkRelative(attributeQuark, String.valueOf(stackDepth)); ITmfStateValue poppedValue = queryOngoingState(subAttributeQuark); /* Update the state value of the stack-attribute */ @@ -474,7 +474,7 @@ public class StateSystem implements ITmfStateSystemBuilder { * handle the recursion ourselves. */ childAttributes = getSubAttributes(attributeQuark, false); - for (Integer childNodeQuark : childAttributes) { + for (int childNodeQuark : childAttributes) { assert (attributeQuark != childNodeQuark); removeAttribute(t, childNodeQuark); } @@ -605,7 +605,7 @@ public class StateSystem implements ITmfStateSystemBuilder { /* There is nothing stored in this stack at this moment */ return null; } - Integer curStackDepth = curStackStateValue.unboxInt(); + int curStackDepth = curStackStateValue.unboxInt(); if (curStackDepth <= 0) { /* * This attribute is an integer attribute, but it doesn't seem like @@ -614,7 +614,7 @@ public class StateSystem implements ITmfStateSystemBuilder { throw new StateValueTypeException(); } - int subAttribQuark = getQuarkRelative(stackAttributeQuark, curStackDepth.toString()); + int subAttribQuark = getQuarkRelative(stackAttributeQuark, String.valueOf(curStackDepth)); return querySingleState(t, subAttribQuark); } diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/trace/TmfLocationArray.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/trace/TmfLocationArray.java index d0f5c38b6e..0ec3c50e65 100644 --- a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/trace/TmfLocationArray.java +++ b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/trace/TmfLocationArray.java @@ -141,11 +141,12 @@ public final class TmfLocationArray implements Comparable { @Override public int compareTo(TmfLocationArray o) { for (int i = 0; i < fRanks.length; i++) { - Long rank1 = fRanks[i]; - Long rank2 = o.fRanks[i]; - int result = rank1.compareTo(rank2); - if (result != 0) { - return result; + long rank1 = fRanks[i]; + long rank2 = o.fRanks[i]; + if (rank1 < rank2) { + return -1; + } else if (rank1 > rank2) { + return 1; } } return 0; diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/analysis/TmfAnalysisModuleHelperConfigElement.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/analysis/TmfAnalysisModuleHelperConfigElement.java index 5b5a94e1bd..05e4f11e40 100644 --- a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/analysis/TmfAnalysisModuleHelperConfigElement.java +++ b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/analysis/TmfAnalysisModuleHelperConfigElement.java @@ -60,7 +60,7 @@ public class TmfAnalysisModuleHelperConfigElement implements IAnalysisModuleHelp @Override public boolean isAutomatic() { - return Boolean.valueOf(fCe.getAttribute(TmfAnalysisModuleSourceConfigElement.AUTOMATIC_ATTR)); + return Boolean.parseBoolean(fCe.getAttribute(TmfAnalysisModuleSourceConfigElement.AUTOMATIC_ATTR)); } @Override @@ -95,7 +95,7 @@ public class TmfAnalysisModuleHelperConfigElement implements IAnalysisModuleHelp String classAppliesVal = element.getAttribute(TmfAnalysisModuleSourceConfigElement.APPLIES_ATTR); boolean classApplies = true; if (classAppliesVal != null) { - classApplies = Boolean.valueOf(classAppliesVal); + classApplies = Boolean.parseBoolean(classAppliesVal); } if (classApplies) { applies = applyclass.isAssignableFrom(traceclass); diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventField.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventField.java index 77b6276a14..0f05b55c38 100644 --- a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventField.java +++ b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventField.java @@ -386,7 +386,7 @@ final class CTFEnumField extends CtfTmfEventField { */ CTFEnumField(String name, CtfEnumPair enumValue) { super(name, new CtfEnumPair(enumValue.getFirst(), - enumValue.getSecond().longValue()), null); + enumValue.getSecond()), null); } @Override diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/filter/model/TmfFilterCompareNode.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/filter/model/TmfFilterCompareNode.java index af24a6b9a0..debb795224 100644 --- a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/filter/model/TmfFilterCompareNode.java +++ b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/filter/model/TmfFilterCompareNode.java @@ -162,14 +162,12 @@ public class TmfFilterCompareNode extends TmfFilterTreeNode { if (fType == Type.NUM) { if (fValueNumber != null) { if (value instanceof Number) { - Double valueDouble = ((Number) value).doubleValue(); - return (valueDouble.compareTo(fValueNumber.doubleValue()) == fResult) ^ fNot; + double valueDouble = ((Number) value).doubleValue(); + return (Double.compare(valueDouble, fValueNumber.doubleValue()) == fResult) ^ fNot; } try { - Double valueDouble = NumberFormat.getInstance().parse(value.toString()) - .doubleValue(); - return (valueDouble.compareTo(fValueNumber.doubleValue()) == fResult) - ^ fNot; + double valueDouble = NumberFormat.getInstance().parse(value.toString()).doubleValue(); + return (Double.compare(valueDouble, fValueNumber.doubleValue()) == fResult) ^ fNot; } catch (ParseException e) { } } diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/parsers/custom/CustomTxtTrace.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/parsers/custom/CustomTxtTrace.java index e40d028d58..9258430a86 100644 --- a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/parsers/custom/CustomTxtTrace.java +++ b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/parsers/custom/CustomTxtTrace.java @@ -195,7 +195,7 @@ public class CustomTxtTrace extends TmfTrace implements ITmfEventParser, ITmfPer } try { if (location.getLocationInfo() instanceof Long) { - return (double) ((Long) location.getLocationInfo()) / fFile.length(); + return ((Long) location.getLocationInfo()).doubleValue() / fFile.length(); } } catch (final IOException e) { Activator.logError("Error seeking event. File: " + getPath(), e); //$NON-NLS-1$ diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/parsers/custom/CustomTxtTraceDefinition.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/parsers/custom/CustomTxtTraceDefinition.java index 65a226544f..175f991ec0 100644 --- a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/parsers/custom/CustomTxtTraceDefinition.java +++ b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/parsers/custom/CustomTxtTraceDefinition.java @@ -417,7 +417,7 @@ public class CustomTxtTraceDefinition extends CustomTraceDefinition { @Override public String toString() { - return "(" + (min >= 0 ? min : "?") + "," + (max == INF ? "\u221E" : (max >= 0 ? max : "?")) + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ + return "(" + (min >= 0 ? min : "?") + ',' + (max == INF ? "\u221E" : (max >= 0 ? max : "?")) + ')'; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ } @Override diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/parsers/custom/CustomXmlTrace.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/parsers/custom/CustomXmlTrace.java index ff6326b937..5678e02356 100644 --- a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/parsers/custom/CustomXmlTrace.java +++ b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/parsers/custom/CustomXmlTrace.java @@ -199,7 +199,7 @@ public class CustomXmlTrace extends TmfTrace implements ITmfEventParser, ITmfPer } try { if (location.getLocationInfo() instanceof Long) { - return (double) ((Long) location.getLocationInfo()) / fFile.length(); + return ((Long) location.getLocationInfo()).doubleValue() / fFile.length(); } } catch (final IOException e) { Activator.logError("Error getting location ration. File: " + getPath(), e); //$NON-NLS-1$ diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/TmfStateSystemOperations.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/TmfStateSystemOperations.java index 1de8409012..b0b23b132c 100644 --- a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/TmfStateSystemOperations.java +++ b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/TmfStateSystemOperations.java @@ -25,7 +25,6 @@ import org.eclipse.linuxtools.tmf.core.interval.ITmfStateInterval; import org.eclipse.linuxtools.tmf.core.statevalue.ITmfStateValue; import org.eclipse.linuxtools.tmf.core.statevalue.ITmfStateValue.Type; import org.eclipse.linuxtools.tmf.core.statevalue.TmfStateValue; -import org.eclipse.linuxtools.tmf.core.util.Pair; /** * This class implements additional statistical operations that can be @@ -199,7 +198,7 @@ public final class TmfStateSystemOperations { private static List queryAttributeRange(ITmfStateSystem ss, long t1, long t2, int baseQuark, String featureString) throws AttributeNotFoundException, TimeRangeException, StateValueTypeException { - Pair timeRange = new Pair<>(t1, t2); + TimeRange timeRange = new TimeRange(t1, t2); int mipmapQuark = -1; List intervals = new ArrayList<>(); try { @@ -238,10 +237,10 @@ public final class TmfStateSystemOperations { private static void queryMipmapAttributeRange(ITmfStateSystem ss, int currentLevel, int levelMax, int baseQuark, int mipmapQuark, - Pair timeRange, List intervals) + TimeRange timeRange, List intervals) throws AttributeNotFoundException, TimeRangeException { int level = currentLevel; - Pair range = timeRange; + TimeRange range = timeRange; ITmfStateInterval currentLevelInterval = null, nextLevelInterval = null; if (range == null || range.getFirst() > range.getSecond()) { return; @@ -250,7 +249,7 @@ public final class TmfStateSystemOperations { return; } try { - if (range.getFirst().longValue() == range.getSecond().longValue()) { + if (range.getFirst() == range.getSecond()) { level = 0; currentLevelInterval = ss.querySingleState(range.getFirst(), baseQuark); if (!currentLevelInterval.getStateValue().isNull()) { @@ -307,17 +306,17 @@ public final class TmfStateSystemOperations { } } - private static Pair updateTimeRange(Pair timeRange, + private static TimeRange updateTimeRange(TimeRange timeRange, ITmfStateInterval currentLevelInterval) { if (currentLevelInterval.getEndTime() >= timeRange.getSecond()) { return null; } long startTime = Math.max(timeRange.getFirst(), Math.min(currentLevelInterval.getEndTime() + 1, timeRange.getSecond())); - return new Pair<>(startTime, timeRange.getSecond()); + return new TimeRange(startTime, timeRange.getSecond()); } - private static boolean isFullyOverlapped(Pair range, + private static boolean isFullyOverlapped(TimeRange range, ITmfStateInterval interval) { if (range.getFirst() >= range.getSecond() || interval.getStartTime() >= interval.getEndTime()) { @@ -330,3 +329,22 @@ public final class TmfStateSystemOperations { return false; } } + +class TimeRange { + + private final long a; + private final long b; + + public TimeRange(long first, long second) { + a = first; + b = second; + } + + public long getFirst() { + return a; + } + + public long getSecond() { + return b; + } +} diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/location/TmfLongLocation.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/location/TmfLongLocation.java index dd0785dff5..4b72882b9c 100644 --- a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/location/TmfLongLocation.java +++ b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/location/TmfLongLocation.java @@ -22,6 +22,16 @@ import java.nio.ByteBuffer; */ public final class TmfLongLocation extends TmfLocation { + /** + * Constructor + * + * @param locationInfo + * The concrete location + */ + public TmfLongLocation(long locationInfo) { + super(Long.valueOf(locationInfo)); + } + /** * The normal constructor * @@ -49,7 +59,7 @@ public final class TmfLongLocation extends TmfLocation { * @since 3.0 */ public TmfLongLocation(ByteBuffer bufferIn) { - super(bufferIn.getLong()); + this(bufferIn.getLong()); } @Override diff --git a/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfTreeContentProviderTest.java b/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfTreeContentProviderTest.java index 19b15110dd..8004ef6330 100755 --- a/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfTreeContentProviderTest.java +++ b/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfTreeContentProviderTest.java @@ -161,7 +161,7 @@ public class TmfTreeContentProviderTest { */ @Test public void testHasChildren() { - Boolean hasChildren = treeProvider.hasChildren(fStatsData.getRootNode()); + boolean hasChildren = treeProvider.hasChildren(fStatsData.getRootNode()); assertTrue("hasChildren", hasChildren); hasChildren = treeProvider.hasChildren(fStatsData.getOrCreateNode(fTestName)); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/TmfUiTracer.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/TmfUiTracer.java index 0e95b5f42e..220124fd71 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/TmfUiTracer.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/TmfUiTracer.java @@ -23,13 +23,13 @@ public class TmfUiTracer { private static String pluginID = Activator.PLUGIN_ID; - static Boolean ERROR = Boolean.FALSE; - static Boolean WARNING = Boolean.FALSE; - static Boolean INFO = Boolean.FALSE; + static boolean ERROR = false; + static boolean WARNING = false; + static boolean INFO = false; - static Boolean INDEX = Boolean.FALSE; - static Boolean DISPLAY = Boolean.FALSE; - static Boolean SORTING = Boolean.FALSE; + static boolean INDEX = false; + static boolean DISPLAY = false; + static boolean SORTING = false; private static String LOGNAME = "traceUI.log"; private static BufferedWriter fTraceLog = null; diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DeleteExperimentHandler.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DeleteExperimentHandler.java index 451d18446d..db8a9d4de9 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DeleteExperimentHandler.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DeleteExperimentHandler.java @@ -66,7 +66,7 @@ public class DeleteExperimentHandler extends AbstractHandler { IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); IWorkbenchPart part = page.getActivePart(); if (part == null) { - return false; + return Boolean.FALSE; } ISelection selection = part.getSite().getSelectionProvider().getSelection(); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DeleteExperimentSupplementaryFilesHandler.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DeleteExperimentSupplementaryFilesHandler.java index cd7f91080b..d8cb0653fb 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DeleteExperimentSupplementaryFilesHandler.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DeleteExperimentSupplementaryFilesHandler.java @@ -60,11 +60,11 @@ public class DeleteExperimentSupplementaryFilesHandler extends AbstractHandler { IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); IWorkbenchPart part = page.getActivePart(); if (part == null) { - return false; + return Boolean.FALSE; } ISelectionProvider selectionProvider = part.getSite().getSelectionProvider(); if (selectionProvider == null) { - return false; + return Boolean.FALSE; } ISelection selection = selectionProvider.getSelection(); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DeleteTraceSupplementaryFilesHandler.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DeleteTraceSupplementaryFilesHandler.java index b6d652de2c..32c933b64b 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DeleteTraceSupplementaryFilesHandler.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DeleteTraceSupplementaryFilesHandler.java @@ -52,11 +52,11 @@ public class DeleteTraceSupplementaryFilesHandler extends AbstractHandler { IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); IWorkbenchPart part = page.getActivePart(); if (part == null) { - return false; + return Boolean.FALSE; } ISelectionProvider selectionProvider = part.getSite().getSelectionProvider(); if (selectionProvider == null) { - return false; + return Boolean.FALSE; } ISelection selection = selectionProvider.getSelection(); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/NewExperimentHandler.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/NewExperimentHandler.java index 82b29588eb..80f5f27b9a 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/NewExperimentHandler.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/NewExperimentHandler.java @@ -48,7 +48,7 @@ public class NewExperimentHandler extends AbstractHandler { IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); IWorkbenchPart part = page.getActivePart(); if (part == null) { - return false; + return Boolean.FALSE; } ISelection selection = part.getSite().getSelectionProvider().getSelection(); TmfExperimentFolder experimentFolder = null; diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/SynchronizeTracesHandler.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/SynchronizeTracesHandler.java index 8475d7723c..53a3aecd75 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/SynchronizeTracesHandler.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/SynchronizeTracesHandler.java @@ -77,11 +77,11 @@ public class SynchronizeTracesHandler extends AbstractHandler { IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); IWorkbenchPart part = page.getActivePart(); if (part == null) { - return false; + return Boolean.FALSE; } ISelectionProvider selectionProvider = part.getSite().getSelectionProvider(); if (selectionProvider == null) { - return false; + return Boolean.FALSE; } ISelection selection = selectionProvider.getSelection(); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/ExportTracePackageHandler.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/ExportTracePackageHandler.java index 1257967bba..7b63397005 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/ExportTracePackageHandler.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/ExportTracePackageHandler.java @@ -43,7 +43,7 @@ public class ExportTracePackageHandler extends AbstractHandler { public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window == null) { - return false; + return Boolean.FALSE; } ISelection currentSelection = HandlerUtil.getCurrentSelection(event); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/ImportTracePackageHandler.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/ImportTracePackageHandler.java index 840bfe33a0..a12a1b0fcd 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/ImportTracePackageHandler.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/wizards/tracepkg/importexport/ImportTracePackageHandler.java @@ -36,7 +36,7 @@ public class ImportTracePackageHandler extends AbstractHandler { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window == null) { - return false; + return Boolean.FALSE; } ISelection currentSelection = HandlerUtil.getCurrentSelection(event); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/BatchImportTraceWizard.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/BatchImportTraceWizard.java index 27dde89586..635463e4e3 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/BatchImportTraceWizard.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/BatchImportTraceWizard.java @@ -564,7 +564,7 @@ public class BatchImportTraceWizard extends ImportTraceWizard { * @return whether it passes or not * @since 3.0 */ - public Boolean getResult(TraceValidationHelper traceToScan) { + public boolean getResult(TraceValidationHelper traceToScan) { return fResults.get(traceToScan); } diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java index 8d60d593f5..47b2b2ffe2 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java @@ -803,9 +803,9 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS }; class ToggleBookmarkAction extends Action { - long fRank; + Long fRank; - public ToggleBookmarkAction(final String text, final long rank) { + public ToggleBookmarkAction(final String text, final Long rank) { super(text); fRank = rank; } @@ -2114,9 +2114,9 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS final IMarker bookmark = bookmarksFile.createMarker(IMarker.BOOKMARK); if (bookmark.exists()) { bookmark.setAttribute(IMarker.MESSAGE, message.toString()); - final long rank = (Long) tableItem.getData(Key.RANK); - final int location = (int) rank; - bookmark.setAttribute(IMarker.LOCATION, (Integer) location); + final Long rank = (Long) tableItem.getData(Key.RANK); + final int location = rank.intValue(); + bookmark.setAttribute(IMarker.LOCATION, Integer.valueOf(location)); fBookmarksMap.put(rank, bookmark.getId()); fTable.refresh(); } @@ -2145,7 +2145,7 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS } } - private void toggleBookmark(final long rank) { + private void toggleBookmark(final Long rank) { if (fBookmarksFile == null) { return; } diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/colors/ColorSettingsXML.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/colors/ColorSettingsXML.java index fc9fd9bcb2..c90e59c715 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/colors/ColorSettingsXML.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/colors/ColorSettingsXML.java @@ -180,19 +180,19 @@ public class ColorSettingsXML { bg = null; filter = null; } else if (localName.equals(FG_TAG)) { - int r = Integer.valueOf(attributes.getValue(R_ATTR)); - int g = Integer.valueOf(attributes.getValue(G_ATTR)); - int b = Integer.valueOf(attributes.getValue(B_ATTR)); + int r = Integer.parseInt(attributes.getValue(R_ATTR)); + int g = Integer.parseInt(attributes.getValue(G_ATTR)); + int b = Integer.parseInt(attributes.getValue(B_ATTR)); fg = new RGB(r, g, b); } else if (localName.equals(BG_TAG)) { - int r = Integer.valueOf(attributes.getValue(R_ATTR)); - int g = Integer.valueOf(attributes.getValue(G_ATTR)); - int b = Integer.valueOf(attributes.getValue(B_ATTR)); + int r = Integer.parseInt(attributes.getValue(R_ATTR)); + int g = Integer.parseInt(attributes.getValue(G_ATTR)); + int b = Integer.parseInt(attributes.getValue(B_ATTR)); bg = new RGB(r, g, b); } else if (localName.equals(TICK_TAG)) { - int r = Integer.valueOf(attributes.getValue(R_ATTR)); - int g = Integer.valueOf(attributes.getValue(G_ATTR)); - int b = Integer.valueOf(attributes.getValue(B_ATTR)); + int r = Integer.parseInt(attributes.getValue(R_ATTR)); + int g = Integer.parseInt(attributes.getValue(G_ATTR)); + int b = Integer.parseInt(attributes.getValue(B_ATTR)); tickColor = new RGB(r, g, b); } else if (localName.equals(FILTER_TAG)) { filterContentHandler = new TmfFilterContentHandler(); -- 2.34.1