mbien commented on code in PR #5802:
URL: https://github.com/apache/netbeans/pull/5802#discussion_r1174652553
##########
java/maven.hints/src/org/netbeans/modules/maven/hints/errors/EnablePreviewMavenProj.java:
##########
@@ -246,47 +226,176 @@ private Configuration createConfiguration() {
}
private Plugin updateMavenCompilerPlugin(final Plugin oldPlugin) {
-
Configuration currenConfig = oldPlugin.getConfiguration();
+ Plugin newPlugin = factory.createPlugin();
+ newPlugin.setGroupId(oldPlugin.getGroupId());
+ newPlugin.setArtifactId(oldPlugin.getArtifactId());
+ newPlugin.setVersion(oldPlugin.getVersion());
+
newPlugin.setConfiguration(updateMavenCompilerPluginConfiguration(currenConfig,
oldPlugin.getVersion()));
+ return newPlugin;
+ }
+
+ private Configuration
updateMavenCompilerPluginConfiguration(Configuration currenConfig, String
version) {
Configuration newConfiguration = createConfiguration();
- boolean isCompilerArgsElementPresent = false;
- if (currenConfig != null) {
- for (POMExtensibilityElement element :
currenConfig.getConfigurationElements()) {
- POMExtensibilityElement newElement =
factory.createPOMExtensibilityElement(element.getQName());
- String elementText = element.getElementText();
- if (elementText.trim().length() > 0) {
- newElement.setElementText(element.getElementText());
+ if (currenConfig == null) {
+ currenConfig = createConfiguration();
+ }
+
+ boolean supportsRelease = false;
+
+ try {
+ supportsRelease = version == null ||
+ new
SpecificationVersion(version).compareTo(new SpecificationVersion("3.6")) >= 0;
Review Comment:
consider using `ComparableVersion`.
- this won't throw `NumberFormatException`s
- and it will also support comparing versions like `3.10-SNAPSHOT`
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists