ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <>
Subject Re: svn commit: r1035335 - in /ant/core/trunk/src/main/org/apache/tools/ant: helper/ taskdefs/
Date Mon, 15 Nov 2010 18:10:31 GMT
2010/11/15 Nicolas Lalevée <>:
> I saw that class EnumeratedAttribute, but it helps to define enums only from the IntrospectionHelper.
When I started to use that class, the strings no-so-enum were still "leaked" through the Java
API of the ProjectHelper.


> So I implemented a class that behave like the Java 5 enums, where there is no possibility
at compile time to have any other value than the predefined ones.

Right. Note that that if it was serializable, new instances would
still be recreated by the framework, and would need to be replaced
before the world could see them (using readReplace()).

> Then on the IntrospectionHelper side, it still see a simple string. So the code that
checks the values is still in the implementation of the target (well actually delegated with
some error rethrowing).

Which still leaves the door open for passing any string at the API
level. But I agree that EnumeratedAttribute's string-based approach is
not ideal either.

> But maybe I should continue, make an EnumeratedAttribute which make the bridge with the
enum like class OnMissingExtensionPoint. But it won't save much code.


> I got an idea. What about creating an interface Enum which will be a marker for classes
which are expected to have a valueOf static method (like for every enum in java 5), and have
IntrospectionHelper support that ? I think that it could be done easily in IntrospectionHelper#getEnumSetter
> WDYT ?

Given that IH already handles java.lang.Enum, maybe it's too late to
do this. Then again, Ant being JDK 1.4 based could use it.

This is all nitpicking on my part already, so don't worry about it.
What you have it fine. --DD

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

View raw message