forked from phoedos/pmd
Checking in some Java 5 changes
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5020 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -5,7 +5,6 @@ package net.sourceforge.pmd.ast;
|
||||
import net.sourceforge.pmd.Rule;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class ASTAnnotation extends SimpleJavaNode {
|
||||
@ -30,9 +29,8 @@ public class ASTAnnotation extends SimpleJavaNode {
|
||||
ASTName annName = ((ASTName) n.jjtGetChild(0));
|
||||
|
||||
if (annName.getImage().equals("SuppressWarnings")) {
|
||||
List nodes = n.findChildrenOfType(ASTLiteral.class);
|
||||
for (Iterator iter = nodes.iterator(); iter.hasNext();) {
|
||||
ASTLiteral element = (ASTLiteral) iter.next();
|
||||
List<ASTLiteral> nodes = n.findChildrenOfType(ASTLiteral.class);
|
||||
for (ASTLiteral element: nodes) {
|
||||
if (element.hasImageEqualTo("\"PMD\"")
|
||||
|| element.hasImageEqualTo(ruleAnno)
|
||||
// the SuppressWarnings("unused") annotation allows unused code
|
||||
|
@ -254,8 +254,8 @@ public abstract class SimpleNode implements Node {
|
||||
String elementName = docNav.getElementName(this);
|
||||
Element element = ownerDocument.createElement(elementName);
|
||||
parentNode.appendChild(element);
|
||||
for (Iterator iter = docNav.getAttributeAxisIterator(this); iter.hasNext();) {
|
||||
Attribute attr = (Attribute) iter.next();
|
||||
for (Iterator<Attribute> iter = docNav.getAttributeAxisIterator(this); iter.hasNext();) {
|
||||
Attribute attr = iter.next();
|
||||
element.setAttribute(attr.getName(), attr.getValue());
|
||||
}
|
||||
for (Iterator iter = docNav.getChildAxisIterator(this); iter.hasNext();) {
|
||||
|
@ -12,7 +12,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class AttributeAxisIterator implements Iterator {
|
||||
public class AttributeAxisIterator implements Iterator<Attribute> {
|
||||
|
||||
private static class MethodWrapper {
|
||||
public Method method;
|
||||
@ -34,7 +34,7 @@ public class AttributeAxisIterator implements Iterator {
|
||||
}
|
||||
}
|
||||
|
||||
private Object currObj;
|
||||
private Attribute currObj;
|
||||
private MethodWrapper[] methodWrappers;
|
||||
private int position;
|
||||
private Node node;
|
||||
@ -59,11 +59,11 @@ public class AttributeAxisIterator implements Iterator {
|
||||
this.currObj = getNextAttribute();
|
||||
}
|
||||
|
||||
public Object next() {
|
||||
public Attribute next() {
|
||||
if (currObj == null) {
|
||||
throw new IndexOutOfBoundsException();
|
||||
}
|
||||
Object ret = currObj;
|
||||
Attribute ret = currObj;
|
||||
currObj = getNextAttribute();
|
||||
return ret;
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ public class DocumentNavigator extends DefaultNavigator {
|
||||
return ((Attribute) arg0).getParent();
|
||||
}
|
||||
|
||||
public Iterator getAttributeAxisIterator(Object arg0) {
|
||||
public Iterator<Attribute> getAttributeAxisIterator(Object arg0) {
|
||||
return new AttributeAxisIterator((Node) arg0);
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ public class AttributesSubMenu
|
||||
private void init() {
|
||||
AttributeAxisIterator i = new AttributeAxisIterator(node);
|
||||
while (i.hasNext()) {
|
||||
Attribute attribute = (Attribute) i.next();
|
||||
Attribute attribute = i.next();
|
||||
add(new XPathFragmentAddingItem(attribute.getName() + " = " + attribute.getValue(), model,
|
||||
AttributeToolkit.constructPredicate(attribute)));
|
||||
}
|
||||
|
Reference in New Issue
Block a user