mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
Fix warnings
This commit is contained in:
parent
c3725935d9
commit
b293aef49f
3 changed files with 31 additions and 30 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2006, 2008 Wind River Systems, Inc. and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.core;
|
||||
|
||||
|
@ -16,7 +16,7 @@ import org.eclipse.core.resources.IFile;
|
|||
import org.eclipse.core.runtime.IPath;
|
||||
|
||||
/**
|
||||
* An interface to manage the position tracking. It allows for mapping character
|
||||
* An interface to manage the position tracking. It allows for mapping character
|
||||
* offsets from a file previously stored on disk to the offset in the current document
|
||||
* for the file.
|
||||
*
|
||||
|
@ -35,7 +35,7 @@ public interface IPositionTrackerManager {
|
|||
* Returns the position converter suitable for mapping character offsets of the
|
||||
* given translation unit to the current version of it.
|
||||
*
|
||||
* @param file a file for which the position adapter is requested.
|
||||
* @param tu a translation unit for which the position adapter is requested.
|
||||
* @param timestamp identifies the version of the file stored on disk.
|
||||
* @return the requested position converter or <code>null</code>.
|
||||
*/
|
||||
|
@ -52,11 +52,11 @@ public interface IPositionTrackerManager {
|
|||
|
||||
/**
|
||||
* Returns the position tracker suitable for mapping character offsets of the
|
||||
* given external file/timestamp to the current version of it. <p>
|
||||
* given external file/timestamp to the current version of it. <p>
|
||||
* The method can be used for resources by supplying the <b>full path</b>. However,
|
||||
* it does not work if you supply the location of a resource.
|
||||
*
|
||||
* @param externalLocationOrFullPath an external location for which the position adapter is requested.
|
||||
* @param fullPathOrExternalLocation an external location for which the position adapter is requested.
|
||||
* @param timestamp identifies the version of the file stored on disk.
|
||||
* @return the requested position converter or <code>null</code>.
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2007 QNX Software Systems and others.
|
||||
* Copyright (c) 2000, 2008 QNX Software Systems 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
|
||||
|
@ -15,6 +15,7 @@ package org.eclipse.cdt.core;
|
|||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.core.formatter.CodeFormatter;
|
||||
import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants;
|
||||
import org.eclipse.cdt.internal.formatter.CCodeFormatter;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IConfigurationElement;
|
||||
|
@ -27,19 +28,19 @@ import org.eclipse.core.runtime.Platform;
|
|||
public class ToolFactory {
|
||||
|
||||
/**
|
||||
* Create an instance of a code formatter. A code formatter implementation can be contributed via the
|
||||
* extension point "org.eclipse.cdt.core.CodeFormatter". If unable to find a registered extension, the factory
|
||||
* Create an instance of a code formatter. A code formatter implementation can be contributed via the
|
||||
* extension point "org.eclipse.cdt.core.CodeFormatter". If unable to find a registered extension, the factory
|
||||
* will default to using the default code formatter.
|
||||
* @param options - the options map to use for formatting with the code formatter. Recognized options
|
||||
* are documented on <code>DefaultCodeFormatterConstants</code>. If set to <code>null</code>, then use
|
||||
* are documented on <code>DefaultCodeFormatterConstants</code>. If set to <code>null</code>, then use
|
||||
* the current settings from <code>CCorePlugin.getOptions()</code>.
|
||||
* @return an instance of either a contributed the built-in code formatter
|
||||
* @see CodeFormatter
|
||||
* @see DefaultCodeFormatterConstants
|
||||
* @see CCorePlugin#getOptions()
|
||||
*/
|
||||
public static CodeFormatter createCodeFormatter(Map options){
|
||||
if (options == null)
|
||||
public static CodeFormatter createCodeFormatter(Map<String, ?> options){
|
||||
if (options == null)
|
||||
options = CCorePlugin.getOptions();
|
||||
String formatterID = (String)options.get(CCorePreferenceConstants.CODE_FORMATTER);
|
||||
String extID = CCorePlugin.FORMATTER_EXTPOINT_ID;
|
||||
|
@ -73,15 +74,15 @@ public class ToolFactory {
|
|||
* Create an instance of the built-in code formatter.
|
||||
*
|
||||
* @param options - the options map to use for formatting with the default code formatter. Recognized options
|
||||
* are documented on <code>DefaultCodeFormatterConstants</code>. If set to <code>null</code>, then use
|
||||
* are documented on <code>DefaultCodeFormatterConstants</code>. If set to <code>null</code>, then use
|
||||
* the current settings from <code>CCorePlugin.getOptions()</code>.
|
||||
* @return an instance of the built-in code formatter
|
||||
* @see CodeFormatter
|
||||
* @see DefaultCodeFormatterConstants
|
||||
* @see CCorePlugin#getOptions()
|
||||
*/
|
||||
public static CodeFormatter createDefaultCodeFormatter(Map options){
|
||||
if (options == null)
|
||||
public static CodeFormatter createDefaultCodeFormatter(Map<String, ?> options){
|
||||
if (options == null)
|
||||
options = CCorePlugin.getOptions();
|
||||
return new CCodeFormatter(options);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2007 IBM Corporation and others.
|
||||
* Copyright (c) 2006, 2008 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,9 +52,9 @@ public final class IndentManipulation {
|
|||
* @param ch the given character
|
||||
* @return Returns <code>true</code> if this the character is a line delimiter character, <code>false</code> otherwise
|
||||
*/
|
||||
public static boolean isLineDelimiterChar(char ch) {
|
||||
public static boolean isLineDelimiterChar(char ch) {
|
||||
return ch == '\n' || ch == '\r';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the indentation of the given line in indentation units. Odd spaces are
|
||||
|
@ -173,7 +173,7 @@ public final class IndentManipulation {
|
|||
|
||||
|
||||
/**
|
||||
* Removes the given number of indentation units from a given line. If the line
|
||||
* Removes the given number of indentation units from a given line. If the line
|
||||
* has less than the given indent, all the available indentation is removed.
|
||||
* If <code>indentsToRemove <= 0</code> the line is returned.
|
||||
*
|
||||
|
@ -212,7 +212,7 @@ public final class IndentManipulation {
|
|||
} else {
|
||||
// Assert.isTrue(false, "Line does not have requested number of indents");
|
||||
start= i;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
if (spaceEquivalents == spaceEquivalentsToRemove) {
|
||||
start= i + 1;
|
||||
|
@ -288,7 +288,7 @@ public final class IndentManipulation {
|
|||
buf.append(line);
|
||||
} else { // no new line after last line
|
||||
buf.append(lineDelim);
|
||||
buf.append(newIndentString);
|
||||
buf.append(newIndentString);
|
||||
buf.append(trimIndent(line, indentUnitsToRemove, tabWidth, indentWidth));
|
||||
}
|
||||
}
|
||||
|
@ -326,13 +326,13 @@ public final class IndentManipulation {
|
|||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
ArrayList result= new ArrayList();
|
||||
ArrayList<ReplaceEdit> result= new ArrayList<ReplaceEdit>();
|
||||
try {
|
||||
ILineTracker tracker= new DefaultLineTracker();
|
||||
tracker.set(source);
|
||||
int nLines= tracker.getNumberOfLines();
|
||||
if (nLines == 1)
|
||||
return (ReplaceEdit[])result.toArray(new ReplaceEdit[result.size()]);
|
||||
return result.toArray(new ReplaceEdit[result.size()]);
|
||||
for (int i= 1; i < nLines; i++) {
|
||||
IRegion region= tracker.getLineInformation(i);
|
||||
int offset= region.getOffset();
|
||||
|
@ -348,7 +348,7 @@ public final class IndentManipulation {
|
|||
} catch (BadLocationException cannotHappen) {
|
||||
// can not happen
|
||||
}
|
||||
return (ReplaceEdit[])result.toArray(new ReplaceEdit[result.size()]);
|
||||
return result.toArray(new ReplaceEdit[result.size()]);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -382,14 +382,14 @@ public final class IndentManipulation {
|
|||
|
||||
/**
|
||||
* Returns the tab width as configured in the given map.
|
||||
* <p>Use {@link org.eclipse.jdt.core.IJavaProject#getOptions(boolean)} to get the most current project options.</p>
|
||||
* <p>Use {@link org.eclipse.cdt.core.model.ICProject#getOptions(boolean)} to get the most current project options.</p>
|
||||
*
|
||||
* @param options the map to get the formatter settings from.
|
||||
*
|
||||
* @return the tab width
|
||||
* @exception IllegalArgumentException if the given <code>options</code> is null
|
||||
*/
|
||||
public static int getTabWidth(Map options) {
|
||||
public static int getTabWidth(Map<String, String> options) {
|
||||
if (options == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
@ -398,14 +398,14 @@ public final class IndentManipulation {
|
|||
|
||||
/**
|
||||
* Returns the tab width as configured in the given map.
|
||||
* <p>Use {@link org.eclipse.jdt.core.IJavaProject#getOptions(boolean)} to get the most current project options.</p>
|
||||
* <p>Use {@link org.eclipse.cdt.core.model.ICProject#getOptions(boolean)} to get the most current project options.</p>
|
||||
*
|
||||
* @param options the map to get the formatter settings from
|
||||
*
|
||||
* @return the indent width
|
||||
* @exception IllegalArgumentException if the given <code>options</code> is null
|
||||
*/
|
||||
public static int getIndentWidth(Map options) {
|
||||
public static int getIndentWidth(Map<String, String> options) {
|
||||
if (options == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
@ -417,9 +417,9 @@ public final class IndentManipulation {
|
|||
return tabWidth;
|
||||
}
|
||||
|
||||
private static int getIntValue(Map options, String key, int def) {
|
||||
private static int getIntValue(Map<String, String> options, String key, int def) {
|
||||
try {
|
||||
return Integer.parseInt((String) options.get(key));
|
||||
return Integer.parseInt(options.get(key));
|
||||
} catch (NumberFormatException e) {
|
||||
return def;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue