diff options
| author | Andrey Loskutov | 2015-04-04 20:34:19 +0000 |
|---|---|---|
| committer | Andrey Loskutov | 2015-04-04 20:34:19 +0000 |
| commit | a7a9831ec9324f493b778f2debe6366cca033fc3 (patch) | |
| tree | f9161aef303c7a4dfd78ff1aac55c823b3b1aeac | |
| parent | 3a2fa1fad22a05ba57dcc425cf4dc199eb53e85a (diff) | |
| download | eclipse.platform.ui-a7a9831ec9324f493b778f2debe6366cca033fc3.tar.gz eclipse.platform.ui-a7a9831ec9324f493b778f2debe6366cca033fc3.tar.xz eclipse.platform.ui-a7a9831ec9324f493b778f2debe6366cca033fc3.zip | |
Bug 418661 - [Metadata] Get rid of compile warnings in platform projects
in official build - part 2
Cleaned up and updated to Java 7 org.eclipse.e4.ui.workbench
Change-Id: I94582e86b518978357c62ecea7ebc58c2310f40b
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
14 files changed, 83 insertions, 64 deletions
diff --git a/bundles/org.eclipse.e4.ui.workbench/.classpath b/bundles/org.eclipse.e4.ui.workbench/.classpath index 4c62a8048e6..e8ea977a694 100644 --- a/bundles/org.eclipse.e4.ui.workbench/.classpath +++ b/bundles/org.eclipse.e4.ui.workbench/.classpath @@ -2,6 +2,6 @@ <classpath> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/bundles/org.eclipse.e4.ui.workbench/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.e4.ui.workbench/.settings/org.eclipse.jdt.core.prefs index 649c7e06a77..f5fbb197456 100644 --- a/bundles/org.eclipse.e4.ui.workbench/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.e4.ui.workbench/.settings/org.eclipse.jdt.core.prefs @@ -17,9 +17,10 @@ org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -100,7 +101,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disa org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.compiler.source=1.7 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 diff --git a/bundles/org.eclipse.e4.ui.workbench/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.ui.workbench/META-INF/MANIFEST.MF index d625062c3af..e7f040adafa 100644 --- a/bundles/org.eclipse.e4.ui.workbench/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.ui.workbench/META-INF/MANIFEST.MF @@ -23,7 +23,7 @@ Require-Bundle: org.eclipse.e4.ui.model.workbench;bundle-version="1.0.0", org.eclipse.emf.ecore.xmi;bundle-version="2.7.0", org.eclipse.e4.core.di.extensions Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Export-Package: org.eclipse.e4.ui.internal.workbench; x-friends:="org.eclipse.e4.ui.workbench.fragment, org.eclipse.e4.ui.workbench.renderers.swt, diff --git a/bundles/org.eclipse.e4.ui.workbench/build.properties b/bundles/org.eclipse.e4.ui.workbench/build.properties index a1f6d5e2422..2899fda9a03 100644 --- a/bundles/org.eclipse.e4.ui.workbench/build.properties +++ b/bundles/org.eclipse.e4.ui.workbench/build.properties @@ -19,3 +19,4 @@ bin.includes = META-INF/,\ src.includes = schema/,\ about.html source.. = src/ +jre.compilation.profile = JavaSE-1.7 diff --git a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/LocaleChangeServiceImpl.java b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/LocaleChangeServiceImpl.java index 5d3a2c0556a..0fe2e51d764 100644 --- a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/LocaleChangeServiceImpl.java +++ b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/LocaleChangeServiceImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013, 2014 Dirk Fauth and others. + * Copyright (c) 2013, 2015 Dirk Fauth and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -106,7 +106,7 @@ public class LocaleChangeServiceImpl implements ILocaleChangeService { * @param children * The list of {@link MUIElement}s that should be checked for Locale updates. */ - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({ "rawtypes" }) protected void updateLocalization(List<? extends MUIElement> children) { for (MUIElement element : children) { if (element instanceof MElementContainer) { diff --git a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/DefaultLoggerProvider.java b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/DefaultLoggerProvider.java index 603a9fe9978..c36d7095bfe 100644 --- a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/DefaultLoggerProvider.java +++ b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/DefaultLoggerProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. + * Copyright (c) 2010, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -29,6 +29,6 @@ public class DefaultLoggerProvider implements ILoggerProvider { public Logger getClassLogger(Class<?> clazz) { IEclipseContext childContext = context.createChild(); childContext.set("logger.bundlename", FrameworkUtil.getBundle(clazz).getSymbolicName()); //$NON-NLS-1$ - return (Logger) ContextInjectionFactory.make(WorkbenchLogger.class, childContext); + return ContextInjectionFactory.make(WorkbenchLogger.class, childContext); } }
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/EMFDeltaEntrySet.java b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/EMFDeltaEntrySet.java index c94601307f3..5b6d1bfbac6 100644 --- a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/EMFDeltaEntrySet.java +++ b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/EMFDeltaEntrySet.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. + * Copyright (c) 2010, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -33,7 +33,8 @@ public class EMFDeltaEntrySet extends ModelDelta { @Override public IStatus apply() { - EMap map = (EMap) ((EObject) getObject()).eGet(feature); + @SuppressWarnings("unchecked") + EMap<String, String> map = (EMap<String, String>) ((EObject) getObject()).eGet(feature); map.put(key, value); return Status.OK_STATUS; } diff --git a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/EMFDeltaMapSet.java b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/EMFDeltaMapSet.java index 23102422cc6..14c691eede5 100644 --- a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/EMFDeltaMapSet.java +++ b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/EMFDeltaMapSet.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. + * Copyright (c) 2010, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -32,7 +32,8 @@ class EMFDeltaMapSet extends ModelDelta { @Override public IStatus apply() { - EMap map = (EMap) ((EObject) getObject()).eGet(feature); + @SuppressWarnings("unchecked") + EMap<String, String> map = (EMap<String, String>) ((EObject) getObject()).eGet(feature); map.clear(); map.putAll(deltaMap); return Status.OK_STATUS; diff --git a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelServiceImpl.java b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelServiceImpl.java index 99a9e30b848..1451dba3be3 100644 --- a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelServiceImpl.java +++ b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelServiceImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 IBM Corporation and others. + * Copyright (c) 2010, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -148,7 +148,9 @@ public class ModelServiceImpl implements EModelService { boolean classMatch = clazz == null ? true : clazz.isInstance(searchRoot); if (classMatch && matcher.select(searchRoot)) { if (!elements.contains(searchRoot)) { - elements.add((T) searchRoot); + @SuppressWarnings("unchecked") + T element = (T) searchRoot; + elements.add(element); } } if (searchRoot instanceof MApplication && (searchFlags == ANYWHERE)) { @@ -196,8 +198,8 @@ public class ModelServiceImpl implements EModelService { if (searchRoot instanceof MPerspectiveStack) { if ((searchFlags & IN_ANY_PERSPECTIVE) != 0) { // Search *all* the perspectives - MElementContainer<MUIElement> container = (MElementContainer<MUIElement>) searchRoot; - List<MUIElement> children = container.getChildren(); + MElementContainer<? extends MUIElement> container = (MPerspectiveStack) searchRoot; + List<? extends MUIElement> children = container.getChildren(); for (MUIElement child : children) { findElementsRecursive(child, clazz, matcher, elements, searchFlags); } @@ -216,6 +218,7 @@ public class ModelServiceImpl implements EModelService { } } } else { + @SuppressWarnings("unchecked") MElementContainer<MUIElement> container = (MElementContainer<MUIElement>) searchRoot; List<MUIElement> children = container.getChildren(); for (MUIElement child : children) { @@ -338,6 +341,7 @@ public class ModelServiceImpl implements EModelService { return 0; } + @SuppressWarnings("unchecked") MElementContainer<MUIElement> container = (MElementContainer<MUIElement>) element; int count = 0; List<MUIElement> kids = container.getChildren(); @@ -485,7 +489,9 @@ public class ModelServiceImpl implements EModelService { element.setToBeRendered(true); } - ((MElementContainer<MUIElement>) parent).setSelectedElement(element); + @SuppressWarnings("unchecked") + MElementContainer<MUIElement> container = (MElementContainer<MUIElement>) parent; + container.setSelectedElement(element); if (window != parent) { showElementInWindow(window, parent); } diff --git a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/PartServiceImpl.java b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/PartServiceImpl.java index aeea54ce954..e6ae4878aaf 100644 --- a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/PartServiceImpl.java +++ b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/PartServiceImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2014 IBM Corporation and others. + * Copyright (c) 2009, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -887,7 +887,7 @@ public class PartServiceImpl implements EPartService { addToLastContainer(null, providedPart); } else { if ("org.eclipse.e4.primaryDataStack".equals(category)) { //$NON-NLS-1$ - MElementContainer<MUIElement> container = getContainer(); + MElementContainer<? extends MUIElement> container = getContainer(); MUIElement area = modelService.find("org.eclipse.ui.editorss", container); //$NON-NLS-1$ MPartStack activeStack = null; @@ -924,6 +924,7 @@ public class PartServiceImpl implements EPartService { } } } else { + @SuppressWarnings("rawtypes") List<MElementContainer> containers = modelService.findElements(getContainer(), null, MElementContainer.class, Collections.singletonList(category), EModelService.PRESENTATION); @@ -933,7 +934,7 @@ public class PartServiceImpl implements EPartService { addToLastContainer(category, providedPart); } else { // add the part to the container - MElementContainer container = containers.get(0); + MElementContainer<MPartSashContainerElement> container = containers.get(0); MPlaceholder placeholder = providedPart.getCurSharedRef(); if (placeholder == null) { container.getChildren().add(providedPart); @@ -993,12 +994,13 @@ public class PartServiceImpl implements EPartService { } } - MElementContainer<?> lastContainer = getLastContainer(); + @SuppressWarnings("unchecked") + MElementContainer<MUIElement> lastContainer = (MElementContainer<MUIElement>) getLastContainer(); MPlaceholder placeholder = part.getCurSharedRef(); if (placeholder == null) { - ((List) lastContainer.getChildren()).add(part); + lastContainer.getChildren().add(part); } else { - ((List) lastContainer.getChildren()).add(placeholder); + lastContainer.getChildren().add(placeholder); } if (category != null) { @@ -1006,12 +1008,13 @@ public class PartServiceImpl implements EPartService { } } - private MElementContainer<?> getLastContainer() { - MElementContainer<MUIElement> searchRoot = getContainer(); - List<MUIElement> children = searchRoot.getChildren(); + private MElementContainer<? extends MUIElement> getLastContainer() { + MElementContainer<? extends MUIElement> searchRoot = getContainer(); + @SuppressWarnings("unchecked") + List<MUIElement> children = (List<MUIElement>) searchRoot.getChildren(); if (children.size() == 0) { MPartStack stack = modelService.createModelElement(MPartStack.class); - searchRoot.getChildren().add(stack); + children.add(stack); return stack; } @@ -1034,7 +1037,7 @@ public class PartServiceImpl implements EPartService { return stack; } - private MElementContainer<?> getLastContainer(MElementContainer<?> container, List<?> children) { + private MElementContainer<? extends MUIElement> getLastContainer(MElementContainer<?> container, List<?> children) { if (children.isEmpty()) { return null; } @@ -1068,7 +1071,8 @@ public class PartServiceImpl implements EPartService { if (parent == null) { MPlaceholder placeholder = element.getCurSharedRef(); if (placeholder == null) { - MElementContainer<MUIElement> container = getContainer(); + @SuppressWarnings("unchecked") + MElementContainer<MUIElement> container = (MElementContainer<MUIElement>) getContainer(); return findContainer(container, element); } return placeholder.getParent(); @@ -1076,26 +1080,28 @@ public class PartServiceImpl implements EPartService { return parent; } - private MElementContainer<MUIElement> findContainer(MElementContainer<?> container, + private MElementContainer<MUIElement> findContainer(MElementContainer<MUIElement> container, MUIElement element) { - for (Object child : container.getChildren()) { + for (MUIElement child : container.getChildren()) { if (child == element) { - return (MElementContainer<MUIElement>) container; + return container; } else if (child instanceof MPlaceholder) { MPlaceholder placeholder = (MPlaceholder) child; MUIElement ref = placeholder.getRef(); if (ref == element) { - return (MElementContainer<MUIElement>) container; + return container; } else if (ref instanceof MElementContainer<?>) { - MElementContainer<MUIElement> match = findContainer((MElementContainer<?>) ref, - element); + @SuppressWarnings("unchecked") + MElementContainer<MUIElement> ref2 = (MElementContainer<MUIElement>) ref; + MElementContainer<MUIElement> match = findContainer(ref2, element); if (match != null) { return match; } } } else if (child instanceof MElementContainer<?>) { - MElementContainer<MUIElement> match = findContainer((MElementContainer<?>) child, - element); + @SuppressWarnings("unchecked") + MElementContainer<MUIElement> child2 = (MElementContainer<MUIElement>) child; + MElementContainer<MUIElement> match = findContainer(child2, element); if (match != null) { return match; } @@ -1385,22 +1391,25 @@ public class PartServiceImpl implements EPartService { * "Container" here is: 1) a selected MPerspective, or, if none available 2) the MWindow for * which this part service is created, or, if not available, 3) the MApplication. */ - private MElementContainer<MUIElement> getContainer() { + private MElementContainer<? extends MUIElement> getContainer() { MElementContainer<? extends MUIElement> outerContainer = (workbenchWindow != null) ? workbenchWindow : application; // see if we can narrow it down to the active perspective - for (MElementContainer<?> container = outerContainer; container != null;) { - if (container instanceof MPerspective) - return (MElementContainer<MUIElement>) container; + for (MElementContainer<? extends MUIElement> container = outerContainer; container != null;) { + if (container instanceof MPerspective) { + return container; + } Object child = container.getSelectedElement(); - if (child == null) + if (child == null) { break; - if (child instanceof MElementContainer<?>) + } + if (child instanceof MElementContainer<?>) { container = (MElementContainer<?>) child; - else + } else { break; + } } - return (MElementContainer<MUIElement>) outerContainer; + return outerContainer; } } diff --git a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/TopologicalSort.java b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/TopologicalSort.java index 6d033ba6cf7..daf7c935f68 100644 --- a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/TopologicalSort.java +++ b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/TopologicalSort.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014 Manumitting Technologies Inc and others. + * Copyright (c) 2015 Manumitting Technologies Inc and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -111,7 +111,7 @@ public abstract class TopologicalSort<T, ID> { * the objects to be sorted * @return the objects in a topologically-sorted order */ - public T[] sort(T... objects) { + public T[] sort(T[] objects) { if (objects.length <= 1) { return objects; } @@ -178,7 +178,7 @@ public abstract class TopologicalSort<T, ID> { /** * @param objects */ - private void addAll(T... objects) { + private void addAll(T[] objects) { // first build up the list of object ids actually being considered for (T o : objects) { ID id = getId(o); diff --git a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/Util.java b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/Util.java index 2614f396dfa..606eae1e156 100644 --- a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/Util.java +++ b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/Util.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013 IBM Corporation and others. + * Copyright (c) 2013, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -30,8 +30,7 @@ public final class Util { * An unmodifiable, empty, sorted set. This value is guaranteed to never change and never be * <code>null</code>. */ - public static final SortedSet EMPTY_SORTED_SET = Collections - .unmodifiableSortedSet(new TreeSet()); + public static final SortedSet<?> EMPTY_SORTED_SET = Collections.unmodifiableSortedSet(new TreeSet<>()); /** * A common zero-length string. It avoids needing write <code>NON-NLS</code> next to code @@ -47,7 +46,7 @@ public final class Util { * @param c * The class which the object should be; must not be <code>null</code>. */ - public static final void assertInstance(final Object object, final Class c) { + public static final void assertInstance(final Object object, final Class<?> c) { assertInstance(object, c, false); } @@ -62,7 +61,7 @@ public final class Util { * @param allowNull * Whether the object is allowed to be <code>null</code>. */ - private static final void assertInstance(final Object object, final Class c, + private static final void assertInstance(final Object object, final Class<?> c, final boolean allowNull) { if (object == null && allowNull) { return; @@ -114,7 +113,7 @@ public final class Util { * @return The result of the comparison. <code>null</code> is considered to be the least * possible value. */ - public static final int compare(final Comparable left, final Comparable right) { + public static final <T extends Comparable<T>> int compare(final T left, final T right) { if (left == null && right == null) { return 0; } else if (left == null) { @@ -136,7 +135,7 @@ public final class Util { * @return The result of the comparison. <code>null</code> is considered to be the least * possible value. A shorter array is considered less than a longer array. */ - public static final int compare(final Comparable[] left, final Comparable[] right) { + public static final <T extends Comparable<T>> int compare(final T[] left, final T[] right) { if (left == null && right == null) { return 0; } else if (left == null) { @@ -176,7 +175,7 @@ public final class Util { * @return The result of the comparison. <code>null</code> is considered to be the least * possible value. A shorter list is considered less than a longer list. */ - public static final int compare(final List left, final List right) { + public static final <T extends Comparable<T>> int compare(final List<T> left, final List<T> right) { if (left == null && right == null) { return 0; } else if (left == null) { @@ -192,7 +191,7 @@ public final class Util { } for (int i = 0; i < l; i++) { - int compareTo = compare((Comparable) left.get(i), (Comparable) right.get(i)); + int compareTo = compare(left.get(i), right.get(i)); if (compareTo != 0) { return compareTo; diff --git a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/WorkbenchLogger.java b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/WorkbenchLogger.java index 0a584cdc93f..c5e76a67b82 100644 --- a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/WorkbenchLogger.java +++ b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/WorkbenchLogger.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * Copyright (c) 2009, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -60,7 +60,7 @@ public final class WorkbenchLogger extends Logger { */ private static FrameworkLogEntry getLog(IStatus status) { Throwable t = status.getException(); - ArrayList childlist = new ArrayList(); + ArrayList<FrameworkLogEntry> childlist = new ArrayList<>(); int stackCode = t instanceof CoreException ? 1 : 0; // ensure a substatus inside a CoreException is properly logged @@ -78,8 +78,8 @@ public final class WorkbenchLogger extends Logger { } } - FrameworkLogEntry[] children = (FrameworkLogEntry[]) (childlist.size() == 0 ? null - : childlist.toArray(new FrameworkLogEntry[childlist.size()])); + FrameworkLogEntry[] children = childlist.size() == 0 ? null + : childlist.toArray(new FrameworkLogEntry[childlist.size()]); return new FrameworkLogEntry(status.getPlugin(), status.getSeverity(), status.getCode(), status.getMessage(), stackCode, t, children); diff --git a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/XMLModelReconciler.java b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/XMLModelReconciler.java index c7207c3d0bd..bcf288853bf 100644 --- a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/XMLModelReconciler.java +++ b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/XMLModelReconciler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2012 IBM Corporation and others. + * Copyright (c) 2009, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -780,7 +780,8 @@ public class XMLModelReconciler extends ModelReconciler { deltas.add(delta); } else if (isStringToStringMap(attributeName)) { EStructuralFeature feature = getStructuralFeature(object, attributeName); - EMap map = (EMap) object.eGet(feature); + @SuppressWarnings("unchecked") + EMap<String, String> map = (EMap<String, String>) object.eGet(feature); NodeList attributes = (NodeList) item; for (int j = 0; j < attributes.getLength(); j++) { |
