summaryrefslogtreecommitdiff
path: root/docs/manual/attributes.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/manual/attributes.html')
-rw-r--r--docs/manual/attributes.html217
1 files changed, 217 insertions, 0 deletions
diff --git a/docs/manual/attributes.html b/docs/manual/attributes.html
new file mode 100644
index 0000000..08265e7
--- /dev/null
+++ b/docs/manual/attributes.html
@@ -0,0 +1,217 @@
+<!doctype html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
+<meta http-equiv="content-style-type" content="text/css">
+<link rel="stylesheet" type="text/css" href="style.css">
+<title>Attributes</title>
+</head>
+<body>
+
+<script type="text/javascript" language="JavaScript">
+<!--
+if (window.self==window.top)
+ document.write('<a class="largebutton" target="_top" href="../index.html#manual/attributes.html">ProGuard index</a> <a class="largebutton" target="_top" href="http://www.saikoa.com/dexguard">DexGuard</a> <a class="largebutton" target="_top" href="http://www.saikoa.com/">Saikoa</a> <a class="largebutton" target="other" href="http://sourceforge.net/projects/proguard/">Sourceforge</a>')
+//-->
+</script>
+<noscript>
+<a class="largebutton" target="_top" href="../index.html#manual/attributes.html">ProGuard index</a>
+<a class="largebutton" target="_top" href="http://www.saikoa.com/dexguard">DexGuard</a>
+<a class="largebutton" target="_top" href="http://www.saikoa.com/">Saikoa</a>
+<a class="largebutton" target="other" href="http://sourceforge.net/projects/proguard/">Sourceforge</a>
+</noscript>
+
+<h2>Attributes</h2>
+
+Class files essentially define classes, their fields, and their methods. A lot
+of essential and non-essential data are attached to these classes, fields, and
+methods as <i>attributes</i>. For instance, attributes can contain bytecode,
+source file names, line number tables, etc.
+<p>
+
+ProGuard's obfuscation step removes attributes that are generally not
+necessary for executing the code. With
+the <a href="usage.html#keepattributes"><code>-keepattributes</code></a>
+option, you can specify a filter for attributes that you do want to keep, for
+instance, if your code accesses them through reflection or if you want to
+preserve some compilation or debugging information. The filter works like
+any <a href="usage.html#filters">filter</a> in ProGuard.
+<p>
+
+The following wildcards are supported:
+
+<table cellspacing="10">
+<tr><td valign="top"><code><b>?</b></code></td>
+ <td>matches any single character in an attribute name.</td></tr>
+<tr><td valign="top"><code><b>*</b></code></td>
+ <td>matches any part of an attribute name.</td></tr>
+</table>
+
+An attribute name that is preceded by an exclamation mark '<b>!</b>' is
+<i>excluded</i> from further attempts to match with <i>subsequent</i>
+attribute names in the filter. Make sure to specify filters correctly, since
+they are not checked for potential typos.
+<p>
+
+For example, the following setting preserves the optional attributes that are
+typically necessary when processing code that is intended to be used as a
+library:
+<pre>
+-keepattributes Exceptions,InnerClasses,Signature,Deprecated,
+ SourceFile,LineNumberTable,*Annotation*,EnclosingMethod
+</pre>
+<p>
+
+The Java bytecode specifications currently specify the following list of
+attributes.
+
+<h3>Optional attributes</h3>
+
+ProGuard's obfuscation step by default discards the following optional
+attributes. You can keep them with
+the <a href="usage.html#keepattributes"><code>-keepattributes</code></a>
+option.
+
+<dl>
+<dt><code><b>SourceFile</b></code></dt>
+<dd>Specifies the name of the source file from which the class file was
+ compiled. If present, this name is reported in stack traces.</dd>
+
+<dt><div>(J++ extension)</div>
+ <code><b>SourceDir</b></code></dt>
+<dd>Specifies the name of the source directory from which the class file was
+ compiled.</dd>
+
+<dt><code><b>InnerClasses</b></code></dt>
+<dd>Specifies the relationship between a class and its inner classes and outer
+ classes. Other than this and the naming convention with a '$' separator
+ between the names of inner classes and outer classes, inner classes are
+ just like ordinary classes. Compilers may need this information to find
+ classes referenced in a compiled library. Code may access this information
+ by reflection, for instance to derive the simple name of the class.</dd>
+
+<dt><div>(Java 5 or higher)</div>
+ <code><b>EnclosingMethod</b></code></dt>
+<dd>Specifies the method in which the class was defined. Compilers may need
+ this information to find classes referenced in a compiled library. Code
+ may access this information by reflection, for instance to derive the
+ simple name of the class.</dd>
+
+<dt><code><b>Deprecated</b></code></dt>
+<dd>Indicates that the class, field, or method is deprecated.</dd>
+
+<dt><code><b>Synthetic</b></code></dt>
+<dd>Indicates that the class, field, or method was generated by the
+ compiler.</dd>
+
+<dt><div>(Java 5 or higher)</div>
+ <code><b>Signature</b></code></dt>
+<dd>Specifies the generic signature of the class, field, or method. Compilers
+ may need this information to properly compile classes that use generic
+ types from compiled libraries. Code may access this signature by
+ reflection.</dd>
+
+<dt><div>(Java 8 or higher)</div>
+ <code><b>MethodParameters</b></code></dt>
+<dd>Specifies the names and access flags of the parameters of the method. Code
+ may access this information by reflection.</dd>
+
+<dt><code><b>Exceptions</b></code></dt>
+<dd>Specifies the exceptions that a method may throw. Compilers may use this
+ information to enforce catching them.</dd>
+
+<dt><code><b>LineNumberTable</b></code></dt>
+<dd>Specifies the line numbers of the method. If present, these line numbers
+ are reported in stack traces.</dd>
+
+<dt><code><b>LocalVariableTable</b></code></dt>
+<dd>Specifies the names and types of local variables of the method. If present,
+ some IDEs may use this information for helping with auto-completion.</dd>
+
+<dt><div>(Java 5 or higher)</div>
+ <code><b>LocalVariableTypeTable</b></code></dt>
+<dd>Specifies the names and generic types of local variables of the method. If
+ present, some IDEs may use this information for helping with
+ auto-completion.</dd>
+
+<dt><div>(Java 5 or higher)</div>
+ <code><b>RuntimeVisibleAnnotations</b></code></dt>
+<dd>Specifies the annotations that are visible at run-time, for classes,
+ fields, and methods. Compilers and annotation processors may use these
+ annotations. Code may access them by reflection.</dd>
+
+<dt><div>(Java 5 or higher)</div>
+ <code><b>RuntimeInvisibleAnnotations</b></code></dt>
+<dd>Specifies the annotations that are visible at compile-time, for classes,
+ fields, and methods. Compilers and annotation processors may use these
+ annotations.</dd>
+
+<dt><div>(Java 5 or higher)</div>
+ <code><b>RuntimeVisibleParameterAnnotations</b></code></dt>
+<dd>Specifies the annotations that are visible at run-time, for method
+ parameters. Compilers and annotation processors may use these
+ annotations. Code may access them by reflection.</dd>
+
+<dt><div>(Java 5 or higher)</div>
+ <code><b>RuntimeInvisibleParameterAnnotations</b></code></dt>
+<dd>Specifies the annotations that are visible at compile-time, for method
+ parameters. Compilers and annotation processors may use these
+ annotations.</dd>
+
+<dt><div>(Java 8 or higher)</div>
+ <code><b>RuntimeVisibleTypeAnnotations</b></code></dt>
+<dd>Specifies the annotations that are visible at run-time, for generic types,
+ instructions, etc. Compilers and annotation processors may use these
+ annotations. Code may access them by reflection.</dd>
+
+<dt><div>(Java 8 or higher)</div>
+ <code><b>RuntimeInvisibleTypeAnnotations</b></code></dt>
+<dd>Specifies the annotations that are visible at compile-time, for generic
+ types, instructions, etc. Compilers and annotation processors may use
+ these annotations.</dd>
+
+<dt><div>(Java 5 or higher)</div>
+ <code><b>AnnotationDefault</b></code></dt>
+<dd>Specifies a default value for an annotation.</dd>
+
+</dl>
+<p>
+
+<h3>Essential attributes</h3>
+
+ProGuard automatically keeps the following essential attributes, processing
+them as necessary. We're listing them for the sake of completeness.
+
+<dl>
+<dt><code><b>ConstantValue</b></code></dt>
+<dd>Specifies a constant integer, float, class, string, etc.</dd>
+
+<dt><code><b>Code</b></code></dt>
+<dd>Specifies the actual bytecode of a method.</dd>
+
+<dt><div>(Java Micro Edition)</div>
+ <code><b>StackMap</b></code></dt>
+<dd>Provides preverification information. The Java Virtual Machine can use
+ this information to speed up the verification step when loading a
+ class.</dd>
+
+<dt><div>(Java 6 or higher)</div>
+ <code><b>StackMapTable</b></code></dt>
+<dd>Provides preverification information. The Java Virtual Machine can use
+ this information to speed up the verification step when loading a
+ class.</dd>
+
+<dt><div>(Java 7 or higher)</div>
+ <code><b>BootstrapMethods</b></code></dt>
+<dd>Specifies the methods to bootstrap dynamic method invocations.</dd>
+
+</dl>
+<p>
+
+<hr />
+<address>
+Copyright &copy; 2002-2014
+<a target="other" href="http://www.lafortune.eu/">Eric Lafortune</a> @ <a target="top" href="http://www.saikoa.com/">Saikoa</a>.
+</address>
+</body>
+</html>