From d0fa48a094d3afc148ed57b04b253e7edd8f6d2e Mon Sep 17 00:00:00 2001
From: dgelessus <dgelessus@users.noreply.github.com>
Date: Fri, 2 Dec 2022 11:54:00 +0100
Subject: [PATCH] Remove unused debugging key generation and passing

The debugging key was only used by the debug_console/2 command, which
the Rodin plugin hasn't called in over 10 years and has now been removed
from probcli.
---
 de.prob.core/src/de/prob/cli/CliStarter.java  | 20 -------------------
 de.prob.core/src/de/prob/core/Animator.java   |  4 ----
 .../src/de/prob/core/IServerConnection.java   |  2 --
 .../de/prob/core/internal/AnimatorImpl.java   |  4 ----
 .../prob/core/internal/ServerConnection.java  |  5 -----
 5 files changed, 35 deletions(-)

diff --git a/de.prob.core/src/de/prob/cli/CliStarter.java b/de.prob.core/src/de/prob/cli/CliStarter.java
index 5890e08e..fa9b381b 100644
--- a/de.prob.core/src/de/prob/cli/CliStarter.java
+++ b/de.prob.core/src/de/prob/cli/CliStarter.java
@@ -8,7 +8,6 @@ package de.prob.cli;
 
 import java.io.*;
 import java.net.*;
-import java.security.*;
 import java.util.*;
 
 import org.eclipse.core.filesystem.EFS;
@@ -26,7 +25,6 @@ public final class CliStarter {
 			"ParserAspects.jar", "aspectjrt.jar", "prolog.jar" };
 
 	private Process prologProcess;
-	private String debuggingKey;
 
 	private int port = -1;
 	private Long userInterruptReference = null;
@@ -59,10 +57,6 @@ public final class CliStarter {
 		}
 	}
 
-	public String getDebuggingKey() {
-		return debuggingKey;
-	}
-
 	// Based on org.eventb.core.seqprover.xprover.BundledFileExtractor.BundledFileDescriptor#makeExecutable
 	// (from rodin-b-sharp/rodincore/org.eventb.core.seqprover)
 	private void setExecutable(final File path, final boolean executable) throws CliException {
@@ -78,7 +72,6 @@ public final class CliStarter {
 
 	private void startProlog(final File file) throws CliException {
 		prologProcess = null;
-		debuggingKey = null;
 
 		final String os = Platform.getOS();
 		final File applicationPath = getCliPath();
@@ -110,11 +103,8 @@ public final class CliStarter {
 			command.add(file.getAbsolutePath());
 		}
 
-		createDebuggingKey();
-
 		final ProcessBuilder pb = new ProcessBuilder();
 		pb.command(command);
-		pb.environment().put("PROB_DEBUGGING_KEY", debuggingKey);
 		pb.environment().put("TRAILSTKSIZE", "1M");
 		pb.environment().put("PROLOGINCSIZE", "50M");
 		pb.environment().put("PROB_HOME", osPath);
@@ -213,16 +203,6 @@ public final class CliStarter {
 		errLogger.start();
 	}
 
-	private void createDebuggingKey() {
-		Random random;
-		try {
-			random = SecureRandom.getInstance("SHA1PRNG");
-		} catch (NoSuchAlgorithmException e) {
-			random = new Random();
-		}
-		debuggingKey = Long.toHexString(random.nextLong());
-	}
-
 	private void analyseStdout(final BufferedReader input,
 			Collection<? extends CliPattern<?>> patterns) throws CliException {
 		patterns = new ArrayList<CliPattern<?>>(patterns);
diff --git a/de.prob.core/src/de/prob/core/Animator.java b/de.prob.core/src/de/prob/core/Animator.java
index e9b45664..1d49c94b 100644
--- a/de.prob.core/src/de/prob/core/Animator.java
+++ b/de.prob.core/src/de/prob/core/Animator.java
@@ -322,10 +322,6 @@ public final class Animator {
 		return getImplementation().isMachineLoaded();
 	}
 
-	public String getDebuggingKey() {
-		return getImplementation().getDebuggingKey();
-	}
-
 	public LanguageDependendAnimationPart getLanguageDependendPart() {
 		return getImplementation().getLangdep();
 	}
diff --git a/de.prob.core/src/de/prob/core/IServerConnection.java b/de.prob.core/src/de/prob/core/IServerConnection.java
index 45e7155f..5b7dc304 100644
--- a/de.prob.core/src/de/prob/core/IServerConnection.java
+++ b/de.prob.core/src/de/prob/core/IServerConnection.java
@@ -43,7 +43,5 @@ public interface IServerConnection {
 
 	public abstract void startup(File file) throws CliException;
 
-	String getDebuggingKey();
-
 	void sendUserInterruptSignal();
 }
\ No newline at end of file
diff --git a/de.prob.core/src/de/prob/core/internal/AnimatorImpl.java b/de.prob.core/src/de/prob/core/internal/AnimatorImpl.java
index d0932e6d..639180e7 100644
--- a/de.prob.core/src/de/prob/core/internal/AnimatorImpl.java
+++ b/de.prob.core/src/de/prob/core/internal/AnimatorImpl.java
@@ -145,10 +145,6 @@ public class AnimatorImpl {
 		return this.description != null;
 	}
 
-	public synchronized String getDebuggingKey() {
-		return connector == null ? null : connector.getDebuggingKey();
-	}
-
 	public void execute(final IComposableCommand command) throws ProBException {
 		checkConnector(command.getClass().getName());
 
diff --git a/de.prob.core/src/de/prob/core/internal/ServerConnection.java b/de.prob.core/src/de/prob/core/internal/ServerConnection.java
index 3809881c..67bbd193 100644
--- a/de.prob.core/src/de/prob/core/internal/ServerConnection.java
+++ b/de.prob.core/src/de/prob/core/internal/ServerConnection.java
@@ -50,11 +50,6 @@ public class ServerConnection implements IServerConnection {
 		return lastCommand;
 	}
 
-	@Override
-	public String getDebuggingKey() {
-		return cli == null ? null : cli.getDebuggingKey();
-	}
-
 	private void establishConnection(final int port) throws CliException {
 		try {
 			socket = new Socket(InetAddress.getByName(null), port);
-- 
GitLab