diff --git a/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/javadoc/JavaMojoDescriptorExtractorTest.java b/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/javadoc/JavaMojoDescriptorExtractorTest.java index bef1c10..c5a09d5 100644 --- a/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/javadoc/JavaMojoDescriptorExtractorTest.java +++ b/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/javadoc/JavaMojoDescriptorExtractorTest.java @@ -233,4 +233,20 @@ public class JavaMojoDescriptorExtractorTest assertEquals( 1, results.size() ); } + public void testSingleTypeImportWithFullyQualifiedClassName() + throws Exception + { + List results = extract( "MPLUGIN-314" ); + + assertEquals( 1, results.size() ); + } + + public void testMethodReferenceInEnumConstructor() + throws Exception + { + List results = extract( "MPLUGIN-320" ); + + assertNull( results ); + } + } diff --git a/maven-plugin-tools-java/src/test/resources/MPLUGIN-314/MyMojo.java b/maven-plugin-tools-java/src/test/resources/MPLUGIN-314/MyMojo.java new file mode 100644 index 0000000..c9d2cdf --- /dev/null +++ b/maven-plugin-tools-java/src/test/resources/MPLUGIN-314/MyMojo.java @@ -0,0 +1,41 @@ +/* + * 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 org.apache.maven.artifact.resolver.ArtifactResolver; +import org.apache.maven.plugin.AbstractMojo; + +/** + * Tests that using an import and the same fully qualified class name results in a correct requirement role generated. + * + * @goal test + */ +public class MyMojo + extends AbstractMojo +{ + + /** + * @component + */ + private org.apache.maven.artifact.resolver.ArtifactResolver resolver; + + public void execute() + { + } + +} diff --git a/maven-plugin-tools-java/src/test/resources/MPLUGIN-314/plugin-expected.xml b/maven-plugin-tools-java/src/test/resources/MPLUGIN-314/plugin-expected.xml new file mode 100644 index 0000000..1afd60b --- /dev/null +++ b/maven-plugin-tools-java/src/test/resources/MPLUGIN-314/plugin-expected.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + test + false + true + + + test + Tests that using an import and the same fully qualified class name results in a correct requirement role generated. + false + true + false + false + false + true + MyMojo + java + per-lookup + once-per-session + false + + + + org.apache.maven.artifact.resolver.ArtifactResolver + resolver + + + + + + \ No newline at end of file diff --git a/maven-plugin-tools-java/src/test/resources/MPLUGIN-320/Exceptions.java b/maven-plugin-tools-java/src/test/resources/MPLUGIN-320/Exceptions.java new file mode 100644 index 0000000..cf0a832 --- /dev/null +++ b/maven-plugin-tools-java/src/test/resources/MPLUGIN-320/Exceptions.java @@ -0,0 +1,32 @@ +/* + * 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 java.util.function.Supplier; + +public enum Exceptions { + NPE(NullPointerException::new), + IAE(IllegalArgumentException::new); + + private final Supplier supplier; + + Exceptions(Supplier supplier) { + this.supplier = supplier; + } + +} \ No newline at end of file diff --git a/maven-plugin-tools-java/src/test/resources/MPLUGIN-320/plugin-expected.xml b/maven-plugin-tools-java/src/test/resources/MPLUGIN-320/plugin-expected.xml new file mode 100644 index 0000000..4234096 --- /dev/null +++ b/maven-plugin-tools-java/src/test/resources/MPLUGIN-320/plugin-expected.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + test + false + true + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index d3e50bb..ce3845f 100644 --- a/pom.xml +++ b/pom.xml @@ -214,7 +214,7 @@ com.thoughtworks.qdox qdox - 2.0-M4 + 2.0-M5