deprecated method Rule.getExample() removed

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@6328 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Xavier Le Vourch committed 2008-07-16 02:16:02 +00:00
1 parent bd07acb6f3
commit eebd21a2bf
6 files changed
+17 -38

No files matched your search

+1
View File
@@ -256,6 +256,7 @@ The following is relatively complete list of the major changes (this may not be
Removed - boolean Rule.include()
Removed - void Rule.setInclude(boolean)
Removed - String Rule.getRulePriorityName()
Removed - String Rule.getExample()
Removed - Rule.LOWEST_PRIORITY
Removed - Rule.PRIORITIES
Removed - RuleSet.applies(Language,Language)
@@ -73,8 +73,6 @@ public class RuleReferenceTest {
assertEquals("Override failed", "description2", ruleReference.getDescription());
assertEquals("Override failed", "description2", ruleReference.getOverriddenDescription());
// TODO Examples is being tested as currently working, but needs to be fixed at some point
assertEquals("Override failed", "example2", ruleReference.getExample());
assertEquals("Override failed", 2, ruleReference.getExamples().size());
assertEquals("Override failed", "example1", ruleReference.getExamples().get(0));
assertEquals("Override failed", "example2", ruleReference.getExamples().get(1));
@@ -139,7 +137,6 @@ public class RuleReferenceTest {
assertEquals("Override failed", "description1", ruleReference.getDescription());
assertNull("Override failed", ruleReference.getOverriddenDescription());
assertEquals("Override failed", "example1", ruleReference.getExample());
assertEquals("Override failed", 1, ruleReference.getExamples().size());
assertEquals("Override failed", "example1", ruleReference.getExamples().get(0));
assertNull("Override failed", ruleReference.getOverriddenExamples());
@@ -18,7 +18,6 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import java.util.Set;
@@ -125,8 +124,8 @@ public class RuleSetFactoryTest {
Set<String> expected = new HashSet<String>();
expected.add("MockRuleName1");
expected.add("MockRuleName2");
for (Iterator<Rule> i = rs.getRules().iterator(); i.hasNext();) {
assertTrue(expected.contains(i.next().getName()));
for (Rule rule : rs.getRules()) {
assertTrue(expected.contains(rule.getName()));
}
}
@@ -179,8 +178,8 @@ public class RuleSetFactoryTest {
assertEquals("TestNameOverride", r.getName());
assertEquals("Test message override", r.getMessage());
assertEquals("Test description override", r.getDescription());
assertEquals("Test example override", r.getExample());
assertEquals("Test that both example are stored", 2, r.getExamples().size());
assertEquals("Test example override", r.getExamples().get(1));
assertEquals(RulePriority.MEDIUM, r.getPriority());
assertTrue(r.hasProperty("test2"));
assertEquals("override2", r.getStringProperty("test2"));
@@ -501,8 +500,8 @@ public class RuleSetFactoryTest {
Rule rule2 = ((List<Rule>) ruleSet2.getRules()).get(i);
assertFalse(message + ", Different RuleReference",
((rule1 instanceof RuleReference) && !(rule2 instanceof RuleReference))
|| (!(rule1 instanceof RuleReference) && (rule2 instanceof RuleReference)));
rule1 instanceof RuleReference && !(rule2 instanceof RuleReference)
|| !(rule1 instanceof RuleReference) && rule2 instanceof RuleReference);
if (rule1 instanceof RuleReference) {
RuleReference ruleReference1 = (RuleReference) rule1;
@@ -652,14 +651,17 @@ public class RuleSetFactoryTest {
return valid;
}
@Override
public void error(SAXParseException e) throws SAXException {
log("Error", e);
}
@Override
public void fatalError(SAXParseException e) throws SAXException {
log("FatalError", e);
}
@Override
public void warning(SAXParseException e) throws SAXException {
log("Warning", e);
}
@@ -670,6 +672,7 @@ public class RuleSetFactoryTest {
valid = false;
}
@Override
public InputSource resolveEntity(String publicId, String systemId) throws IOException, SAXException {
if ("http://pmd.sf.net/ruleset_xml_schema.xsd".equals(systemId) || systemId.endsWith("ruleset.dtd")) {
try {
+5 -13
View File
@@ -108,14 +108,14 @@ public interface Rule {
/**
* Get the name of the RuleSet containing this Rule.
*
*
* @see RuleSet
*/
String getRuleSetName();
/**
* Set the name of the RuleSet containing this Rule.
*
*
* @see RuleSet
*/
void setRuleSetName(String name);
@@ -145,14 +145,6 @@ public interface Rule {
*/
List<String> getExamples();
/**
* Still used by the JDeveloper plugin
*
* @deprecated use getExamples(), since we now support multiple examples
*/
@Deprecated
String getExample();
/**
* Add a single example for this Rule.
*/
@@ -180,7 +172,7 @@ public interface Rule {
/**
* Get all properties for this Rule.
*
*
* @return the properties for the rule
*/
Properties getProperties();
@@ -273,7 +265,7 @@ public interface Rule {
void addRuleChainVisit(String astNodeName);
/**
* Start processing. Called once, before apply() is first called.
* Start processing. Called once, before apply() is first called.
*/
void start(RuleContext ctx);
@@ -284,7 +276,7 @@ public interface Rule {
void apply(List<? extends Node> nodes, RuleContext ctx);
/**
* End processing. Called once, after apply() is last called.
* End processing. Called once, after apply() is last called.
*/
void end(RuleContext ctx);
}
@@ -112,10 +112,6 @@ public abstract class AbstractDelegateRule implements Rule {
return rule.getExamples();
}
public String getExample() {
return rule.getExample();
}
public void addExample(String example) {
rule.addExample(example);
}
@@ -21,7 +21,7 @@ import net.sourceforge.pmd.lang.ast.Node;
/**
* Basic abstract implementation of all parser-independent methods of the Rule
* interface.
*
*
* @author pieter_van_raemdonck - Application Engineers NV/SA - www.ae.be
*/
// FUTURE Move PropertyDescriptor APIs up to Rule interface
@@ -138,16 +138,6 @@ public abstract class AbstractRule implements Rule {
return examples;
}
// FUTURE Remove when cleaning up @deprecated
public String getExample() {
if (examples.isEmpty()) {
return null;
} else {
// We return the last example, so the override still works
return examples.get(examples.size() - 1);
}
}
public void addExample(String example) {
examples.add(example);
}
@@ -334,7 +324,7 @@ public abstract class AbstractRule implements Rule {
/**
* Return all the relevant properties for the receiver by overriding in
* subclasses as necessary.
*
*
* @return Map
*/
protected Map<String, PropertyDescriptor> propertiesByName() {