diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index e74ccc33..8ed8ccb4 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -1,19 +1,24 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
+# MIT License
+#
+# Copyright 2021 Mojohaus
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
name: GitHub CI
diff --git a/LICENSE.txt b/LICENSE.txt
index 7320d25d..49131c09 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,13 +1,14 @@
-The MIT License
+MIT License
-Copyright 2005-2006 The Codehaus.
+Copyright 2005-2015 Mojo@Codehaus
+Copyright 2015-2021 Mojohaus
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
@@ -18,4 +19,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
\ No newline at end of file
+SOFTWARE.
diff --git a/README.md b/README.md
index cfadb0d8..d3b32a79 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Mojohaus AspectJ-Maven-Plugin
+# Mojohaus AspectJ Maven Plugin
This is the [aspectj-maven-plugin](https://www.mojohaus.org/aspectj-maven-plugin/).
@@ -8,7 +8,7 @@ This is the [aspectj-maven-plugin](https://www.mojohaus.org/aspectj-maven-plugin
## Overview
-This plugin weaves AspectJ aspects into your classes using the AspectJ compiler ("ajc").
+This plugin weaves AspectJ aspects into your classes using the AspectJ compiler `ajc`.
Typically, aspects are used in one of two ways within your Maven reactors:
* As part of a Single Project, implying aspects and code are defined within the same Maven project.
@@ -18,7 +18,7 @@ Typically, aspects are used in one of two ways within your Maven reactors:
* As part of a Multi-module Maven Reactor where one/some project(s) contains aspects and other
projects within the Maven reactor contain code using the aspects ("woven by the aspects").
This is a more complex and powerful approach, best suited when several Maven projects should be woven
- by a common set of aspects. The "Examples: Multi-module AspectJ use" contains a basic walkthrough
+ by a common set of aspects. The "Examples: Multi-module AspectJ use" contains a basic walk-through
of this approach.
## Contributing
diff --git a/src/it/LineNumbersInAjcWarnings/pom.xml b/src/it/LineNumbersInAjcWarnings/pom.xml
index d0d091d3..7185c658 100644
--- a/src/it/LineNumbersInAjcWarnings/pom.xml
+++ b/src/it/LineNumbersInAjcWarnings/pom.xml
@@ -1,7 +1,7 @@
4.0.0
- org.codehaus.mjo.aspectj.it
+ org.codehaus.mojo.aspectj.itWarningMessagesWithLineNumbers0.0.1-SNAPSHOT
@@ -41,4 +41,4 @@
-
\ No newline at end of file
+
diff --git a/src/it/NoParameters/pom.xml b/src/it/NoParameters/pom.xml
index 087ad5b6..7b38998e 100644
--- a/src/it/NoParameters/pom.xml
+++ b/src/it/NoParameters/pom.xml
@@ -1,7 +1,7 @@
4.0.0
- org.codehaus.mjo.aspectj.it
+ org.codehaus.mojo.aspectj.itparameters0.0.1-SNAPSHOT
@@ -41,4 +41,4 @@
-
\ No newline at end of file
+
diff --git a/src/it/Parameters/pom.xml b/src/it/Parameters/pom.xml
index 9f87a75a..aa34d1aa 100644
--- a/src/it/Parameters/pom.xml
+++ b/src/it/Parameters/pom.xml
@@ -1,7 +1,7 @@
4.0.0
- org.codehaus.mjo.aspectj.it
+ org.codehaus.mojo.aspectj.itparameters0.0.1-SNAPSHOT
@@ -41,4 +41,4 @@
-
\ No newline at end of file
+
diff --git a/src/it/TOFIX_MASPECTJ-4/pom.xml b/src/it/TOFIX_MASPECTJ-4/pom.xml
index b9d591cd..9f2b759b 100644
--- a/src/it/TOFIX_MASPECTJ-4/pom.xml
+++ b/src/it/TOFIX_MASPECTJ-4/pom.xml
@@ -1,7 +1,7 @@
4.0.0
- org.codehaus.mjo.aspectj.it
+ org.codehaus.mojo.aspectj.itmaspectj-40.0.1-SNAPSHOT
@@ -67,4 +67,4 @@
-
\ No newline at end of file
+
diff --git a/src/it/Xajruntimetarget/pom.xml b/src/it/Xajruntimetarget/pom.xml
index 4f06c96a..00c3ae52 100644
--- a/src/it/Xajruntimetarget/pom.xml
+++ b/src/it/Xajruntimetarget/pom.xml
@@ -1,7 +1,7 @@
4.0.0
- org.codehaus.mjo.aspectj.it
+ org.codehaus.mojo.aspectj.itxajruntimetarget0.0.1-SNAPSHOT
@@ -41,4 +41,4 @@
-
\ No newline at end of file
+
diff --git a/src/it/XhasMember/pom.xml b/src/it/XhasMember/pom.xml
index f531bdf6..1b35a442 100644
--- a/src/it/XhasMember/pom.xml
+++ b/src/it/XhasMember/pom.xml
@@ -1,7 +1,7 @@
4.0.0
- org.codehaus.mjo.aspectj.it
+ org.codehaus.mojo.aspectj.itxhasmember0.0.1-SNAPSHOT
@@ -41,4 +41,4 @@
-
\ No newline at end of file
+
diff --git a/src/it/Xlint/pom.xml b/src/it/Xlint/pom.xml
index a4f77cea..4191f358 100644
--- a/src/it/Xlint/pom.xml
+++ b/src/it/Xlint/pom.xml
@@ -1,7 +1,7 @@
4.0.0
- org.codehaus.mjo.aspectj.it
+ org.codehaus.mojo.aspectj.itxlint0.0.1-SNAPSHOT
@@ -41,4 +41,4 @@
-
\ No newline at end of file
+
diff --git a/src/it/Xlintfile/pom.xml b/src/it/Xlintfile/pom.xml
index 7daa6fb9..f33782f3 100644
--- a/src/it/Xlintfile/pom.xml
+++ b/src/it/Xlintfile/pom.xml
@@ -1,7 +1,7 @@
4.0.0
- org.codehaus.mjo.aspectj.it
+ org.codehaus.mojo.aspectj.itxlintfile0.0.1-SNAPSHOT
@@ -41,4 +41,4 @@
-
\ No newline at end of file
+
diff --git a/src/main/java/org/codehaus/mojo/aspectj/AbstractAjcCompiler.java b/src/main/java/org/codehaus/mojo/aspectj/AbstractAjcCompiler.java
index 3221581c..232a7d02 100644
--- a/src/main/java/org/codehaus/mojo/aspectj/AbstractAjcCompiler.java
+++ b/src/main/java/org/codehaus/mojo/aspectj/AbstractAjcCompiler.java
@@ -1,8 +1,5 @@
package org.codehaus.mojo.aspectj;
-
-import org.apache.commons.collections.CollectionUtils;
-
/**
* The MIT License
*
@@ -27,6 +24,7 @@
* SOFTWARE.
*/
+import org.apache.commons.collections.CollectionUtils;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.handler.ArtifactHandler;
import org.apache.maven.plugin.MojoExecutionException;
@@ -48,8 +46,9 @@
import java.util.Set;
/**
- *
Base class for the two aspectJ compiletime weaving mojos.
+ * Base class for the two aspectJ compile-time weaving mojos.
+ *
+ * For all available options see ajc-ref
*
* @author Kaare Nilsen
*/
@@ -191,25 +190,25 @@ public abstract class AbstractAjcCompiler extends AbstractAjcMojo {
protected boolean XhasMember;
/**
- * Specify classfile target setting (1.1 to 1.8) default is 1.2
+ * Specify bytecode target setting (1.3 to 1.9, 10 to 16). See 'complianceLevel' for details.
*
+ * @see org.codehaus.mojo.aspectj.AjcHelper#ACCEPTED_COMPLIANCE_LEVEL_VALUES
*/
@Parameter( defaultValue = "${project.build.java.target}" )
protected String target;
/**
- * Toggle assertions (1.3, 1.4, 1.5, 1.6, 1.7 or 1.8 - default is 1.4). When using -source 1.3, an assert()
- * statement valid under Java 1.4 will result in a compiler error. When using -source 1.4, treat assert
- * as a keyword and implement assertions according to the 1.4 language spec. When using -source 1.5 or higher, Java
- * 5 language features are permitted. With --source 1.7 or higher Java 7 features are supported.
+ * Specify source code language level (1.3 to 1.9, 10 to 16). See 'complianceLevel' for details.
*
+ * @see org.codehaus.mojo.aspectj.AjcHelper#ACCEPTED_COMPLIANCE_LEVEL_VALUES
*/
@Parameter( defaultValue = "${mojo.java.target}" )
protected String source;
/**
- * Specify compiler compliance setting.
- * Defaults to 1.4, with permitted values ("1.3", "1.4", "1.5", "1.6" and "1.7", "1.8").
+ * Specify compiler compliance setting (same as setting 'source' and 'target' to the same level).
+ * Permitted values: 1.3, 1.4, 1.5, 5, 5.0, 1.6, 6, 6.0, 1.7, 7, 7.0, 1.8, 8, 8.0,
+ * 1.9, 9, 9.0, 10, 10.0, 11, 11.0, 12, 12.0, 13, 13.0, 14, 14.0, 15, 15.0, 16, 16.0.
*
* @see org.codehaus.mojo.aspectj.AjcHelper#ACCEPTED_COMPLIANCE_LEVEL_VALUES
*/
@@ -354,22 +353,22 @@ public abstract class AbstractAjcCompiler extends AbstractAjcMojo {
* Supported values are shown in the list below, with their respective explanations - as copied
* directly from the AJC reference.
*
* The filename holding AJC build arguments.
* The file will be placed in the project build output directory, and will contain all the arguments passed to
* the AJC compiler in the last run, and also all the files included in the AJC build.
- *
- *
+ *
* Sample content shown below to illustrate typical content within the builddef.lst file:
- *
+ * This option can be used in case you want to use AJC options not (yet) supported by this plugin.
+ *
+ * Caveat: Be careful when using this option and select the additional compiler arguments wisely, because
+ * behaviour is undefined if you add arguments which have already been added by the plugin using regular parameters
+ * or their default values. The resulting compiler command line will in that case contain duplicate arguments, which
+ * might be illegal depending on the specific argument. Do not expect to be able to manually override existing
+ * arguments using this option or to replace whole argument lists.
+ *
+ * @since 1.13
+ */
+ @Parameter
+ protected List additionalCompilerArgs = new ArrayList<>();
+
/**
- * Sets the arguments to be passed to the compiler.
- * Example: <compilerArgs> <arg>-Xmaxerrs=1000</arg> <arg>-Xlint</arg> <arg>-J-Duser.language=en_us</arg>
- * </compilerArgs>
+ * Activates compiler preview features (e.g. sealed classes in Java 16) when used with a suitable JDK version.
+ *
+ * Please note: You cannot run code compiled with preview features on any other JDK than the one used for
+ * compilation. For example, records compiled with preview on JDK 15 cannot be used on JDK 16 without recompilation.
+ * This is a JVM limitation unrelated to AspectJ. Also, e.g. sealed classes are preview-1 on JDK 15 and preview-2 on
+ * JDK 16. You still need to recompile, no matter what.
+ *
+ * @since 1.13
*/
- @Parameter
- protected List compilerArgs = new ArrayList<>();
+ // TODO:
+ // Create tickets for at least Eclipse IDE and IntelliJ IDEA to recognise this switch and import it as a compiler
+ // and possibly runtime setting. As for AJDT, maybe we have to implement it ourselves, but actually I found no
+ // references to the Maven module there, so I guess the import is implemented somewhere else.
+ @Parameter( defaultValue = "false" )
+ protected boolean enablePreview;
/**
* Holder for ajc compiler options
@@ -472,7 +497,7 @@ public abstract class AbstractAjcCompiler extends AbstractAjcMojo {
/**
* Do the AspectJ compiling.
*
- * @throws MojoExecutionException
+ * @throws MojoExecutionException if arguments file cannot be written
*/
@SuppressWarnings("unchecked")
public void execute() throws MojoExecutionException {
@@ -623,6 +648,10 @@ protected void assembleArguments()
addModulesArgument("-aspectpath", ajcOptions, aspectLibraries, getAdditionalAspectPaths(),
"an aspect library");
+ // Add Java 9+ modules needed for compilation
+ addModulesArgument("--module-path", ajcOptions, javaModules, null,
+ "Java module");
+
// Add xmlConfigured option and argument
if (null != xmlConfigured) {
ajcOptions.add("-xmlConfigured");
@@ -644,8 +673,8 @@ protected void assembleArguments()
}
ajcOptions.addAll(resolvedIncludes);
- if (CollectionUtils.isNotEmpty(compilerArgs)) {
- ajcOptions.addAll(compilerArgs);
+ if (CollectionUtils.isNotEmpty(additionalCompilerArgs)) {
+ ajcOptions.addAll(additionalCompilerArgs);
}
}
@@ -731,7 +760,7 @@ private void addModulesArgument(final String argument, final List argume
* Checks modifications that would make us need a build
*
* @return true if build is needed, otherwise false
- * @throws MojoExecutionException
+ * @throws MojoExecutionException if an unexpected error occurs, e.g. weave directories cannot be resolved
*/
protected boolean isBuildNeeded()
throws MojoExecutionException {
@@ -882,13 +911,23 @@ public void setShowWeaveInfo(boolean showWeaveInfo) {
}
public void setTarget(String target) {
- ajcOptions.add("-target");
- ajcOptions.add(target);
+ if (AjcHelper.isValidComplianceLevel(target)) {
+ ajcOptions.add("-target");
+ ajcOptions.add(target);
+ }
}
public void setSource(String source) {
- ajcOptions.add("-source");
- ajcOptions.add(source);
+ if (AjcHelper.isValidComplianceLevel(source)) {
+ ajcOptions.add("-source");
+ ajcOptions.add(source);
+ }
+ }
+
+ public void setEnablePreview(boolean enablePreview) {
+ if (enablePreview) {
+ ajcOptions.add("--enable-preview");
+ }
}
public void setVerbose(boolean verbose) {
diff --git a/src/main/java/org/codehaus/mojo/aspectj/AbstractAjcMojo.java b/src/main/java/org/codehaus/mojo/aspectj/AbstractAjcMojo.java
index 0ada5836..f9ec48aa 100644
--- a/src/main/java/org/codehaus/mojo/aspectj/AbstractAjcMojo.java
+++ b/src/main/java/org/codehaus/mojo/aspectj/AbstractAjcMojo.java
@@ -69,6 +69,15 @@ public abstract class AbstractAjcMojo extends AbstractMojo
@Parameter
protected String[] weaveDirectories;
+ /**
+ * Java 9+ modules to build the module path from.
+ * Corresponds to ajc --module-path option.
+ *
+ * @since 1.13
+ */
+ @Parameter
+ protected Module[] javaModules;
+
/**
* Weave binary aspects from the jars.
* The aspects should have been output by the same version of the compiler.
diff --git a/src/main/java/org/codehaus/mojo/aspectj/AjcCompileMojo.java b/src/main/java/org/codehaus/mojo/aspectj/AjcCompileMojo.java
index 73d357cb..70038152 100644
--- a/src/main/java/org/codehaus/mojo/aspectj/AjcCompileMojo.java
+++ b/src/main/java/org/codehaus/mojo/aspectj/AjcCompileMojo.java
@@ -36,7 +36,9 @@
import org.codehaus.plexus.util.Scanner;
/**
- * Weaves all main classes.AspectJ Compiler Plugin.
+ * Weaves all main classes.
+ *
+ * AspectJ Compiler Plugin.
* @author Kaare Nilsen
*/
@Mojo( name="compile", defaultPhase = LifecyclePhase.COMPILE, requiresDependencyResolution = ResolutionScope.COMPILE, threadSafe = true )
diff --git a/src/main/java/org/codehaus/mojo/aspectj/AjcHelper.java b/src/main/java/org/codehaus/mojo/aspectj/AjcHelper.java
index 1347e8bb..8540846c 100644
--- a/src/main/java/org/codehaus/mojo/aspectj/AjcHelper.java
+++ b/src/main/java/org/codehaus/mojo/aspectj/AjcHelper.java
@@ -62,8 +62,23 @@ public class AjcHelper
/**
* List holding all accepted values for the {@code complianceLevel} parameter.
*/
- public static final List ACCEPTED_COMPLIANCE_LEVEL_VALUES =
- Arrays.asList("1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "9", "10", "11", "12", "13", "14", "15", "16");
+ public static final List ACCEPTED_COMPLIANCE_LEVEL_VALUES = Arrays.asList(
+ // TODO: update from AJC (AspectJ Compiler) regularly, which in turn extends ECJ (Eclipse Java Compiler)
+ "1.3",
+ "1.4",
+ "1.5", "5", "5.0",
+ "1.6", "6", "6.0",
+ "1.7", "7", "7.0",
+ "1.8", "8", "8.0",
+ "1.9", "9", "9.0",
+ "10", "10.0",
+ "11", "11.0",
+ "12", "12.0",
+ "13", "13.0",
+ "14", "14.0",
+ "15", "15.0",
+ "16", "16.0"
+ );
/**
* Checks if the given complianceLevel value is valid.
@@ -90,9 +105,12 @@ public static boolean isValidComplianceLevel( String complianceLevel )
public static String createClassPath( MavenProject project, List pluginArtifacts, List outDirs )
{
String cp = "";
- Set classPathElements = Collections.synchronizedSet( new LinkedHashSet<>() );
+ Set classPathElements = Collections.synchronizedSet(
+ // LinkedHashSet preserves order by insertion for iteration
+ new LinkedHashSet<>()
+ );
Set dependencyArtifacts = project.getDependencyArtifacts();
- // Set.addAll only adds if absent, so we want to add the project artifacts first.
+ // Set.addAll only adds if absent, so we want to add the project artifacts first
classPathElements.addAll( project.getArtifacts() );
classPathElements.addAll( dependencyArtifacts == null ? Collections.emptySet() : dependencyArtifacts );
classPathElements.addAll( pluginArtifacts == null ? Collections.emptySet() : pluginArtifacts );
@@ -128,17 +146,17 @@ public static String createClassPath( MavenProject project, List plugi
/**
* Based on a AJDT build properties file resolves the combination of all
* include and exclude statements and returns a set of all the files to be
- * compiled and weaved.
+ * compiled and woven.
*
* @param ajdtBuildDefFile the ajdtBuildDefFile
* @param basedir the baseDirectory
- * @return
- * @throws MojoExecutionException
+ * @return Set of Build Files
+ * @throws MojoExecutionException if build properties are not found or cannot be read
*/
public static Set getBuildFilesForAjdtFile( String ajdtBuildDefFile, File basedir )
throws MojoExecutionException
{
- Set result = new LinkedHashSet();
+ Set result = new LinkedHashSet<>();
Properties ajdtBuildProperties = new Properties();
try
@@ -162,18 +180,18 @@ public static Set getBuildFilesForAjdtFile( String ajdtBuildDefFile, Fil
/**
* Based on a set of sourcedirs, apply include and exclude statements and
- * returns a set of all the files to be compiled and weaved.
+ * returns a set of all the files to be compiled and woven.
*
- * @param sourceDirs
- * @param includes
- * @param excludes
- * @return
- * @throws MojoExecutionException
+ * @param sourceDirs source directories
+ * @param includes file include patterns
+ * @param excludes file exclude patterns
+ * @return Set of Build Files for Source Dirs
+ * @throws MojoExecutionException if sourceDirs cannot be resolved
*/
public static Set getBuildFilesForSourceDirs( List sourceDirs, String[] includes, String[] excludes )
throws MojoExecutionException
{
- Set result = new LinkedHashSet();
+ Set result = new LinkedHashSet<>();
for ( String sourceDir : sourceDirs )
{
@@ -200,10 +218,11 @@ public static Set getBuildFilesForSourceDirs( List sourceDirs, S
}
/**
- * Based on a set of weavedirs returns a set of all the files to be weaved.
+ * Based on a set of weave directories returns a set of all the files to be woven.
*
- * @return
- * @throws MojoExecutionException
+ * @param weaveDirs weave directories
+ * @return a set of all the files to be woven
+ * @throws MojoExecutionException if weave directories cannot be resolved
*/
public static Set getWeaveSourceFiles( String[] weaveDirs )
throws MojoExecutionException
@@ -221,7 +240,7 @@ public static Set getWeaveSourceFiles( String[] weaveDirs )
}
catch ( IOException e )
{
- throw new MojoExecutionException( "IO Error resolving weavedirs", e );
+ throw new MojoExecutionException( "IO Error resolving weave directories", e );
}
}
}
@@ -236,7 +255,7 @@ public static Set getWeaveSourceFiles( String[] weaveDirs )
* @param arguments All arguments passed to ajc in this run
* @param fileName the filename of the argfile
* @param outputDir the build output area.
- * @throws IOException
+ * @throws IOException if argfile cannot be created or written
*/
public static void writeBuildConfigToFile( List arguments, String fileName, File outputDir )
throws IOException
@@ -260,13 +279,13 @@ public static void writeBuildConfigToFile( List arguments, String fileNa
*
* @param fileName the filename of the argfile
* @param outputDir the build output area
- * @return
- * @throws IOException
+ * @return the List of all compiler arguments.
+ * @throws IOException if any file operation fails
*/
public static List readBuildConfigFile( String fileName, File outputDir )
throws IOException
{
- List arguments = new ArrayList();
+ List arguments = new ArrayList<>();
File argFile = new File( outputDir, fileName );
if ( FileUtils.fileExists( argFile.getAbsolutePath() ) )
{
@@ -289,8 +308,8 @@ public static List readBuildConfigFile( String fileName, File outputDir
/**
* Convert a string array to a comma separated list
*
- * @param strings
- * @return
+ * @param strings string array to be converted
+ * @return A comma separated list of Strings
*/
protected static String getAsCsv( String[] strings )
{
@@ -311,7 +330,7 @@ protected static String getAsCsv( String[] strings )
/**
* Helper method to find all .java or .aj files specified by the
- * includeString. The includeString is a comma separated list over files, or
+ * inExcludeString. The includeString is a comma separated list over files, or
* directories relative to the specified basedir. Examples of correct
* listings
*
@@ -323,22 +342,22 @@ protected static String getAsCsv( String[] strings )
* src/main/java/com/project/AnAspect.java
*
*
- * @param input
+ * @param inExcludeString in-/exclude string
* @param basedir the baseDirectory
- * @return a list over all files inn the include string
- * @throws MojoExecutionException
+ * @return a list over all files in the include string
+ * @throws MojoExecutionException if Java or AspectJ source files cannot be resolved
*/
- protected static Set resolveIncludeExcludeString( String input, File basedir )
+ protected static Set resolveIncludeExcludeString( String inExcludeString, File basedir )
throws MojoExecutionException
{
Set inclExlSet = new LinkedHashSet<>();
try
{
- if ( null == input || input.trim().equals( "" ) )
+ if ( null == inExcludeString || inExcludeString.trim().equals( "" ) )
{
return inclExlSet;
}
- String[] elements = input.split( "," );
+ String[] elements = inExcludeString.split( "," );
if ( null != elements )
{
diff --git a/src/main/java/org/codehaus/mojo/aspectj/AjcReportMojo.java b/src/main/java/org/codehaus/mojo/aspectj/AjcReportMojo.java
index 1203890e..40ec85db 100644
--- a/src/main/java/org/codehaus/mojo/aspectj/AjcReportMojo.java
+++ b/src/main/java/org/codehaus/mojo/aspectj/AjcReportMojo.java
@@ -48,7 +48,9 @@
/**
* Creates an AspectJ HTML report using the {@code ajdoc} tool and format.
+ *
* A Maven 2.0 ajdoc report
+ *
* @author Kaare Nilsen
*/
@Mojo( name="aspectj-report", requiresDependencyResolution = ResolutionScope.COMPILE )
@@ -280,7 +282,7 @@ protected void executeReport( Locale locale )
}
/**
- * Get the directories containg sources
+ * @return list of source directories
*/
@SuppressWarnings( "unchecked" )
protected List getSourceDirectories()
@@ -300,7 +302,7 @@ protected String getOutputDirectory()
}
/**
- * get compileroutput directory.
+ * @return list of classpath directories
*/
protected List getClasspathDirectories()
{
@@ -419,7 +421,9 @@ public void setVerbose( boolean verbose )
}
/**
- * Setters which when called sets compiler arguments
+ * Set source compliance level
+ *
+ * @param complianceLevel compliance level
*/
public void setComplianceLevel( String complianceLevel )
{
diff --git a/src/main/java/org/codehaus/mojo/aspectj/AjcTestCompileMojo.java b/src/main/java/org/codehaus/mojo/aspectj/AjcTestCompileMojo.java
index b7f154f0..3c455a7b 100644
--- a/src/main/java/org/codehaus/mojo/aspectj/AjcTestCompileMojo.java
+++ b/src/main/java/org/codehaus/mojo/aspectj/AjcTestCompileMojo.java
@@ -37,7 +37,10 @@
import org.codehaus.plexus.util.Scanner;
/**
- * Weaves all test classes. AspectJ Compiler Plugin.
+ * Weaves all test classes.
+ *
+ * AspectJ Compiler Plugin.
+ *
* @author Kaare Nilsen
*/
@Mojo( name="test-compile", threadSafe = true, defaultPhase = LifecyclePhase.TEST_COMPILE, requiresDependencyResolution = ResolutionScope.TEST )
diff --git a/src/main/java/org/codehaus/mojo/aspectj/MavenMessageHandler.java b/src/main/java/org/codehaus/mojo/aspectj/MavenMessageHandler.java
index 6f766de6..441df731 100644
--- a/src/main/java/org/codehaus/mojo/aspectj/MavenMessageHandler.java
+++ b/src/main/java/org/codehaus/mojo/aspectj/MavenMessageHandler.java
@@ -100,6 +100,7 @@ public MavenMessageHandler(final Log log) {
* Copies output from the supplied message onto the active Maven Log.
* If the message type (i.e. {@code message.getKind()}) is listed in the showDetailsForMessageKindList List,
* the message is prefixed with location details (Class, row/line number etc.) as well.
+ *
* {@inheritDoc}
*/
public boolean handleMessage(final IMessage message) {
diff --git a/src/site/apt/ajc_reference/experimental_opts.apt b/src/site/apt/ajc_reference/experimental_opts.apt
index eb1f7ae6..e6493982 100644
--- a/src/site/apt/ajc_reference/experimental_opts.apt
+++ b/src/site/apt/ajc_reference/experimental_opts.apt
@@ -12,24 +12,23 @@ AspectJ Compiler reference: non-standard options
options of its goals, as defined in the {{{../plugin-info.html}Plugin Documentation}} page.
+------------------------------------------
-AspectJ Compiler 1.8.2 non-standard options:
- -XnoInline dont inline advice
- -XlazyTjp create thisJoinPoint objects lazily
- -Xreweavable create class files that can be subsequently rewoven
- by AspectJ. Deprecated, this is now on by default.
- -Xreweavable:compress deprecated, reweavable is now default.
- -XnotReweavable create class files that cant be subsequently rewoven
- by AspectJ.
- -XserializableAspects allows aspects to implement serializable
- -XterminateAfterCompilation compile classes then terminate before weaving
- -XaddSerialVersionUID calculates and adds the serialVersionUID to any
- serializable type woven by an aspect
- -Xajruntimetarget: allows code to be generated that targets
- a 1.2 or a 1.5 level AspectJ runtime (default 1.5)
- -XhasMember allow hasmethod() and hasfield type patterns in
- declare parents and declare @type
- -Xjoinpoints: supply a comma separated list of new joinpoints
- that can be identified by pointcuts. Values are:
- arrayconstruction, synchronization
-+------------------------------------------
\ No newline at end of file
+AspectJ Compiler - Eclipse Compiler a00b62fa3572b0 (17Mar2021) - Java16
+
+ AspectJ-specific non-standard options:
+ -XnoInline dont inline advice
+ -XnotReweavable create class files that cant be subsequently rewoven
+ by AspectJ.
+ -XserializableAspects allows aspects to implement serializable
+ -XterminateAfterCompilation compile classes then terminate before weaving
+ -XaddSerialVersionUID calculates and adds the serialVersionUID to any
+ serializable type woven by an aspect
+ -Xajruntimetarget: allows code to be generated that targets
+ a 1.2, 1.5, 1.9 level AspectJ runtime (default 1.5)
+ -XhasMember allow hasmethod() and hasfield type patterns in
+ declare parents and declare @type
+ -Xjoinpoints: supply a comma separated list of new joinpoints
+ that can be identified by pointcuts. Values are:
+ arrayconstruction, synchronization
+
++------------------------------------------
diff --git a/src/site/apt/ajc_reference/standard_opts.apt b/src/site/apt/ajc_reference/standard_opts.apt
index a8eb9a8d..7e1540da 100644
--- a/src/site/apt/ajc_reference/standard_opts.apt
+++ b/src/site/apt/ajc_reference/standard_opts.apt
@@ -14,143 +14,216 @@ AspectJ Compiler reference: standard options
For a reference of non-standard AJC options, please refer to {{{./experimental_opts.html}AJC Experimental Options}}.
+------------------------------------------
- AspectJ Compiler 1.8.2
-
- Usage: