scala-ide/scala-ide — pull request #332 by dotta (2013-02-25 12:53:52+00:00)
Title: Issue/cannot enable continuations plugin 1001030

Do not force default location of -XpluginsDir in Scala Compiler Preferences

Trying to force the default location to the plugins directory containing the
continuations.jar plugin turned out to be a very bad idea (this was done as
part of commit SHA-cbfd82d874f998b7726fec895ad4d83194ad1e5b).

The issue is that the default location where the continuations.jar is stored
changes *each time a user updates the Scala IDE* and, when updating, the
*former location is deleted*. The net effect of this is that after upgrading,
all projects using the continuations plugin would report the following error

`bad option: -P:continuations:enable` is reported

Simply because the continuations.jar can no longer be located.

The fix is to somewhat restore the former implementation wrt how we handle the
`-Xpluginsdir` compiler setting. Basically, the solution consists in not
showing the default value of `-Xpluginsdir` to the user in the Preferences
dialog, and pass this default to the different compiler instance we create
unless the user specifices a different location (in which case, we do use the
location provided by the user).

There is one more catch due to the current way `ScalaProject.scalacArguments`
is implemented (the method is used to pass the compiler arguments to the Sbt
builder). In short, the returned arguments are only the ones forces by the user
via the Preference dialog. Since the `-Xpluginsdir` default directory is
**not** shown in the Preference dialog, the Sbt builder would fail to compiler
projects with continuations enabled because it wouldn't know where to look for
the continuations.jar. Hence, I had to add some ad-hoc code to handle this
correctly in `ScalaProject.scalacArguments`.

This whole fix is far from ideal, but I want to keep the changeset as small as
possible to avoid regressions, since this commit should be included in the
upcoming 3.0.0 release.

By the way, all existing projects that were affected by the error should
restore the defaults (Preferences > Scala > Compiler and hit the Restore
Defaults button).

Fixes #1001030, #1000700

backport to _release/3.0.0_