matthiasblaesing commented on code in PR #6493:
URL: https://github.com/apache/netbeans/pull/6493#discussion_r1337684496


##########
java/maven.hints/src/org/netbeans/modules/maven/hints/pom/UpdateDependencyHint.java:
##########
@@ -109,10 +110,15 @@ private void addHintsTo(List<? extends 
VersionablePOMComponent> components, Map<
 
         for (VersionablePOMComponent comp : components) {
 
-            String groupId = comp.getGroupId();
-            String artifactId = comp.getArtifactId();
+            String groupId = comp.getGroupId() != null && 
!comp.getGroupId().isBlank() ? comp.getGroupId() : null;
+            String artifactId = comp.getArtifactId() != null && 
!comp.getArtifactId().isBlank() ? comp.getArtifactId() : null;
 
-            if (groupId != null && artifactId != null && !groupId.isEmpty() && 
!artifactId.isEmpty()) {
+            // no group ID could indicate it is a default maven plugin
+            if (comp instanceof Plugin && groupId == null && artifactId != 
null && artifactId.startsWith("maven-")) {

Review Comment:
   The XSD is pretty definitive here. If not specified, the groupId defaults to 
`org.apache.maven.plugins` for `Plugin` and `ReportPlugin` types. So I suggest 
to simplify to:
   
   ```suggestion
               if ((comp instanceof Plugin || comp instanceof ReportPlugin) && 
groupId == null) {
   ```
   
   This makes me suggest to add the after the handling of the build plugins in 
`getErrorsForDocument`:
   
   ```java
           Reporting reporting = model.getProject().getReporting();
           if(reporting != null) {
               if (reporting.getReportPlugins() != null) {
                   addHintsTo(reporting.getReportPlugins(), hints);
               }
           }
   ```
   



-- 
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

Reply via email to