diff options
author | Alexander Kurtakov | 2012-06-25 21:40:13 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2012-06-25 21:40:13 +0000 |
commit | b70f547a0d050f2a907623dc47841f396f254ee6 (patch) | |
tree | 013b84094d5f1b71bd353898aa371475b5f516b3 | |
parent | f0d9e6bdef1720f8dd2e86689e355bbe1d346714 (diff) | |
download | org.eclipse.linuxtools-b70f547a0d050f2a907623dc47841f396f254ee6.tar.gz org.eclipse.linuxtools-b70f547a0d050f2a907623dc47841f396f254ee6.tar.xz org.eclipse.linuxtools-b70f547a0d050f2a907623dc47841f396f254ee6.zip |
Enable more warnings and fix them.
A number of new compiler warnings are enabled and the problems reported
are fixed.
9 files changed, 115 insertions, 20 deletions
diff --git a/profiling/org.eclipse.linuxtools.profiling.launch/.settings/org.eclipse.jdt.core.prefs b/profiling/org.eclipse.linuxtools.profiling.launch/.settings/org.eclipse.jdt.core.prefs index 03c28b02b2..3c3ca3e17f 100644 --- a/profiling/org.eclipse.linuxtools.profiling.launch/.settings/org.eclipse.jdt.core.prefs +++ b/profiling/org.eclipse.linuxtools.profiling.launch/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,95 @@ -#Wed Oct 22 16:33:22 EDT 2008 eclipse.preferences.version=1 +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.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning 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=disabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +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=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning +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=warning +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +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.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=warning +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=warning +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.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=warning +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +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.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.source=1.5 diff --git a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/internal/profiling/launch/ProfileLaunchPlugin.java b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/internal/profiling/launch/ProfileLaunchPlugin.java index 8dd6431895..4a758c1b80 100644 --- a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/internal/profiling/launch/ProfileLaunchPlugin.java +++ b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/internal/profiling/launch/ProfileLaunchPlugin.java @@ -49,6 +49,7 @@ public class ProfileLaunchPlugin extends AbstractUIPlugin { * (non-Javadoc) * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) */ + @Override public void start(BundleContext context) throws Exception { super.start(context); plugin = this; @@ -58,6 +59,7 @@ public class ProfileLaunchPlugin extends AbstractUIPlugin { * (non-Javadoc) * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) */ + @Override public void stop(BundleContext context) throws Exception { plugin = null; super.stop(context); diff --git a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ConfigUtils.java b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ConfigUtils.java index 4f60751799..26f3ba0c4e 100644 --- a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ConfigUtils.java +++ b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ConfigUtils.java @@ -87,8 +87,7 @@ public class ConfigUtils { * @since 5.0 */ protected IPath verifyResource(String path, - IProgressMonitor monitor) - throws CoreException { + IProgressMonitor monitor) { return Path.fromOSString(path); } diff --git a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchConfigurationDelegate.java b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchConfigurationDelegate.java index 78258ba52d..7c918a0577 100644 --- a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchConfigurationDelegate.java +++ b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchConfigurationDelegate.java @@ -115,7 +115,7 @@ public abstract class ProfileLaunchConfigurationDelegate extends AbstractCLaunch for (String str : tmp) { cmdLine.add(str); } - return (String[]) cmdLine.toArray(new String[cmdLine.size()]); + return cmdLine.toArray(new String[cmdLine.size()]); } @@ -127,10 +127,9 @@ public abstract class ProfileLaunchConfigurationDelegate extends AbstractCLaunch * @param wd -- Working directory * @param usePty -- A value of 'true' usually suffices * @return A properly formed process, or null - * @throws IOException -- If the process cannot be created */ public Process execute(String[] commandArray, String[] env, File wd, - boolean usePty) throws IOException { + boolean usePty) { Process process = null; try { if (wd == null) { @@ -192,8 +191,8 @@ public abstract class ProfileLaunchConfigurationDelegate extends AbstractCLaunch * @return The text contained within that console */ public static String getMainConsoleText(String search){ - TextConsole proc = (TextConsole) getConsole(search); - return ((IDocument)proc.getDocument()).get(); + TextConsole proc = getConsole(search); + return proc.getDocument().get(); } /** @@ -203,7 +202,7 @@ public abstract class ProfileLaunchConfigurationDelegate extends AbstractCLaunch * @return */ public static IDocument getConsoleDocument(String search) { - return ((TextConsole)getConsole(search)).getDocument(); + return getConsole(search).getDocument(); } } diff --git a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchConfigurationTab.java b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchConfigurationTab.java index 7b6bce8fd6..5bfcb4d8ce 100644 --- a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchConfigurationTab.java +++ b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchConfigurationTab.java @@ -2,6 +2,6 @@ package org.eclipse.linuxtools.profiling.launch; import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; -public abstract class ProfileLaunchConfigurationTab extends AbstractLaunchConfigurationTab{ - +public abstract class ProfileLaunchConfigurationTab extends AbstractLaunchConfigurationTab { + // Just a marker for our own tab kind. } diff --git a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchShortcut.java b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchShortcut.java index 7611018a2e..1ed7dac6fe 100644 --- a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchShortcut.java +++ b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchShortcut.java @@ -145,7 +145,7 @@ public abstract class ProfileLaunchShortcut implements ILaunchShortcut { if (candidateCount < 1) { configuration = createConfiguration(bin); } else if (candidateCount == 1) { - configuration = (ILaunchConfiguration) candidateConfigs.get(0); + configuration = candidateConfigs.get(0); } else { // Prompt the user to choose a config. A null result means the user // cancelled the dialog, in which case this method returns null, @@ -225,6 +225,7 @@ public abstract class ProfileLaunchShortcut implements ILaunchShortcut { } } } catch (CModelException e) { + // TODO should this be simply ignored ? } } } @@ -253,7 +254,7 @@ public abstract class ProfileLaunchShortcut implements ILaunchShortcut { } else if (count > 1) { bin = chooseBinary(results, mode); } else { - bin = (IBinary)results.get(0); + bin = results.get(0); } } if (bin != null) { @@ -275,6 +276,7 @@ public abstract class ProfileLaunchShortcut implements ILaunchShortcut { */ protected IBinary chooseBinary(List<IBinary> binList, String mode) { ILabelProvider programLabelProvider = new CElementLabelProvider() { + @Override public String getText(Object element) { if (element instanceof IBinary) { IBinary bin = (IBinary)element; @@ -287,6 +289,7 @@ public abstract class ProfileLaunchShortcut implements ILaunchShortcut { }; ILabelProvider qualifierLabelProvider = new CElementLabelProvider() { + @Override public String getText(Object element) { if (element instanceof IBinary) { IBinary bin = (IBinary)element; diff --git a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/RemoteConnectionException.java b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/RemoteConnectionException.java index c51fb9f7d6..ac2515c949 100644 --- a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/RemoteConnectionException.java +++ b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/RemoteConnectionException.java @@ -11,6 +11,7 @@ package org.eclipse.linuxtools.profiling.launch; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.linuxtools.internal.profiling.launch.ProfileLaunchPlugin; @@ -20,7 +21,7 @@ public class RemoteConnectionException extends CoreException { private static final long serialVersionUID = 1L; public RemoteConnectionException(String message, Throwable t) { - super(new Status(Status.ERROR, ProfileLaunchPlugin.PLUGIN_ID, message, t)); + super(new Status(IStatus.ERROR, ProfileLaunchPlugin.PLUGIN_ID, message, t)); } } diff --git a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/RemoteProxyCMainTab.java b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/RemoteProxyCMainTab.java index 163076856c..8af496489c 100644 --- a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/RemoteProxyCMainTab.java +++ b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/RemoteProxyCMainTab.java @@ -53,7 +53,6 @@ import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -248,6 +247,7 @@ public class RemoteProxyCMainTab extends CAbstractMainTab { * org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse * .debug.core.ILaunchConfigurationWorkingCopy) */ + @Override public void performApply(ILaunchConfigurationWorkingCopy config) { super.performApply(config); ICProject cProject = this.getCProject(); @@ -295,6 +295,7 @@ public class RemoteProxyCMainTab extends CAbstractMainTab { /** * Show a dialog that lists all main types */ + @Override protected void handleSearchButtonSelected() { if (getCProject() == null) { MessageDialog @@ -373,6 +374,7 @@ public class RemoteProxyCMainTab extends CAbstractMainTab { /** * @since 6.0 */ + @Override protected void createProjectGroup(Composite parent, int colSpan) { Composite projComp = new Composite(parent, SWT.NONE); GridLayout projLayout = new GridLayout(); @@ -416,6 +418,7 @@ public class RemoteProxyCMainTab extends CAbstractMainTab { }); } + @Override protected void updateProgramFromConfig(ILaunchConfiguration config) { super.updateProgramFromConfig(config); if(fProgText.getText().equals(EMPTY_STRING)){ @@ -482,14 +485,13 @@ public class RemoteProxyCMainTab extends CAbstractMainTab { toLabel.setEnabled(false); - enableCopyFromExeButton.addSelectionListener(new SelectionListener() { + enableCopyFromExeButton.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { boolean copyEnabled = enableCopyFromExeButton.getSelection(); setEnableCopyFromSection(copyEnabled); updateLaunchConfigurationDialog(); } - - public void widgetDefaultSelected(SelectionEvent e) {} }); copyFromExeText = copyFromExeSelector.getURIText(); diff --git a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/RemoteProxyManager.java b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/RemoteProxyManager.java index 4d6d5b7d71..9519bda9f8 100644 --- a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/RemoteProxyManager.java +++ b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/RemoteProxyManager.java @@ -18,6 +18,7 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; import org.eclipse.linuxtools.internal.profiling.launch.LocalFileProxy; @@ -80,8 +81,8 @@ public class RemoteProxyManager implements IRemoteProxyManager { if (manager != null) return manager.getFileProxy(uri); else - throw new CoreException(new Status(Status.ERROR, ProfileLaunchPlugin.PLUGIN_ID, - Status.OK, Messages.RemoteProxyManager_unrecognized_scheme + scheme, null)); + throw new CoreException(new Status(IStatus.ERROR, ProfileLaunchPlugin.PLUGIN_ID, + IStatus.OK, Messages.RemoteProxyManager_unrecognized_scheme + scheme, null)); } return getLocalFileProxy(); } |