Correcting error for newChannel2

I’m trying to update an addon with the line
return Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService).newChannel2(addon.getResourceURI(file).spec, null, null).name;

I get the error
Warning: ‘nsIOService::NewChannel()’ deprecated, please use ‘nsIOService::NewChannel2()’ bootstrap.js:27:9

How can this line produce this error. In the line it says newChannel2 and in the error it says don’t use newChannel but use newChannel2 instead?
Blessings

It’s possible newChannel2 uses NewChannel and that’s why the warning appears. A warning shouldn’t be a major concern if you’re sure you’re not calling it directly.