[
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.
{code}
class A implement Plugin {
int getVersion() {
return Plugin.VERSION;
}
@Override
void sayHello(String name) { }
}
interface Plugin {
public static final long VERSION = 1;
void sayHello(String name);
}
{code}
If we change version in new Apex as below
{code}
interface Plugin {
public static final long VERSION = 2;
void sayHello(String name);
void newMethod();
}
{code}
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
(v6.3.15#6346)