diff --git a/src/typing/typeloadFields.ml b/src/typing/typeloadFields.ml index a63a41a87f4..f1320af4951 100644 --- a/src/typing/typeloadFields.ml +++ b/src/typing/typeloadFields.ml @@ -1634,10 +1634,10 @@ let init_field (ctx,cctx,fctx) f = if not (has_class_flag c CExtern) && not (Meta.has Meta.Native f.cff_meta) then Typecore.check_field_name ctx name p; List.iter (fun acc -> match (fst acc, f.cff_kind) with - | APublic, _ | APrivate, _ | AStatic, _ | AFinal, FVar _ | AFinal, FFun _ | AExtern, _ -> () + | AFinal, FProp _ when not (has_class_flag c CExtern) && ctx.com.platform <> Java -> invalid_modifier_on_property ctx.com fctx (Ast.s_placed_access acc) (snd acc) + | APublic, _ | APrivate, _ | AStatic, _ | AFinal, _ | AExtern, _ -> () | ADynamic, FFun _ | AOverride, FFun _ | AMacro, FFun _ | AInline, FFun _ | AInline, FVar _ | AAbstract, FFun _ | AOverload, FFun _ -> () | AEnum, (FVar _ | FProp _) -> () - | AFinal, FProp _ -> invalid_modifier_on_property ctx.com fctx (Ast.s_placed_access acc) (snd acc) | _, FVar _ -> display_error ctx.com ("Invalid accessor '" ^ Ast.s_placed_access acc ^ "' for variable " ^ name) (snd acc) | _, FProp _ -> display_error ctx.com ("Invalid accessor '" ^ Ast.s_placed_access acc ^ "' for property " ^ name) (snd acc) | _, FFun _ -> display_error ctx.com ("Invalid accessor '" ^ Ast.s_placed_access acc ^ "' for function " ^ name) (snd acc)