提交 0edf099b 编写于 作者: J joehw

8181155: Fix lint warnings in JAXP repo: fallthrough and static

Reviewed-by: lancea, rriggs
上级 3c30db5b
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Oct 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
......@@ -181,6 +181,7 @@ public abstract class Utility {
* @throws IOException if a failure from reading from the bytes argument
* occurs
*/
@SuppressWarnings("fallthrough") // by design for case Const.INSTANCEOF
public static String codeToString(final ByteSequence bytes, final ConstantPool constant_pool,
final boolean verbose) throws IOException {
final short opcode = (short) bytes.readUnsignedByte();
......
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Oct 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
......@@ -175,6 +175,7 @@ class BCELFactory extends EmptyVisitor {
@Override
@SuppressWarnings("fallthrough") // by design for case Const.ANEWARRAY
public void visitAllocationInstruction( final AllocationInstruction i ) {
Type type;
if (i instanceof CPInstruction) {
......
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Oct 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
......@@ -54,6 +54,7 @@ final class Message extends Instruction {
return Type.Void;
}
@SuppressWarnings("fallthrough") // at default
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
......
......@@ -232,6 +232,7 @@ final class Step extends RelativeLocationPath {
translateStep(classGen, methodGen, hasPredicates() ? _predicates.size() - 1 : -1);
}
@SuppressWarnings("fallthrough") // at case NodeTest.ANODE and NodeTest.ELEMENT
private void translateStep(ClassGenerator classGen,
MethodGenerator methodGen,
int predicateIndex) {
......
......@@ -191,6 +191,7 @@ final class Whitespace extends TopLevelElement {
* Scans through the rules vector and looks for a rule of higher
* priority that contradicts the current rule.
*/
@SuppressWarnings("fallthrough") // case RULE_NAMESPACE
private static WhitespaceRule findContradictingRule(List<WhitespaceRule> rules,
WhitespaceRule rule) {
for (WhitespaceRule currentRule : rules) {
......
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Oct 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
......@@ -73,6 +74,7 @@ class XPathLexer implements com.sun.java_cup.internal.runtime.Scanner {
* name instead of a keyword (Jira-1912). Look two tokens behind
* to desambiguate expressions like "* and *" or "and * and".
*/
@SuppressWarnings("fallthrough")
Symbol disambiguateOperator(int ss) throws Exception {
switch (last) {
case sym.STAR:
......@@ -745,6 +747,7 @@ class XPathLexer implements com.sun.java_cup.internal.runtime.Scanner {
":13,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184:5,-1:3,184:" +
"4,232,184:8,-1:2,184:10,-1:3,76,184,76:3");
@SuppressWarnings("fallthrough") // at case 18 and -1
public com.sun.java_cup.internal.runtime.Symbol next_token ()
throws java.io.IOException,
Exception
......
......@@ -1591,13 +1591,13 @@ class parser_actions {
RESULT = new CurrentCall(fname);
}
else if (fname == parser.getQNameIgnoreDefaultNs("number")) {
RESULT = new NumberCall(fname, parser.EmptyArgs);
RESULT = new NumberCall(fname, XPathParser.EmptyArgs);
}
else if (fname == parser.getQNameIgnoreDefaultNs("string")) {
RESULT = new StringCall(fname, parser.EmptyArgs);
RESULT = new StringCall(fname, XPathParser.EmptyArgs);
}
else if (fname == parser.getQNameIgnoreDefaultNs("concat")) {
RESULT = new ConcatCall(fname, parser.EmptyArgs);
RESULT = new ConcatCall(fname, XPathParser.EmptyArgs);
}
else if (fname == parser.getQNameIgnoreDefaultNs("true")) {
RESULT = new BooleanExpr(true);
......@@ -1609,10 +1609,10 @@ class parser_actions {
RESULT = new NameCall(fname);
}
else if (fname == parser.getQNameIgnoreDefaultNs("generate-id")) {
RESULT = new GenerateIdCall(fname, parser.EmptyArgs);
RESULT = new GenerateIdCall(fname, XPathParser.EmptyArgs);
}
else if (fname == parser.getQNameIgnoreDefaultNs("string-length")) {
RESULT = new StringLengthCall(fname, parser.EmptyArgs);
RESULT = new StringLengthCall(fname, XPathParser.EmptyArgs);
}
else if (fname == parser.getQNameIgnoreDefaultNs("position")) {
RESULT = new PositionCall(fname);
......@@ -1627,7 +1627,7 @@ class parser_actions {
RESULT = new NamespaceUriCall(fname);
}
else {
RESULT = new FunctionCall(fname, parser.EmptyArgs);
RESULT = new FunctionCall(fname, XPathParser.EmptyArgs);
}
parser_result = new Symbol(16/*FunctionCall*/, (parser_stack.get(parser_top-2)).left, (parser_stack.get(parser_top-0)).right, RESULT);
......
/*
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Oct 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
......@@ -1278,11 +1279,13 @@ public final class SAXImpl extends SAX2DTM2
// For "attribute::p:*", the principal node kind is
// attribute
m_baseIterator = getAxisIterator(axis);
break;
}
case Axis.NAMESPACE: {
// This covers "namespace::p:*". It is syntactically
// correct, though it doesn't make much sense.
m_baseIterator = getAxisIterator(axis);
break;
}
default: {
// In all other cases, the principal node kind is
......
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Oct 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
......@@ -145,6 +145,7 @@ public class TransletOutputHandlerFactory {
_indentNumber = value;
}
@SuppressWarnings("fallthrough") // intentional at case STAX, SAX
public SerializationHandler getSerializationHandler()
throws IOException, ParserConfigurationException
{
......
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Oct 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
......@@ -161,8 +161,8 @@ public class DeferredDocumentTypeImpl
if (((DocumentImpl)getOwnerDocument()).allowGrammarAccess){
insertBefore(node, last);
last = node;
break;
}
break;
}
// NOTE: Should never get here! -Ac
......
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Oct 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
......@@ -439,7 +439,7 @@ class XSDElementTraverser extends XSDAbstractTraverser {
fSchemaHandler.checkForDuplicateNames(
(schemaDoc.fTargetNamespace == null) ? ","+DOMUtil.getAttrValue(child, SchemaSymbols.ATT_NAME)
: schemaDoc.fTargetNamespace+","+ DOMUtil.getAttrValue(child, SchemaSymbols.ATT_NAME),
fSchemaHandler.ATTRIBUTE_TYPE, fSchemaHandler.getIDRegistry(), fSchemaHandler.getIDRegistry_sub(),
XSDHandler.ATTRIBUTE_TYPE, fSchemaHandler.getIDRegistry(), fSchemaHandler.getIDRegistry_sub(),
child, schemaDoc);
}
} else if (childName.equals(SchemaSymbols.ELT_KEYREF)) {
......
......@@ -3025,6 +3025,7 @@ public class XSDHandler {
return newComponents;
}
@SuppressWarnings("fallthrough")
private void expandRelatedComponents(XSObject component,List<XSObject>componentList, Map<String, List<String>> dependencies) {
short componentType = component.getType();
switch (componentType) {
......
......@@ -600,6 +600,7 @@ public class AbstractDOMParser extends AbstractXMLDocumentParser {
*
* @throws XNIException Thrown by application to signal an error.
*/
@SuppressWarnings("fallthrough") // by design at case LSParserFilter.FILTER_SKIP
public void comment (XMLString text, Augmentations augs) throws XNIException {
if (fInDTD) {
if (fInternalSubset != null && !fInDTDExternalSubset) {
......@@ -673,6 +674,7 @@ public class AbstractDOMParser extends AbstractXMLDocumentParser {
*
* @throws XNIException Thrown by handler to signal an error.
*/
@SuppressWarnings("fallthrough") // by design at case LSParserFilter.FILTER_REJECT
public void processingInstruction (String target, XMLString data, Augmentations augs)
throws XNIException {
......@@ -1416,6 +1418,7 @@ public class AbstractDOMParser extends AbstractXMLDocumentParser {
*
* @throws XNIException Thrown by handler to signal an error.
*/
@SuppressWarnings("fallthrough") // by design at case LSParserFilter.FILTER_REJECT
public void endCDATA (Augmentations augs) throws XNIException {
fInCDATASection = false;
......@@ -2596,6 +2599,7 @@ public class AbstractDOMParser extends AbstractXMLDocumentParser {
* or removed fFistChunk must be set to true, otherwise some data can be lost.
*
*/
@SuppressWarnings("fallthrough") // by design at case LSParserFilter.FILTER_REJECT
protected void setCharacterData (boolean sawChars){
// handle character data
......
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Oct 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
......@@ -1697,6 +1697,7 @@ implements DTM, org.xml.sax.ContentHandler, org.xml.sax.ext.LexicalHandler
* @return String Value of this node, or null if not
* meaningful for this node type.
*/
@SuppressWarnings("fallthrough")
public String getNodeValue(int nodeHandle)
{
nodes.readSlot(nodeHandle, gotslot);
......
......@@ -1651,6 +1651,7 @@ public class DOM2DTM extends DTMDefaultBaseIterators
* @param node Node whose subtree is to be walked, gathering the
* contents of all Text or CDATASection nodes.
*/
@SuppressWarnings("fallthrough")
protected static void dispatchNodeData(Node node,
org.xml.sax.ContentHandler ch,
int depth)
......
......@@ -1020,6 +1020,7 @@ public abstract class BaseMarkupSerializer
* @throws IOException An I/O exception occured while
* serializing
*/
@SuppressWarnings("fallthrough") // by design at case Node.DOCUMENT_FRAGMENT_NODE
protected void serializeNode( Node node )
throws IOException
{
......
......@@ -62,6 +62,7 @@ public class FilterExprWalker extends AxesWalker
*
* @throws javax.xml.transform.TransformerException
*/
@SuppressWarnings("fallthrough")
public void init(Compiler compiler, int opPos, int stepType)
throws javax.xml.transform.TransformerException
{
......
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Oct 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
......@@ -299,7 +299,7 @@ public class MatchPatternIterator extends LocPathIterator
System.out.println(", "+m_cdtm.getNodeName(n));
// if(m_cdtm.getNodeName(n).equals("near-east"))
System.out.println("pattern: "+m_pattern.toString());
m_pattern.debugWhatToShow(m_pattern.getWhatToShow());
NodeTest.debugWhatToShow(m_pattern.getWhatToShow());
}
XObject score = m_pattern.execute(xctxt);
......
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Oct 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
......@@ -554,6 +554,7 @@ public class WalkerFactory
*
* @throws javax.xml.transform.TransformerException
*/
@SuppressWarnings("fallthrough") // by design at case OpCodes.FROM_DESCENDANTS
private static boolean isOptimizableForDescendantIterator(
Compiler compiler, int stepOpCodePos, int stepIndex)
throws javax.xml.transform.TransformerException
......@@ -1102,7 +1103,7 @@ public class WalkerFactory
System.out.print(", predAxis: " + Axis.getNames(ai.getAxis()));
System.out.print(", what: ");
System.out.print(" ");
ai.debugWhatToShow(ai.getWhatToShow());
NodeTest.debugWhatToShow(ai.getWhatToShow());
}
int argLen = compiler.getFirstPredicateOpPos(opPos);
......@@ -1621,6 +1622,7 @@ public class WalkerFactory
*
* @throws javax.xml.transform.TransformerException
*/
@SuppressWarnings("fallthrough") // by design at case OpCodes.FROM_ROOT
private static boolean isNaturalDocOrder(
Compiler compiler, int stepOpCodePos, int stepIndex, int analysis)
throws javax.xml.transform.TransformerException
......
......@@ -106,6 +106,7 @@ class Lexer
*
* @throws javax.xml.transform.TransformerException
*/
@SuppressWarnings("fallthrough") // on purpose at case '-', '(' and default
void tokenize(String pat, List<String> targetStrings)
throws javax.xml.transform.TransformerException
{
......
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* @LastModified: Oct 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
......@@ -65,7 +65,7 @@ public class ContextMatchStepPattern extends StepPattern
if (xctxt.getIteratorRoot() == xctxt.getCurrentNode())
return getStaticScore();
else
return this.SCORE_NONE;
return NodeTest.SCORE_NONE;
}
/**
......
......@@ -116,7 +116,7 @@ public class StepPattern extends NodeTest implements SubContextList, ExpressionO
m_targetString = PsuedoNames.PSEUDONAME_ROOT;
break;
case DTMFilter.SHOW_ELEMENT :
if (this.WILD == m_name)
if (WILD.equals(m_name))
m_targetString = PsuedoNames.PSEUDONAME_ANY;
else
m_targetString = m_name;
......
......@@ -586,7 +586,7 @@ public class ParserAdapter implements XMLReader, DocumentHandler
// note funky case: localname can be null
// when declaring the default prefix, and
// yet the uri isn't null.
atts.addAttribute (nsSupport.XMLNS, prefix,
atts.addAttribute (NamespaceSupport.XMLNS, prefix,
attQName.intern(), type, value);
else
atts.addAttribute ("", "",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册