When a method name is reused in a component, only ...
# lucee
t
When a method name is reused in a component, only the last occurrence is used and the others seem to be discarded. This can come up when creating lots of unit tests which can involve a lot of copy-pasting. Is there any way to detect this? I'm looking for a setting to forbid it, or a way to list the duplicate methods with introspection. I've tried
GetMetaData
and it only lists the last method of duplicates. The nuclear option is to parse the component source code, which I want to avoid if possible.
z
the info is there in the compiled bytecode, just a question how to access it
Copy code
public final class dup_method_cfc$cf extends ComponentPageImpl {
   private final ImportDefintion[] imports = new ImportDefintion[0];
   private static final StaticStruct staticStruct = new StaticStruct();
   private static final Collection.Key[] keys = new Collection.Key[]{KeyImpl.initKeys("TEST_FOO")};
   private CIPage[] subs;

   public dup_method_cfc$cf(PageSource var1) {
      this.udfs = new UDFProperties[2];
      this.udfs[0] = new UDFPropertiesImpl(this, var1, 3, 5, new FunctionArgument[0], 0, "test_foo", (short)0, (String)null, true, 1);
      this.udfs[1] = new UDFPropertiesImpl(this, var1, 6, 8, new FunctionArgument[0], 1, "test_foo", (short)0, (String)null, true, 1);
      this.setPageSource(var1);
   }