Watch Out for Java Reserved Words

I ran into an annoying one today. I have code that has been working for years, and recently moved lots of the core processing into a CFC. And everything kept working properly. I then started tinkering with Flash Remoting, and everything kept working properly. And then I tried invoking CFC methods via SOAP, that’s when I ran into all sorts of Axis errors.
The problem? The code was for adding a new profile, and so one of my parent directories was logically named “new”. That “new” become part of the package name, and “new” is a reserved word in Java. Renaming the directory solved the problem. What made this one painful was that “new” is fine for ColdFusion code, and even for CFCs accessed via Flash Remoting, it is only when Web Service access was introduced that this cropped up.
The moral of the story? Watch out for Java reserved words. lists Java’s reserved keywords, it would be best to keep the list handy.

3 responses to “Watch Out for Java Reserved Words”

  1. PaulH Avatar

    java had a goto? thats rich 😉

  2. Ben Forta Avatar
    Ben Forta

    But it is not currently used Paul, maybe they just don’t want to use it but don’t want anyone else using it either. 🙂

  3. Tjarko Avatar

    Hahaha.. preserved word "finally".. I wonder if that’s something from the old days.. jezus.. that applet "finally" loaded 😉

Leave a Reply