diff options
author | Alexander Kurtakov | 2017-08-17 13:18:14 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2017-08-17 13:18:14 +0000 |
commit | 97c321205426bc666c975cab58887e381494ccb5 (patch) | |
tree | 7b9bd4d4436b892616f0819c7deb0acefbcec065 | |
parent | 6bfc170d6332d516bcb8022bb0ca4f79fa74fcb8 (diff) | |
download | eclipse.platform.ui.tools-97c321205426bc666c975cab58887e381494ccb5.tar.gz eclipse.platform.ui.tools-97c321205426bc666c975cab58887e381494ccb5.tar.xz eclipse.platform.ui.tools-97c321205426bc666c975cab58887e381494ccb5.zip |
Bug 521063 - Move o.e.e4.tools.services to Java 8
Change-Id: I35377dd1d57c8c9825ff7dc5ac57abb8956c192a
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
7 files changed, 57 insertions, 59 deletions
diff --git a/bundles/org.eclipse.e4.tools.services/.classpath b/bundles/org.eclipse.e4.tools.services/.classpath index e8ea977a..eca7bdba 100644 --- a/bundles/org.eclipse.e4.tools.services/.classpath +++ b/bundles/org.eclipse.e4.tools.services/.classpath @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> <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.7"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/bundles/org.eclipse.e4.tools.services/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.e4.tools.services/.settings/org.eclipse.jdt.core.prefs index cd32e571..e28d402d 100644 --- a/bundles/org.eclipse.e4.tools.services/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.e4.tools.services/.settings/org.eclipse.jdt.core.prefs @@ -21,8 +21,11 @@ org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= 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 @@ -83,12 +86,14 @@ org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error org.eclipse.jdt.core.compiler.problem.nullReference=warning 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.pessimisticNullAnalysisForFreeTypeVariables=warning org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore @@ -111,6 +116,9 @@ 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.unlikelyCollectionMethodArgumentType=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled +org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore diff --git a/bundles/org.eclipse.e4.tools.services/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.e4.tools.services/.settings/org.eclipse.jdt.ui.prefs index e0627af0..336d4397 100644 --- a/bundles/org.eclipse.e4.tools.services/.settings/org.eclipse.jdt.ui.prefs +++ b/bundles/org.eclipse.e4.tools.services/.settings/org.eclipse.jdt.ui.prefs @@ -80,7 +80,7 @@ sp_cleanup.always_use_blocks=true sp_cleanup.always_use_parentheses_in_expressions=false sp_cleanup.always_use_this_for_non_static_field_access=false sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_functional_interfaces=false +sp_cleanup.convert_functional_interfaces=true sp_cleanup.convert_to_enhanced_for_loop=false sp_cleanup.correct_indentation=true sp_cleanup.format_source_code=true @@ -118,7 +118,7 @@ sp_cleanup.sort_members_all=false sp_cleanup.use_anonymous_class_creation=false sp_cleanup.use_blocks=true sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_lambda=false +sp_cleanup.use_lambda=true sp_cleanup.use_parentheses_in_expressions=false sp_cleanup.use_this_for_non_static_field_access=false sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true diff --git a/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF index 83aec567..3f3d0e3d 100644 --- a/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.e4.tools.services Bundle-Version: 4.7.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.7 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Export-Package: org.eclipse.e4.tools.services;version="0.12.0.qualifier";x-friends:="org.eclipse.e4.tools.compat,org.eclipse.e4.tools.emf.editor3x,org.eclipse.e4.tools.emf.ui", org.eclipse.e4.tools.services.impl;version="0.12.0.qualifier";x-friends:="org.eclipse.e4.tools.emf.ui" Bundle-Vendor: %Bundle-Vendor diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/BasicResourceProvider.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/BasicResourceProvider.java index e79a071c..c7e23f29 100644 --- a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/BasicResourceProvider.java +++ b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/BasicResourceProvider.java @@ -1,6 +1,5 @@ package org.eclipse.e4.tools.services; -import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.util.Map; @@ -28,20 +27,11 @@ public abstract class BasicResourceProvider implements IResourceProviderService final URL url = FileLocator.find(context.getBundle(), new Path(properties.get(key)), null); if (url != null) { - InputStream stream = null; - try { - stream = url.openStream(); + try (InputStream stream = url.openStream()) { return new Image(display, stream); } catch (final Exception e) { // TODO Auto-generated catch block e.printStackTrace(); - } finally { - if (stream != null) { - try { - stream.close(); - } catch (final IOException e) { - } - } } } diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourceBundleHelper.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourceBundleHelper.java index 4aa8f663..adfa902f 100644 --- a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourceBundleHelper.java +++ b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourceBundleHelper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012 Dirk Fauth and others. + * Copyright (c) 2012, 2017 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 @@ -86,7 +86,7 @@ public class ResourceBundleHelper { * @return the resource bundle */ public static ResourceBundle getResourceBundleForUri(String contributorURI, Locale locale, - BundleLocalization localization) { + BundleLocalization localization) { if (contributorURI == null) { return null; } @@ -151,7 +151,7 @@ public class ResourceBundleHelper { if (logService != null) { logService.log(LogService.LOG_ERROR, - "Failed to load specified ResourceBundle: " + contributorURI, e); //$NON-NLS-1$ + "Failed to load specified ResourceBundle: " + contributorURI, e); //$NON-NLS-1$ } } } @@ -226,7 +226,7 @@ public class ResourceBundleHelper { // to achieve this we first search without a fallback to the default locale try { resourceBundle = ResourceBundle.getBundle(baseName, locale, loader, - ResourceBundle.Control.getNoFallbackControl(Control.FORMAT_DEFAULT)); + ResourceBundle.Control.getNoFallbackControl(Control.FORMAT_DEFAULT)); } catch (final MissingResourceException e) { // do nothing } @@ -235,7 +235,7 @@ public class ResourceBundleHelper { if (resourceBundle == null) { try { resourceBundle = ResourceBundle.getBundle(baseName, Locale.getDefault(), loader, - ResourceBundle.Control.getNoFallbackControl(Control.FORMAT_DEFAULT)); + ResourceBundle.Control.getNoFallbackControl(Control.FORMAT_DEFAULT)); } catch (final MissingResourceException e) { // do nothing } @@ -302,7 +302,7 @@ public class ResourceBundleHelper { */ public static ResourceBundle getEquinoxResourceBundle(String baseName, Locale locale, Bundle bundle) { return getEquinoxResourceBundle(baseName, locale, - new BundleResourceBundleControl(bundle, true), new BundleResourceBundleControl(bundle, false)); + new BundleResourceBundleControl(bundle, true), new BundleResourceBundleControl(bundle, false)); } /** @@ -353,7 +353,7 @@ public class ResourceBundleHelper { * @see ResourceBundle#getBundle(String, Locale, Control) */ public static ResourceBundle getEquinoxResourceBundle(String baseName, Locale locale, Control withFallback, - Control withoutFallback) { + Control withoutFallback) { ResourceBundle resourceBundle = null; final String equinoxLocale = getEquinoxRootLocale(); @@ -469,7 +469,7 @@ public class ResourceBundleHelper { final String[] localeParts = str.split("_"); //$NON-NLS-1$ if (localeParts.length == 0 || localeParts.length > 3 - || localeParts.length == 1 && localeParts[0].length() == 0) { + || localeParts.length == 1 && localeParts[0].length() == 0) { throw new IllegalArgumentException("Invalid locale format: " + str); //$NON-NLS-1$ } if (localeParts[0].length() == 1 || localeParts[0].length() > 2) { @@ -547,8 +547,8 @@ public class ResourceBundleHelper { @Override public ResourceBundle newBundle(String baseName, Locale locale, - String format, ClassLoader loader, boolean reload) - throws IllegalAccessException, InstantiationException, IOException { + String format, ClassLoader loader, boolean reload) + throws IllegalAccessException, InstantiationException, IOException { final String bundleName = toBundleName(baseName, locale); ResourceBundle bundle = null; @@ -557,23 +557,23 @@ public class ResourceBundleHelper { InputStream stream = null; try { stream = AccessController.doPrivileged( - new PrivilegedExceptionAction<InputStream>() { - @Override - public InputStream run() throws IOException { - InputStream is = null; - final URL url = osgiBundle.getEntry(resourceName); - if (url != null) { - final URLConnection connection = url.openConnection(); - if (connection != null) { - // Disable caches to get fresh data for - // reloading. - connection.setUseCaches(false); - is = connection.getInputStream(); + new PrivilegedExceptionAction<InputStream>() { + @Override + public InputStream run() throws IOException { + InputStream is = null; + final URL url = osgiBundle.getEntry(resourceName); + if (url != null) { + final URLConnection connection = url.openConnection(); + if (connection != null) { + // Disable caches to get fresh data for + // reloading. + connection.setUseCaches(false); + is = connection.getInputStream(); + } } + return is; } - return is; - } - }); + }); } catch (final PrivilegedActionException e) { throw (IOException) e.getException(); } diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourceService.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourceService.java index e39785d8..621db791 100644 --- a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourceService.java +++ b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourceService.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 BestSolution.at and others. + * Copyright (c) 2011, 2017 BestSolution.at 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 ResourceService implements IResourceService { } static class PooledResource<T extends Resource> implements - IPooledResource<T> { + IPooledResource<T> { private final Display display; private int count; private T resource; @@ -54,7 +54,7 @@ public class ResourceService implements IResourceService { private ResourceService resourceService; PooledResource(Display display, ResourceService resourceService, - String id, T resource) { + String id, T resource) { this.display = display; this.id = id; this.count = 1; @@ -105,9 +105,9 @@ public class ResourceService implements IResourceService { public Image getImage(String key) throws CoreException { if (resourceService == null) { throw new CoreException( - new Status(IStatus.ERROR, - ToolsServicesActivator.PLUGIN_ID, - Messages.ResourceService_PoolDisposed)); + new Status(IStatus.ERROR, + ToolsServicesActivator.PLUGIN_ID, + Messages.ResourceService_PoolDisposed)); } IPooledResource<Image> image = null; @@ -128,9 +128,9 @@ public class ResourceService implements IResourceService { public Font getFont(String key) throws CoreException { if (resourceService == null) { throw new CoreException( - new Status(IStatus.ERROR, - ToolsServicesActivator.PLUGIN_ID, - Messages.ResourceService_PoolDisposed)); + new Status(IStatus.ERROR, + ToolsServicesActivator.PLUGIN_ID, + Messages.ResourceService_PoolDisposed)); } IPooledResource<Font> font = null; @@ -150,9 +150,9 @@ public class ResourceService implements IResourceService { public Color getColor(String key) throws CoreException { if (resourceService == null) { throw new CoreException( - new Status(IStatus.ERROR, - ToolsServicesActivator.PLUGIN_ID, - Messages.ResourceService_PoolDisposed)); + new Status(IStatus.ERROR, + ToolsServicesActivator.PLUGIN_ID, + Messages.ResourceService_PoolDisposed)); } IPooledResource<Color> color = null; @@ -164,7 +164,7 @@ public class ResourceService implements IResourceService { if (color == null) { color = resourceService.getColor(display, - key); + key); pooledColors.add(color); } return color.getResource(); @@ -269,7 +269,7 @@ public class ResourceService implements IResourceService { @SuppressWarnings("unchecked") private <R extends Resource> PooledResource<R> loadResource( - Display display, String key, Type type) { + Display display, String key, Type type) { DisplayPool p = displayPool.get(display); PooledResource<R> resource = null; @@ -287,7 +287,7 @@ public class ResourceService implements IResourceService { resource.count++; } else { resource = new PooledResource<>(display, this, key, - (R) lookupResource(display, key, type)); + (R) lookupResource(display, key, type)); if (p == null) { p = new DisplayPool(); @@ -328,17 +328,17 @@ public class ResourceService implements IResourceService { } } throw new IllegalArgumentException(Messages.ResourceService_NoProvider + key - + "'."); //$NON-NLS-1$ + + "'."); //$NON-NLS-1$ } private IResourceProviderService lookupOSGI(String key) { try { final Collection<ServiceReference<IResourceProviderService>> refs = context - .getServiceReferences(IResourceProviderService.class, "(" //$NON-NLS-1$ - + key + "=*)"); //$NON-NLS-1$ + .getServiceReferences(IResourceProviderService.class, "(" //$NON-NLS-1$ + + key + "=*)"); //$NON-NLS-1$ if (!refs.isEmpty()) { final ServiceReference<IResourceProviderService> ref = refs - .iterator().next(); + .iterator().next(); return context.getService(ref); } } catch (final InvalidSyntaxException e) { |