Commit aa2b1973ef66a16dbe1fa8840113c4cf64d1093a

Authored by Mumfrey
1 parent ff13a62c

Update Mixin to 0.5.17

build.gradle
... ... @@ -64,6 +64,7 @@ sourceCompatibility = '1.6'
64 64 targetCompatibility = '1.6'
65 65  
66 66 repositories {
  67 + mavenLocal()
67 68 maven {
68 69 name = 'sponge'
69 70 url = 'https://repo.spongepowered.org/maven/'
... ... @@ -71,7 +72,7 @@ repositories {
71 72 }
72 73  
73 74 dependencies {
74   - compile('org.spongepowered:mixin:0.5.11-SNAPSHOT') {
  75 + compile('org.spongepowered:mixin:0.5.17-SNAPSHOT') {
75 76 exclude module: 'asm-commons'
76 77 exclude module: 'asm-tree'
77 78 exclude module: 'launchwrapper'
... ...
src/main/java/com/mumfrey/liteloader/core/runtime/Obf.java
... ... @@ -10,9 +10,6 @@ import java.lang.reflect.Field;
10 10 import java.util.HashMap;
11 11 import java.util.Map;
12 12  
13   -import org.spongepowered.asm.obfuscation.SrgField;
14   -import org.spongepowered.asm.obfuscation.SrgMethod;
15   -
16 13 /**
17 14 * Centralised obfuscation table for LiteLoader
18 15 *
... ...
src/main/java/com/mumfrey/liteloader/core/runtime/SrgContainer.java
... ... @@ -12,9 +12,6 @@ import java.util.HashMap;
12 12 import java.util.Map;
13 13 import java.util.Map.Entry;
14 14  
15   -import org.spongepowered.asm.obfuscation.SrgField;
16   -import org.spongepowered.asm.obfuscation.SrgMethod;
17   -
18 15 import com.google.common.io.Files;
19 16  
20 17 import joptsimple.internal.Strings;
... ...
src/main/java/com/mumfrey/liteloader/core/runtime/SrgField.java 0 → 100644
  1 +/*
  2 + * This file is part of LiteLoader.
  3 + * Copyright (C) 2012-16 Adam Mummery-Smith
  4 + * All Rights Reserved.
  5 + */
  6 +package com.mumfrey.liteloader.core.runtime;
  7 +
  8 +import com.google.common.base.Objects;
  9 +
  10 +/**
  11 + * Stores information about an SRG field mapping during AP runs
  12 + */
  13 +public final class SrgField
  14 +{
  15 +
  16 + private final String mapping;
  17 +
  18 + public SrgField(String mapping)
  19 + {
  20 + this.mapping = mapping;
  21 + }
  22 +
  23 + public String getName()
  24 + {
  25 + if (this.mapping == null)
  26 + {
  27 + return null;
  28 + }
  29 + int pos = this.mapping.lastIndexOf('/');
  30 + return pos > -1 ? this.mapping.substring(pos + 1) : this.mapping;
  31 + }
  32 +
  33 + public String getOwner()
  34 + {
  35 + if (this.mapping == null)
  36 + {
  37 + return null;
  38 + }
  39 + int pos = this.mapping.lastIndexOf('/');
  40 + return pos > -1 ? this.mapping.substring(0, pos) : null;
  41 + }
  42 +
  43 + public String getMapping()
  44 + {
  45 + return this.mapping;
  46 + }
  47 +
  48 + public SrgField move(String newOwner)
  49 + {
  50 + return new SrgField((newOwner != null ? newOwner + "/" : "") + this.getName());
  51 + }
  52 +
  53 + public SrgField copy()
  54 + {
  55 + return new SrgField(this.mapping);
  56 + }
  57 +
  58 + @Override
  59 + public int hashCode()
  60 + {
  61 + return Objects.hashCode(this.mapping);
  62 + }
  63 +
  64 + @Override
  65 + public boolean equals(Object obj)
  66 + {
  67 + if (this == obj)
  68 + {
  69 + return true;
  70 + }
  71 + if (obj instanceof SrgField)
  72 + {
  73 + return Objects.equal(this.mapping, ((SrgField)obj).mapping);
  74 + }
  75 + return false;
  76 + }
  77 +
  78 + @Override
  79 + public String toString()
  80 + {
  81 + return this.mapping;
  82 + }
  83 +}
0 84 \ No newline at end of file
... ...
src/main/java/com/mumfrey/liteloader/core/runtime/SrgMethod.java 0 → 100644
  1 +/*
  2 + * This file is part of LiteLoader.
  3 + * Copyright (C) 2012-16 Adam Mummery-Smith
  4 + * All Rights Reserved.
  5 + */
  6 +package com.mumfrey.liteloader.core.runtime;
  7 +
  8 +import com.google.common.base.Objects;
  9 +
  10 +/**
  11 + * Stores information about an SRG method mapping during AP runs
  12 + */
  13 +public final class SrgMethod
  14 +{
  15 +
  16 + private final String name;
  17 + private final String desc;
  18 +
  19 + public SrgMethod(String name, String desc)
  20 + {
  21 + this.name = name;
  22 + this.desc = desc;
  23 + }
  24 +
  25 + public SrgMethod(String owner, String simpleName, String desc)
  26 + {
  27 + this.name = SrgMethod.createName(owner, simpleName);
  28 + this.desc = desc;
  29 + }
  30 +
  31 + public String getName()
  32 + {
  33 + return this.name;
  34 + }
  35 +
  36 + public String getSimpleName()
  37 + {
  38 + if (this.name == null)
  39 + {
  40 + return null;
  41 + }
  42 + int pos = this.name.lastIndexOf('/');
  43 + return pos > -1 ? this.name.substring(pos + 1) : this.name;
  44 + }
  45 +
  46 + public String getOwner()
  47 + {
  48 + if (this.name == null)
  49 + {
  50 + return null;
  51 + }
  52 + int pos = this.name.lastIndexOf('/');
  53 + return pos > -1 ? this.name.substring(0, pos) : null;
  54 + }
  55 +
  56 + public String getDesc()
  57 + {
  58 + return this.desc;
  59 + }
  60 +
  61 + public SrgMethod move(String newOwner)
  62 + {
  63 + return new SrgMethod(newOwner, this.getSimpleName(), this.desc);
  64 + }
  65 +
  66 + public SrgMethod copy()
  67 + {
  68 + return new SrgMethod(this.name, this.desc);
  69 + }
  70 +
  71 + @Override
  72 + public int hashCode()
  73 + {
  74 + return Objects.hashCode(this.name, this.desc);
  75 + }
  76 +
  77 + @Override
  78 + public boolean equals(Object obj)
  79 + {
  80 + if (this == obj)
  81 + {
  82 + return true;
  83 + }
  84 + if (obj instanceof SrgMethod)
  85 + {
  86 + return Objects.equal(this.name, ((SrgMethod)obj).name) && Objects.equal(this.desc, ((SrgMethod)obj).desc);
  87 + }
  88 + return false;
  89 + }
  90 +
  91 + @Override
  92 + public String toString()
  93 + {
  94 + return String.format("%s %s", this.name, this.desc);
  95 + }
  96 +
  97 + private static String createName(String owner, String simpleName)
  98 + {
  99 + return (owner != null ? owner + "/" : "") + simpleName;
  100 + }
  101 +
  102 +}
... ...