diff options
Diffstat (limited to 'src/cuchaz/enigma/analysis/SourceIndexClassVisitor.java')
| -rw-r--r-- | src/cuchaz/enigma/analysis/SourceIndexClassVisitor.java | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/cuchaz/enigma/analysis/SourceIndexClassVisitor.java b/src/cuchaz/enigma/analysis/SourceIndexClassVisitor.java index 5257088..a1c8271 100644 --- a/src/cuchaz/enigma/analysis/SourceIndexClassVisitor.java +++ b/src/cuchaz/enigma/analysis/SourceIndexClassVisitor.java | |||
| @@ -10,8 +10,6 @@ | |||
| 10 | ******************************************************************************/ | 10 | ******************************************************************************/ |
| 11 | package cuchaz.enigma.analysis; | 11 | package cuchaz.enigma.analysis; |
| 12 | 12 | ||
| 13 | import com.google.common.collect.HashMultiset; | ||
| 14 | import com.google.common.collect.Multiset; | ||
| 15 | import com.strobel.assembler.metadata.FieldDefinition; | 13 | import com.strobel.assembler.metadata.FieldDefinition; |
| 16 | import com.strobel.assembler.metadata.MethodDefinition; | 14 | import com.strobel.assembler.metadata.MethodDefinition; |
| 17 | import com.strobel.assembler.metadata.TypeDefinition; | 15 | import com.strobel.assembler.metadata.TypeDefinition; |
| @@ -26,6 +24,7 @@ import com.strobel.decompiler.languages.java.ast.SimpleType; | |||
| 26 | import com.strobel.decompiler.languages.java.ast.TypeDeclaration; | 24 | import com.strobel.decompiler.languages.java.ast.TypeDeclaration; |
| 27 | import com.strobel.decompiler.languages.java.ast.VariableInitializer; | 25 | import com.strobel.decompiler.languages.java.ast.VariableInitializer; |
| 28 | 26 | ||
| 27 | import cuchaz.enigma.mapping.BehaviorEntry; | ||
| 29 | import cuchaz.enigma.mapping.ClassEntry; | 28 | import cuchaz.enigma.mapping.ClassEntry; |
| 30 | import cuchaz.enigma.mapping.ConstructorEntry; | 29 | import cuchaz.enigma.mapping.ConstructorEntry; |
| 31 | import cuchaz.enigma.mapping.Entry; | 30 | import cuchaz.enigma.mapping.Entry; |
| @@ -35,12 +34,10 @@ import cuchaz.enigma.mapping.MethodEntry; | |||
| 35 | public class SourceIndexClassVisitor extends SourceIndexVisitor | 34 | public class SourceIndexClassVisitor extends SourceIndexVisitor |
| 36 | { | 35 | { |
| 37 | private ClassEntry m_classEntry; | 36 | private ClassEntry m_classEntry; |
| 38 | private Multiset<Entry> m_indices; | ||
| 39 | 37 | ||
| 40 | public SourceIndexClassVisitor( ClassEntry classEntry ) | 38 | public SourceIndexClassVisitor( ClassEntry classEntry ) |
| 41 | { | 39 | { |
| 42 | m_classEntry = classEntry; | 40 | m_classEntry = classEntry; |
| 43 | m_indices = HashMultiset.create(); | ||
| 44 | } | 41 | } |
| 45 | 42 | ||
| 46 | @Override | 43 | @Override |
| @@ -68,7 +65,7 @@ public class SourceIndexClassVisitor extends SourceIndexVisitor | |||
| 68 | ClassEntry classEntry = new ClassEntry( ref.getInternalName() ); | 65 | ClassEntry classEntry = new ClassEntry( ref.getInternalName() ); |
| 69 | index.addReference( | 66 | index.addReference( |
| 70 | node.getIdentifierToken(), | 67 | node.getIdentifierToken(), |
| 71 | new EntryReference<Entry,Entry>( classEntry, m_classEntry, m_indices.count( classEntry ) ) | 68 | new EntryReference<Entry,Entry>( classEntry, m_classEntry ) |
| 72 | ); | 69 | ); |
| 73 | } | 70 | } |
| 74 | 71 | ||
| @@ -80,11 +77,17 @@ public class SourceIndexClassVisitor extends SourceIndexVisitor | |||
| 80 | { | 77 | { |
| 81 | MethodDefinition def = node.getUserData( Keys.METHOD_DEFINITION ); | 78 | MethodDefinition def = node.getUserData( Keys.METHOD_DEFINITION ); |
| 82 | ClassEntry classEntry = new ClassEntry( def.getDeclaringType().getInternalName() ); | 79 | ClassEntry classEntry = new ClassEntry( def.getDeclaringType().getInternalName() ); |
| 83 | MethodEntry methodEntry = new MethodEntry( classEntry, def.getName(), def.getSignature() ); | 80 | BehaviorEntry behaviorEntry; |
| 84 | index.addDeclaration( node.getNameToken(), methodEntry ); | 81 | if( def.getName().equals( "<clinit>" ) ) |
| 85 | //if( !def.getName().equals( "<clinit>" ) ) | 82 | { |
| 86 | 83 | behaviorEntry = new ConstructorEntry( classEntry ); | |
| 87 | return node.acceptVisitor( new SourceIndexBehaviorVisitor( methodEntry ), index ); | 84 | } |
| 85 | else | ||
| 86 | { | ||
| 87 | behaviorEntry = new MethodEntry( classEntry, def.getName(), def.getSignature() ); | ||
| 88 | } | ||
| 89 | index.addDeclaration( node.getNameToken(), behaviorEntry ); | ||
| 90 | return node.acceptVisitor( new SourceIndexBehaviorVisitor( behaviorEntry ), index ); | ||
| 88 | } | 91 | } |
| 89 | 92 | ||
| 90 | @Override | 93 | @Override |