Using enum singleton coding pattern in a Domino Java Agent

戏子无情 提交于 2019-12-02 00:03:48
  1. Open the Designer preferences and select the Compiler settings.

  2. Click on "Configure Project Specific Settings..."

  3. Select your project and click OK.

  4. Change the settings to 1.6 and default compliance settings.

  5. Click OK. You should get a few prompts, select the default. Then open and save your agent again to recompile it.

Using your code I did this and ran it without error.

In the end I found changing the NOTES.INI setting JavaCompilerTarget from...

JavaCompilerTarget=CurrentJavaVersion

...to...

JavaCompilerTarget=1.6

and recreating the agent from scratch fixed the problem.

For Java agents it looks like there are two fields on the agent doc which control source and target Java versions.

These are $JavaCompilerSource and $JavaCompilerTarget.

They are set when a Java agent is created. The value of these fields depends on the value of the NOTES.INI JavaCompilerTarget entry when the agent was created. Changing the NOTES.INI entry after the agent is created and editing or recompiling the agent has no effect.

If I create a Java agent when the NOTES.INI variable "JavaCompilerTarget" is set to "CurrentJavaVersion", the field "$JavaCompilerTarget" gets set to the value "CurrentJ" and the field "$JavaCompilerSource" gets set to the value "1.6".

If I create a Java agent when the NOTES.INI variable "JavaCompilerTarget" is set to "1.6" then the field "$JavaCompilerTarget" gets set to the value "1.6" and the field "$JavaCompilerSource" gets set to the value "1.6".

If this particular agent's "$JavaCompilerTarget" field has a value of "CurrentJ" then I get the exception.

Whereas if I recreate the same agent and its "$JavaCompilerTarget" field has a value of "1.6", I do not get the exception.

If I recreate this agent when the NOTES.INI variable is set to "1.5" then both the agent field values are set to "1.5" and the agent runs without any errors.

If I use ytria scanEZ to change the broken agent (the one that has the field $JavaCompilerTarget="CurrentJ") so that the value is "1.6" instead, and I then open and re-save the agent in designer, it no longer throws an exception. If I change the field value back to "CurrentJ" and re-save the agent it throws the exception again.

So it seems having a Java agent field $JavaCompilerTarget="CurrentJ" is not good and this happens when you have a NOTES.INI entry of JavaCompilerTarget=CurrentJavaVersion.

I have no idea why this changes the JVM behaviour but it does for me on 8.5.3 FP3.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!