From 810b2aa94112578e4557705a0530f3257c8b3de5 Mon Sep 17 00:00:00 2001 From: Peter Reilly Date: Mon, 8 Sep 2003 13:43:32 +0000 Subject: [PATCH] attempt to remove java 1.1 requirement from guildline add reference to check.xml git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275202 13f79535-47bb-0310-9956-ffa450edef68 --- docs/ant_task_guidelines.html | 43 +++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/docs/ant_task_guidelines.html b/docs/ant_task_guidelines.html index 96ac76830..b863d40ad 100644 --- a/docs/ant_task_guidelines.html +++ b/docs/ant_task_guidelines.html @@ -26,7 +26,7 @@ double "$$" got mapped to "$" for backwards compatibility.

Use built in helper classes

-Ant includes helper tasks to simplify mauch of your work. Be warned that +Ant includes helper tasks to simplify much of your work. Be warned that these helper classes will look very different in ant2.0 from these 1.x versions. However it is still better to use them than roll your own, for development, maintenance and code size reasons. @@ -82,6 +82,10 @@ not eight, four. Even if your editor is configured to have a tab of four spaces, lots of others aren't -spaces have more consistency across editors and platforms. Some IDEs (JEdit) can highlight tabs, to stop you accidentally inserting them +

+There is an ant build file check.xml in the main ant directory with runs + checkstyle over + ant's source code.

Attributes and elements

Use the Ant introspection based mapping of attributes into Java datatypes, @@ -176,33 +180,38 @@ Tasks which don't do any dependency checking do not help users as much as they can, because their needless work can trickle through the entire build, test and deploy process. -

Support Java 1.1 through Java 1.4

+

Support Java 1.2 through Java 1.4

-Ant is designed to support Java1.1: to build on it, to run on it. Sometimes -functionality of tasks have to degrade in that environment -<touch> -is a case in point- this is usually due to library limitations; +Ant1.5 and lower was designed to support Java1.1. Ant1.6 and higher +is designed to support Java1.2: to build on it, to run on it. Sometimes +functionality of tasks have to degrade in that environment +- this is usually due to library limitations; such behaviour change must always be noted in the documentation.

-What is problematic is code which is dependent on Java1.2 features --Collections, Reader and Writer classes, extra methods in older classes. +What is problematic is code which is dependent on Java1.3 features +-java.lang.reflect.Proxy, or Java1.4 features - java.io.nio for example. +Be also aware of extra +methods in older classes - like StringBuffer#append(StringBuffer). These can not be used directly by any code and still be able to compile -and run on a Java 1.1 system. So please stick to the older collection -classes, and the older IO classes. If a new method in an existing class +and run on a Java 1.2 system. +If a new method in an existing class is to be used, it must be used via reflection and the NoSuchMethodException handled somehow.

-What if code simply does not work on Java1.1? It can happen. It will +What if code simply does not work on Java1.2? It can happen. It will probably be OK to have the task as an optional task, with compilation -restricted to Java1.2 or later through build.xml modifications. +restricted to Java1.3 or later through build.xml modifications. Better still, use reflection to link to the classes at run time.

Java 1.4 adds a new optional change to the language itself, the assert keyword, which is only enabled if the compiler is told -to compile 1.4 version source. Clearly with the 1.1 compatibility requirement, +to compile 1.4 version source. Clearly with the 1.2 compatibility requirement, Ant tasks can not use this keyword. They also need to move away from using the JUnit assert() method and call assertTrue() instead. - +

+Java 1.5 will (perhaps) add a new keyword - enum, one should avoid +this for future compatibility.

Refactor

@@ -256,8 +265,8 @@ utterly essential to many users.

-Remember also that Ant 1.x is designed to compile and run on Java1.1, so -you should test on Java 1.1 as well as any later version which you use. +Remember also that Ant 1.x is designed to compile and run on Java1.2, so +you should test on Java 1.2 as well as any later version which you use. You can download an old SDK from Sun for this purpose.

Finally, run a full build test before and after you start @@ -427,7 +436,7 @@ cases, while documentation helps sell the reason for a task.

Checklist before submitting a patch