CFC Method/UDF Gotcha

I ran across a bug today when I tried to make a CFC method called "notify". The error said that notify was already defined. This seemed odd since I was certain that notify wasn't already defined in the CFC.

Turns out that you can't name UDFs, or methods, with the same name as public methods in the underlying Java class hierarchy.

Archived Comments

Comment 1 by Bryan F. Hogan posted on 7/16/2003 at 6:39 PM

For those of us that are not familiar with Java. Is there a list of public methods that Java utilizes so that we can avoid using these method names in our CFC/UDF methods?

Comment 2 by Raymond Camden posted on 7/16/2003 at 6:42 PM

I'm not aware of one, but you can easily go to the javadocs at Sun's website. Also, MACR is releasing a technote on this issue, and they may list some of the methods.

Comment 3 by Bryan F. Hogan posted on 7/16/2003 at 7:38 PM

Thanks Ray

Comment 4 by Kwang Suh posted on 7/16/2003 at 11:13 PM

When you say "underlying Java classes", are you talking about the superclasses that CFCs inherit from?

Comment 5 by Raymond Camden posted on 7/16/2003 at 11:25 PM

I'm talking about the Java classes that are the core of all CFMs now that ColdFusion is compiled to Java.

Comment 6 by Kwang Suh posted on 7/16/2003 at 11:49 PM

Yikes. That's a lot of method names :)

Comment 7 by Raymond Camden posted on 7/16/2003 at 11:55 PM

It would only be the public methods.