There are a number of issues that have been introduced in J2SE 1.4 that may cause problems when used
to compile the Barracuda source. Some are minor (produce only warnings) and some are major (produce errors). There seems to be only one major issue
currently. We'll start off with that...
Issues that may cause errors using J2SE 1.4
As of J2SE 1.4, Sun started including packages such as
org.w3c.dom and org.xml.sax in the standard runtime environment. This is great, but given the needs of developers for different versions
of these packages, it isn't difficult to forsee incompatibilities occurring...more specifically, incompatibilities with XMLC compilation.
In fact, a number of Barracuda developers noticed that attempting to compile XMLC templates with the default install of J2SE 1.4 resulted
in compile errors. After a bit of research, it has been discovered that Sun had considered this issue and provided a way out of their default packages.
They call this "Endorsed Standards Override Mechanism" (ESOM).
The following are instructions on how to utilize ESOM
- Create a directory called "endorsed" in the jre/lib/ (where "jre" is the one specified by the plugin app).
Actually, I made double sure and did this to both the JRE in the J2SDK directory and the stand-alone JRE directory that is also installed by the J2SDK.
For instance, I created the "endorsed" directory (on windows) in "C:\j2sdk1.4.0-beta3\jre\lib\endorsed" and
"C:\Program Files\Java\j2re1.4.0-beta3\lib\endorsed"
- Copy xmlc.jar to the new "endorsed" directories
- compile barracuda just like normal (make sure you do a java -version to double check that the current java version being run is something like "build 1.4.0-beta3-b84, mixed mode")
Make sure to note the other packages included in the ESOM doc, but the above should get the barracuda project and any other basic XMLC based project to compile under J2SE 1.4.
For more information on ESOM, visit http://java.sun.com/j2se/1.4/docs/guide/standards/index.html
Issues that may cause warnings using J2SE 1.4
There are some other issues to note when using J2SE 1.4 of which are detailed below...
Assert syntax
When compiling the Barracuda source (as of 11/29/2001) under J2SE 1.4, you will probably see a bunch of warnings like "warning: as of release 1.4, assert is a keyword, and may not be used as an identifier". This is happening when it sees syntax such as
assert("Parental check 3 failed...root parent not correctly located", pchild2.getRootParent()==proot);.
This is one area where J2SE 1.4 has broken compatibility with previous JSDK's. However, two modes are supported and the default mode is backwards compatible with J2SE 1.3 to ease the transition to J2SE 1.4. Below is a quote from Sun's compatibility doc...
The assert keyword has been added to the Java Programming Language
in J2SE 1.4. Because of the new keyword, existing programs that use
"assert" as an identifier will not be in conformance with J2SE 1.4.
The addition of this keyword does not, however, cause any
problems with the use of preexisting binaries (.class files).
In order to ease the transition from pre-J2SE 1.4 releases in which
assert is a legal identifier to J2SE 1.4 where it isn't, the
Javac bytecode compiler supports two modes of operation in J2SE 1.4.
- In the normal mode of operation, the compiler accepts programs
conforming to the specification for the previous release (J2SE 1.3).
Assertions are not permitted, and the compiler generates a
warning if the assert keyword is used as an identifier.
- In an alternate mode of operation, the compiler accepts programs
conforming to the specification for J2SE 1.4. Assertions are
permitted, and the compiler generates an error message if the
assert keyword is used as an identifier.
To enable assertions, use the following command line switch:
-source 1.4
In the absence of this flag, the behavior defaults to "1.3" for maximal
source compatibility. Support for 1.3 source compatibility is likely to be
phased out over time.
Of course, the obvious question is "what syntax do we use when writing new code for Baracuda or an app that uses Barracuda"? The answer will have to come as consensus from the Barracuda community, but a good rule-of-thumb, for now, is probaby to continue using the old syntax util we make a decision to require, no less than, J2SE 1.4 for compilation and runtime with Barracuda based apps
For more information on incompatibilities introduced in J2SE 1.4, visit http://java.sun.com/j2se/1.4/compatibility.html#incompatibilities1.4
Javadoc
There is some javadoc syntax that has changed between J2SE 1.4 and previous J2SDK's. Running Javadoc on the Barracuda source (as of 11/29/2001) produces 79 warnings with J2SDK 1.4 beta3. Some may be due to bugs, but others are due to Javadoc syntax changes.
For more information on Javadoc changes in J2SE 1.4, visit http://java.sun.com/j2se/1.4/docs/tooldocs/javadoc/whatsnew-1.4.html
General J2SE 1.4 Information
|