From: Thomas Walker Lynch Date: Mon, 16 Dec 2024 12:44:32 +0000 (+0000) Subject: debugging the proxy class, setting up IDEA X-Git-Url: https://git.reasoningtechnology.com/style/static/gitweb.css?a=commitdiff_plain;h=b5e1a61a9c01385a093bffc0766b2b31065c3d4d;p=Mosaic debugging the proxy class, setting up IDEA --- diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..639900d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..d843f34 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git "a/developer/javac\360\237\226\211/Mosaic_AllMethodsPublicProxy.java" "b/developer/javac\360\237\226\211/Mosaic_AllMethodsPublicProxy.java" index cdcd82f..83b4184 100644 --- "a/developer/javac\360\237\226\211/Mosaic_AllMethodsPublicProxy.java" +++ "b/developer/javac\360\237\226\211/Mosaic_AllMethodsPublicProxy.java" @@ -3,7 +3,9 @@ package com.ReasoningTechnology.Mosaic; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; +import java.lang.reflect.Constructor; import java.lang.reflect.Method; +import java.lang.reflect.Modifier; import java.util.HashMap; import java.util.Map; @@ -93,20 +95,20 @@ class FunctionSignature_To_Handle_Map { // Map constructors for(Constructor constructor : class_metadata.getDeclaredConstructors()){ - Class[] parameter_types = constructor.getParameterTypes(); - MethodType method_type = MethodType.methodType(class_metadata, parameter_types); - MethodHandle constructor_handle; - - if((constructor.getModifiers() & Modifier.PRIVATE) != 0){ - constructor_handle = private_lookup.findConstructor(class_metadata, method_type); - } else{ - constructor_handle = lookup.findConstructor(class_metadata, method_type); + try{ + Class[] parameter_types = constructor.getParameterTypes(); + MethodType method_type = MethodType.methodType(class_metadata, parameter_types); + MethodHandle constructor_handle = private_lookup.findConstructor(class_metadata, method_type); + + FunctionSignature signature = new FunctionSignature("", parameter_types); + map.put(signature, constructor_handle); + }catch (NoSuchMethodException e){ + System.err.println("Skipping constructor: " + constructor); + }catch(Throwable t){ + t.printStackTrace(); } - - FunctionSignature signature = new FunctionSignature("", parameter_types); - map.put(signature, constructor_handle); } - + // Map methods for(Method method : class_metadata.getDeclaredMethods()){ Class[] parameter_types = method.getParameterTypes(); @@ -124,43 +126,12 @@ class FunctionSignature_To_Handle_Map { FunctionSignature signature = new FunctionSignature(method); map.put(signature ,method_handle); } - } catch(Throwable t){ - System.out.println("FunctionSignature_To_Handle_Map::add_class exception:"); - t.printStackTrace(); - } - } - - - /* - - private void add_class(Class class_metadata){ - try{ - MethodHandles.Lookup lookup = MethodHandles.lookup(); - MethodHandles.Lookup private_lookup = MethodHandles.privateLookupIn(class_metadata ,lookup); - for( Method method : class_metadata.getDeclaredMethods() ){ - Class[] parameter_types = method.getParameterTypes(); - MethodType method_type = MethodType.methodType( - method.getReturnType() ,parameter_types - ); - MethodHandle method_handle; - - if((method.getModifiers() & java.lang.reflect.Modifier.PRIVATE) != 0 ){ - method_handle = private_lookup.findSpecial(class_metadata ,method.getName() ,method_type ,class_metadata); - }else{ - method_handle = lookup.findVirtual(class_metadata ,method.getName() ,method_type); - } - - FunctionSignature signature = new FunctionSignature(method); - map.put(signature ,method_handle); - } }catch(Throwable t){ System.out.println("FunctionSignature_To_Handle_Map::add_class exception:"); t.printStackTrace(); } } - */ - public MethodHandle get_handle(FunctionSignature signature){ return map.get(signature); diff --git "a/developer/javac\360\237\226\211/Mosaic_FunctionSignature.xjava" "b/developer/javac\360\237\226\211/Mosaic_FunctionSignature.xjava" deleted file mode 100644 index 083ca75..0000000 --- "a/developer/javac\360\237\226\211/Mosaic_FunctionSignature.xjava" +++ /dev/null @@ -1,77 +0,0 @@ -package com.ReasoningTechnology.Mosaic; - -import java.lang.reflect.Method; -import java.util.Arrays; -import com.ReasoningTechnology.Mosaic.Mosaic_IsPrimitive; - -public class Mosaic_FunctionSignature { - private final String method_name; - private final Class[] parameter_types; - - public FunctionSignature(String method_name ,Class[] parameter_types){ - this.method_name = method_name; - this.parameter_types = parameter_types; - } - - public FunctionSignature(String method_name ,Object[] args){ - this.method_name = method_name; - this.parameter_types = resolve_parameter_types(args); - } - - public FunctionSignature(Method method){ - this.method_name = method.getName(); - this.parameter_types = method.getParameterTypes(); - } - - private static Class[] resolve_parameter_types(Object[] arg_list){ - Class[] parameter_types = new Class[arg_list.length]; - for( int i = 0; i < arg_list.length; i++ ){ - if( arg_list[i] instanceof Mosaic_IsPrimitive ){ - parameter_types[i] = ((Mosaic_IsPrimitive) arg_list[i]).get_type(); - }else if( arg_list[i] != null ){ - parameter_types[i] = arg_list[i].getClass(); - }else{ - parameter_types[i] = null; - } - } - return parameter_types; - } - - public String get_method_name(){ - return method_name; - } - - public Class[] get_parameter_types(){ - return parameter_types; - } - - @Override - public boolean equals(Object o){ - if( this == o ) return true; - if( o == null || getClass() != o.getClass() ) return false; - FunctionSignature signature = (FunctionSignature) o; - return method_name.equals(signature.method_name) && - java.util.Arrays.equals(parameter_types ,signature.parameter_types); - } - - @Override - public int hashCode(){ - int result = method_name.hashCode(); - result = 31 * result + java.util.Arrays.hashCode(parameter_types); - return result; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append(method_name).append("("); - for (int i = 0; i < parameter_types.length; i++) { - sb.append(parameter_types[i].getSimpleName()); - if (i < parameter_types.length - 1) sb.append(", "); - } - sb.append(")"); - return sb.toString(); - } - -} - diff --git "a/developer/javac\360\237\226\211/Mosaic_TestClasses.java" "b/developer/javac\360\237\226\211/Mosaic_TestClasses.java" new file mode 100644 index 0000000..fc56ebb --- /dev/null +++ "b/developer/javac\360\237\226\211/Mosaic_TestClasses.java" @@ -0,0 +1,50 @@ +package com.ReasoningTechnology.Mosaic; + +/* + These are used for testing that Mosaic can be used for white box + testing. Mosaic tests for Mosaic itself access each of these as + part of regression. Users are welcome to also check accessing these + when debugging any access problems that might arise. +*/ + +// Public class with public and private methods +public class Mosaic_TestClasses { + public boolean publicMethod() { + return true; + } + + private boolean privateMethod() { + return true; + } + + public class PublicClass { + public boolean publicMethod() { + return true; + } + + private boolean privateMethod() { + return true; + } + } + + private class PrivateClass { + public boolean publicMethod() { + return true; + } + + private boolean privateMethod() { + return true; + } + } +} + +// Default (package-private) class with public and private methods +class DefaultClass { + public boolean publicMethod() { + return true; + } + + private boolean privateMethod() { + return true; + } +} diff --git "a/document\360\237\226\211/todo.txt" "b/document\360\237\226\211/todo.txt" index 771152a..584f1d0 100644 --- "a/document\360\237\226\211/todo.txt" +++ "b/document\360\237\226\211/todo.txt" @@ -48,3 +48,10 @@ to the 'resource' project and plan to deprecate it. project will have to expanded into the same module as that being tested, rather than having its jar file accessed through the class path. + + +2024-12-16T10:47:06Z + + FunctionSignature used with AllMethodsPublic currently does not + include the return type. It needs to have that. + diff --git a/env_run b/env_run new file mode 100644 index 0000000..262bf14 --- /dev/null +++ b/env_run @@ -0,0 +1,42 @@ +#!/usr/bin/env bash + +# Centralized environment executor. Typically used by IDEs to run developer/tool +# or tester/tool commands in the correct environment. Shell users are encouraged +# to source the appropriate environment file into their shell instead of +# running commands through this executor. + +if [ "$#" -lt 2 ]; then + echo "Usage: $0 [args...]" + echo "Example: $0 developer make" + exit 1 +fi + +# extract the environment and the command +environment=$1 +shift +command=$1 +shift +command_args="$@" + +# Determine the path to the environment script based on the environment +case "$environment" in + developer) + env_script="env_developer" + ;; + tester) + env_script="env_tester" + ;; + *) + echo "Error: Unknown environment '$environment'. Supported environments are: developer, tester." + exit 1 + ;; +esac + +# check if the environment script exists and is readable +if [ ! -f "$env_script" ] || [ ! -r "$env_script" ]; then + echo "Error: Environment script '$env_script' not found or not readable." + exit 1 +fi + +source "$env_script" +exec "$command" "$command_args" diff --git a/release/Mosaic.jar b/release/Mosaic.jar index 7b94800..bd7cf76 100644 Binary files a/release/Mosaic.jar and b/release/Mosaic.jar differ diff --git "a/tester/javac\360\237\226\211/Test_Access_0.java" "b/tester/javac\360\237\226\211/Test_Access_0.java" new file mode 100644 index 0000000..7831f8e --- /dev/null +++ "b/tester/javac\360\237\226\211/Test_Access_0.java" @@ -0,0 +1,67 @@ +import com.ReasoningTechnology.Mosaic.Mosaic_AllMethodsPublicProxy; +import com.ReasoningTechnology.Mosaic.Mosaic_IO; +import com.ReasoningTechnology.Mosaic.Mosaic_Testbench; +import com.ReasoningTechnology.Mosaic.Mosaic_TestClasses; + +public class Test_Access_0{ + + public static class TestSuite{ + + private static Mosaic_AllMethodsPublicProxy publicProxy; + // private static Mosaic_AllMethodsPublicProxy nestedPublicProxy; + // private static Mosaic_AllMethodsPublicProxy nestedPrivateProxy; + // private static Mosaic_AllMethodsPublicProxy topPrivateProxy; + + static{ + // Initialize proxies using class metadata and path strings + publicProxy = new Mosaic_AllMethodsPublicProxy(Mosaic_TestClasses.class); + // nestedPublicProxy = new Mosaic_AllMethodsPublicProxy("com.ReasoningTechnology.Mosaic.Mosaic_TestClasses$PublicClass"); + // nestedPrivateProxy = new Mosaic_AllMethodsPublicProxy("com.ReasoningTechnology.Mosaic.Mosaic_TestClasses$PrivateClass"); + // topPrivateProxy = new Mosaic_AllMethodsPublicProxy("com.ReasoningTechnology.Mosaic.PrivateClass"); + } + + public Boolean test_publicClass_publicMethod(Mosaic_IO io){ + Object instance = publicProxy.construct(""); + return true; + // return(Boolean) publicProxy.invoke(instance, "publicMethod"); + } + + /* + + public Boolean test_publicClass_privateMethod(Mosaic_IO io){ + Object instance = publicProxy.construct(""); + return(Boolean) publicProxy.invoke(instance, "privateMethod"); + } + + public Boolean test_nestedPublicClass_publicMethod(Mosaic_IO io){ + Object outerInstance = publicProxy.construct(""); + Object instance = nestedPublicProxy.construct("", outerInstance); + return(Boolean) nestedPublicProxy.invoke(instance, "publicMethod"); + } + + public Boolean test_nestedPublicClass_privateMethod(Mosaic_IO io){ + Object outerInstance = publicProxy.construct(""); + Object instance = nestedPublicProxy.construct("", outerInstance); + return(Boolean) nestedPublicProxy.invoke(instance, "privateMethod"); + } + + public Boolean test_nestedPrivateClass_publicMethod(Mosaic_IO io){ + Object outerInstance = publicProxy.construct(""); + Object instance = nestedPrivateProxy.construct("", outerInstance); + return(Boolean) nestedPrivateProxy.invoke(instance, "publicMethod"); + } + + public Boolean test_nestedPrivateClass_privateMethod(Mosaic_IO io){ + Object outerInstance = publicProxy.construct(""); + Object instance = nestedPrivateProxy.construct("", outerInstance); + return(Boolean) nestedPrivateProxy.invoke(instance, "privateMethod"); + } + */ + } + + public static void main(String[] args){ + TestSuite suite = new TestSuite(); + int result = Mosaic_Testbench.run(suite); + System.exit(result); + } +} diff --git "a/tester/javac\360\237\226\211/Test_AllMethodsPublicProxy_0.java" "b/tester/javac\360\237\226\211/Test_AllMethodsPublicProxy_0.java" new file mode 100644 index 0000000..05b4759 --- /dev/null +++ "b/tester/javac\360\237\226\211/Test_AllMethodsPublicProxy_0.java" @@ -0,0 +1,98 @@ +import com.ReasoningTechnology.Mosaic.Mosaic_AllMethodsPublicProxy; +import com.ReasoningTechnology.Mosaic.Mosaic_IO; +import com.ReasoningTechnology.Mosaic.Mosaic_Testbench; +import com.ReasoningTechnology.Mosaic.Mosaic_TestClasses; + +public class Test_AllMethodsPublicProxy_0 { + + public static class TestSuite { + + private static Mosaic_AllMethodsPublicProxy publicProxy; + private static Mosaic_AllMethodsPublicProxy defaultProxy; + private static Mosaic_AllMethodsPublicProxy privateProxy; + + static { + try { + // Initialize proxies for public, default, and private classes + publicProxy = new Mosaic_AllMethodsPublicProxy(PublicClass.class); + defaultProxy = new Mosaic_AllMethodsPublicProxy(DefaultClass.class); + privateProxy = new Mosaic_AllMethodsPublicProxy(PrivateClass.class); + } catch (Exception e) { + System.err.println("Failed to initialize proxies: " + e.getMessage()); + e.printStackTrace(); + } + } + + public Boolean test_publicClass_publicMethod(Mosaic_IO io) { + try { + Object instance = publicProxy.construct(""); + return (Boolean) publicProxy.invoke(instance, "publicMethod"); + } catch (Exception e) { + System.err.println("Test failed: " + e.getMessage()); + e.printStackTrace(); + return false; + } + } + + public Boolean test_publicClass_privateMethod(Mosaic_IO io) { + try { + Object instance = publicProxy.construct(""); + return (Boolean) publicProxy.invoke(instance, "privateMethod"); + } catch (Exception e) { + System.err.println("Test failed: " + e.getMessage()); + e.printStackTrace(); + return false; + } + } + + public Boolean test_defaultClass_publicMethod(Mosaic_IO io) { + try { + Object instance = defaultProxy.construct(""); + return (Boolean) defaultProxy.invoke(instance, "publicMethod"); + } catch (Exception e) { + System.err.println("Test failed: " + e.getMessage()); + e.printStackTrace(); + return false; + } + } + + public Boolean test_defaultClass_privateMethod(Mosaic_IO io) { + try { + Object instance = defaultProxy.construct(""); + return (Boolean) defaultProxy.invoke(instance, "privateMethod"); + } catch (Exception e) { + System.err.println("Test failed: " + e.getMessage()); + e.printStackTrace(); + return false; + } + } + + public Boolean test_privateClass_publicMethod(Mosaic_IO io) { + try { + Object instance = privateProxy.construct(""); + return (Boolean) privateProxy.invoke(instance, "publicMethod"); + } catch (Exception e) { + System.err.println("Test failed: " + e.getMessage()); + e.printStackTrace(); + return false; + } + } + + public Boolean test_privateClass_privateMethod(Mosaic_IO io) { + try { + Object instance = privateProxy.construct(""); + return (Boolean) privateProxy.invoke(instance, "privateMethod"); + } catch (Exception e) { + System.err.println("Test failed: " + e.getMessage()); + e.printStackTrace(); + return false; + } + } + } + + public static void main(String[] args) { + TestSuite suite = new TestSuite(); + int result = Mosaic_Testbench.run(suite); + System.exit(result); + } +} diff --git "a/tester/javac\360\237\226\211/Test_FunctionSignature.java" "b/tester/javac\360\237\226\211/Test_FunctionSignature.java" deleted file mode 100644 index 1485b93..0000000 --- "a/tester/javac\360\237\226\211/Test_FunctionSignature.java" +++ /dev/null @@ -1,95 +0,0 @@ -import com.ReasoningTechnology.Mosaic.*; - -public class Test_FunctionSignature{ - - public class TestSuite{ - - public Boolean test_basic_signature(Mosaic_IO io){ - Boolean[] conditions = new Boolean[3]; - int i = 0; - - // Test resolve_parameter_types with primitives and non-primitives - Mosaic_FunctionSignature sig1 = new Mosaic_FunctionSignature("test", new Object[]{42, "hello"}); - conditions[i++] = sig1.get_parameter_types()[0].equals(int.class); - conditions[i++] = sig1.get_parameter_types()[1].equals(String.class); - - // Test method name retrieval - conditions[i++] = sig1.get_method_name().equals("test"); - - return Mosaic_Util.all(conditions); - } - - public Boolean test_signature_equality(Mosaic_IO io){ - Boolean[] conditions = new Boolean[2]; - int i = 0; - - Mosaic_FunctionSignature sig1 = new Mosaic_FunctionSignature("test", new Object[]{42, "hello"}); - Mosaic_FunctionSignature sig2 = new Mosaic_FunctionSignature("test", new Object[]{42, "hello"}); - - // Test equality and hash code - conditions[i++] = sig1.equals(sig2); - conditions[i++] = sig1.hashCode() == sig2.hashCode(); - - return Mosaic_Util.all(conditions); - } - - public Boolean test_null_arguments(Mosaic_IO io){ - Boolean[] conditions = new Boolean[2]; - int i = 0; - - Mosaic_FunctionSignature sig = new Mosaic_FunctionSignature("test", new Object[]{null}); - - // Test parameter types for null argument - conditions[i++] = sig.get_parameter_types()[0] == null; - - // Test method name retrieval - conditions[i++] = sig.get_method_name().equals("test"); - - return Mosaic_Util.all(conditions); - } - - public Boolean test_to_string(Mosaic_IO io){ - Boolean[] conditions = new Boolean[1]; - int i = 0; - - Mosaic_FunctionSignature sig = new Mosaic_FunctionSignature("example", new Object[]{42, "text"}); - String expected = "example(int, String)"; - - // Test string representation - conditions[i++] = sig.toString().equals(expected); - - return Mosaic_Util.all(conditions); - } - - public Boolean test_method_constructor(Mosaic_IO io){ - Boolean[] conditions = new Boolean[2]; - int i = 0; - - class TestClass{ - public void sampleMethod(int a, String b){} - } - - try{ - Method method = TestClass.class.getDeclaredMethod("sampleMethod", int.class, String.class); - Mosaic_FunctionSignature sig = new Mosaic_FunctionSignature(method); - - // Test method name - conditions[i++] = sig.get_method_name().equals("sampleMethod"); - - // Test parameter types - conditions[i++] = sig.get_parameter_types()[0].equals(int.class) && - sig.get_parameter_types()[1].equals(String.class); - } catch (NoSuchMethodException e){ - return false; // This shouldn't happen in a controlled test - } - - return Mosaic_Util.all(conditions); - } - } - - public static void main(String[] args){ - TestSuite suite = new Test_FunctionSignature().new TestSuite(); - int result = Mosaic_Testbench.run(suite); - System.exit(result); - } -} diff --git "a/tester/javac\360\237\226\211/Test_FunctionSignature_0.java" "b/tester/javac\360\237\226\211/Test_FunctionSignature_0.java" new file mode 100644 index 0000000..5f26b70 --- /dev/null +++ "b/tester/javac\360\237\226\211/Test_FunctionSignature_0.java" @@ -0,0 +1,42 @@ +import com.ReasoningTechnology.Mosaic.Mosaic_AllMethodsPublicProxy; +import com.ReasoningTechnology.Mosaic.Mosaic_IO; +import com.ReasoningTechnology.Mosaic.Mosaic_Testbench; + +public class Test_FunctionSignature_0 { + + public static class TestSuite { + + private static Mosaic_AllMethodsPublicProxy proxy; + + static { + try { + proxy = new Mosaic_AllMethodsPublicProxy("com.ReasoningTechnology.Mosaic.FunctionSignature"); + } catch (ClassNotFoundException e) { + System.err.println("Failed to initialize proxy: " + e.getMessage()); + } + } + + public Boolean smoke_test_0(Mosaic_IO io) { + try { + // Create a FunctionSignature instance via the proxy constructor + Object signature = proxy.construct("", "testMethod", new Class[]{}); + + // Call the toString method on the proxy instance + String result = (String) proxy.invoke(signature, "toString"); + + // Check expected output + return "testMethod()".equals(result); + } catch (Exception e) { + System.err.println("Test failed: " + e.getMessage()); + e.printStackTrace(); + return false; + } + } + } + + public static void main(String[] args) { + TestSuite suite = new TestSuite(); + int result = Mosaic_Testbench.run(suite); + System.exit(result); + } +} diff --git a/tester/log/log.txt b/tester/log/log.txt index c3fad8a..1b110b8 100644 --- a/tester/log/log.txt +++ b/tester/log/log.txt @@ -1,44 +1,92 @@ -2024-12-13T02:40:45.582Z [main] INFO c.R.Mosaic.Mosaic_Logger - -2024-12-13T02:40:45.580717856Z ----------------------------------------------------------- -Test: smoke_test_logging -Message: -This is a smoke test for logging. - -2024-12-13T02:40:45.962Z [main] INFO c.R.Mosaic.Mosaic_Logger - -2024-12-13T02:40:45.961627900Z ----------------------------------------------------------- -Test: test_failure_3 +2024-12-16T10:34:45.427Z [main] INFO c.R.Mosaic.Mosaic_Logger - +2024-12-16T10:34:45.426403953Z ----------------------------------------------------------- +Test: test_publicClass_publicMethod Stream: stdout Output: -Intentional extraneous chars to stdout for testing +Mosaic_AllMethodsPublicProxy::construct exception: -2024-12-13T02:40:45.963Z [main] INFO c.R.Mosaic.Mosaic_Logger - -2024-12-13T02:40:45.963744794Z ----------------------------------------------------------- -Test: test_failure_4 +2024-12-16T10:34:45.428Z [main] INFO c.R.Mosaic.Mosaic_Logger - +2024-12-16T10:34:45.428781379Z ----------------------------------------------------------- +Test: test_publicClass_publicMethod Stream: stderr Output: -Intentional extraneous chars to stderr for testing. +java.lang.NoSuchMethodException: No constructor found for signature: + at com.ReasoningTechnology.Mosaic.Mosaic_AllMethodsPublicProxy.construct(Mosaic_AllMethodsPublicProxy.java:188) + at Test_Access_0$TestSuite.test_publicClass_publicMethod(Test_Access_0.java:24) + at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) + at java.base/java.lang.reflect.Method.invoke(Method.java:580) + at com.ReasoningTechnology.Mosaic.Mosaic_Testbench.run_test(Mosaic_Testbench.java:58) + at com.ReasoningTechnology.Mosaic.Mosaic_Testbench.run(Mosaic_Testbench.java:95) + at Test_Access_0.main(Test_Access_0.java:64) -2024-12-14T05:51:43.096Z [main] INFO c.R.Mosaic.Mosaic_Logger - -2024-12-14T05:51:43.094778420Z ----------------------------------------------------------- -Test: smoke_test_logging -Message: -This is a smoke test for logging. +2024-12-16T11:02:12.892Z [main] INFO c.R.Mosaic.Mosaic_Logger - +2024-12-16T11:02:12.891300901Z ----------------------------------------------------------- +Test: test_publicClass_publicMethod +Stream: stdout +Output: +Mosaic_AllMethodsPublicProxy::construct exception: + + +2024-12-16T11:02:12.894Z [main] INFO c.R.Mosaic.Mosaic_Logger - +2024-12-16T11:02:12.894076730Z ----------------------------------------------------------- +Test: test_publicClass_publicMethod +Stream: stderr +Output: +java.lang.NoSuchMethodException: No constructor found for signature: + at com.ReasoningTechnology.Mosaic.Mosaic_AllMethodsPublicProxy.construct(Mosaic_AllMethodsPublicProxy.java:188) + at Test_Access_0$TestSuite.test_publicClass_publicMethod(Test_Access_0.java:24) + at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) + at java.base/java.lang.reflect.Method.invoke(Method.java:580) + at com.ReasoningTechnology.Mosaic.Mosaic_Testbench.run_test(Mosaic_Testbench.java:58) + at com.ReasoningTechnology.Mosaic.Mosaic_Testbench.run(Mosaic_Testbench.java:95) + at Test_Access_0.main(Test_Access_0.java:64) + + +2024-12-16T11:03:52.982Z [main] INFO c.R.Mosaic.Mosaic_Logger - +2024-12-16T11:03:52.981361838Z ----------------------------------------------------------- +Test: test_publicClass_publicMethod +Stream: stdout +Output: +Mosaic_AllMethodsPublicProxy::construct exception: + + +2024-12-16T11:03:52.984Z [main] INFO c.R.Mosaic.Mosaic_Logger - +2024-12-16T11:03:52.984090088Z ----------------------------------------------------------- +Test: test_publicClass_publicMethod +Stream: stderr +Output: +java.lang.NoSuchMethodException: No constructor found for signature: + at com.ReasoningTechnology.Mosaic.Mosaic_AllMethodsPublicProxy.construct(Mosaic_AllMethodsPublicProxy.java:188) + at Test_Access_0$TestSuite.test_publicClass_publicMethod(Test_Access_0.java:24) + at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) + at java.base/java.lang.reflect.Method.invoke(Method.java:580) + at com.ReasoningTechnology.Mosaic.Mosaic_Testbench.run_test(Mosaic_Testbench.java:58) + at com.ReasoningTechnology.Mosaic.Mosaic_Testbench.run(Mosaic_Testbench.java:95) + at Test_Access_0.main(Test_Access_0.java:64) + -2024-12-14T05:51:43.496Z [main] INFO c.R.Mosaic.Mosaic_Logger - -2024-12-14T05:51:43.494998052Z ----------------------------------------------------------- -Test: test_failure_3 +2024-12-16T11:05:17.523Z [main] INFO c.R.Mosaic.Mosaic_Logger - +2024-12-16T11:05:17.521819930Z ----------------------------------------------------------- +Test: test_publicClass_publicMethod Stream: stdout Output: -Intentional extraneous chars to stdout for testing +Mosaic_AllMethodsPublicProxy::construct exception: -2024-12-14T05:51:43.497Z [main] INFO c.R.Mosaic.Mosaic_Logger - -2024-12-14T05:51:43.497259959Z ----------------------------------------------------------- -Test: test_failure_4 +2024-12-16T11:05:17.524Z [main] INFO c.R.Mosaic.Mosaic_Logger - +2024-12-16T11:05:17.524857224Z ----------------------------------------------------------- +Test: test_publicClass_publicMethod Stream: stderr Output: -Intentional extraneous chars to stderr for testing. +java.lang.NoSuchMethodException: No constructor found for signature: + at com.ReasoningTechnology.Mosaic.Mosaic_AllMethodsPublicProxy.construct(Mosaic_AllMethodsPublicProxy.java:188) + at Test_Access_0$TestSuite.test_publicClass_publicMethod(Test_Access_0.java:24) + at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) + at java.base/java.lang.reflect.Method.invoke(Method.java:580) + at com.ReasoningTechnology.Mosaic.Mosaic_Testbench.run_test(Mosaic_Testbench.java:58) + at com.ReasoningTechnology.Mosaic.Mosaic_Testbench.run(Mosaic_Testbench.java:95) + at Test_Access_0.main(Test_Access_0.java:64) diff --git "a/tester/tool\360\237\226\211/bash_wrapper_list" "b/tester/tool\360\237\226\211/bash_wrapper_list" deleted file mode 100755 index ac5f2f5..0000000 --- "a/tester/tool\360\237\226\211/bash_wrapper_list" +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/env bash -script_afp=$(realpath "${BASH_SOURCE[0]}") - -# each test listed here will receive a shell wrapper, and run_tests will -# include the test in the test run, in the order it appears in the list. - -# input guards -env_must_be="tester/tool🖉/env" -if [ "$ENV" != "$env_must_be" ]; then - echo "$(script_fp):: error: must be run in the $env_must_be environment" - exit 1 -fi - -# space separated list of bash interface wrappers -echo\ - Test_Logger\ - Test0\ - Test_Util\ - Test_IO\ - Test_Testbench\ - Test_MockClass_0\ - Test_Util_proxy\ - Test_IsPrimitive\ - Test_FunctionSignature\ - "" diff --git "a/tester/tool\360\237\226\211/clean_build_directories" "b/tester/tool\360\237\226\211/clean_build_directories" index 885904a..7136c5c 100755 --- "a/tester/tool\360\237\226\211/clean_build_directories" +++ "b/tester/tool\360\237\226\211/clean_build_directories" @@ -11,6 +11,7 @@ script_afp=$(realpath "${BASH_SOURCE[0]}") # remove files set -x cd "$REPO_HOME"/tester + rm_na log/log.txt rm_na -r scratchpad/* rm_na bash/* set +x diff --git "a/tester/tool\360\237\226\211/make" "b/tester/tool\360\237\226\211/make" index d31e153..66d4ea9 100755 --- "a/tester/tool\360\237\226\211/make" +++ "b/tester/tool\360\237\226\211/make" @@ -3,29 +3,37 @@ script_afp=$(realpath "${BASH_SOURCE[0]}") # input guards - env_must_be="tester/tool🖉/env" - if [ "$ENV" != "$env_must_be" ]; then - echo "$(script_fp):: error: must be run in the $env_must_be environment" - exit 1 - fi +env_must_be="tester/tool🖉/env" +if [ "$ENV" != "$env_must_be" ]; then + echo "$(script_fp):: error: must be run in the $env_must_be environment" + exit 1 +fi echo "Compiling files..." - set -x - cd $REPO_HOME/tester - javac -g -d scratchpad javac🖉/*.java - set +x +set -x +cd $REPO_HOME/tester + +# Get the list of tests to compile +# wrapper is a space-separated list +wrapper_list=$(test_list) + +# make class files +for file in $wrapper_list; do + javac -g -d scratchpad "javac🖉/$file.java" +done +set +x echo "Creating bash wrappers..." - mkdir -p bash - # wrapper is a space separated list - wrapper=$(bash_wrapper_list) - for file in $wrapper;do - cat > bash/$file << EOL +mkdir -p bash + +# make shell call wrappers +for file in $wrapper_list; do + cat > bash/$file << EOL #!/bin/env bash java $file EOL - chmod +x bash/$file + chmod +x bash/$file done echo "$(script_fp) done." diff --git "a/tester/tool\360\237\226\211/test_list" "b/tester/tool\360\237\226\211/test_list" new file mode 100755 index 0000000..ba12487 --- /dev/null +++ "b/tester/tool\360\237\226\211/test_list" @@ -0,0 +1,23 @@ +#!/bin/env bash +script_afp=$(realpath "${BASH_SOURCE[0]}") + +# returns the list of tests for 'make' and for 'run_tests'. + +# input guards +env_must_be="tester/tool🖉/env" +if [ "$ENV" != "$env_must_be" ]; then + echo "$(script_fp):: error: must be run in the $env_must_be environment" + exit 1 +fi + +# space separated list of bash interface wrappers +echo\ + Test_Logger\ + Test0\ + Test_Util\ + Test_IO\ + Test_Testbench\ + Test_MockClass_0\ + Test_IsPrimitive\ + Test_Access_0\ + "" diff --git "a/tool_shared/bespoke\360\237\226\211/env" "b/tool_shared/bespoke\360\237\226\211/env" index df75b2f..76dbada 100644 --- "a/tool_shared/bespoke\360\237\226\211/env" +++ "b/tool_shared/bespoke\360\237\226\211/env" @@ -38,8 +38,8 @@ fi PATH="$REPO_HOME/tool_shared/third_party/RT-project-share/release/amd64:$PATH" PATH="$REPO_HOME/tool_shared/third_party/emacs/bin:$PATH" -# after having installed Itellij IDEA -# PATH="$REPO_HOME/tool_shared/third_party/idea-IC-243.21565.193/:$PATH" + # after having installed Itellij IDEA + PATH="$REPO_HOME/tool_shared/third_party/idea-IC-243.21565.193/bin:$PATH" JAVA_HOME="$REPO_HOME/tool_shared/third_party/jdk-23.0.1" @@ -48,7 +48,6 @@ fi LOGGER_CLASSIC="$REPO_HOME"/tool_shared/third_party/logback-classic-1.4.11.jar LOGGER_CORE="$REPO_HOME"/tool_shared/third_party/logback-core-1.4.11.jar - export PATH JAVA_HOME LOGGER_FACADE LOGGER_CLASSIC LOGGER_CORE # -------------------------------------------------------------------------------- diff --git "a/tool_shared/document\360\237\226\211/install.txt" "b/tool_shared/document\360\237\226\211/install.txt" index 3b662a8..1407032 100644 --- "a/tool_shared/document\360\237\226\211/install.txt" +++ "b/tool_shared/document\360\237\226\211/install.txt" @@ -27,33 +27,6 @@ existing install can be linked, for example for RT-project-share: Otherwise, follow the directions below to make a local install of the third party tool. ----------------------------------------- -RT-project-share - -This pulls in documents and commonly used scripts. The project has symbolic links -into RT-icommon, so this is not optional. - - cd "$REPO_HOME/tool_shared/third_party/" - git clone https://github.com/Thomas-Walker-Lynch/RT-project-share.git - - note this link should already be present: - ln -s "$REPO_HOME/tool_shared/third_party/resource/document" see_also - ----------------------------------------- -jdk-23 - - cd "$REPO_HOME/tool_shared/third_party/upstream" - - # source for the 11 version used before, now upgraded to 23 - #curl -C - -o OpenJDK11U-jdk_x64_linux_hotspot_11.0.16_8.tar.gz https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.16+8/OpenJDK11U-jdk_x64_linux_hotspot_11.0.16_8.tar.gz - curl -L -C - -b "oraclelicense=accept-securebackup-cookie" -O https://download.oracle.com/java/23/latest/jdk-23_linux-x64_bin.tar.gz - - cd .. - tar -xzf upstream/jdk-23_linux-x64_bin.tar.gz - - edit $REPO_HOME/tool_shared/bespoke/env, and update JAVA_HOME: - export JAVA_HOME="$REPO_HOME/tool_shared/third_party/jdk-23.0.1" - ---------------------------------------- Logging @@ -65,25 +38,10 @@ curl -O https://repo1.maven.org/maven2/ch/qos/logback/logback-core/1.4.11/logbac #curl -O https://repo1.maven.org/maven2/ch/qos/logback/logback-classic/1.5.12/logback-classic-1.5.12.jar #curl -O https://repo1.maven.org/maven2/ch/qos/logback/logback-classic/1.5.12/logback-core-1.5.12.jar - - - add to bespoke🖉/env names for these for use in CLASSPATH ---------------------------------------- -IDE - -See -$REPO_HOME/tool_shared/document/install_emacs.txt -$REPO_HOME/tool_shared/document/install_IntelliJ_IDEA.txt - - -but a local install of an IDE will assure it is -sync with the rest of the project build for configuration files and tools built -in to it. - -See the install_emacs.txt and/or install_IDEA.txt files. +see ~/RT-project-share/document🖉 for: -Note, I am using emacs mainly, but also configured and ran IntelliJ IDEA to make -sure it was working. + jdk-23; and one or more IDEs: IntelliJ IDEA, Eclipse, Emacs