Skip to content

Commit

Permalink
Potential fix for #21
Browse files Browse the repository at this point in the history
  • Loading branch information
jamierocks committed Jun 18, 2016
1 parent 47ff345 commit 4d80f04
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ defaultTasks 'clean', 'licenseFormat', 'build'
// Project information
allprojects {
group = 'blue.lapis.nocturne'
version = '1.0.3-SNAPSHOT'
version = '1.0.3'

sourceCompatibility = '1.8'
targetCompatibility = '1.8'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,12 @@

import blue.lapis.nocturne.Main;
import blue.lapis.nocturne.gui.scene.text.SelectableMember;
import blue.lapis.nocturne.jar.model.JarClassEntry;
import blue.lapis.nocturne.mapping.MappingContext;
import blue.lapis.nocturne.util.MemberType;

import java.util.Optional;

/**
* Represents a {@link Mapping} for an inner class, i.e. a class parented by
* another class.
Expand Down Expand Up @@ -70,7 +73,7 @@ public ClassMapping getParent() {
@Override
public String getFullObfuscatedName() {
return (parent instanceof InnerClassMapping
? ((InnerClassMapping) parent).getFullObfuscatedName()
? parent.getFullObfuscatedName()
: parent.getObfuscatedName())
+ INNER_CLASS_SEPARATOR_CHAR + getObfuscatedName();
}
Expand All @@ -83,7 +86,7 @@ public String getFullObfuscatedName() {
@Override
public String getFullDeobfuscatedName() {
return (parent instanceof InnerClassMapping
? ((InnerClassMapping) parent).getFullDeobfuscatedName()
? parent.getFullDeobfuscatedName()
: parent.getDeobfuscatedName())
+ INNER_CLASS_SEPARATOR_CHAR + getDeobfuscatedName();
}
Expand All @@ -95,10 +98,16 @@ public MappingContext getContext() {

@Override
public void setDeobfuscatedName(String deobf) {
super.setDeobfuscatedName(deobf);
Optional<JarClassEntry> jarClassEntry = Main.getLoadedJar().getClass(getParent().getFullObfuscatedName());
if (jarClassEntry.isPresent()) {
jarClassEntry.get().getCurrentInnerClassNames().put(getObfuscatedName(), deobf);
} else {
// log and skip
Main.getLogger().severe("Invalid obfuscated name: " + getParent().getFullObfuscatedName());
return;
}

Main.getLoadedJar().getClass(getParent().getFullObfuscatedName()).get()
.getCurrentInnerClassNames().put(getObfuscatedName(), deobf);
super.setDeobfuscatedName(deobf);
}

@Override
Expand Down

0 comments on commit 4d80f04

Please sign in to comment.