diff --git a/maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/Parameter.java b/maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/Parameter.java index f9eda41ee..87887cb78 100644 --- a/maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/Parameter.java +++ b/maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/Parameter.java @@ -72,13 +72,6 @@ */ String defaultValue() default ""; - /** - * Defines the implementation in the case the parameter type is an interface. - * - * @return the implementation class name - */ - Class implementation() default Object.class; - /** * is the parameter required? * @return true if the Mojo should fail when the parameter cannot be injected diff --git a/maven-plugin-plugin/src/it/annotation-with-inheritance-from-deps/verify.groovy b/maven-plugin-plugin/src/it/annotation-with-inheritance-from-deps/verify.groovy index 90b4b6920..6f0f05df0 100644 --- a/maven-plugin-plugin/src/it/annotation-with-inheritance-from-deps/verify.groovy +++ b/maven-plugin-plugin/src/it/annotation-with-inheritance-from-deps/verify.groovy @@ -28,7 +28,6 @@ def pluginDescriptor = new XmlParser().parse( descriptorFile ); def mojo = pluginDescriptor.mojos.mojo.findAll{ it.goal.text() == "first"}[0] assert mojo.goal.text() == 'first' -assert mojo.implementation.text() == 'org.apache.maven.plugin.coreit.FirstMojo' assert mojo.language.text() == 'java' assert mojo.description.text() == 'Touches a test file.' assert mojo.deprecated.text() == "Don't use!" @@ -44,11 +43,9 @@ assert mojo.executePhase.text() == 'package' assert mojo.executeLifecycle.text() == 'my-lifecycle' assert mojo.configuration.bar[0].text() == '${thebar}' -assert mojo.configuration.bar[0].'@implementation' == 'java.lang.String' assert mojo.configuration.bar[0].'@default-value' == 'coolbar' assert mojo.configuration.beer[0].text() == '${thebeer}' -assert mojo.configuration.beer[0].'@implementation' == 'java.lang.String' assert mojo.configuration.beer[0].'@default-value' == 'coolbeer' assert mojo.requirements.requirement.size() == 2 @@ -61,14 +58,13 @@ assert mojo.requirements.requirement[1].role.text() == 'org.apache.maven.project assert mojo.requirements.requirement[1].'role-hint'.text() == '' assert mojo.requirements.requirement[1].'field-name'.text() == 'projectHelper' -assert mojo.parameters.parameter.size() == 7 +assert mojo.parameters.parameter.size() == 6 def parameter = mojo.parameters.parameter.findAll{ it.name.text() == "aliasedParam"}[0] assert parameter.name.text() == 'aliasedParam' assert parameter.alias.text() == 'alias' assert parameter.type.text() == 'java.lang.String' -assert parameter.implementation.isEmpty() assert parameter.deprecated.text() == 'As of 0.2' assert parameter.required.text() == 'false' assert parameter.editable.text() == 'true' @@ -79,7 +75,6 @@ parameter = mojo.parameters.parameter.findAll{ it.name.text() == "beer"}[0] assert parameter.name.text() == 'beer' assert parameter.alias.isEmpty() assert parameter.type.text() == 'java.lang.String' -assert parameter.implementation.isEmpty() assert parameter.deprecated.text() == "wine is better" assert parameter.required.text() == 'false' assert parameter.editable.text() == 'true' @@ -90,29 +85,16 @@ parameter = mojo.parameters.parameter.findAll{ it.name.text() == "bar"}[0] assert parameter.name.text() == 'bar' assert parameter.alias.isEmpty() assert parameter.type.text() == 'java.lang.String' -assert parameter.implementation.isEmpty() assert parameter.deprecated.isEmpty() assert parameter.required.text() == 'true' assert parameter.editable.text() == 'true' assert parameter.description.text() == 'the cool bar to go' -parameter = mojo.parameters.parameter.findAll{ it.name.text() == "fooInterface"}[0] - -assert parameter.name.text() == 'fooInterface' -assert parameter.alias.isEmpty() -assert parameter.type.text() == 'org.apache.maven.tools.plugin.extractor.annotations.FooInterface' -assert parameter.implementation.text() == 'org.apache.maven.tools.plugin.extractor.annotations.FooInterfaceImpl' -assert parameter.deprecated.isEmpty() -assert parameter.required.text() == 'false' -assert parameter.editable.text() == 'true' -assert parameter.description.text() == 'Interface type as parameter.' - parameter = mojo.parameters.parameter.findAll{ it.name.text() == "paramFromSetter"}[0] assert parameter.name.text() == 'paramFromSetter' assert parameter.alias.isEmpty() assert parameter.type.text() == 'java.lang.String' -assert parameter.implementation.isEmpty() assert parameter.deprecated.isEmpty() assert parameter.required.text() == 'false' assert parameter.editable.text() == 'true' @@ -123,7 +105,6 @@ parameter = mojo.parameters.parameter.findAll{ it.name.text() == "paramFromAdd"} assert parameter.name.text() == 'paramFromAdd' assert parameter.alias.isEmpty() assert parameter.type.text() == 'java.lang.String' -assert parameter.implementation.isEmpty() assert parameter.deprecated.isEmpty() assert parameter.required.text() == 'false' assert parameter.editable.text() == 'true' @@ -134,7 +115,6 @@ parameter = mojo.parameters.parameter.findAll{ it.name.text() == "paramFromSette assert parameter.name.text() == 'paramFromSetterDeprecated' assert parameter.alias.isEmpty() assert parameter.type.text() == 'java.util.List' -assert parameter.implementation.isEmpty() assert parameter.deprecated.text() == 'reason of deprecation' assert parameter.required.text() == 'false' assert parameter.editable.text() == 'true' diff --git a/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/JavaAnnotationsMojoDescriptorExtractor.java b/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/JavaAnnotationsMojoDescriptorExtractor.java index e660eb2ac..b70b91d3d 100644 --- a/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/JavaAnnotationsMojoDescriptorExtractor.java +++ b/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/JavaAnnotationsMojoDescriptorExtractor.java @@ -695,7 +695,6 @@ private List toMojoDescriptors( Map parameter.setName( name ); parameter.setAlias( parameterAnnotationContent.alias() ); parameter.setDefaultValue( parameterAnnotationContent.defaultValue() ); - parameter.setImplementation( parameterAnnotationContent.getImplementationClassName() ); parameter.setDeprecated( parameterAnnotationContent.getDeprecated() ); parameter.setDescription( parameterAnnotationContent.getDescription() ); parameter.setEditable( !parameterAnnotationContent.readonly() ); diff --git a/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/datamodel/ParameterAnnotationContent.java b/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/datamodel/ParameterAnnotationContent.java index 6ac23be50..82b125dc2 100644 --- a/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/datamodel/ParameterAnnotationContent.java +++ b/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/datamodel/ParameterAnnotationContent.java @@ -20,7 +20,6 @@ */ import org.apache.maven.plugins.annotations.Parameter; -import org.objectweb.asm.Type; import java.lang.annotation.Annotation; import java.util.List; @@ -43,8 +42,6 @@ public class ParameterAnnotationContent private String defaultValue; - private String implementationClassName; - private boolean required = false; private boolean readonly = false; @@ -61,14 +58,13 @@ public ParameterAnnotationContent( String fieldName, String className, List implementation, boolean required, boolean readonly, String className, + boolean required, boolean readonly, String className, List typeParameters ) { this( fieldName, className, typeParameters ); this.alias = alias; this.property = property; this.defaultValue = defaultValue; - this.implementationClassName = implementation != null ? implementation.getName() : null; this.required = required; this.readonly = readonly; } @@ -117,33 +113,6 @@ public void defaultValue( String defaultValue ) this.defaultValue = defaultValue; } - public void implementation( Type implementation ) - { - - implementationClassName = implementation.getClassName(); - if ( implementationClassName.equals( Object.class.getName() ) ) - { - // Object is default value for implementation attribute - this.implementationClassName = null; - } - } - - public String getImplementationClassName() - { - return implementationClassName; - } - - @Override - public Class implementation() - { - // needed for implementing @Parameter - // we don't have access to project class path, - // so loading class is not possible without build additional classLoader - // we only operate on classes names - throw new UnsupportedOperationException( - "please use getImplementationClassName instead of implementation method" ); - } - @Override public boolean required() { @@ -201,7 +170,6 @@ public String toString() sb.append( ", alias='" ).append( alias ).append( '\'' ); sb.append( ", property='" ).append( property ).append( '\'' ); sb.append( ", defaultValue='" ).append( defaultValue ).append( '\'' ); - sb.append( ", implementation='" ).append( implementationClassName ).append( '\'' ); sb.append( ", required=" ).append( required ); sb.append( ", readonly=" ).append( readonly ); sb.append( '}' ); @@ -257,10 +225,6 @@ public boolean equals( Object o ) { return false; } - if ( !Objects.equals( implementationClassName, that.implementationClassName ) ) - { - return false; - } return true; } @@ -269,6 +233,6 @@ public boolean equals( Object o ) public int hashCode() { return Objects.hash( alias, getFieldName(), getClassName(), typeParameters, property, defaultValue, required, - readonly, implementationClassName ); + readonly ); } } diff --git a/maven-plugin-tools-annotations/src/site/apt/index.apt b/maven-plugin-tools-annotations/src/site/apt/index.apt index a46c37101..f78b791a3 100644 --- a/maven-plugin-tools-annotations/src/site/apt/index.apt +++ b/maven-plugin-tools-annotations/src/site/apt/index.apt @@ -86,7 +86,6 @@ public class MyMojo alias = "myAlias", property = "a.property", defaultValue = "an expression, possibly with ${variables}", - implementation = "class of implementation in the case the parameter type is an interface" readonly = , required = ) private String parameter; diff --git a/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/FooInterface.java b/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/FooInterface.java deleted file mode 100644 index f89329337..000000000 --- a/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/FooInterface.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.apache.maven.tools.plugin.extractor.annotations; - -/* - * 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 interface FooInterface -{ -} diff --git a/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/FooInterfaceImpl.java b/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/FooInterfaceImpl.java deleted file mode 100644 index 99f593b85..000000000 --- a/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/FooInterfaceImpl.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.apache.maven.tools.plugin.extractor.annotations; - -/* - * 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 FooInterfaceImpl implements FooInterface -{ -} diff --git a/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/FooMojo.java b/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/FooMojo.java index c044d161e..e7265d12c 100644 --- a/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/FooMojo.java +++ b/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/FooMojo.java @@ -45,12 +45,6 @@ public class FooMojo @Parameter( property = "thebar", required = true, defaultValue = "coolbar" ) protected String bar; - /** - * Interface type as parameter. - */ - @Parameter( property = "fooInterface", implementation = FooInterfaceImpl.class ) - protected FooInterface fooInterface; - /** * beer for non french folks * @deprecated wine is better diff --git a/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/TestAnnotationsReader.java b/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/TestAnnotationsReader.java index dca5896c2..0e075c661 100644 --- a/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/TestAnnotationsReader.java +++ b/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/TestAnnotationsReader.java @@ -95,26 +95,19 @@ void testReadMojoClass() Collection parameters = mojoAnnotatedClass.getParameters().values(); assertThat( parameters ).isNotNull() .isNotEmpty() - .hasSize( 6 ) + .hasSize( 5 ) .containsExactlyInAnyOrder( - new ParameterAnnotationContent( "bar", null, "thebar", "coolbar", null, true, false, + new ParameterAnnotationContent( "bar", null, "thebar", "coolbar", true, false, String.class.getName(), Collections.emptyList() ), - new ParameterAnnotationContent( "beer", null, "thebeer", "coolbeer", null, false, false, + new ParameterAnnotationContent( "beer", null, "thebeer", "coolbeer", false, false, String.class.getName(), Collections.emptyList() ), - new ParameterAnnotationContent( "fooInterface", null, "fooInterface", null, - FooInterfaceImpl.class, - false, - false, FooInterface.class.getName(), Collections.emptyList() ), new ParameterAnnotationContent( "paramFromSetter", null, "props.paramFromSetter", null, - null, false, false, String.class.getName(), Collections.emptyList() ), new ParameterAnnotationContent( "paramFromAdd", null, "props.paramFromAdd", null, - null, false, false, String.class.getName(), Collections.emptyList() ), new ParameterAnnotationContent( "paramFromSetterDeprecated", null, "props.paramFromSetterDeprecated", null, - null, false, false, List.class.getName(), Collections.singletonList("java.lang.String") ) );