errael commented on code in PR #8253:
URL: https://github.com/apache/netbeans/pull/8253#discussion_r2017745487


##########
java/java.hints/test/unit/src/org/netbeans/modules/java/hints/errors/MagicSurroundWithTryCatchFixTest.java:
##########
@@ -47,14 +49,69 @@ public void test104085() throws Exception {
                        "package test; public class Test {public void test() 
{try {}finally{System.out.println(\"\"); new java.io.FileInputStream(\"\");}}}",
                        150 - 43,
                        "FixImpl",
-                       "package test; import java.io.FileNotFoundException; 
import java.util.logging.Level; import java.util.logging.Logger; public class 
Test {public void test() {try {}finally{try { System.out.println(\"\"); new 
java.io.FileInputStream(\"\"); } catch (FileNotFoundException ex) { 
Logger.getLogger(Test.class.getName()).log(Level.SEVERE, null, ex); } }}}");
+                       "package test; import java.io.FileNotFoundException; 
import java.util.logging.Level; import java.util.logging.Logger; public class 
Test {public void test() {try {}finally{try { System.out.println(\"\"); new 
java.io.FileInputStream(\"\"); } catch (FileNotFoundException ex) { 
Logger.getLogger(Test.class.getName()).log(Level.SEVERE, \"\", ex); } }}}");

Review Comment:
   Now I see why. For JUL there's
   ```
       log(Level level, String msg, Throwable thrown)
       log(Level level, Throwable thrown, Supplier<String> msgSupplier)
   ```
   For System.Logger there's
   ```
       log(System.Logger.Level level, String msg, Throwable thrown)
       log(System.Logger.Level level, Supplier<String> msgSupplier, Throwable 
thrown)
   ```
   So, when it's `System.Logger`, a null for 2nd arg is ambiguous.
   
   So can do
   1. Use `""` for String arg.
   2. Cast `null` arg as `String`
   3. Have two returns depending on System.Logger or not.
   4. Have variable, depending on System.Logger or not, to use in the return.
   
   Is there a downside to using `""`? (Other than it's different. If there's 
usually provided text, then starting with `""` is less typing).



-- 
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: notifications-unsubscr...@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org
For additional commands, e-mail: notifications-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to