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:
Akim Demaille
2020-11-03 08:34:00 +01:00
parent d156910453
commit f7a7310433
4 changed files with 13 additions and 13 deletions

View File

@@ -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);
}
}
}