Compatibility with javalib 3.0

Summary:
javalib 3.0 adds more support for lambdas and instance methods in interfaces.

Java constant type has 2 more constructors. We don't handle them when
generating SIL (as before) but at least we are compatible with
javalib 3.0

Reviewed By: jvillard

Differential Revision: D16030479

fbshipit-source-id: 0b1508482
master
David Pichardie 6 years ago committed by Facebook Github Bot
parent e803a30c2d
commit 95e90f741c

@ -7,7 +7,6 @@
*) *)
open! IStd open! IStd
open Javalib_pack
(** {2 Class names and types} *) (** {2 Class names and types} *)
@ -15,12 +14,6 @@ let builtins_package = "com.facebook.infer.builtins"
let infer_builtins_cl = builtins_package ^ ".InferBuiltins" let infer_builtins_cl = builtins_package ^ ".InferBuiltins"
let obj_type = JBasics.TObject (JBasics.TClass JBasics.java_lang_object)
let string_cl = "java.lang.String"
let class_cl = "java.lang.Class"
let npe_cl = "java.lang.NullPointerException" let npe_cl = "java.lang.NullPointerException"
let cce_cl = "java.lang.ClassCastException" let cce_cl = "java.lang.ClassCastException"

@ -6,13 +6,6 @@
*) *)
open! IStd open! IStd
open Javalib_pack
val string_cl : string
val class_cl : string
val obj_type : JBasics.value_type
val boolean_code : string val boolean_code : string

@ -175,6 +175,10 @@ let get_constant (c : JBir.const) =
Const.Cint (IntLit.of_int64 i64) Const.Cint (IntLit.of_int64 i64)
| `String jstr -> | `String jstr ->
Const.Cstr (JBasics.jstr_pp jstr) Const.Cstr (JBasics.jstr_pp jstr)
| `MethodType _ ->
raise (Frontend_error "MethodType constant")
| `MethodHandle _ ->
raise (Frontend_error "MethodHandle constant")
let get_binop typ binop = let get_binop typ binop =
@ -256,7 +260,7 @@ let get_bytecode cm =
Array.map Array.map
~f:(function ~f:(function
| JCode.OpInvoke (`Dynamic _, ms) -> | JCode.OpInvoke (`Dynamic _, ms) ->
JCode.OpInvoke (`Static JBasics.java_lang_object, ms) JCode.OpInvoke (`Static (`Class, JBasics.java_lang_object), ms)
| opcode -> | opcode ->
opcode ) opcode )
bytecode.JCode.c_code bytecode.JCode.c_code

@ -51,23 +51,7 @@ let cast_type = function
Typ.mk (Typ.Tint Typ.IShort) Typ.mk (Typ.Tint Typ.IShort)
let const_type const = let const_type const = JBir.type_of_expr (JBir.Const const)
match const with
| `String _ ->
JBasics.TObject (JBasics.TClass (JBasics.make_cn JConfig.string_cl))
| `Class _ ->
JBasics.TObject (JBasics.TClass (JBasics.make_cn JConfig.class_cl))
| `Double _ ->
JBasics.TBasic `Double
| `Int _ ->
JBasics.TBasic `Int
| `Float _ ->
JBasics.TBasic `Float
| `Long _ ->
JBasics.TBasic `Long
| `ANull ->
JConfig.obj_type
let typename_of_classname cn = Typ.Name.Java.from_string (JBasics.cn_name cn) let typename_of_classname cn = Typ.Name.Java.from_string (JBasics.cn_name cn)

@ -53,14 +53,14 @@ depends: [
"cppo" {= "1.6.5"} "cppo" {= "1.6.5"}
"cppo_ocamlbuild" {= "1.6.0"} "cppo_ocamlbuild" {= "1.6.0"}
"ctypes" {= "0.14.0"} "ctypes" {= "0.14.0"}
"dune" {= "1.6.2"} "dune" {= "1.6.3"}
"easy-format" {= "1.3.1"} "easy-format" {= "1.3.1"}
"elina" {= "1.1"} "elina" {= "1.1"}
"extlib" {= "1.7.5"} "extlib" {= "1.7.5"}
"fieldslib" {= "v0.11.0"} "fieldslib" {= "v0.11.0"}
"integers" {= "0.2.2"} "integers" {= "0.2.2"}
"jane-street-headers" {= "v0.11.0"} "jane-street-headers" {= "v0.11.0"}
"javalib" {= "2.3.6"} "javalib" {= "3.0"}
"jbuilder" {= "transition"} "jbuilder" {= "transition"}
"menhir" {= "20181113"} "menhir" {= "20181113"}
"mlgmpidl" {= "1.2.7"} "mlgmpidl" {= "1.2.7"}
@ -108,7 +108,7 @@ depends: [
"ppxlib" {= "0.3.1"} "ppxlib" {= "0.3.1"}
"re" {= "1.8.0"} "re" {= "1.8.0"}
"result" {= "1.3"} "result" {= "1.3"}
"sawja" {= "1.5.5"} "sawja" {= "1.5.6"}
"seq" {= "base"} "seq" {= "base"}
"sexplib" {= "v0.11.0"} "sexplib" {= "v0.11.0"}
"sexplib0" {= "v0.11.0"} "sexplib0" {= "v0.11.0"}

Loading…
Cancel
Save