It would be possible to detect this at runtime by creating an exception object, and getting the stacktrace, but creating an exception object takes non-negligible time. You can also have the same function name with different params in java, but I don't think Stack traces distinguish this.