PATCH: java instance initializers

Alexandre Petit-Bianco apbianco@cygnus.com
Tue Jul 3 08:57:00 GMT 2001


Jeff Sturm writes:

> If a java class contains instance initializers called through a
> constructor invoking `this', the initializers are executed twice:

Good catch. Thanks.

> The patch below fixes this bug and passes the libgcj testsuite.  OK
> for trunk?

Yes.

> @@ -8544,6 +8545,9 @@
>  	  {
>  	  case CALL_EXPR:
>  	    found = CALL_EXPLICIT_CONSTRUCTOR_P (body);
> +	    if (EXPR_WFL_NODE (TREE_OPERAND (body, 0)) == 
> +		  this_identifier_node)
> +	      invokes_this = 1;
>  	    body = NULL_TREE;
>  	    break;
>  	  case COMPOUND_EXPR:

I would just say:

>  	  {
>  	  case CALL_EXPR:
>  	    found = CALL_EXPLICIT_CONSTRUCTOR_P (body);
> +         invokes_this = CALL_THIS_CONSTRUCTOR_P (body)
>  	    body = NULL_TREE;
>  	    break;
>  	  case COMPOUND_EXPR:

./A



More information about the Java-patches mailing list