Skip to content

"Overwriting method ..." noise from devtools::load_all() #474

Closed

Description

@t-kalinowski

This might be better as a pkgload specific issue, but I'm raising it here first. In a package that exports methods, load_all() gets annoyingly noisy.

> devtools::load_all(".")
ℹ Loading r2f
Overwriting method convert(<double>, <integer>)
Overwriting method convert(<logical>, <integer>)
Overwriting method convert(<name>, <character>)
Overwriting method convert(<logical>, <character>)
Overwriting method convert(<double>, <integer>)
Overwriting method convert(<logical>, <integer>)
Overwriting method convert(<name>, <character>)
Overwriting method convert(<logical>, <character>)

Note that each method is overwritten twice: once when sourcing the package code, and then again in .onLoad/S7::methods_register().

Activity

  1. hadley commented on Oct 21, 2024

    @hadley
    Member

    I thought I noticed that too, but it turned out that I was accidentally duplicating method definitions.

  2. t-kalinowski commented on Oct 21, 2024

    @t-kalinowski
    MemberAuthor

    I don't think I'm defining the method twice. A minimal package with just this is enough to show the warning twice:

    #' @import S7
    NULL
    
    method(convert, list(class_double, class_integer)) <- 
      function(from, to, ...) as.integer(from)
    
    .onLoad <- function(...) {
      S7::methods_register()
    }
    > devtools::load_all(".")
    ℹ Loading r2f
    Overwriting method convert(<double>, <integer>)
    Overwriting method convert(<double>, <integer>)
    
  3. hadley commented on Oct 22, 2024

    @hadley
    Member

    Ooh, hmmmm, maybe it only occurs in the dev version?

  4. lawremi commented on Oct 24, 2024

    @lawremi
    Collaborator

    I've noticed this too when redefining methods at runtime during debugging, like with ESS's developer mode. It's a bit distracting.

  5. added
    bug
    on May 21, 2026
  6. hadley commented on May 25, 2026

    @hadley
    Member

    For whatever reason, I'm no longer seeing this. So I'm going to close. @lawremi please let me know if it's still bothering you (but I'll need more details if you want me to run it down).

  7. hadley commented on May 29, 2026

    @hadley
    Member

    Confirmed that @t-kalinowski is no longer seeing this either, so I'm going to assume it was a bug that we fixed.

  8. jjjermiah commented on Jun 3, 2026

    @jjjermiah
    Contributor

    I'm running into this still, using the version of pak from the main branch (0.2.2.9000) and from CRAN (0.2.2)

    ➜ R -e 'devtools::load_all(); devtools::load_all()'
    > devtools::load_all(); devtools::load_all()
    ℹ Loading s7repro2
    ℹ Loading s7repro2
    Overwriting method convert(<s7repro2::Foo>, <s7repro2::Bar>)
    

    DESCRIPTION:

    Package: s7repro2
    Title: Repro
    Version: 0.0.1
    Imports: 
      S7
    Remotes:
      RConsortium/S7@main
    Encoding: UTF-8
    

    a.R

    # -- a.R
    Foo <- S7::new_class("Foo", parent = S7::class_list)
    Bar <- S7::new_class("Bar", properties = list(x = S7::class_numeric))
    
    #' @import S7
    S7::method(convert, list(Foo, Bar)) <- function(from, to, ...) Bar(x = 1)

    NAMESPACE:

    # Generated by roxygen2: do not edit by hand
    
    import(S7)
    
  9. jjjermiah commented on Jun 3, 2026

    @jjjermiah
    Contributor

    even more, if i add S7::methods_register() to .onLoad, required for external generics, message is sent once during first load and now twice during second load

    # -- a.R
    Foo <- S7::new_class("Foo", parent = S7::class_list)
    Bar <- S7::new_class("Bar", properties = list(x = S7::class_numeric))
    
    #' @import S7
    S7::method(convert, list(Foo, Bar)) <- function(from, to, ...) Bar(x = 1)
    
    .onLoad <- function(...) {
      S7::methods_register()
    }
    > devtools::load_all()
    ℹ Loading s7repro2
    Overwriting method convert(<s7repro2::Foo>, <s7repro2::Bar>)
    > devtools::load_all()
    ℹ Loading s7repro2
    Overwriting method convert(<s7repro2::Foo>, <s7repro2::Bar>)
    Overwriting method convert(<s7repro2::Foo>, <s7repro2::Bar>)
    >
  10. hadley commented on Jun 10, 2026

    @hadley
    Member

    Ooooh I bet this is specifically about convert() because it's a generic from another package, and this is thus #316.

  11. JosiahParry commented on Aug 14, 2026

    @JosiahParry

    I'm still getting this from an install from yesterday:

    R 4.6.1 restarted.
    > devtools::load_all()
    ℹ Loading arcgisviz
    > devtools::load_all()
    ℹ Loading arcgisviz
    Overwriting method convert(<character>, <arcgisviz::WebChartStackedKinds>)
    Overwriting method convert(<character>, <arcgisviz::WebChartLegendPositions>)
    Overwriting method convert(<character>, <arcgisviz::WebChartTemporalBinningUnits>)
    Overwriting method convert(<character>, <arcgisviz::WebChartTimeAggregationTypes>)
    Overwriting method convert(<character>, <arcgisviz::WebChartNullPolicyTypes>)
    Overwriting method convert(<character>, <arcgisviz::WebChartSortOrderKinds>)
    Overwriting method convert(<character>, <arcgisviz::WebChartLabelBehavior>)
    Overwriting method convert(<character>, <arcgisviz::WebChartTextSymbolVerticalAlignment>)
    Overwriting method convert(<character>, <arcgisviz::WebChartTextSymbolHorizontalAlignment>)
    Overwriting method convert(<character>, <arcgisviz::WebChartDirectionalDataOrderOrderType>)
    Overwriting method convert(<character>, <arcgisviz::WebChartQuerySpatialRelationship>)
    Overwriting method convert(<character>, <arcgisviz::IntlLocaleMatcher>)
    ....
    

    I do use S7::convert() internally. Is this expected?

    First load perf ~ chef's kiss ~ second I'm getting a full screen of messages.

  12. hadley commented on Aug 14, 2026

    @hadley
    Member

    Do you have dev S7 + latest CRAN pkgload?

  13. JosiahParry commented on Aug 17, 2026

    @JosiahParry

    Yes! I'm using dev S7 (from last week) and 1.5.3 from CRAN for pkgload

  14. hadley commented on Aug 17, 2026

    @hadley
    Member

    Could you please file (or have claude file) a minimal reprex as a new issue? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugregistration 📓

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions