mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-21 10:13:03 +00:00
java: avoid Integer(String), use parseInt
examples/java/calc/Calc.java:1531: warning: [deprecation] Integer(String) in Integer has been deprecated
yylval = new Integer(st.sval);
^
* examples/java/calc/Calc.y, examples/java/simple/Calc.y,
* tests/calc.at, tests/scanner.at: Use Integer.parseInt.
This commit is contained in:
@@ -199,8 +199,8 @@ m4_define([AT_RAW_YYLEX(java)],
|
||||
return yylval;
|
||||
}
|
||||
|
||||
public int yylex () throws IOException {
|
||||
int ttype = st.nextToken ();
|
||||
public int yylex() throws IOException {
|
||||
int ttype = st.nextToken();
|
||||
switch (ttype)
|
||||
{
|
||||
case StreamTokenizer.TT_EOF:
|
||||
@@ -208,7 +208,7 @@ m4_define([AT_RAW_YYLEX(java)],
|
||||
case StreamTokenizer.TT_EOL:
|
||||
return (int) '\n';
|
||||
case StreamTokenizer.TT_WORD:
|
||||
yylval = new Integer (st.sval);
|
||||
yylval = Integer.parseInt(st.sval);
|
||||
return NUM;
|
||||
case '+':
|
||||
return PLUS;
|
||||
@@ -223,7 +223,7 @@ m4_define([AT_RAW_YYLEX(java)],
|
||||
case ')':
|
||||
return RPAR;
|
||||
default:
|
||||
throw new AssertionError ("invalid character: " + ttype);
|
||||
throw new AssertionError("invalid character: " + ttype);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user