0

I am currently using AspectJ to generate Client implementation code for my AWS Activity's. This has generally been working really well for both workflows and activitys.

Its worth noting I don't know alot about AspectJ as I am only using it for this code generation.

However I have reached a point were I wish to return an array from an activity and this prevents that activity class from generating its client implementation (It also prevents some workflow code generation, but I think this is a side affect). If I turn the array into a List (just for a point of test) everything seams to work again. I have had no problems passing arrays to activity's only returning them.

To clarify structure. I have an interface which defines the activity and an implementation class which performs the implementation ... so nothing too crazy.

Broken:

public String[] myMethod( String a, String b, String c ) throws Exception;

Works:

public List<String> myMethod( String a, String b, String c ) throws Exception;

As far as I can see I cannot see any AspectJ compilation errors, but I'm only really looking at the consoles.

The only logs I have found show that the generation was complete, but they do report that the total file generated count is different (as expected because its broken ).

Broken:

    :B:  9:53:40 Compiler configuration for project TestProj doesn't know previous state, so assuming EVERYTHING has changed.
:B:  9:53:40 ===========================================================================================
:B:  9:53:40 Build kind = FULLBUILD
:B:  9:53:40 Project=TestProj, kind of build requested=Full AspectJ compilation
:B:  9:53:40 Timer event: 0ms: Flush included source file cache
:B:  9:53:40 Timer event: 0ms: Check delta
:B:  9:53:40 Builder: Tidied output folder(s), removed class files and derived resources
:B:  9:53:40 Timer event: 160ms: Pre compile
:B:  9:53:40 Compiler configuration for project TestProj has been read by compiler.  Resetting.
:B:  9:53:40      Configuration was [PROJECTSOURCEFILES_CHANGED, JAVAOPTIONS_CHANGED, ASPECTPATH_CHANGED, CLASSPATH_CHANGED, INPATH_CHANGED, NONSTANDARDOPTIONS_CHANGED, OUTJAR_CHANGED, PROJECTSOURCERESOURCES_CHANGED, OUTPUTDESTINATIONS_CHANGED, INJARS_CHANGED]
:B:  9:53:40 Resetting list of modified source files.  Was null
:C:  9:53:40 Preparing for build: not going to be incremental because no successful previous full build
:C:  9:53:41 Timer event: 850ms: Time to first compiled message
:C:  9:53:41 Timer event: 860ms: Time to first woven message
:C:  9:53:42 AspectJ reports build successful, build was: FULL
:C:  9:53:42 AJDE Callback: finish. Was full build: true
:B:  9:53:42 Timer event: 1560ms: Total time spent in AJDE
:B:  9:53:42 Timer event: 0ms: Refresh after build
:C:  9:53:42 Types affected during build = 166
:B:  9:53:42 Timer event: 2436ms: Total time spent in AJBuilder.build()
:B:  9:53:43 Timer event: 10ms: Update visualizer, xref, advice listeners for (separate thread): TestProj
:B:  9:53:43 Timer event: 20ms: Delete markers: TestProj (Finished deleting markers for TestProj)
:B:  9:53:43 Timer event: 570ms: Create markers: TestProj (Finished creating markers for TestProj)
:B:  9:53:43 Created 7 markers in 176 files

Working:

:B:  9:54:55 Timer event: 0ms: Delete markers: TestProj (Finished deleting markers for TestProj)
:B:  9:55:6 Compiler configuration for project TestProj doesn't know previous state, so assuming EVERYTHING has changed.
:B:  9:55:6 ===========================================================================================
:B:  9:55:6 Build kind = FULLBUILD
:B:  9:55:6 Project=TestProj, kind of build requested=Full AspectJ compilation
:B:  9:55:6 Timer event: 0ms: Flush included source file cache
:B:  9:55:6 Timer event: 0ms: Check delta
:B:  9:55:6 Builder: Tidied output folder(s), removed class files and derived resources
:B:  9:55:6 Timer event: 250ms: Pre compile
:B:  9:55:6 Compiler configuration for project TestProj has been read by compiler.  Resetting.
:B:  9:55:6      Configuration was [PROJECTSOURCEFILES_CHANGED, JAVAOPTIONS_CHANGED, ASPECTPATH_CHANGED, CLASSPATH_CHANGED, INPATH_CHANGED, NONSTANDARDOPTIONS_CHANGED, OUTJAR_CHANGED, PROJECTSOURCERESOURCES_CHANGED, OUTPUTDESTINATIONS_CHANGED, INJARS_CHANGED]
:B:  9:55:6 Resetting list of modified source files.  Was null
:C:  9:55:6 Preparing for build: not going to be incremental because no successful previous full build
:C:  9:55:7 Timer event: 970ms: Time to first compiled message
:C:  9:55:7 Timer event: 970ms: Time to first woven message
:C:  9:55:8 AspectJ reports build successful, build was: FULL
:C:  9:55:8 AJDE Callback: finish. Was full build: true
:B:  9:55:8 Timer event: 2420ms: Total time spent in AJDE
:B:  9:55:8 Timer event: 0ms: Refresh after build
:C:  9:55:10 Types affected during build = 320
:B:  9:55:10 Timer event: 3741ms: Total time spent in AJBuilder.build()
:B:  9:55:10 Timer event: 10ms: Update visualizer, xref, advice listeners for (separate thread): TestProj
:B:  9:55:10 Timer event: 30ms: Delete markers: TestProj (Finished deleting markers for TestProj)
:B:  9:55:10 Timer event: 100ms: Create markers: TestProj (Finished creating markers for TestProj)
:B:  9:55:10 Created 28 markers in 320 files

I'm not convinced that the logs tell me anything, but I thought that they might mean something to someone else.

I am reluctant to Use the List implementation as When the activity will recvies a primitives like int[] I will not be able to directly convert them to List which is just an overhead for all activity's.

I will be grateful for any advice.

Jon Whitefield
  • 191
  • 1
  • 1
  • 15

1 Answers1

0

Are you referring to the @activities annotation provided by aws sdk flow framework? In that case it is not aspectj related. Swf uses aspectj only when in the decider logic. For generating code do either of the following. If you are using maven then please refer to mavens annotation builder plugin. If you are using eclipse then in menu select Project --> JavaCompiler --> annotation Processing --> Enable Project Specific Settings and set the path where you want the annotation based files created.

Rohit
  • 842
  • 6
  • 8
  • Ah so its the annotations which are identifying the code generation ... Not AspectJ. Ok so with that in mind, I'm surprised that I'm having problems as the annotations are generating the code code correctly using the list ... but fail when using int[]. Is it an eclipse processor which is generating the code? – Jon Whitefield Mar 06 '15 at 17:32
  • That is because when the annotations are processed to generate the code, the generated code has the return type of the activity method as Promise object. Promise object needs a Class/Interface for the type, however an array is not really a class or interface but more of a data structure. So the code is not able to generate the Promise return objects. You can refer to link below to understand the difference in Array and List. http://stackoverflow.com/questions/10487104/difference-between-list-and-array – Rohit Mar 12 '15 at 14:58
  • Ah OK that makes scene to me, thank you very much. I will have to convert my arrays to lists. – Jon Whitefield Mar 13 '15 at 15:50