lahodaj commented on code in PR #7548:
URL: https://github.com/apache/netbeans/pull/7548#discussion_r1678064320


##########
java/java.hints/src/org/netbeans/modules/java/hints/infrastructure/JavaErrorProvider.java:
##########
@@ -200,25 +202,55 @@ private static List<CodeAction> 
convertFixes(ErrorDescription err, Consumer<Exce
             }
         }
 
-        List<Fix> fixes = sortFixes(lfl.getFixes());
+        List<Fix> baseFixes = lfl.getFixes();
+
+        baseFixes = sortFixes(baseFixes);
+
+        List<Pair<Fix, Boolean>> fixesAndSubfixes = new ArrayList<>(); // true 
if main fix
+
+        for (Fix f : baseFixes){
+            fixesAndSubfixes.add(Pair.of(f, true));
+
+            try {
+                Class<?> controller = 
Class.forName("org.netbeans.modules.editor.hints.HintsControllerImpl",
+                                                    false,
+                                                    
ErrorDescription.class.getClassLoader());
+                Method getSubfixes = 
controller.getDeclaredMethod("getSubfixes", Fix.class);

Review Comment:
   I am afraid there are only bad solutions:
   - either the reflection (where the problem is obvious),
   - implementation dependency between `java.hints` and `spi.editor.hints`, 
which is problematic as a) it goes across cluster boundary; b) `java.hints` is 
a purely hint implementation module, it should not "normally" need to hack into 
any implementation,
   - putting `getSubfixes` to the API, which is problematic, as 
`spi.editor.hints` does not have any API currently, and there's so far only a 
single use of this, and that is here,
   - maybe some tricks with moving `JavaErrorProvider` into a bridge module 
which would have impl dependency on both `java.hints` and `spi.editor.hints`, 
which also seem pretty ugly.
   
   So, the reflection seemed least bad out of the options. It does not open any 
new avenues to get additional access, and it is a clear hack that will be 
obvious (as opposed to e.g. implementation dependency). But I admit my opinion 
here may not be the only one, or even the best.
   



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