Note that there are some explanatory texts on larger screens.

plurals
  1. POProGuard optimization also remove #wait() calls
    primarykey
    data
    text
    <p>When Proguard optimize my application, it seams that all calls to <code>Object#wait()</code> are being removed.</p> <p>So that each Thread which should passively wait (until notification) is now actively waiting (100% CPU usage).</p> <p>When the optimizing is shutdown with <code>-dontoptimize</code> everything is OK.</p> <p>Has I need the optimization for removing some method with <code>-assumenosideeffects</code>, I am searching for what's wrong.<BR> Is it possible to preserve all calls to <code>Object#wait()</code> to be optimized (removed)?</p> <p>Is there any other solution?</p> <p>EDIT 1: For example this code:</p> <pre><code> @Override public void run() { isRunning = true; try { while (isRunning) { if (parent.isActivate) { parent.updateDriveButtons(); synchronized (this) { wait(1000); } } else { synchronized (this) { // Wait for that the page is activated. Utils.wait(this); } } } } catch (Throwable e) { e.printStackTrace(); } finally { isRunning = false; } } </code></pre> <p>is being replaced by this code (after decompiling the optimized code): <code>wait()</code> has been removed and only the synchronize is visible with <code>monitorenter;</code> ... <code>monitorexit;</code></p> <pre><code> public final void run() { this.isRunning = true; try { while (this.isRunning) { if (this.parent.isShowing()) { ... monitorenter; monitorexit; continue; } monitorenter; monitorexit; }return; } catch (Throwable localThrowable) { Object Ljava/lang/Object;; return; } finally { this.isRunning = false; } throw localObject1; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload