2
* ProGuard -- shrinking, optimization, obfuscation, and preverification
5
* Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu)
7
* This program is free software; you can redistribute it and/or modify it
8
* under the terms of the GNU General Public License as published by the Free
9
* Software Foundation; either version 2 of the License, or (at your option)
12
* This program is distributed in the hope that it will be useful, but WITHOUT
13
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17
* You should have received a copy of the GNU General Public License along
18
* with this program; if not, write to the Free Software Foundation, Inc.,
19
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24
* This class represents a keep option with class specification.
26
* @author Eric Lafortune
28
public class KeepClassSpecification extends ClassSpecification
30
public final boolean markClasses;
31
public final boolean markConditionally;
32
public final boolean allowShrinking;
33
public final boolean allowOptimization;
34
public final boolean allowObfuscation;
38
* Creates a new KeepClassSpecification for all possible classes.
39
* @param markClasses specifies whether to mark the classes.
40
* If false, only class members are marked.
41
* If true, the classes are marked as well.
42
* @param markConditionally specifies whether to mark the classes and
43
* class members conditionally. If true, classes
44
* and class members are marked, on the condition
45
* that all specified class members are present.
46
* @param allowShrinking specifies whether shrinking is allowed.
47
* @param allowOptimization specifies whether optimization is allowed.
48
* @param allowObfuscation specifies whether obfuscation is allowed.
50
public KeepClassSpecification(boolean markClasses,
51
boolean markConditionally,
52
boolean allowShrinking,
53
boolean allowOptimization,
54
boolean allowObfuscation)
56
this.markClasses = markClasses;
57
this.markConditionally = markConditionally;
58
this.allowShrinking = allowShrinking;
59
this.allowOptimization = allowOptimization;
60
this.allowObfuscation = allowObfuscation;
65
* Creates a new KeepClassSpecification.
66
* @param markClasses specifies whether to mark the classes.
67
* If false, only class members are marked.
68
* If true, the classes are marked as well.
69
* @param markConditionally specifies whether to mark the classes and
70
* class members conditionally. If true, classes
71
* and class members are marked, on the condition
72
* that all specified class members are present.
73
* @param allowShrinking specifies whether shrinking is allowed.
74
* @param allowOptimization specifies whether optimization is allowed.
75
* @param allowObfuscation specifies whether obfuscation is allowed.
76
* @param classSpecification the specification of classes and class members.
78
public KeepClassSpecification(boolean markClasses,
79
boolean markConditionally,
80
boolean allowShrinking,
81
boolean allowOptimization,
82
boolean allowObfuscation,
83
ClassSpecification classSpecification)
85
super(classSpecification);
87
this.markClasses = markClasses;
88
this.markConditionally = markConditionally;
89
this.allowShrinking = allowShrinking;
90
this.allowOptimization = allowOptimization;
91
this.allowObfuscation = allowObfuscation;
95
// Implementations for Object.
97
public boolean equals(Object object)
100
this.getClass() != object.getClass())
105
KeepClassSpecification other = (KeepClassSpecification)object;
107
this.markClasses == other.markClasses &&
108
this.markConditionally == other.markConditionally &&
109
this.allowShrinking == other.allowShrinking &&
110
this.allowOptimization == other.allowOptimization &&
111
this.allowObfuscation == other.allowObfuscation &&
115
public int hashCode()
118
(markClasses ? 0 : 1) ^
119
(markConditionally ? 0 : 2) ^
120
(allowShrinking ? 0 : 4) ^
121
(allowOptimization ? 0 : 8) ^
122
(allowObfuscation ? 0 : 16) ^
126
public Object clone()
130
return super.clone();
132
// catch (CloneNotSupportedException e)