Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Harden REPL in presence of values that fail to initialize #14702

Merged
merged 2 commits into from
Mar 18, 2022

Commits on Mar 16, 2022

  1. Harden REPL in presence of values that fail to initialize

    The right hand side of value definitions in the REPL are computed in the static
    initializer for the wrapper object created for that input line (e.g. rs$line$1).
    If any of these definitions throws an exception, the wrapper class will fail to
    initialize, and further attempts to use the class will throw NoClassDefFoundError.
    
    In this commit, we avoid all reflective access on a wrapper class once we notice
    that it failed to initialize, and mark that wrapper object as invalid in the REPL
    state. We discard all input from the failed wrapper (which may have been multi-line
    containing many statements and definitions); any types, terms, aliases, or imports
    defined there will not override any existing with the same name, and will not be
    accessible in subsequent runs.
    
    Fixes scala#4416
    Fixes scala#14473
    griggt committed Mar 16, 2022
    Configuration menu
    Copy the full SHA
    4f1ad71 View commit details
    Browse the repository at this point in the history
  2. Fix scala#14701: avoid REPL crash when input is of the form `val _ = …

    …???`
    
    The REPL should not crash when the right hand side of `val _ =`
    throws a non-fatal error that is a subclass of java.lang.Error.
    griggt committed Mar 16, 2022
    Configuration menu
    Copy the full SHA
    0b0f626 View commit details
    Browse the repository at this point in the history