apex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tushar Gosavi (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (APEXCORE-699) Investigate versioning for plugins
Date Fri, 14 Apr 2017 19:45:41 GMT

    [ https://issues.apache.org/jira/browse/APEXCORE-699?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15969449#comment-15969449

Tushar Gosavi commented on APEXCORE-699:

I did following experiments

- Added a static final long variable and added a getVersion() method in the plugin interface.
when it is compiled
  the compiler optimized out the const value and replace it by the actual value. 

  class A implement Plugin {
    int getVersion() {
        return Plugin.VERSION;
    void sayHello(String name) { }

  interface Plugin {
      public static final long VERSION = 1;

      void sayHello(String name);

If we change version in new Apex as below
  interface Plugin {
      public static final long VERSION = 2;

      void sayHello(String name);
      void newMethod();

But plugin compiled against old version is used then getVersion return version of old Apex
(1). This optimization works
only for the primitive types and require a getVersion() method in the interface, or a version
field in interface. We could
introduce a BasePlugin  which will have a field and/or this method and suggest to use extend
plugin from BasePlugin class,
rather than implementing the interface directly.

There is not way to check for absence of method except to call it and catch NoSuchMethod exception.

> Investigate versioning for plugins
> ----------------------------------
>                 Key: APEXCORE-699
>                 URL: https://issues.apache.org/jira/browse/APEXCORE-699
>             Project: Apache Apex Core
>          Issue Type: Sub-task
>            Reporter: Pramod Immaneni
>            Assignee: Tushar Gosavi
>            Priority: Minor
> Having versioning information in the plugin would help in dealing with compatibility
with older plugins when the plugin interface changes. This needs to be investigated.

This message was sent by Atlassian JIRA

View raw message