On Fri, 3 Jun 2022 18:17:55 GMT, Joe Wang <jo...@openjdk.org> wrote: > Adjust how XPath operators are counted to improve accuracy. This change does > not affect how XPath works. > > Test: > Tier2 passed; > JCK XML tests passed.
src/java.xml/share/classes/com/sun/java_cup/internal/runtime/lr_parser.java line 152: > 150: private int opCount = 0; > 151: private int totalOpCount = 0; > 152: private int lastSym; `lastSym` is never initialized. It's OK for the first time, but should this be reset for the next use (if any), e.g. somewhere around line 595? src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/sym.java line 99: > 97: public static final int[] OPERATORS = {GT, GE, EQ, NE, LT, LE, SLASH, > DSLASH, > 98: DOT, DDOT, ATSIGN, DCOLON, PLUS, MINUS, STAR, DIV, MOD, AND, OR, > LPAREN, > 99: LBRACK, VBAR, DOLLAR, NODE, TEXT, PI, PIPARAM}; Any reason for re-shuffling the order of operators? I'd expect new ones are appended to the existing ones, or appear in the order of their declarations above? (or is this automatically generated, as described in the comment?) src/java.xml/share/classes/com/sun/org/apache/xpath/internal/compiler/Lexer.java line 351: > 349: { > 350: nesting++; > 351: if (!isLiteral) { `if (isLiteral) {` might be more readable. src/java.xml/share/classes/com/sun/org/apache/xpath/internal/compiler/Lexer.java line 377: > 375: else if ((Token.LPAREN != c) && (Token.LBRACK != c) && > (Token.RPAREN != c) > 376: && (Token.RBRACK != c) && (Token.COLON != c) && > (Token.COMMA != c)) { > 377: if (Token.STAR == c) { Could be if (Token.STAR != c || !isAxis) { incrementCount(c); } src/java.xml/share/classes/com/sun/org/apache/xpath/internal/compiler/Lexer.java line 476: > 474: } > 475: > 476: private void incrementCount(char c) { `c` is not used. ------------- PR: https://git.openjdk.java.net/jdk/pull/9022