You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2019/08/07 08:47:58 UTC

[plc4x] 11/17: Merge branch 'develop' of https://github.com/apache/plc4x into implement-df1-protocol

This is an automated email from the ASF dual-hosted git repository.

cdutz pushed a commit to branch feature/implement-df1-driver
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 39a42749443151d4d73c85629581590ea45bbbb6
Merge: 3c570d2 504b94c
Author: v.emmert <v....@pragmaticminds.de>
AuthorDate: Wed Jul 31 13:35:54 2019 +0200

    Merge branch 'develop' of https://github.com/apache/plc4x into implement-df1-protocol

 .../language/java/JavaLanguageTemplateHelper.java  | 55 ++++++++++++++++---
 .../main/resources/templates/java/io-template.ftlh | 61 +++++-----------------
 .../resources/templates/java/pojo-template.ftlh    |  3 +-
 .../plugins/codegenerator/language/mspec/MSpec.g4  |  1 +
 .../mspec/expression/ExpressionStringListener.java |  2 +-
 .../DefaultDiscriminatedComplexTypeDefinition.java |  9 ++++
 plc4py/README.md                                   |  4 +-
 7 files changed, 76 insertions(+), 59 deletions(-)

diff --cc build-utils/language-java/src/main/resources/templates/java/io-template.ftlh
index cf5a134,f7738cb..33d0696
--- a/build-utils/language-java/src/main/resources/templates/java/io-template.ftlh
+++ b/build-utils/language-java/src/main/resources/templates/java/io-template.ftlh
@@@ -250,52 -255,7 +255,10 @@@ public class ${typeName}IO implements M
  </#switch>
  </#list>
      }
 +    public static int CRC(Object... args) {
 +        return 0;
 +    }
  
-     private static Map<String, Method> staticMethods;
- 
-     /**
-      * Notice, this method doesn't support using multiple static methods with the same name
-      * but with different argument types. In this case it will use the first used method and
-      * probably fail for all others.
-      *
-      * @param fullyQualifiedMethodName Fully qualified Class name with method name (Example "a.b.c.Foo.bar")
-      * @param args arguments passed to the static method.
-      * @return
-      */
-     private static Object STATIC_CALL(String fullyQualifiedMethodName, Object... args) {
-         if(staticMethods == null) {
-             staticMethods = new HashMap<>();
-         }
-         // Get the method handle and cache it for later usage.
-         if(!staticMethods.containsKey(fullyQualifiedMethodName)) {
-             // Get the types of the arguments.
-             Class<?>[] argTypes = new Class[args.length];
-             for(int i = 0; i < args.length; i++) {
-                 argTypes[i] = args[i].getClass();
-             }
-             // Get the method handle.
-             String className = fullyQualifiedMethodName.substring(0, fullyQualifiedMethodName.lastIndexOf("."));
-             String methodName = fullyQualifiedMethodName.substring(className.length());
-             try {
-                 Class clazz = Class.forName(className);
-                 Method method = clazz.getMethod(methodName, argTypes);
-                 staticMethods.put(fullyQualifiedMethodName, method);
-             } catch (ClassNotFoundException | NoSuchMethodException e) {
-                 throw new RuntimeException("Error finding static method", e);
-             }
-         }
-         Method method = staticMethods.get(fullyQualifiedMethodName);
-         try {
-             // Invoke the static method.
-             return method.invoke(null, args);
-         } catch (InvocationTargetException | IllegalAccessException e) {
-             throw new RuntimeException("Error invoking static method", e);
-         }
-     }
- 
      private static int COUNT(Object obj) {
          if(obj.getClass().isArray()) {
              Object[] arr = (Object[]) obj;