mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
fixed sonar rule violations
This commit is contained in:
File diff suppressed because it is too large
Load Diff
+51
-51
@@ -130,33 +130,33 @@ import com.alibaba.druid.sql.parser.Token;
|
||||
public class MySqlStatementParser extends SQLStatementParser {
|
||||
|
||||
public MySqlStatementParser(String sql) throws ParserException{
|
||||
super (new MySqlExprParser(sql));
|
||||
super(new MySqlExprParser(sql));
|
||||
}
|
||||
|
||||
public MySqlStatementParser(Lexer lexer){
|
||||
super(new MySqlExprParser(lexer));
|
||||
}
|
||||
|
||||
public SQLCreateTableStatement parseCreateTable() throws ParserException {
|
||||
public SQLCreateTableStatement parseCreateTable() {
|
||||
MySqlCreateTableParser parser = new MySqlCreateTableParser(this.exprParser);
|
||||
return parser.parseCrateTable();
|
||||
}
|
||||
|
||||
public SQLSelectStatement parseSelect() throws ParserException {
|
||||
public SQLSelectStatement parseSelect() {
|
||||
return new SQLSelectStatement(new MySqlSelectParser(this.exprParser).select());
|
||||
}
|
||||
|
||||
public SQLUpdateStatement parseUpdateStatement() throws ParserException {
|
||||
public SQLUpdateStatement parseUpdateStatement() {
|
||||
MySqlUpdateStatement stmt = createUpdateStatement();
|
||||
|
||||
if (lexer.token() == Token.UPDATE) {
|
||||
lexer.nextToken();
|
||||
|
||||
|
||||
if (identifierEquals("LOW_PRIORITY")) {
|
||||
lexer.nextToken();
|
||||
stmt.setLowPriority(true);
|
||||
}
|
||||
|
||||
|
||||
if (identifierEquals("IGNORE")) {
|
||||
lexer.nextToken();
|
||||
stmt.setIgnore(true);
|
||||
@@ -192,7 +192,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
lexer.nextToken();
|
||||
stmt.setWhere(this.exprParser.expr());
|
||||
}
|
||||
|
||||
|
||||
stmt.setOrderBy(this.exprParser.parseOrderBy());
|
||||
|
||||
stmt.setLimit(parseLimit());
|
||||
@@ -204,7 +204,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
return new MySqlUpdateStatement();
|
||||
}
|
||||
|
||||
public MySqlDeleteStatement parseDeleteStatement() throws ParserException {
|
||||
public MySqlDeleteStatement parseDeleteStatement() {
|
||||
MySqlDeleteStatement deleteStatement = new MySqlDeleteStatement();
|
||||
|
||||
if (lexer.token() == Token.DELETE) {
|
||||
@@ -264,18 +264,18 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
return deleteStatement;
|
||||
}
|
||||
|
||||
public SQLStatement parseCreate() throws ParserException {
|
||||
public SQLStatement parseCreate() {
|
||||
accept(Token.CREATE);
|
||||
|
||||
List<SQLCommentHint> hints = this.exprParser.parseHints();
|
||||
|
||||
|
||||
if (lexer.token() == Token.TABLE || identifierEquals("TEMPORARY")) {
|
||||
MySqlCreateTableParser parser = new MySqlCreateTableParser(this.exprParser);
|
||||
MySqlCreateTableStatement stmt = parser.parseCrateTable(false);
|
||||
stmt.setHints(hints);
|
||||
return stmt;
|
||||
}
|
||||
|
||||
|
||||
if (lexer.token() == Token.DATABASE) {
|
||||
return parseCreateDatabase();
|
||||
}
|
||||
@@ -292,7 +292,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
throw new ParserException("TODO " + lexer.token());
|
||||
}
|
||||
|
||||
public SQLStatement parseCreateIndex() throws ParserException {
|
||||
public SQLStatement parseCreateIndex() {
|
||||
MySqlCreateIndexStatement stmt = new MySqlCreateIndexStatement();
|
||||
|
||||
if (lexer.token() == Token.UNIQUE) {
|
||||
@@ -350,7 +350,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
}
|
||||
}
|
||||
|
||||
public SQLStatement parseCreateUser() throws ParserException {
|
||||
public SQLStatement parseCreateUser() {
|
||||
if (lexer.token() == Token.CREATE) {
|
||||
lexer.nextToken();
|
||||
}
|
||||
@@ -510,7 +510,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
statementList.add(stmt);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (identifierEquals("HELP")) {
|
||||
lexer.nextToken();
|
||||
MySqlHelpStatement stmt = new MySqlHelpStatement();
|
||||
@@ -524,14 +524,14 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
statementList.add(stmt);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (lexer.token() == Token.LOCK) {
|
||||
lexer.nextToken();
|
||||
acceptIdentifier("TABLES");
|
||||
|
||||
|
||||
MySqlLockTableStatement stmt = new MySqlLockTableStatement();
|
||||
stmt.setTableSource(this.exprParser.name());
|
||||
|
||||
|
||||
if (identifierEquals("READ")) {
|
||||
lexer.nextToken();
|
||||
if (identifierEquals("LOCAL")) {
|
||||
@@ -547,11 +547,11 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
acceptIdentifier("WRITE");
|
||||
stmt.setLockType(LockType.LOW_PRIORITY_WRITE);
|
||||
}
|
||||
|
||||
|
||||
statementList.add(stmt);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (identifierEquals("UNLOCK")) {
|
||||
lexer.nextToken();
|
||||
acceptIdentifier("TABLES");
|
||||
@@ -562,7 +562,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
return false;
|
||||
}
|
||||
|
||||
public MySqlDescribeStatement parseDescribe() throws ParserException {
|
||||
public MySqlDescribeStatement parseDescribe() {
|
||||
if (lexer.token() == Token.DESC || identifierEquals("DESCRIBE")) {
|
||||
lexer.nextToken();
|
||||
} else {
|
||||
@@ -575,7 +575,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
return stmt;
|
||||
}
|
||||
|
||||
public SQLStatement parseShow() throws ParserException {
|
||||
public SQLStatement parseShow() {
|
||||
acceptIdentifier("SHOW");
|
||||
|
||||
if (lexer.token() == Token.FULL) {
|
||||
@@ -1235,7 +1235,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
throw new ParserException("TODO " + lexer.stringVal());
|
||||
}
|
||||
|
||||
private MySqlShowStatusStatement parseShowStatus() throws ParserException {
|
||||
private MySqlShowStatusStatement parseShowStatus() {
|
||||
MySqlShowStatusStatement stmt = new MySqlShowStatusStatement();
|
||||
|
||||
if (lexer.token() == Token.LIKE) {
|
||||
@@ -1253,7 +1253,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
return stmt;
|
||||
}
|
||||
|
||||
private MySqlShowVariantsStatement parseShowVariants() throws ParserException {
|
||||
private MySqlShowVariantsStatement parseShowVariants() {
|
||||
MySqlShowVariantsStatement stmt = new MySqlShowVariantsStatement();
|
||||
|
||||
if (lexer.token() == Token.LIKE) {
|
||||
@@ -1271,7 +1271,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
return stmt;
|
||||
}
|
||||
|
||||
private MySqlShowWarningsStatement parseShowWarnings() throws ParserException {
|
||||
private MySqlShowWarningsStatement parseShowWarnings() {
|
||||
MySqlShowWarningsStatement stmt = new MySqlShowWarningsStatement();
|
||||
|
||||
stmt.setLimit(parseLimit());
|
||||
@@ -1279,7 +1279,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
return stmt;
|
||||
}
|
||||
|
||||
private MySqlShowDatabasesStatement parseShowDatabases() throws ParserException {
|
||||
private MySqlShowDatabasesStatement parseShowDatabases() {
|
||||
MySqlShowDatabasesStatement stmt = new MySqlShowDatabasesStatement();
|
||||
|
||||
if (lexer.token() == Token.LIKE) {
|
||||
@@ -1297,7 +1297,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
return stmt;
|
||||
}
|
||||
|
||||
private MySqlShowTablesStatement parseShowTabless() throws ParserException {
|
||||
private MySqlShowTablesStatement parseShowTabless() {
|
||||
MySqlShowTablesStatement stmt = new MySqlShowTablesStatement();
|
||||
|
||||
if (lexer.token() == Token.FROM) {
|
||||
@@ -1321,7 +1321,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
return stmt;
|
||||
}
|
||||
|
||||
private MySqlShowColumnsStatement parseShowColumns() throws ParserException {
|
||||
private MySqlShowColumnsStatement parseShowColumns() {
|
||||
MySqlShowColumnsStatement stmt = new MySqlShowColumnsStatement();
|
||||
|
||||
if (lexer.token() == Token.FROM) {
|
||||
@@ -1351,7 +1351,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
return stmt;
|
||||
}
|
||||
|
||||
public MySqlStartTransactionStatement parseStart() throws ParserException {
|
||||
public MySqlStartTransactionStatement parseStart() {
|
||||
acceptIdentifier("START");
|
||||
acceptIdentifier("TRANSACTION");
|
||||
|
||||
@@ -1397,21 +1397,21 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
stmt.setChain(Boolean.TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (identifierEquals("TO")) {
|
||||
lexer.nextToken();
|
||||
|
||||
|
||||
if (identifierEquals("SAVEPOINT")) {
|
||||
lexer.nextToken();
|
||||
}
|
||||
|
||||
|
||||
stmt.setTo(this.exprParser.name());
|
||||
}
|
||||
|
||||
return stmt;
|
||||
}
|
||||
|
||||
public MySqlCommitStatement parseCommit() throws ParserException {
|
||||
public MySqlCommitStatement parseCommit() {
|
||||
acceptIdentifier("COMMIT");
|
||||
|
||||
MySqlCommitStatement stmt = new MySqlCommitStatement();
|
||||
@@ -1436,7 +1436,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
return stmt;
|
||||
}
|
||||
|
||||
public MySqlReplaceStatement parseReplicate() throws ParserException {
|
||||
public MySqlReplaceStatement parseReplicate() {
|
||||
MySqlReplaceStatement stmt = new MySqlReplaceStatement();
|
||||
|
||||
acceptIdentifier("REPLACE");
|
||||
@@ -1520,7 +1520,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
return stmt;
|
||||
}
|
||||
|
||||
protected SQLStatement parseLoad() throws ParserException {
|
||||
protected SQLStatement parseLoad() {
|
||||
acceptIdentifier("LOAD");
|
||||
|
||||
if (identifierEquals("DATA")) {
|
||||
@@ -1536,7 +1536,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
throw new ParserException("TODO");
|
||||
}
|
||||
|
||||
protected MySqlLoadXmlStatement parseLoadXml() throws ParserException {
|
||||
protected MySqlLoadXmlStatement parseLoadXml() {
|
||||
acceptIdentifier("XML");
|
||||
|
||||
MySqlLoadXmlStatement stmt = new MySqlLoadXmlStatement();
|
||||
@@ -1609,7 +1609,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
return stmt;
|
||||
}
|
||||
|
||||
protected MySqlLoadDataInFileStatement parseLoadDataInFile() throws ParserException {
|
||||
protected MySqlLoadDataInFileStatement parseLoadDataInFile() {
|
||||
acceptIdentifier("DATA");
|
||||
|
||||
MySqlLoadDataInFileStatement stmt = new MySqlLoadDataInFileStatement();
|
||||
@@ -1682,7 +1682,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
return stmt;
|
||||
}
|
||||
|
||||
public MySqlPrepareStatement parsePrepare() throws ParserException {
|
||||
public MySqlPrepareStatement parsePrepare() {
|
||||
acceptIdentifier("PREPARE");
|
||||
|
||||
SQLName name = exprParser.name();
|
||||
@@ -1692,7 +1692,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
return new MySqlPrepareStatement(name, from);
|
||||
}
|
||||
|
||||
public MySqlExecuteStatement parseExecute() throws ParserException {
|
||||
public MySqlExecuteStatement parseExecute() {
|
||||
acceptIdentifier("EXECUTE");
|
||||
|
||||
MySqlExecuteStatement stmt = new MySqlExecuteStatement();
|
||||
@@ -1825,7 +1825,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
return insertStatement;
|
||||
}
|
||||
|
||||
public SQLStatement parseDropUser() throws ParserException {
|
||||
public SQLStatement parseDropUser() {
|
||||
acceptIdentifier("USER");
|
||||
|
||||
MySqlDropUser stmt = new MySqlDropUser();
|
||||
@@ -1923,7 +1923,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
return new MySqlSelectParser(this.exprParser);
|
||||
}
|
||||
|
||||
public SQLStatement parseSet() throws ParserException {
|
||||
public SQLStatement parseSet() {
|
||||
accept(Token.SET);
|
||||
|
||||
Boolean global = null;
|
||||
@@ -2071,14 +2071,14 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
} else if (lexer.token() == Token.INDEX) {
|
||||
lexer.nextToken();
|
||||
MySqlAlterTableAddIndex item = new MySqlAlterTableAddIndex();
|
||||
|
||||
|
||||
if (lexer.token() == Token.LPAREN) {
|
||||
lexer.nextToken();
|
||||
} else {
|
||||
item.setName(this.exprParser.name());
|
||||
accept(Token.LPAREN);
|
||||
}
|
||||
|
||||
|
||||
for (;;) {
|
||||
SQLSelectOrderByItem column = this.exprParser.parseSelectOrderByItem();
|
||||
item.getItems().add(column);
|
||||
@@ -2094,14 +2094,14 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
} else if (lexer.token() == Token.UNIQUE) {
|
||||
lexer.nextToken();
|
||||
MySqlAlterTableAddUnique item = new MySqlAlterTableAddUnique();
|
||||
|
||||
|
||||
if (lexer.token() == Token.LPAREN) {
|
||||
lexer.nextToken();
|
||||
} else {
|
||||
item.setName(this.exprParser.name());
|
||||
accept(Token.LPAREN);
|
||||
}
|
||||
|
||||
|
||||
for (;;) {
|
||||
SQLSelectOrderByItem column = this.exprParser.parseSelectOrderByItem();
|
||||
item.getItems().add(column);
|
||||
@@ -2171,7 +2171,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
item.setName(stmt.getTableSource().getExpr());
|
||||
item.setTo(this.exprParser.name());
|
||||
renameStmt.getItems().add(item);
|
||||
|
||||
|
||||
return renameStmt;
|
||||
} else if (lexer.token() == Token.ORDER) {
|
||||
throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
|
||||
@@ -2243,7 +2243,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (lexer.token() == Token.COMMA) {
|
||||
lexer.nextToken();
|
||||
continue;
|
||||
@@ -2282,21 +2282,21 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
|
||||
return stmt;
|
||||
}
|
||||
|
||||
|
||||
public SQLStatement parseCreateDatabase() {
|
||||
if (lexer.token() == Token.CREATE) {
|
||||
lexer.nextToken();
|
||||
}
|
||||
|
||||
|
||||
accept(Token.DATABASE);
|
||||
|
||||
|
||||
SQLCreateDatabaseStatement stmt = new SQLCreateDatabaseStatement();
|
||||
stmt.setName(this.exprParser.name());
|
||||
|
||||
|
||||
if (lexer.token() == Token.DEFAULT) {
|
||||
lexer.nextToken();
|
||||
}
|
||||
|
||||
|
||||
return stmt;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ import com.alibaba.druid.sql.ast.statement.SQLSelectOrderByItem;
|
||||
|
||||
public class SQLExprParser extends SQLParser {
|
||||
|
||||
public SQLExprParser(String sql) throws ParserException{
|
||||
public SQLExprParser(String sql){
|
||||
super(sql);
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public class SQLExprParser extends SQLParser {
|
||||
super(lexer);
|
||||
}
|
||||
|
||||
public SQLExpr expr() throws ParserException {
|
||||
public SQLExpr expr() {
|
||||
if (lexer.token() == Token.STAR) {
|
||||
lexer.nextToken();
|
||||
|
||||
@@ -91,7 +91,7 @@ public class SQLExprParser extends SQLParser {
|
||||
return exprRest(expr);
|
||||
}
|
||||
|
||||
public SQLExpr exprRest(SQLExpr expr) throws ParserException {
|
||||
public SQLExpr exprRest(SQLExpr expr) {
|
||||
expr = bitXorRest(expr);
|
||||
expr = multiplicativeRest(expr);
|
||||
expr = additiveRest(expr);
|
||||
@@ -107,12 +107,12 @@ public class SQLExprParser extends SQLParser {
|
||||
return expr;
|
||||
}
|
||||
|
||||
public final SQLExpr bitXor() throws ParserException {
|
||||
public final SQLExpr bitXor() {
|
||||
SQLExpr expr = primary();
|
||||
return bitXorRest(expr);
|
||||
}
|
||||
|
||||
public SQLExpr bitXorRest(SQLExpr expr) throws ParserException {
|
||||
public SQLExpr bitXorRest(SQLExpr expr) {
|
||||
if (lexer.token() == Token.CARET) {
|
||||
lexer.nextToken();
|
||||
SQLExpr rightExp = primary();
|
||||
@@ -123,12 +123,12 @@ public class SQLExprParser extends SQLParser {
|
||||
return expr;
|
||||
}
|
||||
|
||||
public final SQLExpr multiplicative() throws ParserException {
|
||||
public final SQLExpr multiplicative() {
|
||||
SQLExpr expr = primary();
|
||||
return multiplicativeRest(expr);
|
||||
}
|
||||
|
||||
public SQLExpr multiplicativeRest(SQLExpr expr) throws ParserException {
|
||||
public SQLExpr multiplicativeRest(SQLExpr expr) {
|
||||
if (lexer.token() == Token.STAR) {
|
||||
lexer.nextToken();
|
||||
SQLExpr rightExp = bitXor();
|
||||
@@ -148,7 +148,7 @@ public class SQLExprParser extends SQLParser {
|
||||
return expr;
|
||||
}
|
||||
|
||||
public SQLExpr primary() throws ParserException {
|
||||
public SQLExpr primary() {
|
||||
SQLExpr sqlExpr = null;
|
||||
|
||||
final Token tok = lexer.token();
|
||||
@@ -458,7 +458,7 @@ public class SQLExprParser extends SQLParser {
|
||||
return new SQLSelectParser(this);
|
||||
}
|
||||
|
||||
public SQLExpr primaryRest(SQLExpr expr) throws ParserException {
|
||||
public SQLExpr primaryRest(SQLExpr expr) {
|
||||
if (expr == null) {
|
||||
throw new IllegalArgumentException("expr");
|
||||
}
|
||||
@@ -573,11 +573,11 @@ public class SQLExprParser extends SQLParser {
|
||||
return expr;
|
||||
}
|
||||
|
||||
public final SQLExpr groupComparisionRest(SQLExpr expr) throws ParserException {
|
||||
public final SQLExpr groupComparisionRest(SQLExpr expr) {
|
||||
return expr;
|
||||
}
|
||||
|
||||
public final void names(Collection<SQLName> exprCol) throws ParserException {
|
||||
public final void names(Collection<SQLName> exprCol) {
|
||||
if (lexer.token() == Token.RBRACE) {
|
||||
return;
|
||||
}
|
||||
@@ -594,7 +594,7 @@ public class SQLExprParser extends SQLParser {
|
||||
}
|
||||
}
|
||||
|
||||
public final void exprList(Collection<SQLExpr> exprCol) throws ParserException {
|
||||
public final void exprList(Collection<SQLExpr> exprCol) {
|
||||
if (lexer.token() == Token.RPAREN || lexer.token() == Token.RBRACKET) {
|
||||
return;
|
||||
}
|
||||
@@ -613,7 +613,7 @@ public class SQLExprParser extends SQLParser {
|
||||
}
|
||||
}
|
||||
|
||||
public SQLName name() throws ParserException {
|
||||
public SQLName name() {
|
||||
String identName;
|
||||
if (lexer.token() == Token.LITERAL_ALIAS) {
|
||||
identName = '"' + lexer.stringVal() + '"';
|
||||
@@ -636,7 +636,7 @@ public class SQLExprParser extends SQLParser {
|
||||
return name;
|
||||
}
|
||||
|
||||
public SQLName nameRest(SQLName name) throws ParserException {
|
||||
public SQLName nameRest(SQLName name) {
|
||||
if (lexer.token() == Token.DOT) {
|
||||
lexer.nextToken();
|
||||
|
||||
@@ -675,7 +675,7 @@ public class SQLExprParser extends SQLParser {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected SQLAggregateExpr parseAggregateExpr(String methodName) throws ParserException {
|
||||
protected SQLAggregateExpr parseAggregateExpr(String methodName) {
|
||||
methodName = methodName.toUpperCase();
|
||||
|
||||
SQLAggregateExpr aggregateExpr;
|
||||
@@ -696,7 +696,7 @@ public class SQLExprParser extends SQLParser {
|
||||
return aggregateExpr;
|
||||
}
|
||||
|
||||
public SQLOrderBy parseOrderBy() throws ParserException {
|
||||
public SQLOrderBy parseOrderBy() {
|
||||
if (lexer.token() == Token.ORDER) {
|
||||
SQLOrderBy orderBy = new SQLOrderBy();
|
||||
|
||||
@@ -717,7 +717,7 @@ public class SQLExprParser extends SQLParser {
|
||||
return null;
|
||||
}
|
||||
|
||||
public SQLSelectOrderByItem parseSelectOrderByItem() throws ParserException {
|
||||
public SQLSelectOrderByItem parseSelectOrderByItem() {
|
||||
SQLSelectOrderByItem item = new SQLSelectOrderByItem();
|
||||
|
||||
item.setExpr(expr());
|
||||
@@ -733,12 +733,12 @@ public class SQLExprParser extends SQLParser {
|
||||
return item;
|
||||
}
|
||||
|
||||
public final SQLExpr bitAnd() throws ParserException {
|
||||
public final SQLExpr bitAnd() {
|
||||
SQLExpr expr = shift();
|
||||
return bitAndRest(expr);
|
||||
}
|
||||
|
||||
public final SQLExpr bitAndRest(SQLExpr expr) throws ParserException {
|
||||
public final SQLExpr bitAndRest(SQLExpr expr) {
|
||||
while (lexer.token() == Token.AMP) {
|
||||
lexer.nextToken();
|
||||
SQLExpr rightExp = shift();
|
||||
@@ -747,12 +747,12 @@ public class SQLExprParser extends SQLParser {
|
||||
return expr;
|
||||
}
|
||||
|
||||
public final SQLExpr bitOr() throws ParserException {
|
||||
public final SQLExpr bitOr() {
|
||||
SQLExpr expr = bitAnd();
|
||||
return bitOrRest(expr);
|
||||
}
|
||||
|
||||
public final SQLExpr bitOrRest(SQLExpr expr) throws ParserException {
|
||||
public final SQLExpr bitOrRest(SQLExpr expr) {
|
||||
if (lexer.token() == Token.BAR) {
|
||||
lexer.nextToken();
|
||||
SQLExpr rightExp = bitAnd();
|
||||
@@ -767,12 +767,12 @@ public class SQLExprParser extends SQLParser {
|
||||
return expr;
|
||||
}
|
||||
|
||||
public final SQLExpr equality() throws ParserException {
|
||||
public final SQLExpr equality() {
|
||||
SQLExpr expr = shift();
|
||||
return equalityRest(expr);
|
||||
}
|
||||
|
||||
public SQLExpr equalityRest(SQLExpr expr) throws ParserException {
|
||||
public SQLExpr equalityRest(SQLExpr expr) {
|
||||
SQLExpr rightExp;
|
||||
if (lexer.token() == Token.EQ) {
|
||||
lexer.nextToken();
|
||||
@@ -797,7 +797,7 @@ public class SQLExprParser extends SQLParser {
|
||||
return expr;
|
||||
}
|
||||
|
||||
public final SQLExpr inRest(SQLExpr expr) throws ParserException {
|
||||
public final SQLExpr inRest(SQLExpr expr) {
|
||||
if (lexer.token() == Token.IN) {
|
||||
lexer.nextToken();
|
||||
accept(Token.LPAREN);
|
||||
@@ -823,12 +823,12 @@ public class SQLExprParser extends SQLParser {
|
||||
return expr;
|
||||
}
|
||||
|
||||
public final SQLExpr additive() throws ParserException {
|
||||
public final SQLExpr additive() {
|
||||
SQLExpr expr = multiplicative();
|
||||
return additiveRest(expr);
|
||||
}
|
||||
|
||||
public SQLExpr additiveRest(SQLExpr expr) throws ParserException {
|
||||
public SQLExpr additiveRest(SQLExpr expr) {
|
||||
if (lexer.token() == Token.PLUS) {
|
||||
lexer.nextToken();
|
||||
SQLExpr rightExp = multiplicative();
|
||||
@@ -851,12 +851,12 @@ public class SQLExprParser extends SQLParser {
|
||||
return expr;
|
||||
}
|
||||
|
||||
public final SQLExpr shift() throws ParserException {
|
||||
public final SQLExpr shift() {
|
||||
SQLExpr expr = additive();
|
||||
return shiftRest(expr);
|
||||
}
|
||||
|
||||
public SQLExpr shiftRest(SQLExpr expr) throws ParserException {
|
||||
public SQLExpr shiftRest(SQLExpr expr) {
|
||||
if (lexer.token() == Token.LTLT) {
|
||||
lexer.nextToken();
|
||||
SQLExpr rightExp = additive();
|
||||
@@ -874,12 +874,12 @@ public class SQLExprParser extends SQLParser {
|
||||
return expr;
|
||||
}
|
||||
|
||||
public SQLExpr and() throws ParserException {
|
||||
public SQLExpr and() {
|
||||
SQLExpr expr = relational();
|
||||
return andRest(expr);
|
||||
}
|
||||
|
||||
public SQLExpr andRest(SQLExpr expr) throws ParserException {
|
||||
public SQLExpr andRest(SQLExpr expr) {
|
||||
for (;;) {
|
||||
if (lexer.token() == Token.AND || lexer.token() == Token.AMPAMP) {
|
||||
lexer.nextToken();
|
||||
@@ -894,12 +894,12 @@ public class SQLExprParser extends SQLParser {
|
||||
return expr;
|
||||
}
|
||||
|
||||
public SQLExpr or() throws ParserException {
|
||||
public SQLExpr or() {
|
||||
SQLExpr expr = and();
|
||||
return orRest(expr);
|
||||
}
|
||||
|
||||
public SQLExpr orRest(SQLExpr expr) throws ParserException {
|
||||
public SQLExpr orRest(SQLExpr expr) {
|
||||
|
||||
for (;;) {
|
||||
if (lexer.token() == Token.OR) {
|
||||
@@ -920,24 +920,24 @@ public class SQLExprParser extends SQLParser {
|
||||
return expr;
|
||||
}
|
||||
|
||||
public SQLExpr relational() throws ParserException {
|
||||
public SQLExpr relational() {
|
||||
SQLExpr expr = equality();
|
||||
|
||||
return relationalRest(expr);
|
||||
}
|
||||
|
||||
public SQLExpr relationalRest(SQLExpr expr) throws ParserException {
|
||||
public SQLExpr relationalRest(SQLExpr expr) {
|
||||
SQLExpr rightExp;
|
||||
|
||||
if (lexer.token() == Token.LT) {
|
||||
SQLBinaryOperator op = SQLBinaryOperator.LessThan;
|
||||
|
||||
|
||||
lexer.nextToken();
|
||||
if (lexer.token() == Token.EQ) {
|
||||
lexer.nextToken();
|
||||
op = SQLBinaryOperator.LessThanOrEqual;
|
||||
}
|
||||
|
||||
|
||||
rightExp = bitOr();
|
||||
expr = new SQLBinaryOpExpr(expr, op, rightExp);
|
||||
// expr = relationalRest(expr);
|
||||
@@ -1086,7 +1086,7 @@ public class SQLExprParser extends SQLParser {
|
||||
return expr;
|
||||
}
|
||||
|
||||
public SQLDataType parseDataType() throws ParserException {
|
||||
public SQLDataType parseDataType() {
|
||||
|
||||
if (lexer.token() == Token.DEFAULT || lexer.token() == Token.NOT || lexer.token() == Token.NULL) {
|
||||
return null;
|
||||
|
||||
@@ -19,9 +19,7 @@ import java.util.AbstractCollection;
|
||||
import java.util.AbstractMap;
|
||||
import java.util.AbstractSet;
|
||||
import java.util.Collection;
|
||||
import java.util.ConcurrentModificationException;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
@@ -809,16 +807,6 @@ public class ConcurrentIdentityHashMap<K, V> extends AbstractMap<K, V> implement
|
||||
return found;
|
||||
}
|
||||
|
||||
/**
|
||||
* Legacy method testing if some key maps into the specified value in this table. This method is identical in
|
||||
* functionality to {@link #containsValue}, and exists solely to ensure full compatibility with class
|
||||
* {@link Hashtable}, which supported this method prior to introduction of the Java Collections framework.
|
||||
*
|
||||
* @param value a value to search for
|
||||
* @return <tt>true</tt> if and only if some key maps to the <tt>value</tt> argument in this table as determined by
|
||||
* the <tt>equals</tt> method; <tt>false</tt> otherwise
|
||||
* @throws NullPointerException if the specified value is null
|
||||
*/
|
||||
public boolean contains(Object value) {
|
||||
return containsValue(value);
|
||||
}
|
||||
@@ -937,51 +925,18 @@ public class ConcurrentIdentityHashMap<K, V> extends AbstractMap<K, V> implement
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link Set} view of the keys contained in this map. The set is backed by the map, so changes to the map
|
||||
* are reflected in the set, and vice-versa. The set supports element removal, which removes the corresponding
|
||||
* mapping from this map, via the <tt>Iterator.remove</tt>, <tt>Set.remove</tt>, <tt>removeAll</tt>,
|
||||
* <tt>retainAll</tt>, and <tt>clear</tt> operations. It does not support the <tt>add</tt> or <tt>addAll</tt>
|
||||
* operations.
|
||||
* <p>
|
||||
* The view's <tt>iterator</tt> is a "weakly consistent" iterator that will never throw
|
||||
* {@link ConcurrentModificationException}, and guarantees to traverse elements as they existed upon construction of
|
||||
* the iterator, and may (but is not guaranteed to) reflect any modifications subsequent to construction.
|
||||
*/
|
||||
@Override
|
||||
public Set<K> keySet() {
|
||||
Set<K> ks = keySet;
|
||||
return ks != null ? ks : (keySet = new KeySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link Collection} view of the values contained in this map. The collection is backed by the map, so
|
||||
* changes to the map are reflected in the collection, and vice-versa. The collection supports element removal,
|
||||
* which removes the corresponding mapping from this map, via the <tt>Iterator.remove</tt>,
|
||||
* <tt>Collection.remove</tt>, <tt>removeAll</tt>, <tt>retainAll</tt>, and <tt>clear</tt> operations. It does not
|
||||
* support the <tt>add</tt> or <tt>addAll</tt> operations.
|
||||
* <p>
|
||||
* The view's <tt>iterator</tt> is a "weakly consistent" iterator that will never throw
|
||||
* {@link ConcurrentModificationException}, and guarantees to traverse elements as they existed upon construction of
|
||||
* the iterator, and may (but is not guaranteed to) reflect any modifications subsequent to construction.
|
||||
*/
|
||||
@Override
|
||||
public Collection<V> values() {
|
||||
Collection<V> vs = values;
|
||||
return vs != null ? vs : (values = new Values());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link Set} view of the mappings contained in this map. The set is backed by the map, so changes to the
|
||||
* map are reflected in the set, and vice-versa. The set supports element removal, which removes the corresponding
|
||||
* mapping from the map, via the <tt>Iterator.remove</tt>, <tt>Set.remove</tt>, <tt>removeAll</tt>,
|
||||
* <tt>retainAll</tt>, and <tt>clear</tt> operations. It does not support the <tt>add</tt> or <tt>addAll</tt>
|
||||
* operations.
|
||||
* <p>
|
||||
* The view's <tt>iterator</tt> is a "weakly consistent" iterator that will never throw
|
||||
* {@link ConcurrentModificationException}, and guarantees to traverse elements as they existed upon construction of
|
||||
* the iterator, and may (but is not guaranteed to) reflect any modifications subsequent to construction.
|
||||
*/
|
||||
@Override
|
||||
public Set<Map.Entry<K, V>> entrySet() {
|
||||
Set<Map.Entry<K, V>> es = entrySet;
|
||||
|
||||
Reference in New Issue
Block a user