summaryrefslogtreecommitdiffstats
path: root/src/org/jetbrains
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/jetbrains')
-rw-r--r--src/org/jetbrains/java/decompiler/main/collectors/VarNamesCollector.java3
-rw-r--r--src/org/jetbrains/java/decompiler/main/rels/NestedClassProcessor.java20
-rw-r--r--src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarProcessor.java4
3 files changed, 17 insertions, 10 deletions
diff --git a/src/org/jetbrains/java/decompiler/main/collectors/VarNamesCollector.java b/src/org/jetbrains/java/decompiler/main/collectors/VarNamesCollector.java
index dfde971..8d9d5c0 100644
--- a/src/org/jetbrains/java/decompiler/main/collectors/VarNamesCollector.java
+++ b/src/org/jetbrains/java/decompiler/main/collectors/VarNamesCollector.java
@@ -15,6 +15,7 @@
*/
package org.jetbrains.java.decompiler.main.collectors;
+import java.util.Collection;
import java.util.HashSet;
public class VarNamesCollector {
@@ -24,7 +25,7 @@ public class VarNamesCollector {
public VarNamesCollector() {
}
- public VarNamesCollector(HashSet<String> setNames) {
+ public VarNamesCollector(Collection<String> setNames) {
usedNames.addAll(setNames);
}
diff --git a/src/org/jetbrains/java/decompiler/main/rels/NestedClassProcessor.java b/src/org/jetbrains/java/decompiler/main/rels/NestedClassProcessor.java
index 6e40fcb..c4a4ff5 100644
--- a/src/org/jetbrains/java/decompiler/main/rels/NestedClassProcessor.java
+++ b/src/org/jetbrains/java/decompiler/main/rels/NestedClassProcessor.java
@@ -44,6 +44,7 @@ import org.jetbrains.java.decompiler.util.InterpreterUtil;
import java.util.*;
import java.util.Map.Entry;
+import org.jetbrains.java.decompiler.modules.decompiler.ExprProcessor;
public class NestedClassProcessor {
@@ -277,6 +278,7 @@ public class NestedClassProcessor {
if (expr.type == Exprent.EXPRENT_NEW) {
NewExprent new_expr = (NewExprent)expr;
+ VarNamesCollector enclosingCollector = new VarNamesCollector(encmeth.varproc.getVarNames());
if (new_expr.isLambda() && lambda_class_type.equals(new_expr.getNewtype())) {
InvocationExprent inv_dynamic = new_expr.getConstructor();
@@ -284,16 +286,16 @@ public class NestedClassProcessor {
int param_index = is_static_lambda_content ? 0 : 1;
int varindex = is_static_lambda_content ? 0 : 1;
- for (int i = 0; i < vars_count; ++i) {
+ for (int i = 0; i < md_content.params.length; ++i) {
+ VarVersionPaar varVersion = new VarVersionPaar(varindex, 0, ExprProcessor.getCastTypeName(md_content.params[i].copy()), false);
+ if (i < vars_count) {
+ Exprent param = inv_dynamic.getLstParameters().get(param_index + i);
- Exprent param = inv_dynamic.getLstParameters().get(param_index + i);
-
- if (param.type == Exprent.EXPRENT_VAR) {
- VarVersionPaar enc_varpaar = new VarVersionPaar((VarExprent)param);
- String enc_varname = encmeth.varproc.getVarName(enc_varpaar);
-
- //meth.varproc.setVarName(new VarVersionPaar(varindex, 0), enc_varname);
- mapNewNames.put(new VarVersionPaar(varindex, 0), enc_varname);
+ if (param.type == Exprent.EXPRENT_VAR) {
+ mapNewNames.put(varVersion, encmeth.varproc.getVarName(new VarVersionPaar((VarExprent) param)));
+ }
+ } else {
+ mapNewNames.put(varVersion, enclosingCollector.getFreeName(meth.varproc.getVarName(varVersion)));
}
varindex += md_content.params[i].stack_size;
diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarProcessor.java b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarProcessor.java
index 4d4dabb..18314d8 100644
--- a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarProcessor.java
+++ b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarProcessor.java
@@ -120,6 +120,10 @@ public class VarProcessor {
mapVarNames.put(varpaar, name);
}
+ public Collection<String> getVarNames() {
+ return mapVarNames != null ? mapVarNames.values() : Collections.EMPTY_SET;
+ }
+
public int getVarFinal(VarVersionPaar varpaar) {
return varvers == null ? VarTypeProcessor.VAR_FINAL : varvers.getVarFinal(varpaar);
}