summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStiver <stiver.mail@gmail.com>2014-08-13 22:08:06 +0200
committerStiver <stiver.mail@gmail.com>2014-08-13 22:08:06 +0200
commit04b5c9abb177ced644caa520c252f783327a0cbf (patch)
tree0db6a0dc413e0e6bb44d66920487d1f5c7f1d7fc /src
parenta2fa99e3a22f66317cfb4188f86ba5599f448891 (diff)
downloadfernflower-04b5c9abb177ced644caa520c252f783327a0cbf.tar
fernflower-04b5c9abb177ced644caa520c252f783327a0cbf.tar.gz
fernflower-04b5c9abb177ced644caa520c252f783327a0cbf.tar.lz
fernflower-04b5c9abb177ced644caa520c252f783327a0cbf.tar.xz
fernflower-04b5c9abb177ced644caa520c252f783327a0cbf.zip
Fixed 'IDEA-128595: Variable name set to "this"'
Diffstat (limited to 'src')
-rw-r--r--src/de/fernflower/modules/decompiler/vars/VarVersionsProcessor.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/de/fernflower/modules/decompiler/vars/VarVersionsProcessor.java b/src/de/fernflower/modules/decompiler/vars/VarVersionsProcessor.java
index c30e75a..a301a5b 100644
--- a/src/de/fernflower/modules/decompiler/vars/VarVersionsProcessor.java
+++ b/src/de/fernflower/modules/decompiler/vars/VarVersionsProcessor.java
@@ -60,7 +60,7 @@ public class VarVersionsProcessor {
typeproc = new VarTypeProcessor();
typeproc.calculateVarTypes(root, dgraph);
- simpleMerge(typeproc, dgraph);
+ simpleMerge(typeproc, dgraph, mt);
// FIXME: advanced merging
@@ -146,6 +146,8 @@ public class VarVersionsProcessor {
type = type.type == CodeConstants.TYPE_BYTECHAR?VarType.VARTYPE_BYTE:VarType.VARTYPE_SHORT;
}
mapExprentMinTypes.put(paar, type);
+ //} else if(type.type == CodeConstants.TYPE_CHAR && (maxtype == null || maxtype.type == CodeConstants.TYPE_INT)) { // when possible, lift char to int
+ // mapExprentMinTypes.put(paar, VarType.VARTYPE_INT);
} else if(type.type == CodeConstants.TYPE_NULL) {
mapExprentMinTypes.put(paar, VarType.VARTYPE_OBJECT);
}
@@ -153,7 +155,7 @@ public class VarVersionsProcessor {
}
- private void simpleMerge(VarTypeProcessor typeproc, DirectGraph dgraph) {
+ private void simpleMerge(VarTypeProcessor typeproc, DirectGraph dgraph, StructMethod mt) {
HashMap<VarVersionPaar, VarType> mapExprentMaxTypes = typeproc.getMapExprentMaxTypes();
HashMap<VarVersionPaar, VarType> mapExprentMinTypes = typeproc.getMapExprentMinTypes();
@@ -171,6 +173,8 @@ public class VarVersionsProcessor {
}
}
+ boolean is_method_static = (mt.getAccessFlags() & CodeConstants.ACC_STATIC) != 0;
+
final HashMap<VarVersionPaar, Integer> mapMergedVersions = new HashMap<VarVersionPaar, Integer>();
for(Entry<Integer, HashSet<Integer>> ent: mapVarVersions.entrySet()) {
@@ -183,6 +187,10 @@ public class VarVersionsProcessor {
VarVersionPaar firstpaar = new VarVersionPaar(ent.getKey(), lstVersions.get(i));
VarType firsttype = mapExprentMinTypes.get(firstpaar);
+ if(firstpaar.var == 0 && firstpaar.version == 1 && !is_method_static) {
+ continue; // don't merge 'this' variable
+ }
+
for(int j=i+1;j<lstVersions.size();j++) {
VarVersionPaar secpaar = new VarVersionPaar(ent.getKey(), lstVersions.get(j));
VarType sectype = mapExprentMinTypes.get(secpaar);