0

我目前正在使用 AspectJ 为我的 AWS Activity 生成客户端实施代码。这通常对工作流和活动都非常有效。

值得注意的是,我对 AspectJ 了解不多,因为我只将它用于此代码生成。

但是我已经达到了一个点,即我希望从一个活动中返回一个数组,这会阻止该活动类生成其客户端实现(它也阻止了一些工作流代码的生成,但我认为这是一个副作用)。如果我把数组变成一个列表(只是为了一个测试点),一切都会重新开始工作。我将数组传递给活动的唯一返回它们没有问题。

明确结构。我有一个定义活动的接口和一个执行实现的实现类......所以没什么太疯狂的。

破碎的:

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

作品:

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

据我所知,我看不到任何 AspectJ 编译错误,但我只是在看控制台。

我发现的唯一日志显示生成已完成,但他们确实报告生成的文件总数不同(正如预期的那样,因为它损坏了)。

破碎的:

    :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

在职的:

: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

我不相信这些日志能告诉我什么,但我认为它们可能对其他人意味着什么。

我不愿意使用 List 实现,因为当活动将接收像 int[] 这样的原语时,我将无法直接将它们转换为 List,这只是所有活动的开销。

我将不胜感激任何建议。

4

1 回答 1

0

你指的是aws sdk flow framework提供的@activities注解吗?在这种情况下,它与方面无关。Swf 仅在决策者逻辑中使用 aspectj。要生成代码,请执行以下任一操作。如果您使用的是 maven,请参考 mavens annotation builder 插件。如果您使用的是 eclipse,那么在菜单中选择 Project --> JavaCompiler --> annotation Processing --> Enable Project Specific Settings 并设置您希望创建基于注释的文件的路径。

于 2015-03-06T03:36:01.140 回答