Menu

#571 -assumenosideffects notes on annotated methods

v5.2
open-accepted
None
5
2015-04-30
2015-04-29
TWiStErRob
No

I'm trying get rid of my logging helper methods which I'm sure I don't use in production code. I created an annotation just for them:

@Retention(RetentionPolicy.SOURCE)
@Target({CONSTRUCTOR, METHOD, TYPE, PACKAGE})
public @interface DebugHelper { }

One such method is:

@DebugHelper
public static String toFeatureString(@WindowFeature int featureId) {
    switch (featureId) {
        case Window.FEATURE_OPTIONS_PANEL:
            return "FEATURE_OPTIONS_PANEL";
        case Window.FEATURE_NO_TITLE:
            return "FEATURE_NO_TITLE";
        //...
    }
    return "featureId=" + featureId;
}

And here's how I'm trying to remove them (in addition to -assumenosideeffects on logging):

-assumenosideeffects class ** {
    @net.twisterrob.java.annotations.DebugHelper <methods>;
}

I get a Note from ProGuard:

Note: the configuration specifies that none of the methods of class '**' have any side effects
Note: there were 1 '-assumenosideeffects' options that try to match all
methods with wildcards. This will likely cause problems with methods like
'wait()' and 'notify()'. You should specify the methods more precisely.
(http://proguard.sourceforge.net/manual/troubleshooting.html#nosideeffects)

It's possible I messed up the syntax, but then I can't figure out what I messed up.

I think annotations should be on an except list, since there's no way to annotate Object.wait with my custom annotation, so it's safe.

As an alternative please provide some way to -dontnote this single note, I don't want to turn off notes altogether as the troubleshooting page suggests!

Discussion

  • Eric Lafortune

    Eric Lafortune - 2015-04-30

    Thank you for your report. Your configuration looks correct. ProGuard's sanity check appears to be overzealous. You can ignore the note for now and I'll fix it for ProGuard 5.3.

     
  • Eric Lafortune

    Eric Lafortune - 2015-04-30
    • status: open --> open-accepted
     

Log in to post a comment.

MongoDB Logo MongoDB