From winstonchang1 at gmail.com  Thu Dec 19 19:24:54 2013
From: winstonchang1 at gmail.com (Winston Chang)
Date: Thu, 19 Dec 2013 12:24:54 -0600
Subject: [Rd] Strange warnings when unloading packages with S4 classes
In-Reply-To: <CAFOpNVG5S1eLSe5bb3NfOxhp3zTYthk50ODFYHTxoYvzjDMOzw@mail.gmail.com>
References: <CAFOpNVG5S1eLSe5bb3NfOxhp3zTYthk50ODFYHTxoYvzjDMOzw@mail.gmail.com>
Message-ID: <CAFOpNVGgP3C_NFr8BUb4pjDfmDhGmHc3yNGQnkiZ-R+QX0SYkg@mail.gmail.com>

(Sorry, this was previously sent with HTML mail. Resending in plain text.)

I've been seeing warnings when unloading packages. They can be seen
with the shiny and sp packages, among others (this is on R 3.0.2). For
example:
> library(sp)
> unloadNamespace('sp')
Warning messages:
1: In FUN(X[[2L]], ...) :
  Created a package name, ?2013-12-19 12:14:24?, when none found
2: In FUN(X[[2L]], ...) :
  Created a package name, ?2013-12-19 12:14:24?, when none found
3: In FUN(X[[2L]], ...) :
  Created a package name, ?2013-12-19 12:14:24?, when none found
4: In FUN(X[[2L]], ...) :
  Created a package name, ?2013-12-19 12:14:24?, when none found

It appears to be related to the methods:::.removeSuperclassBackRefs function.


I can get the warnings to appear when the following are both true:
* The package has an S4 class which inherits from a class outside of
the package.
* The NAMESPACE file contains import(methods)

I've created some very simple test packages here which illustrate the
problem, along with instructions on how to duplicate the warning.
https://github.com/wch/s4unload

The warnings only appear when unloading the package where both of the
conditions above are true. I'm not sure why import(methods) should
make a difference, but it does.

Is this a bug in the implementation of S4?

Best,
-Winston



[Rd] Strange warnings when unloading packages with S4 classes
Winston Chang