From 658e0268ed41526cf4723b1cfa4d10724e25105e Mon Sep 17 00:00:00 2001 From: Matthew Khouzam Date: Fri, 22 Jan 2016 22:34:50 -0500 Subject: [PATCH] Make some inner classes static These classes are inner classes, but they do not use its embedded reference to the object which created them. This reference makes the instances of the class larger, and may keep the reference to the creator object alive longer than necessary. The classes should be static. Change-Id: I76982a42e10fa89ea7e18524914605d60016fbf3 Signed-off-by: Matthew Khouzam Reviewed-on: https://git.eclipse.org/r/65036 Reviewed-by: Hudson CI Reviewed-by: Marc-Andre Laperle Tested-by: Marc-Andre Laperle --- .../tracecompass/btf/ui/BtfEventPropertySource.java | 6 +++--- .../ui/viewers/events/TmfEventPropertySource.java | 6 +++--- .../tmf/ui/viewers/events/TmfEventsTable.java | 4 ++-- .../tmf/ui/views/callstack/CallStackView.java | 12 ++++++------ .../tmf/ui/widgets/timegraph/TimeGraphCombo.java | 4 ++-- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/btf/org.eclipse.tracecompass.btf.ui/src/org/eclipse/tracecompass/btf/ui/BtfEventPropertySource.java b/btf/org.eclipse.tracecompass.btf.ui/src/org/eclipse/tracecompass/btf/ui/BtfEventPropertySource.java index 8aae9d9b92..d9abc0055f 100644 --- a/btf/org.eclipse.tracecompass.btf.ui/src/org/eclipse/tracecompass/btf/ui/BtfEventPropertySource.java +++ b/btf/org.eclipse.tracecompass.btf.ui/src/org/eclipse/tracecompass/btf/ui/BtfEventPropertySource.java @@ -71,7 +71,7 @@ public class BtfEventPropertySource extends TmfEventPropertySource { return DESCRIPTORS; } - private class EntityPropertySource implements IPropertySource { + private static class EntityPropertySource implements IPropertySource { private final String fName; private final String fInstance; @@ -115,7 +115,7 @@ public class BtfEventPropertySource extends TmfEventPropertySource { } - private class TypePropertySource implements IPropertySource { + private static class TypePropertySource implements IPropertySource { private final String fType; private final String fDescr; @@ -158,7 +158,7 @@ public class BtfEventPropertySource extends TmfEventPropertySource { } } - private class EventPropertySource implements IPropertySource { + private static class EventPropertySource implements IPropertySource { private final ITmfEventField fEventField; public EventPropertySource(ITmfEventField eventField) { diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/events/TmfEventPropertySource.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/events/TmfEventPropertySource.java index 693b660d20..5276616ad5 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/events/TmfEventPropertySource.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/events/TmfEventPropertySource.java @@ -52,7 +52,7 @@ public class TmfEventPropertySource implements IPropertySource { private ITmfEvent fEvent; - private class TimestampPropertySource implements IPropertySource { + private static class TimestampPropertySource implements IPropertySource { private static final String ID_TIMESTAMP_VALUE = "timestamp_value"; //$NON-NLS-1$ private static final String ID_TIMESTAMP_SCALE = "timestamp_scale"; //$NON-NLS-1$ private static final String NAME_TIMESTAMP_VALUE = "value"; //$NON-NLS-1$ @@ -101,7 +101,7 @@ public class TmfEventPropertySource implements IPropertySource { } } - private class ContentPropertySource implements IPropertySource { + private static class ContentPropertySource implements IPropertySource { private ITmfEventField fContent; public ContentPropertySource(ITmfEventField content) { @@ -147,7 +147,7 @@ public class TmfEventPropertySource implements IPropertySource { } } - private class SourceLookupPropertySource implements IPropertySource { + private static class SourceLookupPropertySource implements IPropertySource { private static final String ID_FILE_NAME = "callsite_file"; //$NON-NLS-1$ private static final String ID_FUNCTION_NAME = "callsite_function"; //$NON-NLS-1$ diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/events/TmfEventsTable.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/events/TmfEventsTable.java index f71a9d8fbb..f393e04bd2 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/events/TmfEventsTable.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/events/TmfEventsTable.java @@ -417,7 +417,7 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS } } - private final class PainItemListener implements Listener { + private static final class PainItemListener implements Listener { @Override public void handleEvent(Event event) { TableItem item = (TableItem) event.item; @@ -451,7 +451,7 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS } } - private final class EraseItemListener implements Listener { + private static final class EraseItemListener implements Listener { @Override public void handleEvent(Event event) { TableItem item = (TableItem) event.item; diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/callstack/CallStackView.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/callstack/CallStackView.java index 6a8f01b62e..0d4ce1d948 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/callstack/CallStackView.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/callstack/CallStackView.java @@ -182,7 +182,7 @@ public class CallStackView extends AbstractTimeGraphView { // Classes // ------------------------------------------------------------------------ - private class TraceEntry extends TimeGraphEntry { + private static class TraceEntry extends TimeGraphEntry { public TraceEntry(String name, long startTime, long endTime) { super(name, startTime, endTime); } @@ -193,7 +193,7 @@ public class CallStackView extends AbstractTimeGraphView { } } - private class ThreadEntry extends TimeGraphEntry { + private static class ThreadEntry extends TimeGraphEntry { // The call stack quark private final int fCallStackQuark; // The state system from which this entry comes @@ -237,7 +237,7 @@ public class CallStackView extends AbstractTimeGraphView { } } - private class ThreadNameComparator implements Comparator { + private static class ThreadNameComparator implements Comparator { private boolean reverse; public ThreadNameComparator(boolean reverse) { @@ -251,7 +251,7 @@ public class CallStackView extends AbstractTimeGraphView { } } - private class ThreadIdComparator implements Comparator { + private static class ThreadIdComparator implements Comparator { private boolean reverse; public ThreadIdComparator(boolean reverse) { @@ -267,7 +267,7 @@ public class CallStackView extends AbstractTimeGraphView { } } - private class ThreadTimeComparator implements Comparator { + private static class ThreadTimeComparator implements Comparator { private boolean reverse; public ThreadTimeComparator(boolean reverse) { @@ -281,7 +281,7 @@ public class CallStackView extends AbstractTimeGraphView { } } - private class CallStackTreeLabelProvider extends TreeLabelProvider { + private static class CallStackTreeLabelProvider extends TreeLabelProvider { @Override public Image getColumnImage(Object element, int columnIndex) { diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/TimeGraphCombo.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/TimeGraphCombo.java index cc31d219d3..4ff736cc93 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/TimeGraphCombo.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/TimeGraphCombo.java @@ -242,7 +242,7 @@ public class TimeGraphCombo extends Composite { * The TreeLabelProviderWrapper is used to intercept the filler items * from the calls to the tree's real label provider. */ - private class TreeLabelProviderWrapper implements ITableLabelProvider { + private static class TreeLabelProviderWrapper implements ITableLabelProvider { private final ITableLabelProvider labelProvider; public TreeLabelProviderWrapper(ITableLabelProvider labelProvider) { @@ -334,7 +334,7 @@ public class TimeGraphCombo extends Composite { * the time graph combo's real ViewerFilters. These filler items should * always be visible. */ - private class ViewerFilterWrapper extends ViewerFilter { + private static class ViewerFilterWrapper extends ViewerFilter { private ViewerFilter fWrappedFilter; -- 2.34.1