[MCOMPILER-298] Add support for "parameters" flag
fixes #114

git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk@1796724 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/pom.xml b/pom.xml
index ebc76d3..df8902f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -63,7 +63,7 @@
       ! The following property is used in the integration tests MCOMPILER-157
     -->
     <mavenPluginPluginVersion>3.5</mavenPluginPluginVersion>
-    <plexusCompilerVersion>2.8.1</plexusCompilerVersion>
+    <plexusCompilerVersion>2.8.2-SNAPSHOT</plexusCompilerVersion>
     <groovyVersion>1.8.0</groovyVersion>
     <groovyEclipseCompilerVersion>2.7.0-01</groovyEclipseCompilerVersion>
     <groovy-eclipse-batch>2.0.4-04</groovy-eclipse-batch>
diff --git a/src/it/MCOMPILER-298/invoker.properties b/src/it/MCOMPILER-298/invoker.properties
new file mode 100644
index 0000000..928055c
--- /dev/null
+++ b/src/it/MCOMPILER-298/invoker.properties
@@ -0,0 +1,19 @@
+# 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.
+
+invoker.java.version = 1.8+
+invoker.goals = test
diff --git a/src/it/MCOMPILER-298/pom.xml b/src/it/MCOMPILER-298/pom.xml
new file mode 100644
index 0000000..0505e5f
--- /dev/null
+++ b/src/it/MCOMPILER-298/pom.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.plugins.compiler.it</groupId>
+  <artifactId>mcompiler298</artifactId>
+  <version>1.0-SNAPSHOT</version>
+
+  <url>https://issues.apache.org/jira/browse/MCOMPILER-298</url>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.12</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>@project.version@</version>
+        <configuration>
+          <source>1.8</source>
+          <target>1.8</target>
+          <parameters>true</parameters>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>
diff --git a/src/it/MCOMPILER-298/src/main/java/com/foo/ParameterClass.java b/src/it/MCOMPILER-298/src/main/java/com/foo/ParameterClass.java
new file mode 100644
index 0000000..439e1e1
--- /dev/null
+++ b/src/it/MCOMPILER-298/src/main/java/com/foo/ParameterClass.java
@@ -0,0 +1,29 @@
+package com.foo;
+
+/*
+ * 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.
+ */
+
+
+public class ParameterClass
+{
+    public void method( String parameterName )
+    {
+        // nothing
+    }
+}
diff --git a/src/it/MCOMPILER-298/src/test/java/com/foo/ParameterTest.java b/src/it/MCOMPILER-298/src/test/java/com/foo/ParameterTest.java
new file mode 100644
index 0000000..b552b77
--- /dev/null
+++ b/src/it/MCOMPILER-298/src/test/java/com/foo/ParameterTest.java
@@ -0,0 +1,36 @@
+package com.foo;
+
+/*
+ * 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.
+ */
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+
+
+public class ParameterTest
+{
+
+    @Test
+    public void testParameter() throws Exception
+    {
+        assertEquals( "parameterName", ParameterClass.class.getMethod( "method", String.class ).getParameters()[0].getName() );
+    }
+}
diff --git a/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java b/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
index d4b019d..80e7606 100644
--- a/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
@@ -118,6 +118,12 @@
     private boolean debug = true;
 
     /**
+     * Set to <code>true</code> to generate metadata for reflection on method parameters.
+     */
+    @Parameter( property = "maven.compiler.parameters", defaultValue = "false" )
+    private boolean parameters;
+
+    /**
      * Set to <code>true</code> to show messages about what the compiler is doing.
      */
     @Parameter( property = "maven.compiler.verbose", defaultValue = "false" )
@@ -588,6 +594,8 @@
             compilerConfiguration.setDebugLevel( debuglevel );
         }
 
+        compilerConfiguration.setParameters( parameters );
+
         compilerConfiguration.setVerbose( verbose );
 
         compilerConfiguration.setShowWarnings( showWarnings );