Skip to content

Commit 9d080b2

Browse files
committed
Add CannotInlineException message to debug log
1 parent f4f84e4 commit 9d080b2

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Diff for: base/src/main/java/proguard/optimize/lambdainline/BaseLambdaInliner.java

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package proguard.optimize.lambdainline;
22

3+
import org.apache.logging.log4j.LogManager;
4+
import org.apache.logging.log4j.Logger;
35
import proguard.classfile.AccessConstants;
46
import proguard.classfile.ClassPool;
57
import proguard.classfile.Clazz;
@@ -47,6 +49,7 @@
4749
* instruction if this class manages to inline the lambda.
4850
*/
4951
public abstract class BaseLambdaInliner {
52+
private static final Logger logger = LogManager.getLogger();
5053
private final Clazz consumingClass;
5154
private final Method consumingMethod;
5255
private final ClassPool programClassPool;
@@ -192,6 +195,8 @@ public void visitProgramMethod(ProgramClass programClass, ProgramMethod method)
192195
try {
193196
copiedConsumingMethod.accept(consumingClass, new RecursiveInliner(calledLambdaIndex));
194197
} catch (CannotInlineException cie) {
198+
logger.debug("Aborting inlining this lambda into this method. Reason:");
199+
logger.debug(cie.getMessage());
195200
ClassEditor classEditor = new ClassEditor((ProgramClass) consumingClass);
196201
classEditor.removeMethod(copiedConsumingMethod);
197202
classEditor.removeMethod(staticInvokeMethod);

Diff for: base/src/main/java/proguard/optimize/lambdainline/RecursiveInliner.java

-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ public void visitVariableInstruction(Clazz clazz, Method method, CodeAttribute c
100100
int sizeAdjustedLambdaIndex = ClassUtil.internalMethodVariableIndex(consumingMethodDescriptor, true, lambdaConsumingMethodArgIndex);
101101

102102
if (variableSourceInstruction.variableIndex == sizeAdjustedLambdaIndex) {
103-
logger.debug("Cannot inline lambdas into functions that call other functions that consume this lambda!");
104103
throw new CannotInlineException("Cannot inline lambdas into functions that call other functions that consume this lambda!");
105104
}
106105
}

0 commit comments

Comments
 (0)