ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: [Patch] AntClassloader.java
Date Fri, 03 May 2002 15:36:56 GMT
This switch smells like ANT might benefit from having an abstract JavaDevKit
class with a String[] getSystemPackageRoots(), and concrete JavaDevKit1_1,
..., JavaDevKit1_4. Then again, if it's the only place ANT has JDK-specific
things it might not be worth the effort, but is it!?!?! --DD

-----Original Message-----
From: Steve Loughran [mailto:steve_l@iseran.com] 
Sent: Friday, May 03, 2002 2:04 AM
To: Ant Developer List
Subject: [Patch] AntClassloader.java

OK,

here is the first iteration on a patch to handle the fatter distro of
java1.4, part of my todo list for ant1.5

I have run ant test on this on 1.4, but am yet to write the tests to verify
that the classloading stuff works. Or more importantly, the tests to verify
that on java1.3 we dont get xalan or crimson in there. I may have a go next
week, while I sit in a meeting room somewhere just east of seattle. There's
something deeply amusing about the idea of coding open source java inside
the MS campus.

Anyhows. I wanted to bounce this source by to see how much it abused the
style rules. I'd have like JavaEnvUtils to have given me the java version
numerically...half this patch turns the strings into numbers, numbers that I
switch on with a fallthrough to always load the previous versions system
packages too.

I have left a placeholder for java1.5 in there too.

-steve

Index: AntClassLoader.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/AntClassLoader.java,v
retrieving revision 1.52.2.1
diff -r1.52.2.1 AntClassLoader.java
73a74
> import org.apache.tools.ant.util.JavaEnvUtils;
321,322c322
<         addSystemPackageRoot("java");
<         addSystemPackageRoot("javax");
---
>         addJavaLibraries();
1176a1177,1224
>     }
>
>     /**
>      * add any libraries that come with different java versions
>      * here
>      */
>     private void addJavaLibraries() {
>         //turn the version into an integer
>         int version=10;
>         String javaVersion=JavaEnvUtils.getJavaVersion();
>         if(javaVersion.equals(JavaEnvUtils.JAVA_1_1)) {
>             version=11;
>         } else if(javaVersion.equals(JavaEnvUtils.JAVA_1_2)) {
>             version=12;
>         } else if(javaVersion.equals(JavaEnvUtils.JAVA_1_3)) {
>             version=13;
>         } else if(javaVersion.equals(JavaEnvUtils.JAVA_1_4)) {
>             version=14;
>         } else {
>             //whatever it is, it is newer than what we know here
>             version=15;
>         }
>         //now switch off that, falling through as we go
>         //we are assuming that each version of java
>         //is a superset of the previous version
>         switch(version) {
>             case 15:
>             case 14:
>                 addSystemPackageRoot("org.apache.crimson");
>                 addSystemPackageRoot("org.apache.xalan");
>                 addSystemPackageRoot("org.apache.xml");
>                 addSystemPackageRoot("org.apache.xpath");
>                 addSystemPackageRoot("org.w3c.dom");
>                 addSystemPackageRoot("org.xml.sax");
>                 // fall through
>             case 13:
>                 addSystemPackageRoot("org.omg");
>                 // fall through
>             case 12:
>                 addSystemPackageRoot("");
>                 // fall through
>             case 11:
>             default:
>                 addSystemPackageRoot("java");
>                 addSystemPackageRoot("javax");
>                 break;
>         }
>



--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message