mvvmFX icon indicating copy to clipboard operation
mvvmFX copied to clipboard

Document AspectJ configuration for architecture checks

Open manuel-mauky opened this issue 9 years ago • 4 comments

@gbalderas is a student at Saxonia Systems AG and he has worked on configuration for checking violations of the MVVM pattern with AspectJ.

There are 2 tasks to be done for a first proof of concept for this:

  • [ ] add a maven module with the AspectJ aspects
  • [ ] document how to use and configure this in the wiki

manuel-mauky avatar Aug 31 '16 12:08 manuel-mauky

I'm currently working on this. The branch can be found here: https://github.com/gbalderas/mvvmFX/tree/436_AspectJ/mvvmfx-aspectj

Currently the Model layer is attached to any package and its subpackages of name model on it, like: com.example.model or com.another.example.project.model.also.in.model

The package com.example.mymodel will not work as the model layer.

I'm now working on a way to make it possible that the user can give their own model package names before compiling the project.

gbalderas avatar Sep 14 '16 17:09 gbalderas

As it is now I have created a maven-plugin where the user can define their model packages. The plugin then generates the aspects and drops them to a folder inside the project.

I will be pushing my changes soon and also create some documentation for setting this plugin up as well as how to use the generated aspects for maven projects and multi-module projects.

gbalderas avatar Dec 05 '16 17:12 gbalderas

Is AspectJ compiling the source code or the byte code? If there is another compiler that generates things based on the source code (for example Lombok) then we would have a problem when AspectJ operates on source code too. It wouldn't see the generated code of the other compiler. It would only work if AspectJ operates on bytecode. @gbalderas can you say more about this topic?

manuel-mauky avatar Dec 15 '16 08:12 manuel-mauky

As far as I know, the AspectJ compiler takes a java class and produces bytecode. It can also take valid java bytecode and produce new bytecode with the weaved advices. So if the Sourcecode or Bytecode is valid it should also be valid for the AspectJ compiler.

Looking into this post we can configure the AspectJ compiler to recompile the bytecode. https://palesz.wordpress.com/2011/12/03/howto-maven-lombok-and-aspectj-together/

gbalderas avatar Dec 15 '16 14:12 gbalderas