mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 11:39:11 +03:00
[FIX] Рефакторинг в пакете pro.gravit.launchserver.asm.
This commit is contained in:
parent
ea6e131b60
commit
567e2fefaf
1 changed files with 5 additions and 2 deletions
|
@ -21,11 +21,14 @@ public class InjectClassAcceptor {
|
||||||
public static final List<Class<?>> zPrimitivesList = Arrays.asList(primitives);
|
public static final List<Class<?>> zPrimitivesList = Arrays.asList(primitives);
|
||||||
public static final String INJ_DESC = Type.getDescriptor(LauncherInject.class);
|
public static final String INJ_DESC = Type.getDescriptor(LauncherInject.class);
|
||||||
|
|
||||||
public static void visit(ClassNode cn, Map<String, Object> object) {
|
public static void checkMap(Map<String,Object> object) {
|
||||||
if (!object.values().stream().allMatch(zPrimitivesList::contains))
|
if (!object.values().stream().allMatch(zPrimitivesList::contains))
|
||||||
throw new IllegalArgumentException("Only primitives in values...");
|
throw new IllegalArgumentException("Only primitives in values...");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void visit(ClassNode cn, Map<String, Object> object) {
|
||||||
cn.fields.stream().filter(e -> e.invisibleAnnotations != null)
|
cn.fields.stream().filter(e -> e.invisibleAnnotations != null)
|
||||||
.filter(e -> e.invisibleAnnotations.stream().anyMatch(f -> f.desc.equals(INJ_DESC))).forEach(e -> {
|
.filter(e -> !e.invisibleAnnotations.isEmpty() && e.invisibleAnnotations.stream().anyMatch(f -> f.desc.equals(INJ_DESC))).forEach(e -> {
|
||||||
// Notice that fields that will be used with this algo should not have default
|
// Notice that fields that will be used with this algo should not have default
|
||||||
// value by = ...;
|
// value by = ...;
|
||||||
AnnotationNode n = e.invisibleAnnotations.stream().filter(f -> INJ_DESC.equals(f.desc)).findFirst()
|
AnnotationNode n = e.invisibleAnnotations.stream().filter(f -> INJ_DESC.equals(f.desc)).findFirst()
|
||||||
|
|
Loading…
Reference in a new issue