Dukascopy Support Board
http://www.dukascopy.com/swiss/english/forex/jforex/forum/

Obfuscate does not work
http://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=88&t=50465
Page 1 of 1

Author:  fxdiler [ Thu 05 Dec, 2013, 10:18 ]
Post subject:  Obfuscate does not work

Hello,
There is a bug with obfuscate. When I create a new empty strategy and try to compile it obfuscate work ok. Very simple strategies wich print "Hello, word!" or submit one order when compile it obfuscate work ok too. But obfuscate does not work with other strategies which contains some code.
Consider example strategy from Strategy Tutorial https://www.dukascopy.com/wiki/#Strategy_Tutorial/Add_Stop_Loss_and_Take_Profit
Here is the complete strategy's java file - https://www.dukascopy.com/wiki/files/StopLossStrategy.java.
When I try to compile it with obfuscate I get message:
08:55:19 Compiling StopLossStrategy.java

and jfx file not created. But when I compile it without obfuscate I get messages:
08:55:28 Compiling StopLossStrategy.java
08:55:29 Compilation successful. Strategy ID: 63DFB833436E549F9F73FE826090FE10

and creates a new jfx file.

When I compile it from Eclipse with JForex SDK
client.compileStrategy("c:/Documents and Settings/fxdiler/My Documents/JForex/Strategies/StopLossStrategy.java", true);

there is next error
2013-12-05 09:12:41.640 INFO  JavaGuard2 - Unrecoverable error during obfuscation
java.lang.UnsupportedOperationException
   at net.sf.javaguard.classfile.AnnotationElementInfo.read(AnnotationElementInfo.java:115)
   at net.sf.javaguard.classfile.AnnotationElementInfo.create(AnnotationElementInfo.java:48)
   at net.sf.javaguard.classfile.AnnotationInfo.read(AnnotationInfo.java:108)
   at net.sf.javaguard.classfile.AnnotationInfo.create(AnnotationInfo.java:61)
   at net.sf.javaguard.classfile.RuntimeVisibleAnnotationsAttrInfo.readInfo(RuntimeVisibleAnnotationsAttrInfo.java:85)
   at net.sf.javaguard.classfile.AttrInfo.create(AttrInfo.java:101)
   at net.sf.javaguard.classfile.ClassItemInfo.read(ClassItemInfo.java:305)
   at net.sf.javaguard.classfile.FieldInfo.create(FieldInfo.java:47)
   at net.sf.javaguard.classfile.ClassFile.read(ClassFile.java:183)
   at net.sf.javaguard.classfile.ClassFile.create(ClassFile.java:114)
   at net.sf.javaguard.GuardDB.addClasses(GuardDB.java:405)
   at net.sf.javaguard.GuardDB.obfuscate(GuardDB.java:231)
   at net.sf.javaguard.JavaGuard2.obfuscate(JavaGuard2.java:292)
   at net.sf.javaguard.JavaGuard2.start(JavaGuard2.java:170)
   at com.dukascopy.dds2.greed.agent.compiler.JFXCompiler.compile4JFX(JFXCompiler.java:670)
   at com.dukascopy.dds2.greed.agent.compiler.JFXCompiler.compile(JFXCompiler.java:180)
   at com.dukascopy.dds2.greed.agent.compiler.JFXCompiler.compile(JFXCompiler.java:173)
   at com.dukascopy.api.impl.connect.DCClientImpl.compileStrategy(DCClientImpl.java:1314)
   at singlejartest.Main.main(Main.java:136)

Author:  Ivan35 [ Fri 06 Dec, 2013, 06:14 ]
Post subject:  Re: Obfuscate does not work

It happens if there is readOnly=true in @Configurable line.
Try it erase and compilation with obfuscate will be ok.

Author:  API Support [ Fri 06 Dec, 2013, 07:48 ]
Post subject:  Re: Obfuscate does not work

Ivan35 is right. Current obfuscation implementation does not support annotations with named parameters:
@Configurable(readOnly=true, value="a")

Hence, only simple annotations can be used in obfuscated code:
@Configurable("a")

Author:  fxdiler [ Fri 06 Dec, 2013, 11:02 ]
Post subject:  Re: Obfuscate does not work

Thanks, with simple annotations all strategies compiled well.

  Page 1 of 1