Grokbase Groups Ant user January 2015
Hi experts,

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?

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(

(above line is from line 39 of ant source code;a=blob;f=src/main/org/apache/tools/ant/property/;h=fb2fa9c0a80a4cadf0fbc3098eedef16fd710aa9;hb=1c927b15af84cfce315a0ef6f4db60c7d47c2c50,
also seen from many other tasks )

But actually it doesn't work as LocalProperties cannot be extended,
thus above assigning would cause class cast issue. So I'm confused, if
this is not supposed to be extended, then what's the point of having

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. To fix the
thread-safe issue in LocalPropertyStack on our side, I'd like to
create an alternative one by overriding following method in

61 /**
62 * Get the initial value.
63 * @return a new localproperties stack.
64 */
65 protected synchronized LocalPropertyStack initialValue() {
66 return new LocalPropertyStack();
67 }

Any input would be appreciated.

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

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
postedJan 15, '15 at 6:10a
activeJan 15, '15 at 6:10a

1 user in discussion

Gan Dong: 1 post



site design / logo © 2019 Grokbase