Lines Matching full:code
37 <li><a href="#rmi">Processing RMI code</a>
47 <li><a href="#deadcode">Finding dead code</a>
52 You can find some sample configuration files in the <code>examples</code>
58 typically create a configuration file <code>proguard.pro</code> and then type:
75 Note the use of the <code><java.home></code> system property; it is
79 <code>proguard.ProGuard</code> and <code>java.lang.String[]</code>.
81 The access modifiers <code>public</code> and <code>static</code> are not
86 href="usage.html#printmapping"><code>-printmapping</code></a>, for
112 <code>mypackage.MyApplet</code>:
122 <code>mypackage.MyApplet</code> is an extension of the <code>Applet</code>
123 class in the library <code>rt.jar</code>.
135 <code>mypackage.MyMIDlet</code>:
150 <code>midpapi20.jar</code> and <code>cldcapi11.jar</code>, instead of the Java
151 Standard Edition run-time environment <code>rt.jar</code>. You can target
155 <code>mypackage.MyMIDlet</code> is an extension of the <code>MIDlet</code>
156 class in the library <code>midpapi20.jar</code>.
158 The <a href="usage.html#microedition"><code>-microedition</code></a> option
160 compact <code>StackMap</code> attributes. It is no longer necessary to run an
163 Be careful if you do use the external <code>preverify</code> tool on a platform
166 href="usage.html#dontusemixedcaseclassnames"><code>-dontusemixedcaseclassnames</code></a>
178 <code>mypackage.MyApplet</code>:
198 <code>mypackage.MyXlet</code>:
218 based on a single activity <code>mypackage.MyActivity</code>:
226 -optimizations !code/simplification/arithmetic
234 The <a href="usage.html#optimizations"><code>-optimizations</code></a> option
245 serialization code:
286 href="usage.html#keep"><code>-keep</code></a> options.
289 href="usage.html#keepclassmembernames"><code>-keepclassmembernames</code></a>
290 option for the <code>class$</code> methods is not strictly necessary. These
291 methods are inserted by the <code>javac</code> compiler and the
292 <code>jikes</code> compiler respectively, to implement the <code>.class</code>
304 library. The <code>javac</code> compiler would be unable to find the inner
322 <code>in.jar</code>:
335 href="usage.html#keepclasseswithmembers"><code>-keepclasseswithmembers</code></a>.
339 The <a href="usage.html#printseeds"><code>-printseeds</code></a> option prints
353 <code>in.jar</code>:
363 We're simply keeping all classes that extend the <code>Applet</code> class.
365 Again, the <a href="usage.html#printseeds"><code>-printseeds</code></a> option
378 <code>in.jar</code>:
393 We're simply keeping all classes that extend the <code>MIDlet</code> class.
395 The <a href="usage.html#microedition"><code>-microedition</code></a> option
397 compact <code>StackMap</code> attributes. It is no longer necessary to run an
400 Be careful if you do use the external <code>preverify</code> tool on a platform
403 href="usage.html#dontusemixedcaseclassnames"><code>-dontusemixedcaseclassnames</code></a>
406 The <a href="usage.html#printseeds"><code>-printseeds</code></a> option prints
418 <code>in.jar</code>:
432 We're simply keeping all classes that implement the <code>Applet</code>
435 The <a href="usage.html#printseeds"><code>-printseeds</code></a> option prints
441 <code>in.jar</code>:
456 We're simply keeping all classes that implement the <code>Xlet</code> interface.
458 The <a href="usage.html#printseeds"><code>-printseeds</code></a> option prints
464 broadcast receivers, and content providers in <code>in.jar</code>:
472 -optimizations !code/simplification/arithmetic
482 by the <code>AndroidManifest.xml</code> file of the application.
484 The <a href="usage.html#printseeds"><code>-printseeds</code></a> option prints
494 <code>in.jar</code>:
509 We're then keeping all classes that implement the <code>Servlet</code>
510 interface. We're using the <code>implements</code> keyword because it looks
511 more familiar in this context, but it is equivalent to <code>extends</code>,
514 The <a href="usage.html#printseeds"><code>-printseeds</code></a> option prints
537 href="usage.html#keepclasseswithmembernames"><code>-keepclasseswithmembernames</code></a>.
541 ProGuard doesn't look at your native code, so it won't automatically preserve
542 the classes or class members that are invoked by the native code. These are
549 methods, which are called from external code (native code, scripts,...),
551 entry points to your code, much like, say, the main method of an application.
552 If they aren't preserved by other <code>-keep</code> options, something like
569 that just grand? Introspection is the self-modifying code of a new
601 href="usage.html#keepclassmembers"><code>-keepclassmembers</code></a>
603 option instead of the basic <code>-keep</code> option, we're not
612 have <code>serialVersionUID</code> fields. The following options should
630 The <code>serialVersionUID</code> and <code>serialPersistentFields</code>
632 The <code><fields></code> line preserves all non-static,
638 classes involved lack <code>serialVersionUID</code> fields. I imagine the
639 original code will then be hard to maintain, since the serial version UID
668 interfaces of the serializable classes (using something like "<code>-keep
669 interface MyInterface</code>"), since these names are also used when
671 keeping all interfaces with "<code>-keep interface *</code>".
678 the <code>Serialization</code> interface, yet only a small number may actually
700 possible setters and getters in classes in the package <code>mybeans</code>:
714 The '<code>***</code>' wildcard matches any type (primitive or non-primitive,
715 array or non-array). The methods with the '<code>int</code>' arguments matches
722 attributes that have no direct effect on the execution of the code. However,
732 <code>RuntimeVisibleAnnotations</code>,
733 <code>RuntimeInvisibleAnnotations</code>,
734 <code>RuntimeVisibleParameterAnnotations</code>,
735 <code>RuntimeInvisibleParameterAnnotations</code>, and
736 <code>AnnotationDefault</code>. Depending on the purpose of the processed
737 code, you could refine this selection, for instance not keeping the run-time
740 Some code may make further use of introspection to figure out the enclosing
749 Database drivers are implementations of the <code>Driver</code> interface.
757 <code>(java.sql.Driver)Class.forName</code> constructs, if you are
758 instantiating a driver in your code (without necessarily implementing any
764 <code>ComponentUI</code> class. For some reason, these have to contain a
765 static method <code>createUI</code>, which the Swing API invokes using
777 <h3>Processing RMI code</h3>
778 Reportedly, the easiest way to handle RMI code is to process the code with
779 ProGuard first and then invoke the <code>rmic</code> tool. If that is not
793 The first <code>-keep</code> option keeps all your Remote interfaces and their
797 The <code>Exceptions</code> attribute has to be kept too, because the RMI
798 handling code performs introspection to check whether the method signatures
844 <code>out.map</code>. The information can then be used by the <a
861 Let's assume the class name <code>mycompany.myapplication.MyMain</code> is the
879 href="usage.html#flattenpackagehierarchy"><code>-flattenpackagehierarchy</code></a>
898 href="usage.html#repackageclasses"><code>-repackageclasses</code></a> option
916 href="usage.html#allowaccessmodification"><code>-allowaccessmodification</code></a>
951 all code. Notably, you may have to take into account that your application may
967 <code>classes</code> directory and the three jars into a single output jar
968 <code>out.jar</code>.
980 The input jars will then be reconstructed in the directory <code>out</code>,
999 <code>in.war</code> (plus any other contents of <code>in.war</code>) into
1000 <code>out.jar</code>.
1004 <a href="usage.html#injars"><code>-injars</code></a> and <a
1005 href="usage.html#outjars"><code>-outjars</code></a> options. For example:
1016 This configuration puts the processed results of all <code>base_in*.jar</code>
1017 jars into <code>base_out.jar</code>, and the processed results of the
1018 <code>extra_in.jar</code> into <code>extra_out.jar</code>. Note that only the
1036 This configuration removes any files in the <code>images</code> directory and
1054 The filter makes ProGuard disregard <code>com.sun.**</code> classes, for
1065 names. In this case, only <code>acme_*.jar</code> jars are read from the
1066 directory <code>in</code> and its subdirectories. Filters for war names, ear
1078 This configuration splits the processed output, sending <code>**.class</code>
1079 files to <code>code_out.jar</code>, and all remaining files to
1080 <code>resources_out.jar</code>.
1102 After processing, the directory <code>processed_applications</code> will
1108 ProGuard itself, you can still incrementally add other pieces of code that
1125 href="usage.html#applymapping"><code>-applymapping</code></a> option then
1126 makes sure the ProGuard part of the code gets the previously produced
1130 The added code in this example is straightforward; it doesn't affect the
1131 original code. The <code>proguard_out.jar</code> will be identical to the one
1133 extensions to your code, you should specify the options <a
1134 href="usage.html#useuniqueclassmembernames"><code>-useuniqueclassmembernames</code></a>,
1135 <a href="usage.html#dontshrink"><code>-dontshrink</code></a>, and <a
1136 href="usage.html#dontoptimize"><code>-dontoptimize</code></a> <i>in the
1174 href="usage.html#microedition"><code>-microedition</code></a> option. Note
1175 that we don't need any <code>-keep</code> options to specify entry points; all
1196 href="usage.html#target"><code>-target</code></a> option. They will
1198 any <code>-keep</code> options to specify entry points; all class files are
1202 <h3>Finding dead code</h3>
1204 <code>mypackage.MyApplication</code>:
1223 (<code>static final</code> fields). ProGuard would therefore list such fields
1226 href="usage.html#keepclassmembers"><code>-keepclassmembers</code></a> option
1257 between the code and the configuration for shrinking, optimization, and
1259 and then annotate the code to configure the processing.
1262 <code>examples/annotations/lib</code> in the ProGuard distribution.
1263 The annotation classes are defined in <code>annotations.jar</code>. The
1265 is specified in <code>annotations.pro</code>. With these files, you can start
1266 annotating your code. For instance, a java source file
1267 <code>Application.java</code> can be annotated as follows:
1286 <code>-keep</code> options. You may still wish to add traditional
1287 <code>-keep</code> options for processing <a href="#native">native
1292 The directory <code>examples/annotations</code> contains more examples that