aionnetwork / AVM

Enabling Java code to run in a blockchain environment
https://theoan.com/
MIT License
49 stars 25 forks source link

Create way for tools to access JCL whitelist description #356

Closed jeff-aion closed 5 years ago

jeff-aion commented 5 years ago

Tools which want to help developers build contracts for the AVM need a way to look up the JCL whitelist in order to synthesize warnings when the user attempts to use something not provided.

The current proposal is to expose this as a Map of supported Class objects to arrays of an internal data structure to describe a single method name and its arguments:

public class AvmDetails {
   public static Map<Class<?>, MethodDescriptor[]> getClassLibraryWhiteList() {
       // TODO:  Implement.
       return null;
   }

   public static class MethodDescriptor {
       public final String name;
       public final Class<?>[] arguments;

       public MethodDescriptor(String name, Class<?>[] arguments) {
           this.name = name;
           this.arguments = arguments;
       }
   }
}
satran004 commented 5 years ago

It seems that the latest stable version of Intellij (2018.3.4) only works with JDK 8 as bootJDK. With JDK 10/11 as bootJDK, IntelliJ just freezes. Because of this, AVM idea plugin needs to be compatible with JDK 8. But as target version of avm.jar is JDK 10, calling AvmDetails from Idea plugin class is not directly possible.

So we need to find a workaround for this. May be we can think of compiling AvmDetails.java independently with JDK 8 and consume it in avm idea plugin for now.

Another option is, provide support only from Intellij (2019.1) which is still in early release version.