Skip to content

Commit

Permalink
Added support for code specific to 2.9 or 2.10
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Luc Bourlier committed Sep 10, 2012
1 parent 6bd9a57 commit c4e3088
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 1 deletion.
1 change: 1 addition & 0 deletions org.scala-ide.sdt.core/.classpath
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" output="target/classes" path="src"/> <classpathentry kind="src" output="target/classes" path="src"/>
<classpathentry kind="src" path="src-2.9"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/> <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="con" path="org.scala-ide.sdt.launching.SCALA_COMPILER_CONTAINER"/> <classpathentry kind="con" path="org.scala-ide.sdt.launching.SCALA_COMPILER_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
Expand Down
17 changes: 17 additions & 0 deletions org.scala-ide.sdt.core/pom.xml
Expand Up @@ -83,6 +83,23 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<!-- added source folder containing the code specific to the scala version -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals><goal>add-source</goal></goals>
<configuration>
<sources>
<source>src-${scala.major.minor.version}</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</build> </build>
</project> </project>
@@ -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 {

}

}
@@ -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 =>

}
Expand Up @@ -41,7 +41,8 @@ class ScalaPresentationCompiler(project: ScalaProject, settings: Settings)
with JavaSig with JavaSig
with JVMUtils with JVMUtils
with LocateSymbol with LocateSymbol
with HasLogger { self => with HasLogger
with SymbolsCompatibility { self =>


def presentationReporter = reporter.asInstanceOf[ScalaPresentationCompiler.PresentationReporter] def presentationReporter = reporter.asInstanceOf[ScalaPresentationCompiler.PresentationReporter]
presentationReporter.compiler = this presentationReporter.compiler = this
Expand Down

0 comments on commit c4e3088

Please sign in to comment.