3

In applications based on NetBeans Platform 7.2, it is possible to replace the ModuleInstall classes with this code:

import org.openide.modules.OnStart;
import org.openide.modules.OnStop;

@OnStart
public final class Installer implements Runnable {

   @Override
   public void run() {
       System.out.println("enable something...");
   }

   @OnStop
   public static final class Down implements Runnable {
       @Override
       public void run() {
           System.out.println("disable something...");
       }
   }
}

My problem is that, after obfuscation, the class loader does not find the annotated classes.

In the Proguard configuration I added (as suggested here)

-keep @org.openide.modules.OnStart class *

But apparently this is not enough or it does not work.

Does anybody have a suggestion?

Community
  • 1
  • 1
Angelo
  • 166
  • 2
  • 4

2 Answers2

1

From I could figure out, you need to explicitly keep the annotations that you use to keep whatever specifications. So, in your case, adding

-keep enum org.openide.modules.OnStart

would allow this annotation to be used as a selector. Proguard really ought to include a warning message if annotation selectors are not actually matching. It also doesn't really make sense to keep the annotation, especially if it's not of runtime retention.

Pawel Veselov
  • 3,996
  • 7
  • 44
  • 62
-1

Have you tried -keepattributes *Annotation*? It might do the trick, based on proguard usage.

jolivier
  • 7,380
  • 3
  • 29
  • 47