You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "elharo (via GitHub)" <gi...@apache.org> on 2026/07/01 15:37:06 UTC
[I] DescribeMojo.toLines() delegates to generated HelpMojo via fragile reflection [maven-help-plugin]
elharo opened a new issue, #390:
URL: https://github.com/apache/maven-help-plugin/issues/390
In src/main/java/org/apache/maven/plugins/help/DescribeMojo.java:747-778:
Method m = HelpMojo.class.getDeclaredMethod("toLines", String.class, Integer.TYPE, Integer.TYPE, Integer.TYPE);
m.setAccessible(true);
List<String> output = (List<String>) m.invoke(HelpMojo.class, text, indent, indentSize, lineLength);
HelpMojo is generated by maven-plugin-tools at compile time (in target/generated-sources/). It IS available at runtime, but this reflection is brittle: any change in the generated code toLines signature silently breaks all describe output formatting. The HelpMojo.toLines internally calls repeat() with new StringBuilder(repeat * str.length()) — a classic integer overflow risk that can throw NegativeArraySizeException.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] DescribeMojo.toLines() delegates to generated HelpMojo via fragile reflection [maven-help-plugin]
Posted by "slachiewicz (via GitHub)" <gi...@apache.org>.
slachiewicz closed issue #390: DescribeMojo.toLines() delegates to generated HelpMojo via fragile reflection
URL: https://github.com/apache/maven-help-plugin/issues/390
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org