From 9dc2c93e698236eaafca3ed950a1a020fac62e37 Mon Sep 17 00:00:00 2001 From: Thomas Walker Lynch Date: Thu, 16 Jan 2025 13:06:39 +0000 Subject: [PATCH] replaces Object/casts/ignore_warnings with generics that compile cleanly --- "developer/document\360\237\226\211/bugs.txt" | 47 +++++- .../CountingNumber/CountingNumber.java | 45 ++--- .../GraphCycleCFinder/TM_SR_ND_Depth.java | 26 +-- developer/example/GraphIndexTree/Graph.java | 4 +- developer/example/GraphIndexTree/Node.java | 2 +- .../GraphIndexTree/TM_SR_ND_Child.java | 65 ++------ .../GraphIndexTree/TM_SR_ND_Diagonal.java | 154 ++++++++---------- .../example/TM_SR_ND/TM_SR_ND_Print_CLI.java | 6 + .../TM_SR_ND/TM_SR_ND_Print_transcript.txt | 17 +- .../javac\360\237\226\211/Ariadne_Graph.java" | 7 +- .../javac\360\237\226\211/Ariadne_Node.java" | 15 +- .../Ariadne_TM_SR_ND.java" | 56 ++++--- .../Ariadne_TM_SR_ND_Array.java" | 84 ++++++---- .../Ariadne_TM_SR_ND_Label.java" | 18 -- .../Ariadne_TM_SR_ND_List.java" | 75 +++------ .../Ariadne_TM_SR_ND_Set.java" | 125 +++++++------- 16 files changed, 365 insertions(+), 381 deletions(-) delete mode 100644 "developer/javac\360\237\226\211/Ariadne_TM_SR_ND_Label.java" diff --git "a/developer/document\360\237\226\211/bugs.txt" "b/developer/document\360\237\226\211/bugs.txt" index 2a42aef..a519022 100644 --- "a/developer/document\360\237\226\211/bugs.txt" +++ "b/developer/document\360\237\226\211/bugs.txt" @@ -2,9 +2,50 @@ 2024-12-31T01:47:53Z -The pencil on file names has been working well .. until yesterday. The jvm doesn't like the `example🖉` directory and refuses to run code in it, so I had to change it to `example`. + The pencil on file names has been working well .. until yesterday. The jvm doesn't like the `example🖉` directory and refuses to run code in it, so I had to change it to `example`. - 2024-12-31T01:47:53Z + 2024-12-31T01:47:53Z - The example directory turns out to be mixed content anyway. + The example directory turns out to be mixed content anyway. +2025-01-16T07:46:45Z[] + + Interesting Java 23 bug-feature. For purposes of backwards compatibility they have added + 'type erasure' where generics are dropped and replaced with 'Object'. This then causes + type mismatch warnings in places there are no type mismatches in the code. An example + line of code that causes this is: + + ``` + protected final TopoIface topo_null = new TopoIface(){ + ... + }; + + ``` + Though perfectly legal, and it compiles, class extensions give type mismatch warnings. This is then replaced with: + + ``` + protected class NullTopo implements TopoIface{ + ... + } + protected final TopoIface topo_null = new NullTopo<>(); + ``` + + And the type mismatch warnings go away. + + +2025-01-16T10:09:24Z[] + + Nuance: + + `Label` is child type of `Ariadne_Label`. + + However the compiler does not consider: + + `Ariadne_TM_SR_ND