From 8352d010adf34c25b137fde9883396c68bd81ac0 Mon Sep 17 00:00:00 2001
From: dgelessus <dgelessus@users.noreply.github.com>
Date: Fri, 7 Jul 2023 11:21:44 +0200
Subject: [PATCH] Fix unsuppressable deprecation warnings

---
 src/main/java/org/sablecc/sablecc/lexer/Lexer.java   | 3 +--
 src/main/java/org/sablecc/sablecc/parser/Parser.java | 9 ++++-----
 src/main/resources/org/sablecc/sablecc/lexer.txt     | 3 +--
 src/main/resources/org/sablecc/sablecc/parser.txt    | 9 ++++-----
 4 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/src/main/java/org/sablecc/sablecc/lexer/Lexer.java b/src/main/java/org/sablecc/sablecc/lexer/Lexer.java
index 88b92d8..a582d49 100644
--- a/src/main/java/org/sablecc/sablecc/lexer/Lexer.java
+++ b/src/main/java/org/sablecc/sablecc/lexer/Lexer.java
@@ -13,12 +13,11 @@ import java.util.List;
 import java.util.Queue;
 
 import de.hhu.stups.sablecc.patch.IToken;
-import de.hhu.stups.sablecc.patch.ITokenListContainer;
 
 import org.sablecc.sablecc.node.*;
 
 @SuppressWarnings({"deprecation", "unused"}) // ITokenListContainer is deprecated, but the generated lexer still implements it for compatibility
-public class Lexer implements ITokenListContainer
+public class Lexer implements de.hhu.stups.sablecc.patch.ITokenListContainer
 {
     protected Token token;
     protected State state = State.NORMAL;
diff --git a/src/main/java/org/sablecc/sablecc/parser/Parser.java b/src/main/java/org/sablecc/sablecc/parser/Parser.java
index 28bbe35..992afd4 100644
--- a/src/main/java/org/sablecc/sablecc/parser/Parser.java
+++ b/src/main/java/org/sablecc/sablecc/parser/Parser.java
@@ -16,7 +16,6 @@ import java.util.Map;
 import de.hhu.stups.sablecc.patch.IParser;
 import de.hhu.stups.sablecc.patch.IToken;
 import de.hhu.stups.sablecc.patch.PositionedNode;
-import de.hhu.stups.sablecc.patch.SourcecodeRange;
 
 import org.sablecc.sablecc.lexer.Lexer;
 import org.sablecc.sablecc.lexer.LexerException;
@@ -46,14 +45,14 @@ public class Parser implements IParser
     }
 
     @Deprecated
-    private Map<PositionedNode, SourcecodeRange> mapping = new HashMap<PositionedNode, SourcecodeRange>();
+    private Map<PositionedNode, de.hhu.stups.sablecc.patch.SourcecodeRange> mapping = new HashMap<>();
     /**
      * @deprecated All generated token classes store their own position info.
      *     Use the {@link PositionedNode} or {@link IToken} APIs to access the positions stored in the tokens.
      */
     @Deprecated
     @Override
-    public Map<PositionedNode, SourcecodeRange> getMapping() { return this.mapping; }
+    public Map<PositionedNode, de.hhu.stups.sablecc.patch.SourcecodeRange> getMapping() { return this.mapping; }
 
     private void checkResult(Object elementToCheck, List<Object> beginNodeList, List<Object> endNodeList) {
         if (elementToCheck instanceof List<?>) {
@@ -92,7 +91,7 @@ public class Parser implements IParser
             PositionedNode endNode = findEndNode(endNodeList);
             int end = findEndPos(endNode);
             if (end == -1) end = begin;
-            final SourcecodeRange range = new SourcecodeRange(begin, end);
+            final de.hhu.stups.sablecc.patch.SourcecodeRange range = new de.hhu.stups.sablecc.patch.SourcecodeRange(begin, end);
 
             this.getMapping().put(node, range);
 
@@ -139,7 +138,7 @@ public class Parser implements IParser
             return findIndex((IToken) node);
         }
 
-        final SourcecodeRange item = this.getMapping().get(node);
+        final de.hhu.stups.sablecc.patch.SourcecodeRange item = this.getMapping().get(node);
         if (item == null) {
             return -1;
         }
diff --git a/src/main/resources/org/sablecc/sablecc/lexer.txt b/src/main/resources/org/sablecc/sablecc/lexer.txt
index 5651a1f..f129be4 100644
--- a/src/main/resources/org/sablecc/sablecc/lexer.txt
+++ b/src/main/resources/org/sablecc/sablecc/lexer.txt
@@ -37,12 +37,11 @@ import java.util.List;
 import java.util.Queue;
 
 import de.hhu.stups.sablecc.patch.IToken;
-import de.hhu.stups.sablecc.patch.ITokenListContainer;
 
 import $0$node.*;
 
 @SuppressWarnings({"deprecation", "unused"}) // ITokenListContainer is deprecated, but the generated lexer still implements it for compatibility
-public class Lexer implements ITokenListContainer
+public class Lexer implements de.hhu.stups.sablecc.patch.ITokenListContainer
 {
     protected Token token;
     protected State state = State.$1$;
diff --git a/src/main/resources/org/sablecc/sablecc/parser.txt b/src/main/resources/org/sablecc/sablecc/parser.txt
index f7ebae7..302d4d8 100644
--- a/src/main/resources/org/sablecc/sablecc/parser.txt
+++ b/src/main/resources/org/sablecc/sablecc/parser.txt
@@ -24,7 +24,6 @@ import java.util.Map;
 import de.hhu.stups.sablecc.patch.IParser;
 import de.hhu.stups.sablecc.patch.IToken;
 import de.hhu.stups.sablecc.patch.PositionedNode;
-import de.hhu.stups.sablecc.patch.SourcecodeRange;
 
 import $0$lexer.Lexer;
 import $0$lexer.LexerException;
@@ -54,14 +53,14 @@ public class Parser implements IParser
     }
 
     @Deprecated
-    private Map<PositionedNode, SourcecodeRange> mapping = new HashMap<PositionedNode, SourcecodeRange>();
+    private Map<PositionedNode, de.hhu.stups.sablecc.patch.SourcecodeRange> mapping = new HashMap<>();
     /**
      * @deprecated All generated token classes store their own position info.
      *     Use the {@link PositionedNode} or {@link IToken} APIs to access the positions stored in the tokens.
      */
     @Deprecated
     @Override
-    public Map<PositionedNode, SourcecodeRange> getMapping() { return this.mapping; }
+    public Map<PositionedNode, de.hhu.stups.sablecc.patch.SourcecodeRange> getMapping() { return this.mapping; }
 
     private void checkResult(Object elementToCheck, List<Object> beginNodeList, List<Object> endNodeList) {
         if (elementToCheck instanceof List<?>) {
@@ -100,7 +99,7 @@ public class Parser implements IParser
             PositionedNode endNode = findEndNode(endNodeList);
             int end = findEndPos(endNode);
             if (end == -1) end = begin;
-            final SourcecodeRange range = new SourcecodeRange(begin, end);
+            final de.hhu.stups.sablecc.patch.SourcecodeRange range = new de.hhu.stups.sablecc.patch.SourcecodeRange(begin, end);
 
             this.getMapping().put(node, range);
 
@@ -147,7 +146,7 @@ public class Parser implements IParser
             return findIndex((IToken) node);
         }
 
-        final SourcecodeRange item = this.getMapping().get(node);
+        final de.hhu.stups.sablecc.patch.SourcecodeRange item = this.getMapping().get(node);
         if (item == null) {
             return -1;
         }
-- 
GitLab