Menu

#629 assumenosideeffects will delete methods of other classes while using public *

v5.3
closed-works-for-me
5
2016-11-29
2016-11-29
Hao Chen
No

Here's my problem with using assumenosideeffects.

First I follow the guild in http://proguard.sourceforge.net/manual/examples.html#logging to delete my own log invoke, and it does work. Here's the configuration.

-assumenosideeffects class com.excelsecu.driver.util.LogUtil {
    public static void v(...);
    public static void i(...);
    public static void w(...);
    public static void d(...);
    public static void e(...);
}

Then I try to use this comfiguration:

-assumenosideeffects class com.excelsecu.driver.util.LogUtil {
    public *;
}

Something strange happened. My code in EsLock.java:

public void lock()
{
    synchronized (this) {
        setLocked(true);
        try {
            Log.e("wtf", "" + 1);
            wait();
            Log.e("wtf", "" + 2);
        } catch (Exception e) {
            e.printStackTrace();
            LogUtil.w(TAG, e.getLocalizedMessage());
        }
        setLocked(false);
    }
}

the wait() was deleted after proguarding:

Though I cannot find this usage with assumenosideeffects in offical document(it may be a invalid usage), but I think it should not delete my method of other classes in any way because I declare the scope is "com.excelsecu.driver.util.LogUtil".

Discussion

  • Hao Chen

    Hao Chen - 2016-11-29

    the missing image:

     
  • Eric Lafortune

    Eric Lafortune - 2016-11-29

    The wildcard matches alll methods, including wait(). ProGuard prints out a note if you specify this. There's also some explanation in the ProGuard manual > Usage > -assumenosideeffects, and in Troubleshooting > "Note: the configuration specifies that none of the methods of class '...' have any side effects".

     
  • Eric Lafortune

    Eric Lafortune - 2016-11-29
    • status: open --> closed-works-for-me
     

Log in to post a comment.

MongoDB Logo MongoDB