[
https://issues.apache.org/jira/browse/MNG-8214?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17874480#comment-17874480
]
ASF GitHub Bot commented on MNG-8214:
-------------------------------------
gnodet commented on PR #1660:
URL: https://github.com/apache/maven/pull/1660#issuecomment-2294825243
> This is not about inheritance within MDO models but inheritance of classes
generated from MDO, like for
https://github.com/apache/maven-plugin-tools/blob/9332b09acc08d2e063f12a8158a57ca8ec56fadd/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/ExtendedMojoDescriptor.java#L31.
This is currently not possible due to the restricted visibility of the
constructors and the lack of a constructor taking a builder as argument.
Fair point. However the use case of ExtendedMojoDescriptor is definitely a
bad one. Those were needed because the models did not really evolved, but we
allowed small additions without properly versioning them, and then rely on such
hacks.
> Allow extension of the model classes being generated with model.vm
> ------------------------------------------------------------------
>
> Key: MNG-8214
> URL: https://issues.apache.org/jira/browse/MNG-8214
> Project: Maven
> Issue Type: Improvement
> Affects Versions: 4.0.0-beta-3
> Reporter: Konrad Windszus
> Assignee: Konrad Windszus
> Priority: Major
>
> The [model.vm|https://github.com/apache/maven/blob/master/src/mdo/model.vm]
> being used with Maven 4 models generates immutable classes with builders. The
> generated classes cannot be extended easily because
> # the builder's constructor is having default access instead of being
> protected
> (https://github.com/apache/maven/blob/e335f95dfd11468bdf617421fd5e7093a727d1e1/src/mdo/model.vm#L409
> and
> https://github.com/apache/maven/blob/e335f95dfd11468bdf617421fd5e7093a727d1e1/src/mdo/model.vm#L427
> # the classes constructor doesn't take a builder as argument (therefore the
> subclass cannot leverage reuse most of the functionality currently
> encapsulated by the Builder)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)