mbien commented on code in PR #9043:
URL: https://github.com/apache/netbeans/pull/9043#discussion_r2573021420


##########
ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/api/NativeProcessExecutionService.java:
##########
@@ -34,6 +34,7 @@
  * This is a very light-weigth version of ExecutionService from 
org.netbeans.api.extexecution
  * @author ak119685
  */
+@SuppressWarnings("deprecation") // 
org.netbeans.api.extexecution.input.LineProcessor is API
 public final class NativeProcessExecutionService {

Review Comment:
   Looks like the migration to the new API happened in past already and this is 
all unused public API by now.
   
   suggestion:
   
   instead of suppressing deprecation warnings, `@Deprecate` (already unused) 
`newService(...)` and the private `ExecutionTask` class. I believe this 
communicates a bit better what happened while also having the same effect of 
not generating javac warnings since a deprecated method may use other 
deprecated things.



##########
ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/api/util/ProcessUtils.java:
##########
@@ -336,23 +323,23 @@ public void run() {
      * Even if you ignore process output stream, it should be read,
      * otherwise other processes can hang - this is a jsch related issue.
      * This method reads and ignores process output stream
+     * @param <T>
      * @param p process
+     * @return
      */
     public static <T extends Process> T ignoreProcessOutput(final T p) {
         if (p != null) {
-            NativeTaskExecutorService.submit(new Runnable() {
-                @Override
-                public void run() {
-                    try {
-                        readAndIgnoreProcessStream(p.getInputStream());
-                    } catch (IOException ex) {
-                    }
+            NativeTaskExecutorService.submit(() -> {
+                try {
+                    readAndIgnoreProcessStream(p.getInputStream());
+                } catch (IOException ex) {
                 }
             }, "Reading process output " + p); // NOI18N
         }
         return p;
     }
 
+    @SuppressWarnings("deprecation") // 
org.netbeans.api.extexecution.input.LineProcessor is API
     public static void writeError(final Writer error, Process p) throws 
IOException {

Review Comment:
   here too
   -> consider swapping `@SuppressWarnings("deprecation")` with `@Deprecated`



##########
ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/api/util/ProcessUtils.java:
##########
@@ -166,48 +165,41 @@ private static void logErrorImpl(final Level logLevel, 
final Logger log, List<St
     /**
      * Reads process stream asynchronously. As soon as all stream is read (i. 
e. process is finished),
      * all lines are added to listToAdd.
+     *
+     * @param process
+     * @param lineProcessor
      */
+    @SuppressWarnings("deprecation") // 
org.netbeans.api.extexecution.input.LineProcessor is API
     public static void readProcessOutputAsync(final Process process, final 
LineProcessor lineProcessor) {

Review Comment:
   same here. I checked and this is unused
   
    -> consider swapping `@SuppressWarnings("deprecation")` with `@Deprecated`



##########
ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/api/util/ProcessUtils.java:
##########
@@ -166,48 +165,41 @@ private static void logErrorImpl(final Level logLevel, 
final Logger log, List<St
     /**
      * Reads process stream asynchronously. As soon as all stream is read (i. 
e. process is finished),
      * all lines are added to listToAdd.
+     *
+     * @param process
+     * @param lineProcessor
      */
+    @SuppressWarnings("deprecation") // 
org.netbeans.api.extexecution.input.LineProcessor is API
     public static void readProcessOutputAsync(final Process process, final 
LineProcessor lineProcessor) {
-        NativeTaskExecutorService.submit(new Runnable() {
-            @Override
-            public void run() {
-                try {
-                    readProcessStreamImpl(process.getInputStream(), 
isRemote(process), lineProcessor);
-                } catch (IOException ex) {
-                    // nothing
-                }
+        NativeTaskExecutorService.submit(() -> {
+            try {
+                readProcessStreamImpl(process.getInputStream(), 
isRemote(process), lineProcessor);
+            } catch (IOException ex) {
+                // nothing
             }
         }, "reading process output"); // NOI18N
     }
 
     public static Future<List<String>> readProcessOutputAsync(final Process 
process) {
-        return NativeTaskExecutorService.submit(new Callable<List<String>>() {
-            @Override
-            public List<String> call() throws Exception {
-                return readProcessStreamImpl(process.getInputStream(), 
isRemote(process));
-            }
+        return NativeTaskExecutorService.submit(() -> {
+            return readProcessStreamImpl(process.getInputStream(), 
isRemote(process));
         }, "reading process output"); // NOI18N
     }
 
+    @SuppressWarnings("deprecation") // 
org.netbeans.api.extexecution.input.LineProcessor is API
     public static void readProcessErrorAsync(final Process process,  final 
LineProcessor lineProcessor) {

Review Comment:
   here too
   -> consider swapping `@SuppressWarnings("deprecation")` with `@Deprecated`



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