scala/scala — pull request #4051 by heathermiller (2014-10-14 23:07:23+00:00)
Title: Fixes SI-6502, reenables loading jars into the running REPL (regression in 2.10)

Fixes [SI-6502](https://issues.scala-lang.org/browse/SI-6502), reenables loading jars into the running REPL (regression in 2.10). This PR allows adding a jar to the compile and runtime classpaths without resetting the REPL state (crucial for Spark [SPARK-3257](issues.apache.org/jira/browse/SPARK-3257)).

This follows the lead taken by som-snytt in PR [#3986](https://github.com/scala/scala/pull/3986), which differentiates two jar-loading behaviors (muddled by `cp`):
- adding jars and replaying REPL expressions (using `replay`)
- adding jars without resetting the REPL (deprecated `cp`, introduced `require`)
This PR implements `require` (left unimplemented in [#3986](https://github.com/scala/scala/pull/3986))

This PR is a simplification of a similar approach taken by gkossakowski in #3884. In this attempt, we check first to make sure that a jar is only added if it only contains _new_ classes/traits/objects, otherwise we emit an error. This differs from the old invalidation approach which also tracked deleted classpath entries.

(I will squash all the little commits after review)