ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: cannot be extended
Date Tue, 20 Jan 2015 15:11:45 GMT
On 2015-01-15, Gan Dong wrote:

> Recently, I came across a problem in Ant and the solution seems to
> write a custom LocalProperties implementation to fix the issue. But I
> found that this class has a sole privet constructor which prevents me
> from sub-classing it:

> 55     /**
> 56      * Construct a new LocalProperties object.
> 57      */
> 58     private LocalProperties() {
> 59     }

> I'd like to know, is such design on purpose? What's the consideration
> in making it private?

Basically because we never felt this is an extension point we want to
support.  The class is not meant to be subclassed.

> I know Ant provided a mechanism as following which seems to have the
> ability to register user-defined LocalProperties class:

> LocalProperties l = (LocalProperties) project.getReference(

Ah, no.  There should only be a single LocalProperties stack for a
project and the code above is getting access to that.  Like a global
variable but hidden behind some smoke and mirrors.

> Some additional context on why I want to extend the class. Due to this
> ant bug:, our
> framework, which calls ant, occasionally throws
> ConcurrentModificationException when parallel is used.

I've been meaning to look into this, but failed to find the time to do
so so far.  LocalPropertyStack is supposed to be used only by a single
thread at a time, I'm surprised to see the
ConcurrentModificationException.  Rather than synchronizing the stack
I'd like to figure out where it leaks outside of its Thread and fix



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message