From 39743587acda56e9519f072e8c9b25370e51f4cf Mon Sep 17 00:00:00 2001 From: JoJoDeveloping Date: Wed, 18 Sep 2019 20:57:42 +0200 Subject: [PATCH] Add lambda method detection --- .../java/de/oceanlabs/mcp/mcinjector/adaptors/ApplyMap.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/oceanlabs/mcp/mcinjector/adaptors/ApplyMap.java b/src/main/java/de/oceanlabs/mcp/mcinjector/adaptors/ApplyMap.java index c369549..7ec89f2 100644 --- a/src/main/java/de/oceanlabs/mcp/mcinjector/adaptors/ApplyMap.java +++ b/src/main/java/de/oceanlabs/mcp/mcinjector/adaptors/ApplyMap.java @@ -197,7 +197,11 @@ else if (tmp.getType() != AbstractInsnNode.LABEL) } private boolean isSynthetic(MethodNode mn){ - if ((mn.access & Opcodes.ACC_SYNTHETIC) != 0) return true; + if ((mn.access & Opcodes.ACC_SYNTHETIC) != 0) { + //de-lambdaified methods may be synthetic but actually appear in sourcecode so their args still get renamed + //such methods are private and start with lambda$ + return (mn.access & Opcodes.ACC_PRIVATE) == 0 || !mn.name.startsWith("lambda$"); + } //check for special case pursuant to JLS 13.1.7 //which specifies that are the one and only proper methods that may be generated and not be marked synthetic