From c4e3088a3ff9a0d2dcc78e70d46bdaf07b3137ab Mon Sep 17 00:00:00 2001 From: Luc Bourlier Date: Mon, 10 Sep 2012 16:48:39 +0200 Subject: [PATCH] Added support for code specific to 2.9 or 2.10 Maven is configure to add an extra source folder in sdt.core, the one matching the scala version. Added code to manage the missing InvalidCompanions class in 2.10 Fix #1001243 --- org.scala-ide.sdt.core/.classpath | 1 + org.scala-ide.sdt.core/pom.xml | 17 +++++++++++++++++ .../tools/eclipse/SymbolsCompatibility.scala | 17 +++++++++++++++++ .../tools/eclipse/SymbolsCompatibility.scala | 10 ++++++++++ .../eclipse/ScalaPresentationCompiler.scala | 3 ++- 5 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 org.scala-ide.sdt.core/src-2.10/scala/tools/eclipse/SymbolsCompatibility.scala create mode 100644 org.scala-ide.sdt.core/src-2.9/scala/tools/eclipse/SymbolsCompatibility.scala diff --git a/org.scala-ide.sdt.core/.classpath b/org.scala-ide.sdt.core/.classpath index c9598440a2..a930e9e20d 100644 --- a/org.scala-ide.sdt.core/.classpath +++ b/org.scala-ide.sdt.core/.classpath @@ -1,6 +1,7 @@ + diff --git a/org.scala-ide.sdt.core/pom.xml b/org.scala-ide.sdt.core/pom.xml index 375185e5d5..1a9be3ad2a 100644 --- a/org.scala-ide.sdt.core/pom.xml +++ b/org.scala-ide.sdt.core/pom.xml @@ -83,6 +83,23 @@ + + + org.codehaus.mojo + build-helper-maven-plugin + 1.7 + + + generate-sources + add-source + + + src-${scala.major.minor.version} + + + + + diff --git a/org.scala-ide.sdt.core/src-2.10/scala/tools/eclipse/SymbolsCompatibility.scala b/org.scala-ide.sdt.core/src-2.10/scala/tools/eclipse/SymbolsCompatibility.scala new file mode 100644 index 0000000000..63a1f66bb9 --- /dev/null +++ b/org.scala-ide.sdt.core/src-2.10/scala/tools/eclipse/SymbolsCompatibility.scala @@ -0,0 +1,17 @@ +package scala.tools.eclipse + +import scala.reflect.internal.Symbols + +/** + * Trait used to keep 2.9-2.10 source compatibility + */ +trait SymbolsCompatibility { self: Symbols => + + /** + * This class as been removed in 2.10, but we need its real implementation in 2.9 + */ + case class InvalidCompanions(sym1: Symbol, sym2: Symbol) extends Throwable { + + } + +} diff --git a/org.scala-ide.sdt.core/src-2.9/scala/tools/eclipse/SymbolsCompatibility.scala b/org.scala-ide.sdt.core/src-2.9/scala/tools/eclipse/SymbolsCompatibility.scala new file mode 100644 index 0000000000..d09a45eaf8 --- /dev/null +++ b/org.scala-ide.sdt.core/src-2.9/scala/tools/eclipse/SymbolsCompatibility.scala @@ -0,0 +1,10 @@ +package scala.tools.eclipse + +import scala.tools.nsc.symtab.Symbols + +/** + * Trait used to keep 2.9-2.10 source compatibility + */ +trait SymbolsCompatibility { self: Symbols => + +} \ No newline at end of file diff --git a/org.scala-ide.sdt.core/src/scala/tools/eclipse/ScalaPresentationCompiler.scala b/org.scala-ide.sdt.core/src/scala/tools/eclipse/ScalaPresentationCompiler.scala index 2b8d5c7cde..3646ea5dba 100644 --- a/org.scala-ide.sdt.core/src/scala/tools/eclipse/ScalaPresentationCompiler.scala +++ b/org.scala-ide.sdt.core/src/scala/tools/eclipse/ScalaPresentationCompiler.scala @@ -41,7 +41,8 @@ class ScalaPresentationCompiler(project: ScalaProject, settings: Settings) with JavaSig with JVMUtils with LocateSymbol - with HasLogger { self => + with HasLogger + with SymbolsCompatibility { self => def presentationReporter = reporter.asInstanceOf[ScalaPresentationCompiler.PresentationReporter] presentationReporter.compiler = this