1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

compilation warnings

This commit is contained in:
Andrew Gvozdev 2010-04-28 19:31:34 +00:00
parent 906c0d3869
commit ae1955efc0
8 changed files with 51 additions and 49 deletions

View file

@ -129,7 +129,7 @@ public class MakeCorePlugin extends Plugin {
return BuildInfoFactory.create(project, builderID); return BuildInfoFactory.create(project, builderID);
} }
public static IMakeBuilderInfo createBuildInfo(Map args, String builderID) { public static IMakeBuilderInfo createBuildInfo(Map<String, String> args, String builderID) {
return BuildInfoFactory.create(args, builderID); return BuildInfoFactory.create(args, builderID);
} }
@ -149,11 +149,11 @@ public class MakeCorePlugin extends Plugin {
public String[] getMakefileDirs() { public String[] getMakefileDirs() {
String stringList = getPluginPreferences().getString(MAKEFILE_DIRS); String stringList = getPluginPreferences().getString(MAKEFILE_DIRS);
StringTokenizer st = new StringTokenizer(stringList, File.pathSeparator + "\n\r");//$NON-NLS-1$ StringTokenizer st = new StringTokenizer(stringList, File.pathSeparator + "\n\r");//$NON-NLS-1$
ArrayList v = new ArrayList(); ArrayList<String> v = new ArrayList<String>();
while (st.hasMoreElements()) { while (st.hasMoreElements()) {
v.add(st.nextElement()); v.add(st.nextToken());
} }
return (String[])v.toArray(new String[v.size()]); return v.toArray(new String[v.size()]);
} }
/** /**
@ -163,15 +163,16 @@ public class MakeCorePlugin extends Plugin {
* @param makefileDirs * @param makefileDirs
* @return * @return
*/ */
@Deprecated
static public IMakefile createMakefile(File file, boolean isGnuStyle, String[] makefileDirs) { static public IMakefile createMakefile(File file, boolean isGnuStyle, String[] makefileDirs) {
IMakefile makefile; IMakefile makefile;
if (isGnuStyle) { if (isGnuStyle) {
GNUMakefile gnu = new GNUMakefile(); GNUMakefile gnu = new GNUMakefile();
ArrayList includeList = new ArrayList(); ArrayList<String> includeList = new ArrayList<String>();
includeList.add(new Path(file.getAbsolutePath()).removeLastSegments(1).toOSString()); includeList.add(new Path(file.getAbsolutePath()).removeLastSegments(1).toOSString());
includeList.addAll(Arrays.asList(gnu.getIncludeDirectories())); includeList.addAll(Arrays.asList(gnu.getIncludeDirectories()));
includeList.addAll(Arrays.asList(makefileDirs)); includeList.addAll(Arrays.asList(makefileDirs));
String[] includes = (String[]) includeList.toArray(new String[includeList.size()]); String[] includes = includeList.toArray(new String[includeList.size()]);
gnu.setIncludeDirectories(includes); gnu.setIncludeDirectories(includes);
try { try {
gnu.parse(file.getAbsolutePath(), new FileReader(file)); gnu.parse(file.getAbsolutePath(), new FileReader(file));
@ -208,11 +209,11 @@ public class MakeCorePlugin extends Plugin {
IMakefile makefile; IMakefile makefile;
if (isGnuStyle) { if (isGnuStyle) {
GNUMakefile gnu = new GNUMakefile(); GNUMakefile gnu = new GNUMakefile();
ArrayList includeList = new ArrayList(); ArrayList<String> includeList = new ArrayList<String>();
includeList.add(new Path(fileURI.getPath()).removeLastSegments(1).toString()); includeList.add(new Path(fileURI.getPath()).removeLastSegments(1).toString());
includeList.addAll(Arrays.asList(gnu.getIncludeDirectories())); includeList.addAll(Arrays.asList(gnu.getIncludeDirectories()));
includeList.addAll(Arrays.asList(makefileDirs)); includeList.addAll(Arrays.asList(makefileDirs));
String[] includes = (String[]) includeList.toArray(new String[includeList.size()]); String[] includes = includeList.toArray(new String[includeList.size()]);
gnu.setIncludeDirectories(includes); gnu.setIncludeDirectories(includes);
try { try {
gnu.parse(fileURI, makefileReaderProvider); gnu.parse(fileURI, makefileReaderProvider);
@ -247,6 +248,7 @@ public class MakeCorePlugin extends Plugin {
return createMakefile(EFS.getStore(file.getLocationURI()), isMakefileGNUStyle(), getMakefileDirs()); return createMakefile(EFS.getStore(file.getLocationURI()), isMakefileGNUStyle(), getMakefileDirs());
} }
@Override
public void stop(BundleContext context) throws Exception { public void stop(BundleContext context) throws Exception {
try { try {
if ( fTargetManager != null) { if ( fTargetManager != null) {
@ -278,7 +280,7 @@ public class MakeCorePlugin extends Plugin {
} }
public static IScannerConfigBuilderInfo createScannerConfigBuildInfo( public static IScannerConfigBuilderInfo createScannerConfigBuildInfo(
Map args, String builderID) { Map<String, String> args, String builderID) {
return ScannerConfigInfoFactory.create(args, builderID); return ScannerConfigInfoFactory.create(args, builderID);
} }
@ -336,7 +338,7 @@ public class MakeCorePlugin extends Plugin {
IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(PLUGIN_ID, SI_CONSOLE_PARSER_SIMPLE_ID); IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(PLUGIN_ID, SI_CONSOLE_PARSER_SIMPLE_ID);
if (extension != null) { if (extension != null) {
IExtension[] extensions = extension.getExtensions(); IExtension[] extensions = extension.getExtensions();
List parserIds = new ArrayList(extensions.length); List<String> parserIds = new ArrayList<String>(extensions.length);
for (int i = 0; i < extensions.length; i++) { for (int i = 0; i < extensions.length; i++) {
String parserId = extensions[i].getUniqueIdentifier(); String parserId = extensions[i].getUniqueIdentifier();
if (parserId != null) { if (parserId != null) {
@ -347,7 +349,7 @@ public class MakeCorePlugin extends Plugin {
} }
} }
} }
return (String[])parserIds.toArray(empty); return parserIds.toArray(empty);
} }
return empty; return empty;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2000, 2006 QNX Software Systems and others. * Copyright (c) 2000, 2010 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -53,6 +53,7 @@ public class StreamMonitor extends OutputStream {
/** /**
* @see java.io.OutputStream#close() * @see java.io.OutputStream#close()
*/ */
@Override
public void close() throws IOException { public void close() throws IOException {
if (console != null) { if (console != null) {
console.close(); console.close();
@ -63,6 +64,7 @@ public class StreamMonitor extends OutputStream {
/** /**
* @see java.io.OutputStream#flush() * @see java.io.OutputStream#flush()
*/ */
@Override
public void flush() throws IOException { public void flush() throws IOException {
if (console != null) { if (console != null) {
console.flush(); console.flush();
@ -72,6 +74,7 @@ public class StreamMonitor extends OutputStream {
/** /**
* @see java.io.OutputStream#write(int) * @see java.io.OutputStream#write(int)
*/ */
@Override
public synchronized void write(int b) throws IOException { public synchronized void write(int b) throws IOException {
if (console != null) { if (console != null) {
console.write(b); console.write(b);
@ -82,6 +85,7 @@ public class StreamMonitor extends OutputStream {
/** /**
* @see java.io.OutputStream#write(...) * @see java.io.OutputStream#write(...)
*/ */
@Override
public synchronized void write(byte[] b, int off, int len) throws IOException { public synchronized void write(byte[] b, int off, int len) throws IOException {
if (b == null) { if (b == null) {
throw new NullPointerException(); throw new NullPointerException();

View file

@ -21,6 +21,7 @@ public class BadDirective extends Directive implements IBadDirective {
line = s; line = s;
} }
@Override
public String toString() { public String toString() {
return line; return line;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2000, 2006 QNX Software Systems and others. * Copyright (c) 2000, 2010 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -33,13 +33,13 @@ public abstract class Rule extends Parent implements IRule {
public ICommand[] getCommands() { public ICommand[] getCommands() {
IDirective[] directives = getDirectives(); IDirective[] directives = getDirectives();
ArrayList cmds = new ArrayList(directives.length); ArrayList<IDirective> cmds = new ArrayList<IDirective>(directives.length);
for (int i = 0; i < directives.length; i++) { for (int i = 0; i < directives.length; i++) {
if (directives[i] instanceof ICommand) { if (directives[i] instanceof ICommand) {
cmds.add(directives[i]); cmds.add(directives[i]);
} }
} }
return (ICommand[])cmds.toArray(new ICommand[0]); return cmds.toArray(new ICommand[0]);
} }
public ITarget getTarget() { public ITarget getTarget() {

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2000, 2006 QNX Software Systems and others. * Copyright (c) 2000, 2010 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -22,6 +22,7 @@ public class UnExport extends Directive implements IUnExport {
variable = var; variable = var;
} }
@Override
public String toString() { public String toString() {
StringBuffer sb = new StringBuffer(GNUMakefileConstants.DIRECTIVE_UNEXPORT); StringBuffer sb = new StringBuffer(GNUMakefileConstants.DIRECTIVE_UNEXPORT);
sb.append(' ').append(variable); sb.append(' ').append(variable);

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2000, 2006 QNX Software Systems and others. * Copyright (c) 2000, 2010 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -48,6 +48,7 @@ public class VariableDefinition extends MacroDefinition implements IVariableDefi
/** /**
* @see java.lang.Object#toString() * @see java.lang.Object#toString()
*/ */
@Override
public String toString() { public String toString() {
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
if (isTargetSpecific()) { if (isTargetSpecific()) {

View file

@ -13,6 +13,11 @@ package org.eclipse.cdt.make.internal.core.scannerconfig;
import java.util.Map; import java.util.Map;
import org.eclipse.cdt.make.core.MakeCorePlugin;
import org.eclipse.cdt.make.core.MakeProjectNature;
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo;
import org.eclipse.cdt.make.core.scannerconfig.ScannerConfigNature;
import org.eclipse.cdt.make.internal.core.MakeMessages;
import org.eclipse.core.resources.ICommand; import org.eclipse.core.resources.ICommand;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription; import org.eclipse.core.resources.IProjectDescription;
@ -25,12 +30,6 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Preferences; import org.eclipse.core.runtime.Preferences;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
import org.eclipse.cdt.make.core.MakeCorePlugin;
import org.eclipse.cdt.make.core.MakeProjectNature;
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo;
import org.eclipse.cdt.make.core.scannerconfig.ScannerConfigNature;
import org.eclipse.cdt.make.internal.core.MakeMessages;
import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfileManager;
/** /**
* Creates a ScannerConfigBuilderInfo variant * Creates a ScannerConfigBuilderInfo variant
@ -227,24 +226,6 @@ public class ScannerConfigInfoFactory {
putString(SI_PROBLEM_GENERATION_ENABLED, Boolean.toString(enabled)); putString(SI_PROBLEM_GENERATION_ENABLED, Boolean.toString(enabled));
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#getProfileId()
*/
public String getProfileId() {
String profileId = getString(SI_PROFILE_ID);
if (profileId == null || profileId.length() == 0) {
profileId = ScannerConfigProfileManager.getDefaultSIProfileId();
// the default is the first one in the registry
}
return profileId;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#setProfileId(java.lang.String)
*/
public void setProfileId(String profileId) throws CoreException {
putString(SI_PROFILE_ID, profileId);
}
protected boolean getBoolean(String property) { protected boolean getBoolean(String property) {
return Boolean.valueOf(getString(property)).booleanValue(); return Boolean.valueOf(getString(property)).booleanValue();
} }
@ -287,6 +268,7 @@ public class ScannerConfigInfoFactory {
this.useDefaults = useDefaults; this.useDefaults = useDefaults;
} }
@Override
protected void putString(String name, String value) { protected void putString(String name, String value) {
if (useDefaults) { if (useDefaults) {
prefs.setDefault(name, value); prefs.setDefault(name, value);
@ -295,6 +277,7 @@ public class ScannerConfigInfoFactory {
} }
} }
@Override
protected String getString(String property) { protected String getString(String property) {
if (useDefaults) { if (useDefaults) {
return prefs.getDefaultString(property); return prefs.getDefaultString(property);
@ -302,6 +285,7 @@ public class ScannerConfigInfoFactory {
return prefs.getString(property); return prefs.getString(property);
} }
@Override
protected String getBuilderID() { protected String getBuilderID() {
return builderID; return builderID;
} }
@ -310,7 +294,7 @@ public class ScannerConfigInfoFactory {
private static class BuildProperty extends Store { private static class BuildProperty extends Store {
private IProject project; private IProject project;
private String builderID; private String builderID;
private Map args; private Map<String, String> args;
BuildProperty(IProject project, String builderID) throws CoreException { BuildProperty(IProject project, String builderID) throws CoreException {
this.project = project; this.project = project;
@ -322,11 +306,14 @@ public class ScannerConfigInfoFactory {
MakeMessages.getString("ScannerConfigInfoFactory.Missing_Builder")//$NON-NLS-1$ MakeMessages.getString("ScannerConfigInfoFactory.Missing_Builder")//$NON-NLS-1$
+ builderID, null)); + builderID, null));
} }
args = builder.getArguments(); @SuppressWarnings("unchecked")
Map<String,String> bArgs = builder.getArguments();
args = bArgs;
} }
@Override
protected void putString(String name, String value) throws CoreException { protected void putString(String name, String value) throws CoreException {
String curValue = (String) args.get(name); String curValue = args.get(name);
if (curValue != null && curValue.equals(value)) { if (curValue != null && curValue.equals(value)) {
return; return;
} }
@ -338,33 +325,38 @@ public class ScannerConfigInfoFactory {
project.setDescription(description, null); project.setDescription(description, null);
} }
@Override
protected String getString(String name) { protected String getString(String name) {
String value = (String) args.get(name); String value = args.get(name);
return value == null ? "" : value; //$NON-NLS-1$ return value == null ? "" : value; //$NON-NLS-1$
} }
@Override
protected String getBuilderID() { protected String getBuilderID() {
return builderID; return builderID;
} }
} }
private static class BuildArguments extends Store { private static class BuildArguments extends Store {
private Map args; private Map<String, String> args;
private String builderID; private String builderID;
BuildArguments(Map args, String builderID) { BuildArguments(Map<String, String> args, String builderID) {
this.args = args; this.args = args;
this.builderID = builderID; this.builderID = builderID;
} }
@Override
protected void putString(String name, String value) { protected void putString(String name, String value) {
args.put(name, value); args.put(name, value);
} }
@Override
protected String getString(String name) { protected String getString(String name) {
return (String) args.get(name); return args.get(name);
} }
@Override
protected String getBuilderID() { protected String getBuilderID() {
return builderID; return builderID;
} }
@ -378,7 +370,7 @@ public class ScannerConfigInfoFactory {
return new ScannerConfigInfoFactory.BuildProperty(project, builderID); return new ScannerConfigInfoFactory.BuildProperty(project, builderID);
} }
public static IScannerConfigBuilderInfo create(Map args, String builderID) { public static IScannerConfigBuilderInfo create(Map<String, String> args, String builderID) {
return new ScannerConfigInfoFactory.BuildArguments(args, builderID); return new ScannerConfigInfoFactory.BuildArguments(args, builderID);
} }
} }

View file

@ -52,6 +52,7 @@ public class BuildOutputReaderJob extends Job {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.core.internal.jobs.InternalJob#run(org.eclipse.core.runtime.IProgressMonitor) * @see org.eclipse.core.internal.jobs.InternalJob#run(org.eclipse.core.runtime.IProgressMonitor)
*/ */
@Override
protected IStatus run(IProgressMonitor monitor) { protected IStatus run(IProgressMonitor monitor) {
IProject project = resource.getProject(); IProject project = resource.getProject();
monitor.beginTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder"), 100); //$NON-NLS-1$ monitor.beginTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder"), 100); //$NON-NLS-1$