Skip to content

Implementation changes

Martin Desruisseaux edited this page Apr 13, 2024 · 14 revisions

This page lists some noticeable implementation changes.

Plexus dependencies removed

The major change is the replacement of Plexus compiler API by the standard javax.tools.JavaCompiler API introduced in Java 6. This changes required an almost full rewrite of the compiler plugin. Other Plexus dependencies such as StringUtils could also be removed because they now have replacements in the standard Java API.

Include/exclude filters

The Plexus scranners used for include/exclude filters have been replaced by java.nio.file.PatternMatcher. The set of allowed syntaxes contains at least "glob" and "regex". If no syntax is specified, then the "glob" syntax is used with the following modifications to the given path:

  • Replacement of the / and \ separators by the platform-specific separator.
  • Escaping of the \ character (replaced by \\).

Compiler options validation

The way to handle compiler options has been modified. Previously, the Maven plugin validated some options before to pass them to the compiler. For example, if the <debuglevel> value contains anything else than lines, vars or source, the plugin raised an error. The intend was to provide more informative message. But in the javax.tools.JavaCompiler interface, there is an API telling us whether an option is supported. Therefor, the new plugin version first asks to the compiler whether the option is supported, and only if the compiler said "no", the validation is performed for producing the error message. Consequently, if the compiler claims to support the -g:foo option, then the plugin will no longer block the use of the foo value in <debuglevel> even if the plugin does not know that value.

Incremental compilation

The code has been rewritten. The previous code had an issue with list of files generated and compared in one case as absolute files, and in other case as relative files. Consequently, the plugin always considered that all files changed, which may explain the performance issue reported in MCOMPILER-209.

Clone this wiki locally