Skip to content

Commit 628abaf

Browse files
committed
[DEX] Rename debug block elements
1 parent af3a9f7 commit 628abaf

26 files changed

Lines changed: 207 additions & 203 deletions

src/main/java/com/reandroid/dex/data/CodeItem.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,12 @@
2020
import com.reandroid.arsc.item.IndirectInteger;
2121
import com.reandroid.arsc.io.BlockReader;
2222
import com.reandroid.arsc.item.IntegerReference;
23-
import com.reandroid.dex.base.*;
23+
import com.reandroid.dex.base.DexPositionAlign;
24+
import com.reandroid.dex.base.IndirectShort;
25+
import com.reandroid.dex.base.PositionAlignedItem;
26+
import com.reandroid.dex.base.UsageMarker;
2427
import com.reandroid.dex.common.SectionItem;
25-
import com.reandroid.dex.debug.DebugElement;
28+
import com.reandroid.dex.debug.DebugElementBlock;
2629
import com.reandroid.dex.id.IdItem;
2730
import com.reandroid.dex.ins.ExtraLine;
2831
import com.reandroid.dex.ins.Label;
@@ -121,7 +124,7 @@ public boolean ensureLocalRegistersCount(int locals){
121124
}
122125

123126

124-
public Iterator<DebugElement> getDebugLabels() {
127+
public Iterator<DebugElementBlock> getDebugLabels() {
125128
DebugInfo debugInfo = getDebugInfo();
126129
if(debugInfo != null) {
127130
return debugInfo.getExtraLines();

src/main/java/com/reandroid/dex/data/DebugInfo.java

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
import com.reandroid.arsc.container.BlockList;
2020
import com.reandroid.arsc.io.BlockReader;
2121
import com.reandroid.dex.base.Ule128Item;
22-
import com.reandroid.dex.debug.DebugElement;
22+
import com.reandroid.dex.debug.DebugElementBlock;
2323
import com.reandroid.dex.debug.DebugSequence;
24-
import com.reandroid.dex.debug.DebugParameter;
24+
import com.reandroid.dex.debug.DebugParameterBlock;
2525
import com.reandroid.dex.id.IdItem;
2626
import com.reandroid.dex.key.DataKey;
2727
import com.reandroid.dex.key.Key;
@@ -40,7 +40,7 @@ public class DebugInfo extends DataItem implements KeyReference, Comparable<Debu
4040

4141
private final Ule128Item lineStart;
4242
private final Ule128Item debugParameterCount;
43-
private BlockList<DebugParameter> debugParametersArray;
43+
private BlockList<DebugParameterBlock> debugParametersArray;
4444
private final DebugSequence debugSequence;
4545

4646
private final DataKey<DebugInfo> debugKey;
@@ -95,24 +95,24 @@ public int getParameterCount() {
9595
}
9696
return 0;
9797
}
98-
public DebugParameter getDebugParameter(int index) {
99-
BlockList<DebugParameter> debugParametersArray = this.debugParametersArray;
98+
public DebugParameterBlock getDebugParameter(int index) {
99+
BlockList<DebugParameterBlock> debugParametersArray = this.debugParametersArray;
100100
if (debugParametersArray != null) {
101101
return debugParametersArray.get(index);
102102
}
103103
return null;
104104
}
105-
public DebugParameter getOrCreateDebugParameter(int index) {
106-
BlockList<DebugParameter> debugParametersArray = initParametersArray();
105+
public DebugParameterBlock getOrCreateDebugParameter(int index) {
106+
BlockList<DebugParameterBlock> debugParametersArray = initParametersArray();
107107
debugParametersArray.ensureSize(index + 1);
108108
return debugParametersArray.get(index);
109109
}
110110
public void removeDebugParameter(int index) {
111-
BlockList<DebugParameter> parameterNames = this.debugParametersArray;
111+
BlockList<DebugParameterBlock> parameterNames = this.debugParametersArray;
112112
if (parameterNames == null) {
113113
return;
114114
}
115-
DebugParameter parameter = parameterNames.get(index);
115+
DebugParameterBlock parameter = parameterNames.get(index);
116116
if (parameter == null) {
117117
return;
118118
}
@@ -127,16 +127,16 @@ public boolean hasSequence() {
127127
return !getDebugSequence().isEmpty();
128128
}
129129
public boolean hasParameters() {
130-
BlockList<DebugParameter> array = debugParametersArray;
130+
BlockList<DebugParameterBlock> array = debugParametersArray;
131131
return array != null && array.size() != 0;
132132
}
133-
public Iterator<DebugParameter> getParameters() {
133+
public Iterator<DebugParameterBlock> getParameters() {
134134
if (debugParametersArray != null) {
135135
return debugParametersArray.iterator();
136136
}
137137
return EmptyIterator.of();
138138
}
139-
public Iterator<DebugElement> getExtraLines() {
139+
public Iterator<DebugElementBlock> getExtraLines() {
140140
return getDebugSequence().getExtraLines();
141141
}
142142
public DebugSequence getDebugSequence() {
@@ -148,14 +148,14 @@ public void onReadBytes(BlockReader reader) throws IOException {
148148
lineStart.onReadBytes(reader);
149149
debugParameterCount.onReadBytes(reader);
150150
if (debugParameterCount.get() > 0) {
151-
BlockList<DebugParameter> array = initParametersArray();
151+
BlockList<DebugParameterBlock> array = initParametersArray();
152152
array.setSize(debugParameterCount.get());
153153
array.readChildes(reader);
154154
}
155155
debugSequence.onReadBytes(reader);
156156
}
157-
private BlockList<DebugParameter> initParametersArray() {
158-
BlockList<DebugParameter> debugParametersArray = this.debugParametersArray;
157+
private BlockList<DebugParameterBlock> initParametersArray() {
158+
BlockList<DebugParameterBlock> debugParametersArray = this.debugParametersArray;
159159
if (debugParametersArray == null) {
160160
debugParametersArray = new BlockList<>();
161161
this.debugParametersArray = debugParametersArray;
@@ -166,7 +166,7 @@ private BlockList<DebugParameter> initParametersArray() {
166166
}
167167

168168
public void onRemove() {
169-
BlockList<DebugParameter> array = this.debugParametersArray;
169+
BlockList<DebugParameterBlock> array = this.debugParametersArray;
170170
if (array != null) {
171171
this.debugParametersArray = null;
172172
array.clearChildes();
@@ -191,9 +191,9 @@ protected void onRefreshed() {
191191
}
192192

193193
public Iterator<IdItem> usedIds() {
194-
Iterator<IdItem> iterator1 = new IterableIterator<DebugParameter, IdItem>(getParameters()) {
194+
Iterator<IdItem> iterator1 = new IterableIterator<DebugParameterBlock, IdItem>(getParameters()) {
195195
@Override
196-
public Iterator<IdItem> iterator(DebugParameter element) {
196+
public Iterator<IdItem> iterator(DebugParameterBlock element) {
197197
return element.usedIds();
198198
}
199199
};
@@ -207,11 +207,11 @@ public void merge(DebugInfo debugInfo) {
207207
int count = debugInfo.getParameterCount();
208208
debugParameterCount.set(count);
209209
if (count != 0) {
210-
BlockList<DebugParameter> array = initParametersArray();
210+
BlockList<DebugParameterBlock> array = initParametersArray();
211211
array.setSize(count);
212212
for(int i = 0; i < count; i++) {
213-
DebugParameter comingParameter = debugInfo.getDebugParameter(i);
214-
DebugParameter parameter = array.get(i);
213+
DebugParameterBlock comingParameter = debugInfo.getDebugParameter(i);
214+
DebugParameterBlock parameter = array.get(i);
215215
parameter.merge(comingParameter);
216216
}
217217
}
@@ -279,7 +279,7 @@ public int hashCode() {
279279
int hash = 1;
280280
if (!isEmpty()) {
281281
hash = hash * 31 + lineStart.get();
282-
BlockList<DebugParameter> array = this.debugParametersArray;
282+
BlockList<DebugParameterBlock> array = this.debugParametersArray;
283283
hash = hash * 31;
284284
if (array != null) {
285285
hash = hash + array.hashCode();
@@ -299,6 +299,6 @@ public String toString() {
299299
")}";
300300
}
301301

302-
private static final Creator<DebugParameter> CREATOR = DebugParameter::new;
302+
private static final Creator<DebugParameterBlock> CREATOR = DebugParameterBlock::new;
303303

304304
}

src/main/java/com/reandroid/dex/data/MethodParameterDef.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import com.reandroid.dex.common.DefIndex;
1919
import com.reandroid.dex.dalvik.DalvikSignature;
20-
import com.reandroid.dex.debug.DebugParameter;
20+
import com.reandroid.dex.debug.DebugParameterBlock;
2121
import com.reandroid.dex.id.ProtoId;
2222
import com.reandroid.dex.id.TypeId;
2323
import com.reandroid.dex.key.AnnotationItemKey;
@@ -148,9 +148,9 @@ public void clearDebugParameter() {
148148

149149
@Override
150150
public String getDebugName() {
151-
DebugParameter debugParameter = getDebugParameter();
152-
if (debugParameter != null) {
153-
return debugParameter.getName();
151+
DebugParameterBlock debugParameterBlock = getDebugParameter();
152+
if (debugParameterBlock != null) {
153+
return debugParameterBlock.getName();
154154
}
155155
return null;
156156
}
@@ -171,12 +171,12 @@ public void setDebugName(String name) {
171171
debugInfo.removeDebugParameter(getDefinitionIndex());
172172
return;
173173
}
174-
DebugParameter parameter = debugInfo.getOrCreateDebugParameter(
174+
DebugParameterBlock parameter = debugInfo.getOrCreateDebugParameter(
175175
getDefinitionIndex());
176176
parameter.setName(name);
177177
}
178178

179-
public DebugParameter getDebugParameter() {
179+
public DebugParameterBlock getDebugParameter() {
180180
DebugInfo debugInfo = getMethodDef().getDebugInfo();
181181
if (debugInfo != null) {
182182
return debugInfo.getDebugParameter(getDefinitionIndex());
@@ -211,9 +211,9 @@ public ParameterisedTypeKey getParameterisedTypeKey() {
211211

212212
@Override
213213
public void append(SmaliWriter writer) throws IOException {
214-
DebugParameter debugParameter = getDebugParameter();
215-
boolean has_debug = debugParameter != null &&
216-
debugParameter.getNameId() != null;
214+
DebugParameterBlock debugParameterBlock = getDebugParameter();
215+
boolean has_debug = debugParameterBlock != null &&
216+
debugParameterBlock.getNameId() != null;
217217
AnnotationSetKey annotation = getAnnotation();
218218
boolean has_annotation = !annotation.isEmpty();
219219
if (!has_debug && !has_annotation) {
@@ -224,7 +224,7 @@ public void append(SmaliWriter writer) throws IOException {
224224
writer.append('p');
225225
writer.appendInteger(getRegister());
226226
if (has_debug) {
227-
debugParameter.append(writer);
227+
debugParameterBlock.append(writer);
228228
}
229229
ParameterisedTypeKey typeKey = getParameterisedTypeKey();
230230
if (typeKey != null) {

src/main/java/com/reandroid/dex/debug/DebugAdvance.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
import java.io.IOException;
2222

23-
public abstract class DebugAdvance extends DebugElement {
23+
public abstract class DebugAdvance extends DebugElementBlock {
2424

2525
private final Le128 advance;
2626

@@ -49,7 +49,7 @@ public void appendExtra(SmaliWriter writer) throws IOException {
4949
}
5050

5151
@Override
52-
public void merge(DebugElement element){
52+
public void merge(DebugElementBlock element){
5353
super.merge(element);
5454
DebugAdvance coming = (DebugAdvance) element;
5555
this.advance.set(coming.advance.get());

0 commit comments

Comments
 (0)