[Libguestfs] [PATCH 3/3] java: add @Deprecated annotation for deprecated methods

Richard W.M. Jones rjones at redhat.com
Wed Feb 11 13:54:09 UTC 2015


On Tue, Feb 10, 2015 at 03:12:26PM +0100, Pino Toscano wrote:
> ---
>  generator/java.ml | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/generator/java.ml b/generator/java.ml
> index 8b0d12f..81faff1 100644
> --- a/generator/java.ml
> +++ b/generator/java.ml
> @@ -280,7 +280,11 @@ public class GuestFS {
>          pr "   */\n";
>        );
>        pr "  ";
> -      generate_java_prototype ~public:true ~semicolon:false f.name f.style;
> +      let deprecated =
> +        match f with
> +        | { deprecated_by = None } -> false
> +        | { deprecated_by = Some _ } -> true in
> +      generate_java_prototype ~public:true ~semicolon:false ~deprecated f.name f.style;
>        pr "\n";
>        pr "  {\n";
>        pr "    if (g == 0)\n";
> @@ -421,7 +425,8 @@ and generate_java_call_args ~handle (_, args, optargs) =
>    pr ")"
>  
>  and generate_java_prototype ?(public=false) ?(privat=false) ?(native=false)
> -    ?(semicolon=true) name (ret, args, optargs) =
> +    ?(semicolon=true) ?(deprecated=false) name (ret, args, optargs) =
> +  if deprecated then pr "@Deprecated ";
>    if privat then pr "private ";
>    if public then pr "public ";
>    if native then pr "native ";

ACK series.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/




More information about the Libguestfs mailing list