Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ java ] replace deprecated new Double by Double.valueOf #402

Merged
merged 1 commit into from
Nov 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions source/src/BNFC/Backend/Java/CFtoJLex15.hs
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ restOfJLex jflex rp cf = vcat
, ifC catString strStates
, ifC catChar chStates
, ifC catDouble
"<YYINITIAL>{DIGIT}+\".\"{DIGIT}+(\"e\"(\\-)?{DIGIT}+)? { return cf.newSymbol(\"\", sym._DOUBLE_, left_loc(), right_loc(), new Double(yytext())); }"
"<YYINITIAL>{DIGIT}+\".\"{DIGIT}+(\"e\"(\\-)?{DIGIT}+)? { return cf.newSymbol(\"\", sym._DOUBLE_, left_loc(), right_loc(), Double.valueOf(yytext())); }"
, ifC catInteger
"<YYINITIAL>{DIGIT}+ { return cf.newSymbol(\"\", sym._INTEGER_, left_loc(), right_loc(), new Integer(yytext())); }"
"<YYINITIAL>{DIGIT}+ { return cf.newSymbol(\"\", sym._INTEGER_, left_loc(), right_loc(), Integer.valueOf(yytext())); }"
, ifC catIdent
"<YYINITIAL>{LETTER}{IDENT}* { return cf.newSymbol(\"\", sym._IDENT_, left_loc(), right_loc(), yytext().intern()); }"
, "<YYINITIAL>[ \\t\\r\\n\\f] { /* ignore white space. */ }"
Expand Down
8 changes: 4 additions & 4 deletions source/src/BNFC/Backend/Java/CFtoJavaAbs15.hs
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ definedRules defs packageAbsyn cf = map rule defs
| isUpper (head x) -> callQ x es
| otherwise -> call (sanitize x) es
-- -- | x `elem` args -> call x es
LitInt n -> "new Integer(" ++ show n ++ ")"
LitDouble x -> "new Double(" ++ show x ++ ")"
LitChar c -> "new Character(" ++ show c ++ ")"
LitString s -> "new String(" ++ show s ++ ")"
LitInt n -> "Integer.valueOf(" ++ show n ++ ")"
LitDouble x -> "Double.valueOf(" ++ show x ++ ")"
LitChar c -> "Character.valueOf(" ++ show c ++ ")"
LitString s -> "String.valueOf(" ++ show s ++ ")"
where
call x es = x ++ "(" ++ intercalate ", " (map (javaExp args) es) ++ ")"
callQ = call . qualify
Expand Down