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

Warning cleanup.

This commit is contained in:
Sergey Prigogin 2012-02-23 15:05:20 -08:00
parent 934adecf48
commit f6ecdf5318
12 changed files with 118 additions and 217 deletions

View file

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<component id="org.eclipse.cdt.codan.core" version="2">
<resource path="src/org/eclipse/cdt/codan/core/model/AbstractProblemLocation.java" type="org.eclipse.cdt.codan.core.model.AbstractProblemLocation">
<filter comment="getFile method should return IResource not IFile according to interface. Don't know how it compiled before like that..." id="338792546">
<message_arguments>
<message_argument value="org.eclipse.cdt.codan.core.model.AbstractProblemLocation"/>
<message_argument value="getFile()"/>
</message_arguments>
</filter>
<filter comment="upgrade file attribute to IResource from IFile - it is backward compatible" id="388161617">
<message_arguments>
<message_argument value="org.eclipse.cdt.codan.core.model.AbstractProblemLocation"/>
<message_argument value="file"/>
</message_arguments>
</filter>
</resource>
</component>

View file

@ -10,7 +10,7 @@ Require-Bundle: org.eclipse.core.runtime,
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: org.eclipse.cdt.codan.core, Export-Package: org.eclipse.cdt.codan.core,
org.eclipse.cdt.codan.core.externaltool;x-friends:="org.eclipse.cdt.codan.ui,org.eclipse.cdt.codan.core.test", org.eclipse.cdt.codan.core.externaltool,
org.eclipse.cdt.codan.core.model, org.eclipse.cdt.codan.core.model,
org.eclipse.cdt.codan.core.model.cfg;x-friends:="org.eclipse.cdt.codan.core.cxx,org.eclipse.cdt.codan.checkers", org.eclipse.cdt.codan.core.model.cfg;x-friends:="org.eclipse.cdt.codan.core.cxx,org.eclipse.cdt.codan.checkers",
org.eclipse.cdt.codan.core.param, org.eclipse.cdt.codan.core.param,
@ -21,4 +21,8 @@ Export-Package: org.eclipse.cdt.codan.core,
org.eclipse.cdt.codan.ui", org.eclipse.cdt.codan.ui",
org.eclipse.cdt.codan.internal.core.cfg;x-friends:="org.eclipse.cdt.codan.core.cxx", org.eclipse.cdt.codan.internal.core.cfg;x-friends:="org.eclipse.cdt.codan.core.cxx",
org.eclipse.cdt.codan.internal.core.externaltool;x-friends:="org.eclipse.cdt.codan.core.test", org.eclipse.cdt.codan.internal.core.externaltool;x-friends:="org.eclipse.cdt.codan.core.test",
org.eclipse.cdt.codan.internal.core.model;x-friends:="org.eclipse.cdt.codan.core.cxx,org.eclipse.cdt.codan.core.test,org.eclipse.cdt.codan.ui" org.eclipse.cdt.codan.internal.core.model;
x-friends:="org.eclipse.cdt.codan.core.cxx,
org.eclipse.cdt.codan.core.test,
org.eclipse.cdt.codan.ui,
org.eclipse.cdt.codan.ui.cxx"

View file

@ -161,7 +161,7 @@ public abstract class AbstractChecker implements IChecker {
* @return instance of IProblemLocation * @return instance of IProblemLocation
*/ */
protected IProblemLocation createProblemLocation(IFile file, int startChar, int endChar) { protected IProblemLocation createProblemLocation(IFile file, int startChar, int endChar) {
return getRuntime().getProblemLocationFactory().createProblemLocation(file, startChar, endChar); return getRuntime().getProblemLocationFactory().createProblemLocation(file, startChar, endChar, -1);
} }
/** /**

View file

@ -45,7 +45,10 @@ public interface IProblemLocationFactory {
* - end char of the problem in the file, is zero-relative and * - end char of the problem in the file, is zero-relative and
* exclusive. * exclusive.
* @return instance of IProblemLocation * @return instance of IProblemLocation
*
* @deprecated Use {@link #createProblemLocation(IFile, int, int, int)} instead.
*/ */
@Deprecated
public IProblemLocation createProblemLocation(IFile file, int startChar, int endChar); public IProblemLocation createProblemLocation(IFile file, int startChar, int endChar);
/** /**
@ -55,11 +58,10 @@ public interface IProblemLocationFactory {
* @param startChar - start char of the problem in the file, is * @param startChar - start char of the problem in the file, is
* zero-relative * zero-relative
* @param endChar - end char of the problem in the file, is zero-relative * @param endChar - end char of the problem in the file, is zero-relative
* and * and exclusive.
* exclusive.
* *
* @param line * @param line
* - start line number (for visualisation purposes) * - start line number (for visualization purposes)
* @return instance of IProblemLocation * @return instance of IProblemLocation
*/ */
public IProblemLocation createProblemLocation(IFile astFile, int startChar, int endChar, int line); public IProblemLocation createProblemLocation(IFile astFile, int startChar, int endChar, int line);

View file

@ -14,7 +14,7 @@ import org.eclipse.core.resources.IResource;
/** /**
* IProblemReporterPersistent - interface to report problems, which are * IProblemReporterPersistent - interface to report problems, which are
* persistent, ex. markers. Also this object has context of checker and * persistent, e.g. markers. Also this object has context of checker and
* current resource, which allows to manage markers better - i.e. instead of * current resource, which allows to manage markers better - i.e. instead of
* deleting replace them when needed, and queue markers for insertion instead * deleting replace them when needed, and queue markers for insertion instead
* of add right away. * of add right away.
@ -30,9 +30,9 @@ import org.eclipse.core.resources.IResource;
public interface IProblemReporterSessionPersistent extends IProblemReporter { public interface IProblemReporterSessionPersistent extends IProblemReporter {
/** /**
* Deletes all problems associated with session resource and session checker. * Deletes all problems associated with session resource and session checker.
* If "all" is true also delete all problems associated with workspace (and
* session checker).
* *
* @param all If <code>true</code> the method also deletes all problems associated with
* workspace (and session checker).
*/ */
public void deleteProblems(boolean all); public void deleteProblems(boolean all);
@ -51,12 +51,11 @@ public interface IProblemReporterSessionPersistent extends IProblemReporter {
IResource getResource(); IResource getResource();
/** /**
* Create an instance of the object. This is a bit ugly since implemented has * Creates a problem reporter.
* to combine the object itself and factory to this object.
* *
* @param resource * @param resource
* @param checker * @param checker
* @return * @return the created reporter
* @since 2.0 * @since 2.0
*/ */
public IProblemReporterSessionPersistent createReporter(IResource resource, IChecker checker); public IProblemReporterSessionPersistent createReporter(IResource resource, IChecker checker);

View file

@ -10,12 +10,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.codan.core.param; package org.eclipse.cdt.codan.core.param;
import java.io.IOException;
import java.io.StreamTokenizer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.eclipse.cdt.codan.core.Messages; import org.eclipse.cdt.codan.core.Messages;
import org.eclipse.cdt.codan.internal.core.CharOperation; import org.eclipse.cdt.codan.internal.core.CharOperation;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
@ -26,6 +20,12 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Path;
import java.io.IOException;
import java.io.StreamTokenizer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/** /**
* Custom preference for resource scope * Custom preference for resource scope
* *
@ -174,14 +174,14 @@ public class FileScopeProblemPreference extends AbstractProblemPreference {
checkChar(tokenizer, '>'); checkChar(tokenizer, '>');
ArrayList<IPath> list = new ArrayList<IPath>(); ArrayList<IPath> list = new ArrayList<IPath>();
int token; int token;
int index = 0;
try { try {
checkChar(tokenizer, '('); checkChar(tokenizer, '(');
token = tokenizer.nextToken(); token = tokenizer.nextToken();
if (token != ')') if (token != ')') {
tokenizer.pushBack(); tokenizer.pushBack();
else } else {
return Collections.emptyList(); return Collections.emptyList();
}
while (true) { while (true) {
token = tokenizer.nextToken(); token = tokenizer.nextToken();
if (tokenizer.sval == null) if (tokenizer.sval == null)
@ -192,7 +192,6 @@ public class FileScopeProblemPreference extends AbstractProblemPreference {
break; break;
tokenizer.pushBack(); tokenizer.pushBack();
checkChar(tokenizer, ','); checkChar(tokenizer, ',');
index++;
} }
} catch (IOException e) { } catch (IOException e) {
throw new IllegalArgumentException(e); throw new IllegalArgumentException(e);

View file

@ -1975,15 +1975,15 @@ public final class CharOperation {
*/ */
public static final int occurencesOf(char toBeFound, char[] array) { public static final int occurencesOf(char toBeFound, char[] array) {
int count = 0; int count = 0;
for (char element : array) for (char element : array) {
if (toBeFound == element) if (toBeFound == element)
count++; count++;
}
return count; return count;
} }
/** /**
* Answers the number of occurrences of the given character in the given * Answers the number of occurrences of the given character in the given array starting
* array starting
* at the given index, 0 if any. * at the given index, 0 if any.
* *
* <br> * <br>
@ -2006,16 +2006,12 @@ public final class CharOperation {
* </li> * </li>
* </ol> * </ol>
* *
* @param toBeFound * @param toBeFound the given character
* the given character * @param array the given array
* @param array * @param start the start position for the search
* the given array * @return the number of occurrences of the given character in the given array, or 0 if any
* @return the number of occurrences of the given character in the given * @exception NullPointerException if array is null
* array, 0 if any * @exception ArrayIndexOutOfBoundsException if start is lower than 0
* @exception NullPointerException
* if array is null
* @exception ArrayIndexOutOfBoundsException
* if start is lower than 0
*/ */
public static final int occurencesOf(char toBeFound, char[] array, int start) { public static final int occurencesOf(char toBeFound, char[] array, int start) {
int count = 0; int count = 0;

View file

@ -10,24 +10,21 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.codan.internal.core.cfg; package org.eclipse.cdt.codan.internal.core.cfg;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.cdt.codan.core.model.cfg.IBasicBlock; import org.eclipse.cdt.codan.core.model.cfg.IBasicBlock;
import org.eclipse.cdt.codan.core.model.cfg.IBranchNode; import org.eclipse.cdt.codan.core.model.cfg.IBranchNode;
import org.eclipse.cdt.codan.core.model.cfg.IConnectorNode; import org.eclipse.cdt.codan.core.model.cfg.IConnectorNode;
import org.eclipse.cdt.codan.core.model.cfg.IDecisionNode; import org.eclipse.cdt.codan.core.model.cfg.IDecisionNode;
import java.util.ArrayList;
import java.util.List;
/** /**
* @see {@link IDecisionNode} * @see IDecisionNode
*/ */
public class DecisionNode extends AbstractSingleIncomingNode implements IDecisionNode { public class DecisionNode extends AbstractSingleIncomingNode implements IDecisionNode {
private List<IBasicBlock> next = new ArrayList<IBasicBlock>(2); private List<IBasicBlock> next = new ArrayList<IBasicBlock>(2);
private IConnectorNode conn; private IConnectorNode conn;
/**
* @param prev
*/
protected DecisionNode() { protected DecisionNode() {
super(); super();
} }
@ -38,33 +35,16 @@ public class DecisionNode extends AbstractSingleIncomingNode implements IDecisio
next.add(cnode); next.add(cnode);
} }
/*
* (non-Javadoc)
*
* @seeorg.eclipse.cdt.codan.provisional.core.model.cfg.IBasicBlock#
* getOutgoingIterator()
*/
@Override @Override
public IBasicBlock[] getOutgoingNodes() { public IBasicBlock[] getOutgoingNodes() {
return next.toArray(new IBasicBlock[next.size()]); return next.toArray(new IBasicBlock[next.size()]);
} }
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.codan.core.model.cfg.IBasicBlock#getOutgoingSize ()
*/
@Override @Override
public int getOutgoingSize() { public int getOutgoingSize() {
return next.size(); return next.size();
} }
/*
* (non-Javadoc)
*
* @seeorg.eclipse.cdt.codan.provisional.core.model.cfg.IDecisionNode#
* getConnectionNode()
*/
@Override @Override
public IConnectorNode getMergeNode() { public IConnectorNode getMergeNode() {
return conn; return conn;

View file

@ -16,37 +16,19 @@ import org.eclipse.core.resources.IFile;
/** /**
* Factory class that allows to create problem locations * Factory class that allows to create problem locations
*
*/ */
public class ProblemLocationFactory implements IProblemLocationFactory { public class ProblemLocationFactory implements IProblemLocationFactory {
/*
* (non-Javadoc)
*
* @seeorg.eclipse.cdt.codan.core.model.IProblemLocationFactory#
* createProblemLocation(org.eclipse.core.resources.IFile, int)
*/
@Override @Override
public IProblemLocation createProblemLocation(IFile file, int line) { public IProblemLocation createProblemLocation(IFile file, int line) {
return new CodanProblemLocation(file, line); return new CodanProblemLocation(file, line);
} }
/*
* (non-Javadoc)
*
* @seeorg.eclipse.cdt.codan.core.model.IProblemLocationFactory#
* createProblemLocation(org.eclipse.core.resources.IFile, int, int)
*/
@Override @Override
@Deprecated
public IProblemLocation createProblemLocation(IFile file, int startChar, int endChar) { public IProblemLocation createProblemLocation(IFile file, int startChar, int endChar) {
return new CodanProblemLocation(file, startChar, endChar); return new CodanProblemLocation(file, startChar, endChar);
} }
/*
* (non-Javadoc)
*
* @seeorg.eclipse.cdt.codan.core.model.IProblemLocationFactory#
* createProblemLocation(org.eclipse.core.resources.IFile, int, int, int)
*/
@Override @Override
public IProblemLocation createProblemLocation(IFile file, int startChar, int endChar, int line) { public IProblemLocation createProblemLocation(IFile file, int startChar, int endChar, int line) {
return new CodanProblemLocation(file, startChar, endChar, line); return new CodanProblemLocation(file, startChar, endChar, line);

View file

@ -10,9 +10,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.codan.internal.core.model; package org.eclipse.cdt.codan.internal.core.model;
import java.util.ArrayList;
import java.util.Collection;
import org.eclipse.cdt.codan.core.model.IProblem; import org.eclipse.cdt.codan.core.model.IProblem;
import org.eclipse.cdt.codan.core.model.IProblemCategory; import org.eclipse.cdt.codan.core.model.IProblemCategory;
import org.eclipse.cdt.codan.core.model.IProblemProfile; import org.eclipse.cdt.codan.core.model.IProblemProfile;
@ -22,9 +19,11 @@ import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.ListenerList; import org.eclipse.core.runtime.ListenerList;
import org.eclipse.core.runtime.SafeRunner; import org.eclipse.core.runtime.SafeRunner;
import java.util.ArrayList;
import java.util.Collection;
/** /**
* @author Alena * @author Alena
*
*/ */
public class ProblemProfile implements IProblemProfile, Cloneable { public class ProblemProfile implements IProblemProfile, Cloneable {
private CodanProblemCategory rootCategory; private CodanProblemCategory rootCategory;
@ -38,23 +37,11 @@ public class ProblemProfile implements IProblemProfile, Cloneable {
rootCategory.setProfile(this); rootCategory.setProfile(this);
} }
/*
* (non-Javadoc)
*
* @see
* org.eclipse.cdt.codan.core.model.IProblemProfile#getProblem(java.lang
* .String)
*/
@Override @Override
public IProblem findProblem(String id) { public IProblem findProblem(String id) {
return CodanProblemCategory.findProblem(getRoot(), id); return CodanProblemCategory.findProblem(getRoot(), id);
} }
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.codan.core.model.IProblemProfile#getProblems()
*/
@Override @Override
public IProblem[] getProblems() { public IProblem[] getProblems() {
Collection<IProblem> problems = new ArrayList<IProblem>(); Collection<IProblem> problems = new ArrayList<IProblem>();
@ -62,10 +49,6 @@ public class ProblemProfile implements IProblemProfile, Cloneable {
return problems.toArray(new IProblem[problems.size()]); return problems.toArray(new IProblem[problems.size()]);
} }
/**
* @param root
* @param problems
*/
protected void collectProblems(IProblemCategory parent, Collection<IProblem> problems) { protected void collectProblems(IProblemCategory parent, Collection<IProblem> problems) {
Object[] children = parent.getChildren(); Object[] children = parent.getChildren();
for (Object object : children) { for (Object object : children) {
@ -94,11 +77,6 @@ public class ProblemProfile implements IProblemProfile, Cloneable {
return CodanProblemCategory.findCategory(getRoot(), id); return CodanProblemCategory.findCategory(getRoot(), id);
} }
/*
* (non-Javadoc)
*
* @see java.lang.Object#clone()
*/
@Override @Override
public Object clone() { public Object clone() {
try { try {
@ -115,38 +93,21 @@ public class ProblemProfile implements IProblemProfile, Cloneable {
} }
} }
/**
* @param p
* @param cat
*/
public void addCategory(IProblemCategory category, IProblemCategory parent) { public void addCategory(IProblemCategory category, IProblemCategory parent) {
((CodanProblemCategory) parent).addChild(category); ((CodanProblemCategory) parent).addChild(category);
} }
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.codan.core.model.IProblemElement#getProfile()
*/
@Override @Override
public IProblemProfile getProfile() { public IProblemProfile getProfile() {
return this; return this;
} }
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.codan.core.model.IProblemElement#getParentCategory()
*/
@Override @Override
public IProblemCategory getParentCategory() { public IProblemCategory getParentCategory() {
return getRoot(); return getRoot();
} }
private ListenerList preferenceChangeListeners; private ListenerList preferenceChangeListeners;
/**
* @param listener
*/
@Override @Override
public void addProfileChangeListener(IProblemProfileChangeListener listener) { public void addProfileChangeListener(IProblemProfileChangeListener listener) {
if (preferenceChangeListeners == null) if (preferenceChangeListeners == null)
@ -154,9 +115,6 @@ public class ProblemProfile implements IProblemProfile, Cloneable {
preferenceChangeListeners.add(listener); preferenceChangeListeners.add(listener);
} }
/**
* @param listener
*/
@Override @Override
public void removeProfileChangeListener(IProblemProfileChangeListener listener) { public void removeProfileChangeListener(IProblemProfileChangeListener listener) {
if (preferenceChangeListeners == null) if (preferenceChangeListeners == null)
@ -166,14 +124,15 @@ public class ProblemProfile implements IProblemProfile, Cloneable {
preferenceChangeListeners = null; preferenceChangeListeners = null;
} }
/* /**
* Convenience method for notifying preference change listeners. * Convenience method for notifying preference change listeners.
*/ */
protected void fireProfileChangeEvent(String key, Object oldValue, Object newValue) { protected void fireProfileChangeEvent(String key, Object oldValue, Object newValue) {
if (preferenceChangeListeners == null) if (preferenceChangeListeners == null)
return; return;
Object[] listeners = preferenceChangeListeners.getListeners(); Object[] listeners = preferenceChangeListeners.getListeners();
final ProblemProfileChangeEvent event = new ProblemProfileChangeEvent(this, this.resource, key, oldValue, newValue); final ProblemProfileChangeEvent event =
new ProblemProfileChangeEvent(this, this.resource, key, oldValue, newValue);
for (int i = 0; i < listeners.length; i++) { for (int i = 0; i < listeners.length; i++) {
final IProblemProfileChangeListener listener = (IProblemProfileChangeListener) listeners[i]; final IProblemProfileChangeListener listener = (IProblemProfileChangeListener) listeners[i];
ISafeRunnable job = new ISafeRunnable() { ISafeRunnable job = new ISafeRunnable() {
@ -191,11 +150,6 @@ public class ProblemProfile implements IProblemProfile, Cloneable {
} }
} }
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.codan.core.model.IProblemProfile#getResource()
*/
@Override @Override
public Object getResource() { public Object getResource() {
return resource; return resource;

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<projectDescription> <projectDescription>
<name>org.eclipse.cdt.codan.internal.ui.cxx</name> <name>org.eclipse.cdt.codan.ui.cxx</name>
<comment></comment> <comment></comment>
<projects> <projects>
</projects> </projects>

View file

@ -38,6 +38,8 @@ import org.eclipse.ui.editors.text.TextEditor;
* external tools cannot see unsaved changes. * external tools cannot see unsaved changes.
* *
* @author alruiz@google.com (Alex Ruiz) * @author alruiz@google.com (Alex Ruiz)
*
* @since 3.0
*/ */
public abstract class AbstractCxxExternalToolBasedChecker extends AbstractExternalToolBasedChecker { public abstract class AbstractCxxExternalToolBasedChecker extends AbstractExternalToolBasedChecker {
/** /**