[plm] 09/13: Kill all parts of scala since the debian package lags behind
Martin Quinson
mquinson at moszumanska.debian.org
Sat Nov 1 07:28:06 UTC 2014
This is an automated email from the git hooks/post-receive script.
mquinson pushed a commit to branch debian
in repository plm.
commit 44bf2b2493d0efb771c36f93423990d487eb590c
Author: Martin Quinson <martin.quinson at loria.fr>
Date: Fri Oct 24 21:00:05 2014 +0200
Kill all parts of scala since the debian package lags behind
That's a pity, but there is nothing I can do right now
---
debian/patches/no-github | 209 +++++++++++++
debian/patches/no-scala | 747 +++++++++++++++++++++++++++++++++++++++++++++--
debian/patches/series | 1 +
3 files changed, 938 insertions(+), 19 deletions(-)
diff --git a/debian/patches/no-github b/debian/patches/no-github
new file mode 100644
index 0000000..acde146
--- /dev/null
+++ b/debian/patches/no-github
@@ -0,0 +1,209 @@
+---
+ src/plm/core/ui/FeedbackDialog.java | 161 ------------------------------------
+ src/plm/core/ui/MainFrame.java | 13 --
+ 2 files changed, 1 insertion(+), 173 deletions(-)
+
+Index: b/src/plm/core/ui/FeedbackDialog.java
+===================================================================
+--- a/src/plm/core/ui/FeedbackDialog.java
++++ /dev/null
+@@ -1,161 +0,0 @@
+-package plm.core.ui;
+-
+-import java.awt.BorderLayout;
+-import java.awt.Color;
+-import java.awt.Dimension;
+-import java.awt.Label;
+-import java.awt.event.ActionEvent;
+-import java.awt.event.ActionListener;
+-import java.io.IOException;
+-
+-import javax.swing.JButton;
+-import javax.swing.JDialog;
+-import javax.swing.JEditorPane;
+-import javax.swing.JOptionPane;
+-import javax.swing.JPanel;
+-import javax.swing.JScrollPane;
+-import javax.swing.JTextField;
+-import javax.swing.ScrollPaneConstants;
+-
+-import org.eclipse.egit.github.core.Issue;
+-import org.eclipse.egit.github.core.client.GitHubClient;
+-import org.eclipse.egit.github.core.service.IssueService;
+-import org.xnap.commons.i18n.I18n;
+-import org.xnap.commons.i18n.I18nFactory;
+-
+-import plm.core.model.Game;
+-import plm.core.model.lesson.Exercise;
+-import plm.core.model.lesson.Exercise.WorldKind;
+-import plm.core.model.tracking.GitUtils;
+-import plm.universe.World;
+-
+-public class FeedbackDialog extends JDialog {
+-
+- private static final long serialVersionUID = 0;
+- private static FeedbackDialog instance = null;
+-
+- public I18n i18n = I18nFactory.getI18n(getClass(), "org.plm.i18n.Messages", getLocale(), I18nFactory.FALLBACK);
+- final JEditorPane feedback = new JEditorPane();
+- final JTextField title = new JTextField();
+-
+- public static FeedbackDialog getInstance() {
+- if (FeedbackDialog.instance == null) {
+- FeedbackDialog.instance = new FeedbackDialog();
+- }
+- StringBuffer worldInfo = new StringBuffer();
+- for (World w:((Exercise)Game.getInstance().getCurrentLesson().getCurrentExercise()).getWorlds(WorldKind.ANSWER)) {
+- String s = w.getDebugInfo();
+- if (s != "")
+- worldInfo.append("World: "+s+"\n");
+- }
+-
+- FeedbackDialog.instance.feedback.setText(FeedbackDialog.instance.i18n.tr(
+- "Please write your suggestion here, with all necessary details\n"
+- + "(if possible in English or French).\n\n"
+- + "When you find a typo or a sentence that is hard to understand, \n"
+- + "it really helps to suggest a new wording.\n\n"
+- + "If you encounter a technical bug, please tell us what you did,\n"
+- + "which outcome you were expecting and what happened instead.\n\n"
+- + " but DO NEVER DISCLOSE A PASSWORD to a bug tracker. Never."
+- + "\n\n--------------------[ Technical Information ]--------------------\n"
+- + "(This can help us fixing your problem, please don't erase)\n"
+- ) /* The rest is not translated */
+- + "\nLesson: "+Game.getInstance().getCurrentLesson().getId() + "\n"
+- + "Exercise: "+Game.getInstance().getCurrentLesson().getCurrentExercise().getId() + "\n"
+- + worldInfo.toString()
+- + "Programming Language: "+Game.getProgrammingLanguage().getLang() + "\n"
+- + "Locale: "+Game.getInstance().getLocale().getDisplayName() + "\n"
+- + "Java version: " + System.getProperty("java.version") + " (VM: " + System.getProperty("java.vm.name") + "; version: " + System.getProperty("java.vm.version") + ")" + "\n"
+- + "OS: " + System.getProperty("os.name") + " (version: " + System.getProperty("os.version") + "; arch: " + System.getProperty("os.arch") + ")" + "\n"
+- + "PLM version: " + Game.getProperty("plm.major.version", "internal", false) + " (" + Game.getProperty("plm.minor.version", "internal", false) + ")" + "\n"
+- + "Public user ID: PLM"+GitUtils.sha1(Game.getInstance().getUsers().getCurrentUser().getUserUUIDasString())+ "\n");
+-
+- FeedbackDialog.instance.title.setText(FeedbackDialog.instance.i18n.tr("Please describe the problem in a few words"));
+- FeedbackDialog.instance.pack();
+- return FeedbackDialog.instance;
+- }
+-
+- private FeedbackDialog() {
+- super(MainFrame.getInstance(), "Report your feedback", false);
+- this.setTitle(i18n.tr("Report your feedback"));
+- initComponent();
+- }
+-
+- public void initComponent() {
+-
+- setLayout(new BorderLayout());
+- JPanel headerToolbar = new JPanel();
+- headerToolbar.add(new Label(i18n.tr("Issue title:")));
+- headerToolbar.add(title);
+- add(headerToolbar, BorderLayout.NORTH);
+-
+- feedback.setBackground(Color.white);
+- feedback.setOpaque(true);
+- feedback.setEditable(true);
+- JScrollPane jsp = new JScrollPane(feedback);
+- jsp.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
+- jsp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
+- add(jsp, BorderLayout.CENTER);
+-
+- feedback.setContentType("text/plain");
+-
+- final JButton cancelBtn = new JButton(i18n.tr("Cancel"));
+- cancelBtn.addActionListener(new ActionListener() {
+- @Override
+- public void actionPerformed(ActionEvent e) {
+- int dialogResult = JOptionPane.showConfirmDialog(cancelBtn,
+- i18n.tr("Do you really want to cancel your feedback and lose any edit?"),
+- i18n.tr("are you sure?"),
+- JOptionPane.YES_NO_OPTION);
+- if (dialogResult == JOptionPane.YES_OPTION) {
+- dispose();
+- }
+- }
+- });
+-
+- final JButton sendBtn = new JButton(i18n.tr("Send feedback"));
+- sendBtn.addActionListener(new ActionListener() {
+- GitHubClient client = new GitHubClient();
+-
+- @Override
+- public void actionPerformed(ActionEvent e) {
+- client.setOAuth2Token(Game.getProperty("plm.github.oauth"));
+- Issue issue = new Issue();
+- issue.setTitle(title.getText());
+- issue.setBody(feedback.getText());
+- IssueService issueService = new IssueService(client);
+- try {
+- Issue i = issueService.createIssue(Game.getProperty("plm.github.owner"), Game.getProperty("plm.github.repo"), issue);
+- JOptionPane.showMessageDialog(sendBtn, i18n.tr(
+- "Thank you for your remark, we will do our best to integrate it.\n"
+- + "Follow our progress at {0}.",i.getHtmlUrl()), i18n.tr("Thanks for your suggestion"), JOptionPane.INFORMATION_MESSAGE);
+- dispose();
+- } catch (IOException ex) {
+- StringBuffer ctn = new StringBuffer(ex.getLocalizedMessage() + "\n");
+- for (StackTraceElement elm : ex.getStackTrace()) {
+- ctn.append(elm.toString()).append("\n");
+- }
+- JOptionPane.showMessageDialog(cancelBtn,
+- ctn.toString(),
+- i18n.tr("Error while uploading your feedback"),
+- JOptionPane.ERROR_MESSAGE);
+- ex.printStackTrace();
+- }
+- }
+- });
+-
+- JPanel toolbar = new JPanel();
+- toolbar.add(cancelBtn);
+- toolbar.add(sendBtn);
+- add(toolbar, BorderLayout.SOUTH);
+-
+- setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
+- pack();
+- setMinimumSize(new Dimension(200, 600));
+- setPreferredSize(new Dimension(500, 800));
+- setResizable(true);
+-
+- setLocationRelativeTo(getParent());
+- }
+-
+-}
+Index: b/src/plm/core/ui/MainFrame.java
+===================================================================
+--- a/src/plm/core/ui/MainFrame.java
++++ b/src/plm/core/ui/MainFrame.java
+@@ -93,7 +93,7 @@ public class MainFrame extends JFrame im
+
+ private JMenu menuLanguage, menuLangHuman, menuLangProg;
+ private JMenu menuHelp;
+- private JMenuItem miHelpFeedback, miHelpLesson,miHelpWorld,miHelpAbout;
++ private JMenuItem miHelpLesson,miHelpWorld,miHelpAbout;
+
+ private LoggerPanel outputArea;
+ private MissionEditorTabs met;
+@@ -388,16 +388,6 @@ public class MainFrame extends JFrame im
+ menuHelp = new JMenu(i18n.tr("Help"));
+ menuHelp.setMnemonic(KeyEvent.VK_H);
+ menuBar.add(menuHelp);
+-
+- miHelpFeedback = new JMenuItem(new AbstractGameAction(g, i18n.tr("Provide feedback")) {
+- private static final long serialVersionUID = 1L;
+-
+- public void actionPerformed(ActionEvent arg0) {
+- FeedbackDialog.getInstance().setVisible(true);
+- }
+- });
+- miHelpFeedback.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, ActionEvent.CTRL_MASK));
+- menuHelp.add(miHelpFeedback);
+
+ miHelpLesson = new JMenuItem(new AbstractGameAction(g, i18n.tr("About this lesson")) {
+ private static final long serialVersionUID = 1L;
+@@ -760,7 +750,6 @@ public class MainFrame extends JFrame im
+ menuLangProg.setText(i18n.tr("Computer"));
+
+ menuHelp.setText(i18n.tr("Help"));
+- miHelpFeedback.setText(i18n.tr("Provide feedback"));
+ miHelpLesson.setText(i18n.tr("About this lesson"));
+ miHelpWorld.setText(i18n.tr("About this world"));
+ if (miHelpAbout != null)
diff --git a/debian/patches/no-scala b/debian/patches/no-scala
index d553738..2affd88 100644
--- a/debian/patches/no-scala
+++ b/debian/patches/no-scala
@@ -1,12 +1,12 @@
---
- src/lessons/lander/Main.fr.html | 23 -
- src/lessons/lander/Main.html | 21 -
+ src/lessons/lander/Main.fr.html | 23
+ src/lessons/lander/Main.html | 21
src/lessons/lander/Main.scala | 14
- src/lessons/lander/icon.svg | 104 -----
- src/lessons/lander/lvl1_lander_101/Lander101.fr.html | 49 --
+ src/lessons/lander/icon.svg | 104 ----
+ src/lessons/lander/lvl1_lander_101/Lander101.fr.html | 49 -
src/lessons/lander/lvl1_lander_101/Lander101.html | 41 -
- src/lessons/lander/lvl1_lander_101/Lander101.it.html | 45 --
- src/lessons/lander/lvl1_lander_101/Lander101.pt_BR.html | 45 --
+ src/lessons/lander/lvl1_lander_101/Lander101.it.html | 45 -
+ src/lessons/lander/lvl1_lander_101/Lander101.pt_BR.html | 45 -
src/lessons/lander/lvl1_lander_101/Lander101.scala | 17
src/lessons/lander/lvl1_lander_101/Lander101Entity.java | 14
src/lessons/lander/lvl1_lander_101/Lander101Entity.py | 13
@@ -15,30 +15,41 @@
src/lessons/lander/lvl2_locate_landing_zone/LocateLandingZone.html | 34 -
src/lessons/lander/lvl2_locate_landing_zone/LocateLandingZone.scala | 19
src/lessons/lander/lvl2_locate_landing_zone/LocateLandingZoneEntity.java | 57 --
- src/lessons/lander/lvl2_locate_landing_zone/LocateLandingZoneEntity.py | 43 --
+ src/lessons/lander/lvl2_locate_landing_zone/LocateLandingZoneEntity.py | 43 -
src/lessons/lander/lvl2_locate_landing_zone/ScalaLocateLandingZoneEntity.scala | 54 --
src/lessons/lander/lvl3_fly_the_lander/FlyTheLander.fr.html | 41 -
src/lessons/lander/lvl3_fly_the_lander/FlyTheLander.html | 33 -
src/lessons/lander/lvl3_fly_the_lander/FlyTheLander.pt_BR.html | 37 -
src/lessons/lander/lvl3_fly_the_lander/FlyTheLander.scala | 20
- src/lessons/lander/lvl3_fly_the_lander/FlyTheLanderEntity.java | 48 --
- src/lessons/lander/lvl3_fly_the_lander/FlyTheLanderEntity.py | 45 --
+ src/lessons/lander/lvl3_fly_the_lander/FlyTheLanderEntity.java | 48 -
+ src/lessons/lander/lvl3_fly_the_lander/FlyTheLanderEntity.py | 45 -
src/lessons/lander/lvl3_fly_the_lander/ScalaFlyTheLanderEntity.scala | 53 --
src/lessons/lander/short_desc.fr.html | 9
src/lessons/lander/short_desc.html | 7
src/lessons/lander/universe/Configurations.scala | 77 ---
- src/lessons/lander/universe/DelegatingLanderWorld.fr.html | 48 --
- src/lessons/lander/universe/DelegatingLanderWorld.html | 44 --
- src/lessons/lander/universe/DelegatingLanderWorld.java | 71 ---
- src/lessons/lander/universe/DelegatingLanderWorld.pt_BR.html | 43 --
- src/lessons/lander/universe/Geometry.scala | 47 --
+ src/lessons/lander/universe/DelegatingLanderWorld.fr.html | 48 -
+ src/lessons/lander/universe/DelegatingLanderWorld.html | 44 -
+ src/lessons/lander/universe/DelegatingLanderWorld.java | 71 --
+ src/lessons/lander/universe/DelegatingLanderWorld.pt_BR.html | 43 -
+ src/lessons/lander/universe/Geometry.scala | 47 -
src/lessons/lander/universe/LanderEntity.scala | 59 --
- src/lessons/lander/universe/LanderWorld.scala | 148 -------
- src/lessons/lander/universe/LanderWorldView.scala | 207 ----------
+ src/lessons/lander/universe/LanderWorld.scala | 148 -----
+ src/lessons/lander/universe/LanderWorldView.scala | 207 --------
+ src/plm/core/lang/JVMCompiledLang.java | 9
+ src/plm/core/lang/LangScala.java | 247 ----------
+ src/plm/core/model/Game.java | 51 --
+ src/plm/core/model/lesson/ExerciseTemplated.java | 4
+ src/plm/core/model/lesson/ExerciseTemplatingEntity.java | 19
src/plm/core/ui/ChooseLessonDialog.java | 2
- src/plm/test/ExoTest.java | 2
- src/plm/test/LessonTest.java | 2
- 39 files changed, 3 insertions(+), 1689 deletions(-)
+ src/plm/core/ui/JavaEditorPanel.java | 2
+ src/plm/core/ui/editor/MissionEditor.java | 6
+ src/plm/test/ExoTest.java | 13
+ src/plm/test/LessonTest.java | 10
+ src/plm/test/simple/test/AllSimpleExerciseTests.java | 2
+ src/plm/test/simple/test/ScalaSimpleExerciseTest.java | 52 --
+ src/plm/universe/bat/BatExercise.java | 2
+ src/plm/universe/bat/BatTest.java | 16
+ 50 files changed, 17 insertions(+), 2104 deletions(-)
Index: b/src/lessons/lander/universe/Configurations.scala
===================================================================
@@ -1936,6 +1947,31 @@ Index: b/src/plm/test/ExoTest.java
};
@BeforeClass
+@@ -122,7 +122,7 @@ public class ExoTest {
+ // For compiled languages, we mutate to the compiled entity.
+ // For script languages, we mutate to the correction entity.
+ StudentOrCorrection what = StudentOrCorrection.CORRECTION;
+- if (lang == Game.JAVA || lang == Game.SCALA || lang == Game.C)
++ if (lang == Game.JAVA || lang == Game.C)
+ what = StudentOrCorrection.STUDENT;
+ exo.mutateEntities(WorldKind.CURRENT, what);
+
+@@ -157,14 +157,7 @@ public class ExoTest {
+ public void testJavaEntity() {
+ testCorrectionEntity(Game.JAVA);
+ }
+-
+- @Test(timeout=30000) // The compiler sometimes takes time to kick in
+- public void testScalaEntity() {
+- if (!exo.getProgLanguages().contains(Game.SCALA))
+- fail("Exercise "+exo.getId()+" does not support scala");
+- testCorrectionEntity(Game.SCALA);
+- }
+-
++
+ // @Test(timeout=30000) // The compiler sometimes takes time to kick in
+ public void testCEntity() {
+ if (!exo.getProgLanguages().contains(Game.C))
Index: b/src/plm/test/LessonTest.java
===================================================================
--- a/src/plm/test/LessonTest.java
@@ -1949,3 +1985,676 @@ Index: b/src/plm/test/LessonTest.java
};
private String lessonName;
+@@ -82,13 +82,7 @@ public class LessonTest {
+ Lesson lesson = loadLesson(Game.JAVA);
+ assertTrue("An error arose while loading lesson "+lesson.getName()+"...", lesson.getLoadingOutcomeState() == LoadingOutcome.SUCCESS);
+ }
+-
+- @Test
+- public void testScalaLesson() throws InstantiationException, IllegalAccessException, ClassNotFoundException {
+- Lesson lesson = loadLesson(Game.SCALA);
+- assertTrue("An error arose while loading lesson "+lesson.getName()+"...", lesson.getLoadingOutcomeState() == LoadingOutcome.SUCCESS);
+- }
+-
++
+ @Test
+ public void testPythonLesson() throws InstantiationException, IllegalAccessException, ClassNotFoundException {
+ Lesson lesson = loadLesson(Game.PYTHON);
+Index: b/src/plm/core/lang/LangScala.java
+===================================================================
+--- a/src/plm/core/lang/LangScala.java
++++ /dev/null
+@@ -1,247 +0,0 @@
+-package plm.core.lang;
+-
+-import java.util.HashMap;
+-import java.util.LinkedList;
+-import java.util.List;
+-import java.util.Map;
+-import java.util.Vector;
+-
+-import plm.core.PLMCompilerException;
+-import plm.core.model.Game;
+-import plm.core.model.LogWriter;
+-import plm.core.model.lesson.ExecutionProgress;
+-import plm.core.model.lesson.Exercise;
+-import plm.core.model.lesson.Exercise.StudentOrCorrection;
+-import plm.core.ui.ResourcesCache;
+-import plm.universe.Entity;
+-import scala.Option;
+-import scala.collection.JavaConverters;
+-import scala.reflect.internal.util.BatchSourceFile;
+-import scala.reflect.internal.util.Position;
+-import scala.reflect.internal.util.SourceFile;
+-import scala.reflect.io.VirtualDirectory;
+-import scala.reflect.io.VirtualFile;
+-import scala.tools.nsc.Global;
+-import scala.tools.nsc.Global.Run;
+-import scala.tools.nsc.Settings;
+-import scala.tools.nsc.interpreter.AbstractFileClassLoader;
+-import scala.tools.nsc.reporters.AbstractReporter;
+-
+-public class LangScala extends JVMCompiledLang {
+-
+- ScalaCompiler compiler = new ScalaCompiler();
+-
+- public LangScala() {
+- super("Scala","scala",ResourcesCache.getIcon("img/lang_scala.png"));
+- }
+-
+- @Override
+- public void compileExo(Exercise exo, LogWriter out, StudentOrCorrection whatToCompile)
+- throws PLMCompilerException {
+- /* Make sure each run generate a new package to avoid that the loader cache prevent the reloading of the newly generated class */
+- packageNameSuffix++;
+- runtimePatterns.put("\\$package",
+- "package "+packageName()+";import java.awt.Color;");
+-
+- List<plm.core.model.session.SourceFile> sfs = exo.getSourceFilesList(this);
+- if (sfs == null || sfs.isEmpty()) {
+- String msg = exo.getName()+": No source to compile";
+- System.err.println(msg);
+- PLMCompilerException e = new PLMCompilerException(msg, null, null);
+- exo.lastResult = ExecutionProgress.newCompilationError(e.getMessage());
+- throw e;
+- }
+-
+- try {
+- compiler.reset();
+- for (plm.core.model.session.SourceFile sf : sfs) {
+- compiler.compile(className(sf.getName()), sf.getCompilableContent(runtimePatterns,whatToCompile), sf.getOffset());
+- }
+- } catch (PLMCompilerException e) {
+- System.err.println(Game.i18n.tr("Compilation error:"));
+- System.err.println(e.getMessage());
+- exo.lastResult = ExecutionProgress.newCompilationError(e.getMessage());
+-
+- throw e;
+- }
+-
+- }
+-
+- /** Converts {@code "foo.bar.baz"} to {@code "foo.bar.Scalabaz"}. */
+- @Override
+- public String nameOfCorrectionEntity(Exercise exo){
+- String path = super.nameOfCorrectionEntity(exo);
+-
+- String[] components = path.split("\\.");
+- StringBuilder result = new StringBuilder();
+- int last = components.length - 1;
+- for (int i = 0; i < last; i++) {
+- result.append(components[i] + ".");
+- }
+- result.append("Scala" + components[last]);
+- return result.toString();
+- }
+-
+- @Override
+- protected Entity mutateEntity(String newClassName)
+- throws InstantiationException, IllegalAccessException,
+- ClassNotFoundException {
+- return (Entity) compiler.findClass(className(newClassName)).newInstance();
+- }
+-}
+-
+-/** In memory compiler of scala code.
+- * This is highly inspired of https://github.com/twitter/util/blob/master/util-eval/src/main/scala/com/twitter/util/Eval.scala */
+-class ScalaCompiler {
+-
+- private PLMReporter reporter;
+- private Settings settings;
+- private Map<String, Class<?>> cache = new HashMap<String, Class<?>>();
+- private Global global;
+- private VirtualDirectory target;
+- private ClassLoader classLoader = new AbstractFileClassLoader(target, this.getClass().getClassLoader());
+-
+- public ScalaCompiler() {
+- super();
+- settings = new Settings();
+- settings.nowarnings().tryToSetFromPropertyValue("true"); // warnings seem to be exceptions, and we don't want them to mess with us
+-
+- Option<VirtualDirectory> noAncestor = scala.Option$.MODULE$.apply(null);
+- target = new VirtualDirectory("(memory)", noAncestor);
+- settings.outputDirs().setSingleOutput(target);
+-
+- settings.usejavacp().tryToSetFromPropertyValue("true");
+- //settings.usemanifestcp().tryToSetFromPropertyValue("true");
+- reporter = new PLMReporter(settings);
+- global = new Global(settings,reporter);
+- }
+-
+- public void reset() {
+- reporter.reset();
+- reporter.setOffset(0);
+- target.clear();
+- cache = new HashMap<String, Class<?>>();
+- classLoader = new AbstractFileClassLoader(target, this.getClass().getClassLoader());
+- }
+-
+- public void compile(String name,String content,int offset) throws PLMCompilerException {
+- if (Game.getInstance().isDebugEnabled())
+- System.out.println("Compiline souce "+name+" to scala (offset:"+offset+"):\n"+content);
+-
+- Run compiler = global.new Run();
+- List<SourceFile> sources = new LinkedList<SourceFile>();
+-
+- sources.add(new BatchSourceFile(new VirtualFile(name) , content.toCharArray()));
+- reporter.setOffset(offset);
+-
+- compiler.compileSources(JavaConverters.asScalaBufferConverter(sources).asScala().toList());
+-
+- if (Game.getInstance().isDebugEnabled() && reporter.hasErrors())
+- System.out.println("Here is the scala source code of "+name+" (offset:"+offset+"): "+content);
+- reporter.throwExceptionOnNeed();
+- }
+- public Class<?> findClass(String className) {
+- synchronized (this) {
+- if (!cache.containsKey(className)) {
+- Class<?> res;
+- try {
+- res = classLoader.loadClass(className);
+- } catch (ClassNotFoundException e) {
+- res = null;
+- }
+- cache.put(className, res);
+- }
+-
+- return cache.get(className);
+- }
+- }
+-
+- class PLMReporter extends AbstractReporter {
+- final static int INFO = 0;
+- final static int WARNING = 1;
+- final static int ERROR = 2;
+- int offset=0;
+- Vector<String> messages = new Vector<String>();
+- Settings settings;
+-
+- public PLMReporter(Settings s) {
+- settings = s;
+- }
+- public void setOffset(int _offset) {
+- this.offset = _offset;
+- }
+- @Override
+- public Settings settings() {
+- return settings;
+- }
+- @Override
+- public void displayPrompt() {
+- /* Don't do that, pal. */
+- }
+- @Override
+- public void display(Position pos, String message, Severity _severity) {
+- String severityName = _severity.toString();
+- String label = "";
+- int severity = -1;
+- if (severityName.equals("INFO") || severityName.equals("scala.tools.nsc.reporters.Reporter$Severity at 0"))
+- severity = INFO;
+- if (severityName.equals("WARNING") || severityName.equals("scala.tools.nsc.reporters.Reporter$Severity at 1")) {
+- severity = WARNING;
+- label= "warning: ";
+- }
+- if (severityName.equals("ERROR") || severityName.equals("scala.tools.nsc.reporters.Reporter$Severity at 2")) {
+- severity = ERROR;
+- label = "error: ";
+- }
+- if (severity == -1)
+- throw new RuntimeException("Got an unknown severity: "+severityName+". Please adapt the PLM to this new version of scala (or whatever).");
+- if (severity == INFO && !Game.getInstance().isDebugEnabled())
+- return;
+-
+- int lineNum = -1;
+- try {
+- lineNum = pos.line() - offset;
+- } catch (Throwable t) {
+- // That's fine if the line number is not defined.
+- }
+-
+- String name = pos.source().path();
+- int lastDot = name.lastIndexOf('.');
+- if (lastDot != -1)
+- name = name.substring(lastDot+1);
+- String msg = name+(lineNum == -1? "": ":"+lineNum) +": "+label+message;
+-
+- // Append the line content and a position marker, if possible
+- if (pos != null && pos.isDefined()) {
+- msg += "\n"+pos.inUltimateSource(pos.source()).lineContent()+"\n";
+- for (int i=0;i<pos.column()-1;i++)
+- msg += " ";
+- msg += "^";
+- }
+-
+- messages.add(msg);
+- }
+- public void throwExceptionOnNeed() throws PLMCompilerException {
+- if (hasErrors()) {
+- StringBuffer sb = new StringBuffer();
+- for (String s : messages)
+- sb.append(s);
+- throw new PLMCompilerException(sb.toString(), null, null);
+- }
+- }
+- @Override
+- public void reset() {
+- super.reset();
+- messages.removeAllElements();
+- }
+-
+- /* These methods are mandated by scala 2.11, but I dunno what to do with it, so ignore that for now */
+- public int count(Object o) {
+- return 0;
+- }
+- public void resetCount(Object o) {}
+- public void info0(Position arg0, String arg1, Object arg2, boolean arg3) {
+- // TODO Auto-generated method stub
+- }
+- }
+-}
+\ No newline at end of file
+Index: b/src/plm/core/model/Game.java
+===================================================================
+--- a/src/plm/core/model/Game.java
++++ b/src/plm/core/model/Game.java
+@@ -43,7 +43,6 @@ import plm.core.lang.LangJava;
+ import plm.core.lang.LangLightbot;
+ import plm.core.lang.LangPython;
+ import plm.core.lang.LangRuby;
+-import plm.core.lang.LangScala;
+ import plm.core.lang.ProgrammingLanguage;
+ import plm.core.model.lesson.Exercise;
+ import plm.core.model.lesson.Exercise.WorldKind;
+@@ -99,14 +98,13 @@ public class Game implements IWorldView
+
+ public static final ProgrammingLanguage JAVA = new LangJava();
+ public static final ProgrammingLanguage PYTHON = new LangPython();
+- public static final ProgrammingLanguage SCALA = new LangScala();
+ public static final ProgrammingLanguage C = new LangC();
+ //public static final ProgrammingLanguage JAVASCRIPT = new ProgrammingLanguage("JavaScript","js",ResourcesCache.getIcon("img/lang_javascript.png"));
+ public static final ProgrammingLanguage RUBY = new LangRuby();
+ public static final ProgrammingLanguage LIGHTBOT = new LangLightbot();
+
+ public static final ProgrammingLanguage[] programmingLanguages = new ProgrammingLanguage[] {
+- JAVA, PYTHON, SCALA, RUBY, LIGHTBOT, C // TODO: re-add JAVASCRIPT to this list once it works at least a bit
++ JAVA, PYTHON, RUBY, LIGHTBOT, C // TODO: re-add JAVASCRIPT to this list once it works at least a bit
+ };
+ private ProgrammingLanguage programmingLanguage = JAVA;
+
+@@ -164,10 +162,6 @@ public class Game implements IWorldView
+ i18n = I18nFactory.getI18n(getClass(),"org.plm.i18n.Messages",FileUtils.getLocale(), I18nFactory.FALLBACK);
+ loadProperties();
+
+- if (checkScala())
+- System.err.println(i18n.tr("Scala is usable on your machine. Congratulations."));
+- else
+- System.err.println(i18n.tr("Please install Scala version 2.10 or higher to use it in the PLM."));
+ if (checkPython())
+ System.err.println(i18n.tr("Jython is usable on your machine. Congratulations."));
+ else
+@@ -180,17 +174,13 @@ public class Game implements IWorldView
+ String defaultProgrammingLanguage = Game.getProperty(PROP_PROGRAMING_LANGUAGE,Game.JAVA.getLang(),true);
+ if (!defaultProgrammingLanguage.equalsIgnoreCase(Game.JAVA.getLang()) &&
+ !defaultProgrammingLanguage.equalsIgnoreCase(Game.PYTHON.getLang()) &&
+- !defaultProgrammingLanguage.equalsIgnoreCase(Game.SCALA.getLang()) &&
+ !defaultProgrammingLanguage.equalsIgnoreCase(Game.C.getLang()))
+ System.err.println(i18n.tr("Warning, the default programming language is neither ''Java'' nor ''python'' or ''Scala'' or ''C'' but {0}.\n"+
+ " This language will be used to setup the worlds, possibly leading to severe issues for the exercises that don''t expect it.\n" +
+ " It is safer to change the current language, and restart the PLM before proceeding.\n"+
+ " Alternatively, the property {1} can be changed in your configuration file ({2}/plm.properties)",defaultProgrammingLanguage,PROP_PROGRAMING_LANGUAGE, getSavingLocation()));
+
+- if (defaultProgrammingLanguage.equalsIgnoreCase(Game.SCALA.getLang()) && !canScala) {
+- System.err.println(i18n.tr("The default programming language is Scala, but your scala installation is not usable. Switching to Java instead.\n"));
+- setProgramingLanguage(JAVA);
+- } else if (defaultProgrammingLanguage.equalsIgnoreCase(Game.PYTHON.getLang()) && !canPython) {
++ if (defaultProgrammingLanguage.equalsIgnoreCase(Game.PYTHON.getLang()) && !canPython) {
+ System.err.println(i18n.tr("The default programming language is python, but your python installation is not usable. Switching to Java instead.\n"));
+ setProgramingLanguage(JAVA);
+ } else if (defaultProgrammingLanguage.equalsIgnoreCase(Game.C.getLang()) && !canC) {
+@@ -231,35 +221,7 @@ public class Game implements IWorldView
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ private boolean checkScala() {
+- String[] resources = new String[] {"/scala/tools/nsc/Interpreter", "/scala/ScalaObject", "/scala/reflect/io/AbstractFile"};
+- String[] hints = new String[] {"scala-compiler.jar", "scala-library.jar", "scala-reflect.jar"};
+- for (int i=0;i<resources.length;i++) {
+- scalaError = canResolve(resources[i],hints[i]);
+- if (!scalaError.isEmpty()) {
+- System.err.println(scalaError);
+- return canScala;
+- }
+- }
+-
+- String version = null;
+- try {
+- Class props = Class.forName("scala.util.Properties");
+- Method meth = props.getMethod("versionString", new Class[] {});
+- version = (String) meth.invoke(props);
+- } catch (Exception e) {
+- scalaError = i18n.tr("Error {0} while retrieving the Scala version: {1}", e.getClass().getName() ,e.getLocalizedMessage());
+- System.err.println( scalaError );
+- return canScala;
+- }
+-
+- if (version.contains("version 2.10") || version.contains("version 2.11")) {
+- canScala = true;
+- return canScala;
+- } else {
+- scalaError = i18n.tr("Scala is too ancient. Found {0} while I need 2.10 or higher.",version);
+- System.err.println(scalaError);
+- return canScala;
+- }
++ return false;
+ }
+
+ public boolean canPython = false;
+@@ -972,11 +934,6 @@ public class Game implements IWorldView
+
+ if (isValidProgLanguage(newLanguage)) {
+ //System.out.println("Switch programming language to "+newLanguage);
+- if (newLanguage.equals(Game.SCALA) && !canScala) {
+- JOptionPane.showMessageDialog(null, i18n.tr("Please install Scala version 2.10 or higher to use it in the PLM.\n\n")+scalaError ,
+- i18n.tr("Scala is missing"), JOptionPane.ERROR_MESSAGE);
+- return;
+- }
+ if (newLanguage.equals(Game.PYTHON) && !canPython) {
+ JOptionPane.showMessageDialog(null, i18n.tr("Please install jython and its dependencies to use the python programming language in the PLM.\n\n")+pythonError,
+ i18n.tr("Python is missing"), JOptionPane.ERROR_MESSAGE);
+@@ -999,7 +956,7 @@ public class Game implements IWorldView
+ }
+ this.programmingLanguage = newLanguage;
+ fireProgLangChange(newLanguage);
+- if (newLanguage.equals(Game.JAVA) || newLanguage.equals(Game.PYTHON) || newLanguage.equals(Game.SCALA) || newLanguage.equals(Game.C)) // Only save it if it's stable enough
++ if (newLanguage.equals(Game.JAVA) || newLanguage.equals(Game.PYTHON) || newLanguage.equals(Game.C)) // Only save it if it's stable enough
+ setProperty(PROP_PROGRAMING_LANGUAGE, newLanguage.getLang());
+ return;
+ }
+Index: b/src/plm/core/model/lesson/ExerciseTemplated.java
+===================================================================
+--- a/src/plm/core/model/lesson/ExerciseTemplated.java
++++ b/src/plm/core/model/lesson/ExerciseTemplated.java
+@@ -212,7 +212,7 @@ public abstract class ExerciseTemplated
+ String initialContent = templateHead.toString() + templateTail.toString();
+ String skelContent;
+ String headContent;
+- if (lang == Game.PYTHON || lang == Game.SCALA || lang == Game.C) {
++ if (lang == Game.PYTHON || lang == Game.C) {
+ skelContent = skel.toString();
+ headContent = head.toString();
+ } else {
+@@ -358,7 +358,7 @@ public abstract class ExerciseTemplated
+ System.out.println("Found suitable templating entity "+lang.nameOfCorrectionEntity(this)+" in "+lang);
+
+ } catch (NoSuchEntityException e) {
+- if (lang.equals(Game.PYTHON) || lang.equals(Game.SCALA) || lang.equals(Game.JAVA))
++ if (lang.equals(Game.PYTHON) || lang.equals(Game.JAVA))
+ System.out.println("No templating entity found: "+e);
+
+ if (getProgLanguages().contains(lang))
+Index: b/src/plm/universe/bat/BatTest.java
+===================================================================
+--- a/src/plm/universe/bat/BatTest.java
++++ b/src/plm/universe/bat/BatTest.java
+@@ -165,9 +165,7 @@ public class BatTest {
+ }
+ private void displayParameter(Object o, StringBuffer sb, ProgrammingLanguage pl) {
+ if (o == null) {
+- if (pl == Game.SCALA)
+- sb.append("Nil");
+- else if (pl == Game.PYTHON)
++ if (pl == Game.PYTHON)
+ sb.append("None");
+ else
+ sb.append("null");
+@@ -175,8 +173,6 @@ public class BatTest {
+ } else if (o instanceof String[]) {
+ if (pl.equals(Game.JAVA)) {
+ sb.append("{");
+- } else if (pl.equals(Game.SCALA)) {
+- sb.append("Array(");
+ } else if (pl.equals(Game.PYTHON)) {
+ sb.append("[");
+ } else {
+@@ -191,8 +187,6 @@ public class BatTest {
+ sb.deleteCharAt(sb.length()-1);
+ if (pl.equals(Game.JAVA)) {
+ sb.append("}");
+- } else if (pl.equals(Game.SCALA)) {
+- sb.append(")");
+ } else if (pl.equals(Game.PYTHON)) {
+ sb.append("]");
+ } else {
+@@ -204,8 +198,6 @@ public class BatTest {
+
+ if (pl.equals(Game.JAVA)) {
+ sb.append("{");
+- } else if (pl.equals(Game.SCALA)) {
+- sb.append("Array(");
+ } else if (pl.equals(Game.PYTHON)) { // Python
+ sb.append("[");
+ } else {
+@@ -231,8 +223,6 @@ public class BatTest {
+ }
+ if (pl.equals(Game.JAVA)) {
+ sb.append("}");
+- } else if (pl.equals(Game.SCALA)) {
+- sb.append(")");
+ } else if (pl.equals(Game.PYTHON)) {
+ sb.append("]");
+ } else {
+@@ -240,7 +230,7 @@ public class BatTest {
+ }
+ } else if (o instanceof Boolean) {
+ Boolean b = (Boolean) o;
+- if (pl.equals(Game.JAVA) || pl.equals(Game.SCALA)) {
++ if (pl.equals(Game.JAVA)) {
+ sb.append(b ? "true":"false");
+ } else if (pl.equals(Game.PYTHON)) {
+ sb.append(b ? "True" : "False");
+@@ -296,8 +286,6 @@ public class BatTest {
+ displayParameter(o, sb, Game.getProgrammingLanguage());
+ return sb.toString();
+ } else {
+- if (Game.getProgrammingLanguage() == Game.SCALA)
+- return "Nil";
+ if (Game.getProgrammingLanguage() == Game.PYTHON)
+ return "None";
+ return "null";
+Index: b/src/plm/test/simple/test/ScalaSimpleExerciseTest.java
+===================================================================
+--- a/src/plm/test/simple/test/ScalaSimpleExerciseTest.java
++++ /dev/null
+@@ -1,52 +0,0 @@
+-package plm.test.simple.test;
+-
+-import plm.core.model.Game;
+-
+-public class ScalaSimpleExerciseTest extends JVMCompiledSimpleExerciseTest {
+-
+- public ScalaSimpleExerciseTest() {
+- super(Game.SCALA);
+- }
+-
+- @Override
+- public String generateSyntaxErrorCode() {
+- return "zqkdçajdé\"\"";
+- }
+-
+- @Override
+- public String generateVariableErrorCode() {
+- return "toto += 1;\n";
+- }
+-
+- @Override
+- public String generateNullPointerErrorCode() {
+- return "override def run() {\n"
+- + " var s:String = null;\n"
+- + " println(s.length());\n"
+- + "}";
+- }
+-
+- @Override
+- public String generateOutOfBoundsErrorCode() {
+- return "override def run() {\n"
+- + " var t:Array[Int] = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);\n"
+- + " println(t(42));\n"
+- + "}";
+- }
+-
+- @Override
+- public String generateWrongCode() {
+- return "override def run() {\n"
+- + " world.asInstanceOf[SimpleWorld].setObjectif(false);\n"
+- + "}";
+- }
+-
+- @Override
+- public String generateSolutionFollowedByError() {
+- return "override def run() {\n"
+- + " world.asInstanceOf[SimpleWorld].setObjectif(true);\n"
+- + " var t:Array[Int] = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);\n"
+- + " println(t(42));\n"
+- + "}";
+- }
+-}
+Index: b/src/plm/core/lang/JVMCompiledLang.java
+===================================================================
+--- a/src/plm/core/lang/JVMCompiledLang.java
++++ b/src/plm/core/lang/JVMCompiledLang.java
+@@ -48,15 +48,6 @@ public abstract class JVMCompiledLang ex
+ ent = (Entity)getClass().getClassLoader().loadClass(newClassName).newInstance();
+ } catch (Exception e2) {
+ if (whatToMutate == StudentOrCorrection.STUDENT) {
+- if (Game.getProgrammingLanguage() == Game.SCALA)
+- throw new PLMCompilerException(Game.i18n.tr(
+- "Your entity failed to start. Did you forgot to put your code within a method?\n\n"
+- + "This problem often arises when the exercise expects you to put all the code within a \n"
+- + "method e.g. run(), but you put some statements (e.g. forward()) outside of any method.\n\n"
+- + "The easiest solution to sort it out is to copy all your code (Ctrl-A Ctrl-C), use the \n"
+- + "'Exercise/Revert' menu to reset the template, and paste (Ctrl-V) your code within the\n"
+- + "provided method."));
+- else
+ throw new PLMCompilerException(Game.i18n.tr("Your entity failed to start. Your constructor seems to be broken, but I have no clue."));
+ } else {
+ throw new PLMEntityNotFound("Cannot find an entity of name "+className(newClassName)+" or "+newClassName+". Broken lesson.", e2);
+Index: b/src/plm/core/model/lesson/ExerciseTemplatingEntity.java
+===================================================================
+--- a/src/plm/core/model/lesson/ExerciseTemplatingEntity.java
++++ b/src/plm/core/model/lesson/ExerciseTemplatingEntity.java
+@@ -83,19 +83,7 @@ public abstract class ExerciseTemplating
+ javaFile.setCorrection("$package "+template+" @SuppressWarnings(\"unchecked\") public void run(BatTest t) {\n"+javaFile.getTemplate()+"}\n"+javaFile.getCorrection()+" }");
+ javaFile.setTemplate ("$package "+template+" @SuppressWarnings(\"unchecked\") public void run(BatTest t) { "+javaFile.getTemplate()+"} $body }");
+ //System.out.println("New template: "+sf.getTemplate());
+-
+- if (getProgLanguages().contains(Game.SCALA)) {
+- SourceFile scalaFile = sourceFiles.get(Game.SCALA).get(0);
+- String header = "$package\n"
+- + "import plm.universe.bat.{BatEntity,BatWorld,BatTest}; \n"
+- + "import plm.universe.World; \n"
+- + "import scala.collection.JavaConverters._;\n"
+- + "class "+entName+" extends BatEntity { ";
+-
+- scalaFile.setCorrection(header+scalaFile.getCorrection()+" }");
+- scalaFile.setTemplate (header+scalaFile.getTemplate() +" }");
+- }
+-
++
+ computeAnswer();
+ setSetup(true);
+ }
+@@ -114,8 +102,6 @@ public abstract class ExerciseTemplating
+ protected void templateScala(String entName, String[] types, String initialCode, String correction) {
+ if (isSetup())
+ throw new RuntimeException("The exercise "+getName()+" is already setup, too late to add a programming language template.");
+- if (this.getProgLanguages().contains(Game.SCALA))
+- throw new RuntimeException("The exercise "+getName()+" has two Scala templates. Please fix this bug.");
+
+ StringBuffer skeleton = new StringBuffer(" val res = ");
+ skeleton.append(entName);
+@@ -146,9 +132,6 @@ public abstract class ExerciseTemplating
+ skeleton.append(" case e:java.lang.ClassCastException => t.setResult(res)\n"); // primitive types cannot be converted to java, but I don't care (and cannot test whether res is a primitive type)
+ skeleton.append("}\n");
+
+- newSource(Game.SCALA, entName, initialCode, "\n override def run(t: BatTest) {\n"+skeleton+"\n }\n$body",14,
+- "\n override def run(t: BatTest) {\n"+skeleton+"\n }\n"+initialCode+correction);
+- addProgLanguage(Game.SCALA);
+ }
+ public boolean isSetup() {
+ return isSetup;
+Index: b/src/plm/core/ui/editor/MissionEditor.java
+===================================================================
+--- a/src/plm/core/ui/editor/MissionEditor.java
++++ b/src/plm/core/ui/editor/MissionEditor.java
+@@ -110,7 +110,6 @@ public class MissionEditor extends JFram
+ selectorAll.setSelected(true);
+ final JCheckBox selectorC = new JCheckBox("C");
+ final JCheckBox selectorJava = new JCheckBox("Java");
+- final JCheckBox selectorScala = new JCheckBox("Scala");
+ final JCheckBox selectorPython = new JCheckBox("Python");
+
+ final ItemListener il = new ItemListener() {
+@@ -129,9 +128,6 @@ public class MissionEditor extends JFram
+ if(selectorJava.isSelected()){
+ l.add(Game.JAVA);
+ }
+- if(selectorScala.isSelected()){
+- l.add(Game.SCALA);
+- }
+ if(selectorPython.isSelected()){
+ l.add(Game.PYTHON);
+ }
+@@ -162,7 +158,6 @@ public class MissionEditor extends JFram
+ selectorAll.addItemListener(il);
+ selectorC.addItemListener(il);
+ selectorJava.addItemListener(il);
+- selectorScala.addItemListener(il);
+ selectorPython.addItemListener(il);
+
+ editor = new JEditorPane();
+@@ -183,7 +178,6 @@ public class MissionEditor extends JFram
+ box.add(selectorAll);
+ box.add(selectorC);
+ box.add(selectorJava);
+- box.add(selectorScala);
+ box.add(selectorPython);
+
+ rightDisplay.add(box, BorderLayout.NORTH);
+Index: b/src/plm/core/ui/JavaEditorPanel.java
+===================================================================
+--- a/src/plm/core/ui/JavaEditorPanel.java
++++ b/src/plm/core/ui/JavaEditorPanel.java
+@@ -31,8 +31,6 @@ public class JavaEditorPanel extends RTe
+ codeEditor.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
+ } else if (lang.equals(Game.PYTHON)) {
+ codeEditor.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_PYTHON);
+- } else if (lang.equals(Game.SCALA)) {
+- codeEditor.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_SCALA);
+ } else if (lang.equals(Game.C)) {
+ codeEditor.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_C);
+ } else {
+Index: b/src/plm/universe/bat/BatExercise.java
+===================================================================
+--- a/src/plm/universe/bat/BatExercise.java
++++ b/src/plm/universe/bat/BatExercise.java
+@@ -98,7 +98,7 @@ public abstract class BatExercise extend
+ }
+
+ for (ProgrammingLanguage pl : getProgLanguages()) {
+- if (!pl.equals(Game.JAVA) && !pl.equals(Game.SCALA))
++ if (!pl.equals(Game.JAVA))
+ worlds.get(0).getEntity(0).setScript(pl, corrections.get(pl));
+ }
+
+Index: b/src/plm/test/simple/test/AllSimpleExerciseTests.java
+===================================================================
+--- a/src/plm/test/simple/test/AllSimpleExerciseTests.java
++++ b/src/plm/test/simple/test/AllSimpleExerciseTests.java
+@@ -5,7 +5,7 @@ import org.junit.runners.Suite;
+ import org.junit.runners.Suite.SuiteClasses;
+
+ @RunWith(Suite.class)
+- at SuiteClasses({ JavaSimpleExerciseTest.class, ScalaSimpleExerciseTest.class, PythonSimpleExerciseTest.class })
++ at SuiteClasses({ JavaSimpleExerciseTest.class, PythonSimpleExerciseTest.class })
+ public class AllSimpleExerciseTests {
+
+ }
diff --git a/debian/patches/series b/debian/patches/series
index 91eca40..96ea746 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
system-ant-tasks
no-scala
+no-github
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/plm.git
More information about the pkg-java-commits
mailing list