Fix printing of fields in Java

Reviewed By: mbouaziz

Differential Revision: D8874270

fbshipit-source-id: 1e90754aa
master
Ezgi Çiçek 6 years ago committed by Facebook Github Bot
parent c2416defed
commit 34c2899a69

@ -70,10 +70,13 @@ module SymbolPath = struct
let rec pp_partial fmt = function
| Pvar pvar ->
Pvar.pp_value fmt pvar
(* Temporary fix, see T31250173 *)
| Index p when Language.curr_language_is Java ->
F.fprintf fmt "%a" pp_partial p
| Index p ->
F.fprintf fmt "%a[*]" pp_partial p
| Field (fn, p) ->
F.fprintf fmt "%a.%a" pp_partial p Typ.Fieldname.pp fn
F.fprintf fmt "%a.%s" pp_partial p (Typ.Fieldname.to_flat_string fn)
let pp fmt = function

@ -0,0 +1,23 @@
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package codetoanalyze.java.performance;
public class FieldAccess{
public class Test{
int a;
}
void iterate_upto_field_size(Test test){
for (int ci = 0; ci < test.a; ++ci) {
}
}
}

@ -48,6 +48,8 @@ codetoanalyze/java/performance/Cost_test_deps.java, int Cost_test_deps.two_loops
codetoanalyze/java/performance/Cost_test_deps.java, void Cost_test_deps.if_bad(int), 6, EXPENSIVE_EXECUTION_TIME_CALL, no_bucket, ERROR, [with estimated cost 608]
codetoanalyze/java/performance/Cost_test_deps.java, void Cost_test_deps.if_bad(int), 6, EXPENSIVE_EXECUTION_TIME_CALL, no_bucket, ERROR, [with estimated cost 607]
codetoanalyze/java/performance/EvilCfg.java, void EvilCfg.foo(int,int,boolean), 0, INFINITE_EXECUTION_TIME_CALL, no_bucket, ERROR, []
codetoanalyze/java/performance/FieldAccess.java, void FieldAccess.iterate_upto_field_size(FieldAccess$Test), 1, EXPENSIVE_EXECUTION_TIME_CALL, no_bucket, ERROR, [with estimated cost 2 + 6 * test.a.ub]
codetoanalyze/java/performance/FieldAccess.java, void FieldAccess.iterate_upto_field_size(FieldAccess$Test), 1, EXPENSIVE_EXECUTION_TIME_CALL, no_bucket, ERROR, [with estimated cost 1 + 6 * test.a.ub]
codetoanalyze/java/performance/JsonArray.java, void JsonArray.addStringEntry(String), 0, INFINITE_EXECUTION_TIME_CALL, no_bucket, ERROR, []
codetoanalyze/java/performance/JsonMap.java, void JsonMap.addEntry(String,JsonType), 0, INFINITE_EXECUTION_TIME_CALL, no_bucket, ERROR, []
codetoanalyze/java/performance/JsonMap.java, void JsonMap.addEntry(String,Object), 0, INFINITE_EXECUTION_TIME_CALL, no_bucket, ERROR, []

Loading…
Cancel
Save