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-RequiredExecutionEnvironment: JavaSE-1.6
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.cfg;x-friends:="org.eclipse.cdt.codan.core.cxx,org.eclipse.cdt.codan.checkers",
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.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.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
*/
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
* exclusive.
* @return instance of IProblemLocation
*
* @deprecated Use {@link #createProblemLocation(IFile, int, int, int)} instead.
*/
@Deprecated
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
* zero-relative
* @param endChar - end char of the problem in the file, is zero-relative
* and
* exclusive.
* and exclusive.
*
* @param line
* - start line number (for visualisation purposes)
* - start line number (for visualization purposes)
* @return instance of IProblemLocation
*/
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
* 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
* deleting replace them when needed, and queue markers for insertion instead
* of add right away.
@ -30,9 +30,9 @@ import org.eclipse.core.resources.IResource;
public interface IProblemReporterSessionPersistent extends IProblemReporter {
/**
* 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);
@ -51,12 +51,11 @@ public interface IProblemReporterSessionPersistent extends IProblemReporter {
IResource getResource();
/**
* Create an instance of the object. This is a bit ugly since implemented has
* to combine the object itself and factory to this object.
* Creates a problem reporter.
*
* @param resource
* @param checker
* @return
* @return the created reporter
* @since 2.0
*/
public IProblemReporterSessionPersistent createReporter(IResource resource, IChecker checker);

View file

@ -10,12 +10,6 @@
*******************************************************************************/
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.internal.core.CharOperation;
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.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
*
@ -174,14 +174,14 @@ public class FileScopeProblemPreference extends AbstractProblemPreference {
checkChar(tokenizer, '>');
ArrayList<IPath> list = new ArrayList<IPath>();
int token;
int index = 0;
try {
checkChar(tokenizer, '(');
token = tokenizer.nextToken();
if (token != ')')
if (token != ')') {
tokenizer.pushBack();
else
} else {
return Collections.emptyList();
}
while (true) {
token = tokenizer.nextToken();
if (tokenizer.sval == null)
@ -192,7 +192,6 @@ public class FileScopeProblemPreference extends AbstractProblemPreference {
break;
tokenizer.pushBack();
checkChar(tokenizer, ',');
index++;
}
} catch (IOException e) {
throw new IllegalArgumentException(e);

View file

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

View file

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

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Alena Laskavaia - initial API and implementation
* Alena Laskavaia - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.codan.internal.core.model;
@ -16,37 +16,19 @@ import org.eclipse.core.resources.IFile;
/**
* Factory class that allows to create problem locations
*
*/
public class ProblemLocationFactory implements IProblemLocationFactory {
/*
* (non-Javadoc)
*
* @seeorg.eclipse.cdt.codan.core.model.IProblemLocationFactory#
* createProblemLocation(org.eclipse.core.resources.IFile, int)
*/
@Override
public IProblemLocation createProblemLocation(IFile file, int line) {
return new CodanProblemLocation(file, line);
}
/*
* (non-Javadoc)
*
* @seeorg.eclipse.cdt.codan.core.model.IProblemLocationFactory#
* createProblemLocation(org.eclipse.core.resources.IFile, int, int)
*/
@Override
@Deprecated
public IProblemLocation createProblemLocation(IFile file, int startChar, int 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
public IProblemLocation createProblemLocation(IFile file, int startChar, int endChar, int line) {
return new CodanProblemLocation(file, startChar, endChar, line);

View file

@ -6,13 +6,10 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Alena Laskavaia - initial API and implementation
* Alena Laskavaia - initial API and implementation
*******************************************************************************/
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.IProblemCategory;
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.SafeRunner;
import java.util.ArrayList;
import java.util.Collection;
/**
* @author Alena
*
*/
public class ProblemProfile implements IProblemProfile, Cloneable {
private CodanProblemCategory rootCategory;
@ -38,23 +37,11 @@ public class ProblemProfile implements IProblemProfile, Cloneable {
rootCategory.setProfile(this);
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.cdt.codan.core.model.IProblemProfile#getProblem(java.lang
* .String)
*/
@Override
public IProblem findProblem(String id) {
return CodanProblemCategory.findProblem(getRoot(), id);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.codan.core.model.IProblemProfile#getProblems()
*/
@Override
public IProblem[] getProblems() {
Collection<IProblem> problems = new ArrayList<IProblem>();
@ -62,10 +49,6 @@ public class ProblemProfile implements IProblemProfile, Cloneable {
return problems.toArray(new IProblem[problems.size()]);
}
/**
* @param root
* @param problems
*/
protected void collectProblems(IProblemCategory parent, Collection<IProblem> problems) {
Object[] children = parent.getChildren();
for (Object object : children) {
@ -94,11 +77,6 @@ public class ProblemProfile implements IProblemProfile, Cloneable {
return CodanProblemCategory.findCategory(getRoot(), id);
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#clone()
*/
@Override
public Object clone() {
try {
@ -115,38 +93,21 @@ public class ProblemProfile implements IProblemProfile, Cloneable {
}
}
/**
* @param p
* @param cat
*/
public void addCategory(IProblemCategory category, IProblemCategory parent) {
((CodanProblemCategory) parent).addChild(category);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.codan.core.model.IProblemElement#getProfile()
*/
@Override
public IProblemProfile getProfile() {
return this;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.codan.core.model.IProblemElement#getParentCategory()
*/
@Override
public IProblemCategory getParentCategory() {
return getRoot();
}
private ListenerList preferenceChangeListeners;
/**
* @param listener
*/
@Override
public void addProfileChangeListener(IProblemProfileChangeListener listener) {
if (preferenceChangeListeners == null)
@ -154,9 +115,6 @@ public class ProblemProfile implements IProblemProfile, Cloneable {
preferenceChangeListeners.add(listener);
}
/**
* @param listener
*/
@Override
public void removeProfileChangeListener(IProblemProfileChangeListener listener) {
if (preferenceChangeListeners == null)
@ -166,14 +124,15 @@ public class ProblemProfile implements IProblemProfile, Cloneable {
preferenceChangeListeners = null;
}
/*
/**
* Convenience method for notifying preference change listeners.
*/
protected void fireProfileChangeEvent(String key, Object oldValue, Object newValue) {
if (preferenceChangeListeners == null)
return;
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++) {
final IProblemProfileChangeListener listener = (IProblemProfileChangeListener) listeners[i];
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
public Object getResource() {
return resource;

View file

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

View file

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