diff options
author | Alexander Kurtakov | 2016-02-22 11:01:58 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2016-02-22 11:01:58 +0000 |
commit | 589f7c7a05911bfe8a5e7229ee5234beddb61c79 (patch) | |
tree | 01abeeda292fec3bfcbf7f936f2c8fba4e7d8092 /org.eclipse.help | |
parent | 791fa3a67592b11709284fb1c109ae60ecf86033 (diff) | |
download | eclipse.platform.ua-589f7c7a05911bfe8a5e7229ee5234beddb61c79.tar.gz eclipse.platform.ua-589f7c7a05911bfe8a5e7229ee5234beddb61c79.tar.xz eclipse.platform.ua-589f7c7a05911bfe8a5e7229ee5234beddb61c79.zip |
Bug 488210 - Generify org.eclipse.help plugin
Handle collections internal to methods.
Enable unnecessary cast/innstanceof warnings.
Change-Id: I5bf77da1f7cd703c3dd141206f25a4cf6b9f9ebe
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'org.eclipse.help')
18 files changed, 114 insertions, 100 deletions
diff --git a/org.eclipse.help/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.help/.settings/org.eclipse.jdt.core.prefs index 24f706aa1..c20481bad 100644 --- a/org.eclipse.help/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.help/.settings/org.eclipse.jdt.core.prefs @@ -1,4 +1,13 @@ eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullable.secondary= +org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.compliance=1.7 @@ -13,6 +22,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod= org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore @@ -20,12 +30,15 @@ org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=error org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled @@ -34,37 +47,53 @@ org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignor org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=error +org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error org.eclipse.jdt.core.compiler.problem.nullReference=ignore +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedImport=error org.eclipse.jdt.core.compiler.problem.unusedLabel=warning org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.source=1.7 diff --git a/org.eclipse.help/src/org/eclipse/help/internal/UAElement.java b/org.eclipse.help/src/org/eclipse/help/internal/UAElement.java index ec6cdf30d..9edd875ad 100644 --- a/org.eclipse.help/src/org/eclipse/help/internal/UAElement.java +++ b/org.eclipse.help/src/org/eclipse/help/internal/UAElement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2015 IBM Corporation and others. + * Copyright (c) 2007, 2016 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 @@ -46,7 +46,7 @@ public class UAElement implements IUAElement { private Element element; private UAElement parent; - protected List children; + protected List<UAElement> children; private Filter[] filters; private Expression enablementExpression; private IUAElement src; @@ -92,7 +92,7 @@ public class UAElement implements IUAElement { private Filter[] getFilterElements() { if (filters == null) { - List list = new ArrayList(); + List<Filter> list = new ArrayList<>(); if (element.hasChildNodes()) { Node node = element.getFirstChild(); while (node != null) { @@ -125,7 +125,7 @@ public class UAElement implements IUAElement { node = node.getNextSibling(); } } - filters = (Filter[])list.toArray(new Filter[list.size()]); + filters = list.toArray(new Filter[list.size()]); } return filters; } @@ -142,7 +142,7 @@ public class UAElement implements IUAElement { public void appendChildren(IUAElement[] children) { if (this.children == null && children.length > 0) { - this.children = new ArrayList(4); + this.children = new ArrayList<>(4); } for (int i=0;i<children.length;i++) { appendChild(children[i] instanceof UAElement ? (UAElement)children[i] : UAElementFactory.newElement(children[i])); @@ -170,7 +170,7 @@ public class UAElement implements IUAElement { public synchronized IUAElement[] getChildren() { if (children == null) { if (element.hasChildNodes()) { - children = new ArrayList(4); + children = new ArrayList<>(4); Node node = element.getFirstChild(); while (node != null) { if (node.getNodeType() == Node.ELEMENT_NODE) { @@ -186,13 +186,13 @@ public class UAElement implements IUAElement { return new UAElement[0]; } } - return (UAElement[])children.toArray(new UAElement[children.size()]); + return children.toArray(new UAElement[children.size()]); } public Object getChildren(Class clazz) { IUAElement[] children = getChildren(); if (children.length > 0) { - List list = new ArrayList(); + List<Object> list = new ArrayList<>(); for (int i=0;i<children.length;++i) { IUAElement child = children[i]; if (clazz.isAssignableFrom(child.getClass())) { diff --git a/org.eclipse.help/src/org/eclipse/help/internal/context/Context.java b/org.eclipse.help/src/org/eclipse/help/internal/context/Context.java index 13fac2171..851f5ab5b 100644 --- a/org.eclipse.help/src/org/eclipse/help/internal/context/Context.java +++ b/org.eclipse.help/src/org/eclipse/help/internal/context/Context.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -41,7 +41,7 @@ public class Context extends UAElement implements IContext3 { public Context(IContext src, String id) { super(NAME); setId(id); - children = new ArrayList(); + children = new ArrayList<>(); mergeContext(src); } diff --git a/org.eclipse.help/src/org/eclipse/help/internal/context/ContextFileProvider.java b/org.eclipse.help/src/org/eclipse/help/internal/context/ContextFileProvider.java index f1bbf35e2..74541c343 100644 --- a/org.eclipse.help/src/org/eclipse/help/internal/context/ContextFileProvider.java +++ b/org.eclipse.help/src/org/eclipse/help/internal/context/ContextFileProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2015 IBM Corporation and others. + * Copyright (c) 2006, 2016 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 @@ -107,13 +107,10 @@ public class ContextFileProvider extends AbstractContextProvider { } } - /* (non-Javadoc) - * @see org.eclipse.help.AbstractContextProvider#getPlugins() - */ @Override public String[] getPlugins() { - Map associations = getPluginAssociations(); - return (String[])associations.keySet().toArray(new String[associations.size()]); + Map<String, ?> associations = getPluginAssociations(); + return associations.keySet().toArray(new String[associations.size()]); } /* @@ -153,7 +150,7 @@ public class ContextFileProvider extends AbstractContextProvider { * as a mapping of short IDs to Context objects (shortContextId -> Context). */ public Map[] getPluginContexts(String pluginId, String locale) { - List maps = new ArrayList(); + List<Map> maps = new ArrayList<>(); Map associations = getPluginAssociations(); ContextFile[] descriptors = (ContextFile[])associations.get(pluginId); for (int i=0;i<descriptors.length;++i) { @@ -162,7 +159,7 @@ public class ContextFileProvider extends AbstractContextProvider { maps.add(contexts); } } - return (Map[])maps.toArray(new Map[maps.size()]); + return maps.toArray(new Map[maps.size()]); } /* diff --git a/org.eclipse.help/src/org/eclipse/help/internal/dynamic/ExtensionResolver.java b/org.eclipse.help/src/org/eclipse/help/internal/dynamic/ExtensionResolver.java index 3e6756b6d..be9e6c9d4 100644 --- a/org.eclipse.help/src/org/eclipse/help/internal/dynamic/ExtensionResolver.java +++ b/org.eclipse.help/src/org/eclipse/help/internal/dynamic/ExtensionResolver.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2015 IBM Corporation and others. + * Copyright (c) 2006, 2016 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 @@ -59,7 +59,7 @@ public class ExtensionResolver { manager = HelpPlugin.getContentExtensionManager(); } ContentExtension[] extensions = manager.getExtensions(path, type, locale); - List list = new ArrayList(); + List<Node> list = new ArrayList<>(); for (int i=0;i<extensions.length;++i) { String content = extensions[i].getContent(); try { @@ -72,7 +72,7 @@ public class ExtensionResolver { // ignore invalid extensions } } - return (Node[])list.toArray(new Node[list.size()]); + return list.toArray(new Node[list.size()]); } /* @@ -136,7 +136,7 @@ public class ExtensionResolver { return new Node[] { element }; } Element body = findBody(in); - List children = new ArrayList(); + List<Node> children = new ArrayList<>(); Node node = body.getFirstChild(); while (node != null) { if (node.getNodeType() == Node.ELEMENT_NODE) { @@ -145,7 +145,7 @@ public class ExtensionResolver { children.add(node); node = node.getNextSibling(); } - return (Node[])children.toArray(new Node[children.size()]); + return children.toArray(new Node[children.size()]); } finally { try { diff --git a/org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtensionFileParser.java b/org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtensionFileParser.java index 510719821..7127c5c25 100644 --- a/org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtensionFileParser.java +++ b/org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtensionFileParser.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2015 IBM Corporation and others. + * Copyright (c) 2006, 2016 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 @@ -51,7 +51,7 @@ public class ContentExtensionFileParser extends DefaultHandler { URL url= FileLocator.find(bundle, new Path(path), null); if (url != null) { InputStream in = url.openStream(); - UAElement extension = (UAElement)reader.read(in); + UAElement extension = reader.read(in); if (processor == null) { processor = new DocumentProcessor(new ProcessorHandler[] { new ValidationHandler(getRequiredAttributes(), getDeprecatedElements()) diff --git a/org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtensionFileProvider.java b/org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtensionFileProvider.java index fff3ce682..66f4a8783 100644 --- a/org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtensionFileProvider.java +++ b/org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtensionFileProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2015 IBM Corporation and others. + * Copyright (c) 2006, 2016 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,12 +32,9 @@ public class ContentExtensionFileProvider extends AbstractContentExtensionProvid private static final String ATTRIBUTE_FILE = "file"; //$NON-NLS-1$ private static final String ATTRIBUTE_CONTENT = "content"; //$NON-NLS-1$ - /* (non-Javadoc) - * @see org.eclipse.help.AbstractContentExtensionProvider#getContentExtensions(java.lang.String) - */ @Override public IContentExtension[] getContentExtensions(String locale) { - List extensions = new ArrayList(); + List<IContentExtension> extensions = new ArrayList<>(); IExtensionRegistry registry = Platform.getExtensionRegistry(); ContentExtensionFileParser parser = new ContentExtensionFileParser(); IConfigurationElement[] elements = registry.getConfigurationElementsFor(EXTENSION_POINT_CONTENT_EXTENSION); @@ -62,6 +59,6 @@ public class ContentExtensionFileProvider extends AbstractContentExtensionProvid } } } - return (IContentExtension[])extensions.toArray(new IContentExtension[extensions.size()]); + return extensions.toArray(new IContentExtension[extensions.size()]); } } diff --git a/org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtensionManager.java b/org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtensionManager.java index 416e431d3..8ce5ff410 100644 --- a/org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtensionManager.java +++ b/org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtensionManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2015 IBM Corporation and others. + * Copyright (c) 2006, 2016 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 @@ -48,7 +48,7 @@ public class ContentExtensionManager { if (extensionsByPath == null) { loadExtensions(locale); } - List extensions = new ArrayList(); + List<ContentExtension> extensions = new ArrayList<>(); Iterator iter = extensionsByPath.values().iterator(); while (iter.hasNext()) { extensions.addAll((Collection)iter.next()); @@ -57,7 +57,7 @@ public class ContentExtensionManager { while (iter.hasNext()) { extensions.addAll((Collection)iter.next()); } - return (ContentExtension[])extensions.toArray(new ContentExtension[extensions.size()]); + return extensions.toArray(new ContentExtension[extensions.size()]); } /* @@ -68,9 +68,9 @@ public class ContentExtensionManager { loadExtensions(locale); } Map map = (type == ContentExtension.CONTRIBUTION ? extensionsByPath : replacesByPath); - List extensions = (List)map.get(path); + List<ContentExtension> extensions = (List<ContentExtension>) map.get(path); if (extensions != null) { - return (ContentExtension[])extensions.toArray(new ContentExtension[extensions.size()]); + return extensions.toArray(new ContentExtension[extensions.size()]); } return EMPTY_ARRAY; } @@ -125,7 +125,7 @@ public class ContentExtensionManager { */ private AbstractContentExtensionProvider[] getContentExtensionProviders() { if (contentExtensionProviders == null) { - List providers = new ArrayList(); + List<AbstractContentExtensionProvider> providers = new ArrayList<>(); IExtensionRegistry registry = Platform.getExtensionRegistry(); IConfigurationElement[] elements = registry.getConfigurationElementsFor(EXTENSION_POINT_ID_CONTENT_EXTENSION); for (int i=0;i<elements.length;++i) { @@ -142,7 +142,7 @@ public class ContentExtensionManager { } } } - contentExtensionProviders = (AbstractContentExtensionProvider[])providers.toArray(new AbstractContentExtensionProvider[providers.size()]); + contentExtensionProviders = providers.toArray(new AbstractContentExtensionProvider[providers.size()]); } return contentExtensionProviders; } diff --git a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexAssembler.java b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexAssembler.java index a358bc344..8ec8f3826 100644 --- a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexAssembler.java +++ b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexAssembler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2015 IBM Corporation and others. + * Copyright (c) 2006, 2016 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 @@ -92,7 +92,7 @@ public class IndexAssembler { else if (childA instanceof Topic) { topicHrefs.add(childA.getAttribute(Topic.ATTRIBUTE_HREF)); } else if (childA instanceof IndexSee) { - seeTargets.add(((IndexSee)childA)); + seeTargets.add((childA)); } } @@ -120,7 +120,7 @@ public class IndexAssembler { topicHrefs.add(href); } } else if (childB instanceof IndexSee) { - if (!seeTargets.contains(((IndexSee) childB))) { + if (!seeTargets.contains((childB))) { // add see only if it doesn't exist yet a.appendChild(childB); seeTargets.add(childB); diff --git a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexFileProvider.java b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexFileProvider.java index f02012625..24890522e 100644 --- a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexFileProvider.java +++ b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexFileProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2015 IBM Corporation and others. + * Copyright (c) 2006, 2016 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,12 +32,9 @@ public class IndexFileProvider extends AbstractIndexProvider { public static final String ELEMENT_NAME_INDEX = "index"; //$NON-NLS-1$ public static final String ATTRIBUTE_NAME_FILE = "file"; //$NON-NLS-1$ - /* (non-Javadoc) - * @see org.eclipse.help.AbstractIndexProvider#getIndexContributions(java.lang.String) - */ @Override public IIndexContribution[] getIndexContributions(String locale) { - List contributions = new ArrayList(); + List<IIndexContribution> contributions = new ArrayList<>(); IndexFile[] indexFiles = getIndexFiles(locale); IndexFileParser parser = new IndexFileParser(); for (int i=0;i<indexFiles.length;++i) { @@ -65,7 +62,7 @@ public class IndexFileProvider extends AbstractIndexProvider { HelpPlugin.logError(msg, t); } } - return (IIndexContribution[])contributions.toArray(new IIndexContribution[contributions.size()]); + return contributions.toArray(new IIndexContribution[contributions.size()]); } private String getIndexFilePath(IndexFile indexFile) { @@ -78,7 +75,7 @@ public class IndexFileProvider extends AbstractIndexProvider { * Returns all available IndexFiles for the given locale. */ private IndexFile[] getIndexFiles(String locale) { - List indexFiles = new ArrayList(); + List<IndexFile> indexFiles = new ArrayList<>(); IExtensionRegistry registry = Platform.getExtensionRegistry(); IConfigurationElement[] elements = registry.getConfigurationElementsFor(EXTENSION_POINT_ID_INDEX); for (int i=0;i<elements.length;++i) { @@ -90,6 +87,6 @@ public class IndexFileProvider extends AbstractIndexProvider { indexFiles.add(indexFile); } } - return (IndexFile[])indexFiles.toArray(new IndexFile[indexFiles.size()]); + return indexFiles.toArray(new IndexFile[indexFiles.size()]); } } diff --git a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexManager.java b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexManager.java index 09ad74f95..015c27e6c 100644 --- a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexManager.java +++ b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2015 Intel Corporation and others. + * Copyright (c) 2005, 2016 Intel 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 @@ -80,7 +80,7 @@ public class IndexManager { private IndexContribution[] readIndexContributions(String locale) { IndexContribution[] cached; - List contributions = new ArrayList(); + List<IndexContribution> contributions = new ArrayList<>(); AbstractIndexProvider[] providers = getIndexProviders(); for (int i=0;i<providers.length;++i) { IIndexContribution[] contrib; @@ -111,7 +111,7 @@ public class IndexManager { continue; } } - cached = (IndexContribution[])contributions.toArray(new IndexContribution[contributions.size()]); + cached = contributions.toArray(new IndexContribution[contributions.size()]); return cached; } @@ -129,7 +129,7 @@ public class IndexManager { */ public AbstractIndexProvider[] getIndexProviders() { if (indexProviders == null) { - List providers = new ArrayList(); + List<AbstractIndexProvider> providers = new ArrayList<>(); IExtensionRegistry registry = Platform.getExtensionRegistry(); IConfigurationElement[] elements = registry.getConfigurationElementsFor(EXTENSION_POINT_ID_INDEX); for (int i=0;i<elements.length;++i) { @@ -146,7 +146,7 @@ public class IndexManager { } } } - indexProviders = (AbstractIndexProvider[])providers.toArray(new AbstractIndexProvider[providers.size()]); + indexProviders = providers.toArray(new AbstractIndexProvider[providers.size()]); } return indexProviders; } diff --git a/org.eclipse.help/src/org/eclipse/help/internal/toc/DocumentFinder.java b/org.eclipse.help/src/org/eclipse/help/internal/toc/DocumentFinder.java index eeb9f985d..09ad47f65 100644 --- a/org.eclipse.help/src/org/eclipse/help/internal/toc/DocumentFinder.java +++ b/org.eclipse.help/src/org/eclipse/help/internal/toc/DocumentFinder.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2015 IBM Corporation and others. + * Copyright (c) 2006, 2016 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 @@ -36,7 +36,7 @@ public class DocumentFinder { String dir = HrefUtil.normalizeDirectoryHref(tocFile.getPluginId(), tocFile.getExtraDir()); String locale = tocFile.getLocale(); - List result = new ArrayList(); + List<String> result = new ArrayList<>(); String pluginID = HrefUtil.getPluginIDFromHref(dir); if (pluginID == null) { return new String[0]; @@ -52,7 +52,7 @@ public class DocumentFinder { } // Find doc.zip file IPath iPath = new Path("$nl$/doc.zip"); //$NON-NLS-1$ - Map override = new HashMap(1); + Map<String, String> override = new HashMap<>(1); override.put("$nl$", locale); //$NON-NLS-1$ URL url = FileLocator.find(pluginDesc, iPath, override); if (url == null) { @@ -71,7 +71,7 @@ public class DocumentFinder { href = HrefUtil.normalizeDirectoryPath(href); result.add(href); } - return (String[])result.toArray(new String[result.size()]); + return result.toArray(new String[result.size()]); } private static List collectExtraDocumentsFromZip(String pluginID, String directory, @@ -107,7 +107,7 @@ public class DocumentFinder { private static List createExtraTopicsFromZipFile(String pluginID, ZipFile zipFile, String directory) { String constantHrefSegment = "/" + pluginID + "/"; //$NON-NLS-1$ //$NON-NLS-2$ - List result = new ArrayList(); + List<String> result = new ArrayList<>(); for (Enumeration entriesEnum = zipFile.entries(); entriesEnum.hasMoreElements();) { ZipEntry zEntry = (ZipEntry) entriesEnum.nextElement(); if (zEntry.isDirectory()) { diff --git a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocAssembler.java b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocAssembler.java index 01833b2f3..75096ed7d 100644 --- a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocAssembler.java +++ b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocAssembler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2015 IBM Corporation and others. + * Copyright (c) 2006, 2016 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 @@ -335,10 +335,10 @@ public class TocAssembler { combinedExtraDocuments = extraDocuments; } else { - Set set = new HashSet(); + Set<String> set = new HashSet<>(); set.addAll(Arrays.asList(destExtraDocuments)); set.addAll(Arrays.asList(extraDocuments)); - combinedExtraDocuments = (String[])set.toArray(new String[set.size()]); + combinedExtraDocuments = set.toArray(new String[set.size()]); } contribution.setExtraDocuments(combinedExtraDocuments); } diff --git a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileProvider.java b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileProvider.java index 4003ab3d9..e8d6b21a6 100644 --- a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileProvider.java +++ b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2015 IBM Corporation and others. + * Copyright (c) 2006, 2016 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 @@ -35,12 +35,9 @@ public class TocFileProvider extends AbstractTocProvider { public static final String ATTRIBUTE_NAME_EXTRADIR = "extradir"; //$NON-NLS-1$ public static final String ATTRIBUTE_NAME_CATEGORY = "category"; //$NON-NLS-1$ - /* (non-Javadoc) - * @see org.eclipse.help.AbstractTocProvider#getTocContributions(java.lang.String) - */ @Override public ITocContribution[] getTocContributions(String locale) { - List contributions = new ArrayList(); + List<ITocContribution> contributions = new ArrayList<>(); TocFile[] tocFiles = getTocFiles(locale); TocFileParser parser = new TocFileParser(); for (int i=0;i<tocFiles.length;++i) { @@ -64,14 +61,14 @@ public class TocFileProvider extends AbstractTocProvider { HelpPlugin.logError(msg, t); } } - return (ITocContribution[])contributions.toArray(new ITocContribution[contributions.size()]); + return contributions.toArray(new ITocContribution[contributions.size()]); } /* * Returns all available TocFiles for the given locale. */ protected TocFile[] getTocFiles(String locale) { - List tocFiles = new ArrayList(); + List<TocFile> tocFiles = new ArrayList<>(); IExtensionRegistry registry = Platform.getExtensionRegistry(); IConfigurationElement[] elements = registry.getConfigurationElementsFor(EXTENSION_POINT_ID_TOC); for (int i=0;i<elements.length;++i) { @@ -94,12 +91,9 @@ public class TocFileProvider extends AbstractTocProvider { tocFiles.add(tocFile); } } - return (TocFile[])tocFiles.toArray(new TocFile[tocFiles.size()]); + return tocFiles.toArray(new TocFile[tocFiles.size()]); } - /* (non-Javadoc) - * @see org.eclipse.help.AbstractTocProvider#getPriority() - */ @Override public int getPriority() { return TOC_FILE_PRIORITY; diff --git a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocManager.java b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocManager.java index 6f2a149b4..498132b36 100644 --- a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocManager.java +++ b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -68,7 +68,7 @@ public class TocManager { TocContribution[] raw = getRootTocContributions(locale, tocsToFilter); TocContribution[] filtered = filterTocContributions(raw, tocsToFilter); ITocContribution[] ordered = new TocSorter().orderTocContributions(filtered); - List orderedTocs = new ArrayList(ordered.length); + List<Toc> orderedTocs = new ArrayList<>(ordered.length); for (int i=0;i<ordered.length;++i) { try { Toc toc = (Toc)ordered[i].getToc(); @@ -81,7 +81,7 @@ public class TocManager { HelpPlugin.logError(msg, t); } } - tocs = (Toc[])orderedTocs.toArray(new Toc[orderedTocs.size()]); + tocs = orderedTocs.toArray(new Toc[orderedTocs.size()]); TopicSorter topicSorter = new TopicSorter(); for (int i = 0; i < tocs.length; i++) { topicSorter.sortChildren(tocs[i]); @@ -202,7 +202,7 @@ public class TocManager { private synchronized TocContribution[] getAndCacheTocContributions(String locale, Map contributionsByLocale) { TocContribution[] cached = (TocContribution[])contributionsByLocale.get(locale); if (cached == null) { - HashMap contributions = new HashMap(); + HashMap<String, TocContribution> contributions = new HashMap<>(); AbstractTocProvider[] providers = getTocProviders(); for (int i=0;i<providers.length;++i) { ITocContribution[] contrib; @@ -232,7 +232,7 @@ public class TocManager { } } - cached = (TocContribution[])contributions.values().toArray(new TocContribution[contributions.size()]); + cached = contributions.values().toArray(new TocContribution[contributions.size()]); contributionsByLocale.put(locale, cached); } return cached; @@ -256,7 +256,7 @@ public class TocManager { */ public AbstractTocProvider[] getTocProviders() { if (tocProviders == null) { - List providers = new ArrayList(); + List<AbstractTocProvider> providers = new ArrayList<>(); IExtensionRegistry registry = Platform.getExtensionRegistry(); IConfigurationElement[] elements = registry.getConfigurationElementsFor(EXTENSION_POINT_ID_TOC); for (int i=0;i<elements.length;++i) { @@ -274,7 +274,7 @@ public class TocManager { } } Collections.sort(providers, new TocProviderComparator()); - tocProviders = (AbstractTocProvider[])providers.toArray(new AbstractTocProvider[providers.size()]); + tocProviders = providers.toArray(new AbstractTocProvider[providers.size()]); } return tocProviders; } @@ -292,22 +292,22 @@ public class TocManager { * ignoredTocs, filter the contribution. */ private TocContribution[] filterTocContributions(TocContribution[] unfiltered, Set tocsToFilter) { - List filtered = new ArrayList(); + List<TocContribution> filtered = new ArrayList<>(); for (int i=0;i<unfiltered.length;++i) { if (!tocsToFilter.contains(unfiltered[i].getId()) && !tocsToFilter.contains(unfiltered[i].getCategoryId())) { filtered.add(unfiltered[i]); } } - return (TocContribution[])filtered.toArray(new TocContribution[filtered.size()]); + return filtered.toArray(new TocContribution[filtered.size()]); } private TocContribution[] getRootTocContributions(String locale, Set tocsToFilter) { TocContribution[] contributions = getTocContributionsForToc(locale); List unassembled = new ArrayList(Arrays.asList(contributions)); TocAssembler assembler = new TocAssembler(tocsToFilter); - List assembled = assembler.assemble(unassembled); - return (TocContribution[])assembled.toArray(new TocContribution[assembled.size()]); + List<TocContribution> assembled = assembler.assemble(unassembled); + return assembled.toArray(new TocContribution[assembled.size()]); } private Set getIgnoredTocContributions() { diff --git a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocSorter.java b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocSorter.java index cc70de039..c64731b88 100644 --- a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocSorter.java +++ b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocSorter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -52,14 +52,14 @@ public class TocSorter { Map nameIdMap = createNameIdMap(categorized); // order them - List orderedItems = ProductPreferences.getTocOrder(itemsToOrder, nameIdMap); + List<ITocContribution> orderedItems = ProductPreferences.getTocOrder(itemsToOrder, nameIdMap); // replace with actual TocContribution or category orderedItems = substituteValues(orderedItems, categorized); // expand the categories orderedItems = expandCategories(orderedItems); - return (ITocContribution[])orderedItems.toArray(new ITocContribution[orderedItems.size()]); + return orderedItems.toArray(new ITocContribution[orderedItems.size()]); } // Create a mapping from an id to a label that can be sorted diff --git a/org.eclipse.help/src/org/eclipse/help/internal/util/ProductPreferences.java b/org.eclipse.help/src/org/eclipse/help/internal/util/ProductPreferences.java index fd648a7e7..b25615cd9 100644 --- a/org.eclipse.help/src/org/eclipse/help/internal/util/ProductPreferences.java +++ b/org.eclipse.help/src/org/eclipse/help/internal/util/ProductPreferences.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2015 IBM Corporation and others. + * Copyright (c) 2006, 2016 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 @@ -99,7 +99,7 @@ public class ProductPreferences { */ public static List[] getSecondaryTocOrderings() { if (secondaryTocOrderings == null) { - List list = new ArrayList(); + List<List> list = new ArrayList<>(); Properties[] productPreferences = getProductPreferences(false); for (int i=0;i<productPreferences.length;++i) { String pluginId = (String)preferencesToPluginIdMap.get(productPreferences[i]); @@ -110,7 +110,7 @@ public class ProductPreferences { list.add(ordering); } } - secondaryTocOrderings = (List[])list.toArray(new List[list.size()]); + secondaryTocOrderings = list.toArray(new List[list.size()]); } return secondaryTocOrderings; } @@ -267,7 +267,7 @@ public class ProductPreferences { if (activeProduct != null) { activeProductId = activeProduct.getId(); } - Collection collection = new ArrayList(); + Collection<Properties> collection = new ArrayList<>(); IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.core.runtime.products"); //$NON-NLS-1$ for (int i=0;i<elements.length;++i) { if (elements[i].getName().equals("product")) { //$NON-NLS-1$ @@ -298,7 +298,7 @@ public class ProductPreferences { } } } - productPreferences = (Properties[])collection.toArray(new Properties[collection.size()]); + productPreferences = collection.toArray(new Properties[collection.size()]); } return productPreferences; } diff --git a/org.eclipse.help/src/org/eclipse/help/internal/util/SequenceResolver.java b/org.eclipse.help/src/org/eclipse/help/internal/util/SequenceResolver.java index 5760215e0..774612bb3 100644 --- a/org.eclipse.help/src/org/eclipse/help/internal/util/SequenceResolver.java +++ b/org.eclipse.help/src/org/eclipse/help/internal/util/SequenceResolver.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2015 IBM Corporation and others. + * Copyright (c) 2006, 2016 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 @@ -135,13 +135,13 @@ public class SequenceResolver { topRank = candidates[i].rank; } } - List topCandidates = new ArrayList(); + List<Candidate> topCandidates = new ArrayList<>(); for (int i=0;i<candidates.length;++i) { if (candidates[i].rank == topRank) { topCandidates.add(candidates[i]); } } - return (Candidate[])topCandidates.toArray(new Candidate[topCandidates.size()]); + return topCandidates.toArray(new Candidate[topCandidates.size()]); } return candidates; } @@ -163,7 +163,7 @@ public class SequenceResolver { } // if we have no primary candidate then they're all eligible if (primary != null) { - List eligibleCandidates = new ArrayList(allCandidates.length); + List<Candidate> eligibleCandidates = new ArrayList<>(allCandidates.length); // primary candidate is always eligible eligibleCandidates.add(primary); Set primarySet = Collections.singleton(primary.item); @@ -176,7 +176,7 @@ public class SequenceResolver { } } } - return (Candidate[])eligibleCandidates.toArray(new Candidate[eligibleCandidates.size()]); + return eligibleCandidates.toArray(new Candidate[eligibleCandidates.size()]); } return allCandidates; } @@ -186,7 +186,7 @@ public class SequenceResolver { * no duplicates. */ private Candidate[] getAllCandidates() { - List candidates = new ArrayList(); + List<Candidate> candidates = new ArrayList<>(); Object item = getNextItem(primaryIter); if (item != null) { Candidate c = new Candidate(); @@ -207,7 +207,7 @@ public class SequenceResolver { } } } - return (Candidate[])candidates.toArray(new Candidate[candidates.size()]); + return candidates.toArray(new Candidate[candidates.size()]); } /* |