Commit 701baaa5 authored by Eric Bruneton's avatar Eric Bruneton

Add a failing test case showing the issue.

parent f52a21ff
......@@ -30,6 +30,7 @@ package org.objectweb.asm.tree.analysis;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
import java.io.IOException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.objectweb.asm.ClassReader;
......@@ -820,6 +821,25 @@ public class AnalyzerTest {
assertMaxs(4, 6);
}
/**
* Tests that Analyzer works correctly on classes with many labels.
*
* @throws IOException
*/
@Test
public void testManyLabels() {
Label target = new Label();
JSR(target);
LABEL(target);
for (int i = 0; i < 8192; i++) {
Label label = new Label();
GOTO(label);
LABEL(label);
}
RETURN();
assertMaxs(1, 1);
}
/**
* Tests an example coming from distilled down version of
* com/sun/corba/ee/impl/protocol/CorbaClientDelegateImpl from GlassFish 2. See issue #317823.
......@@ -911,9 +931,9 @@ public class AnalyzerTest {
return new MethodNode(Opcodes.ASM5, access, name, desc, signature, exceptions) {
@Override
public void visitEnd() {
Analyzer<BasicValue> a = new Analyzer<BasicValue>(new BasicInterpreter());
Analyzer<BasicValue> analyzer = new Analyzer<BasicValue>(new BasicInterpreter());
try {
Frame<BasicValue>[] frames = a.analyze("C", this);
Frame<BasicValue>[] frames = analyzer.analyze("C", this);
int mStack = 0;
int mLocals = 0;
for (int i = 0; i < frames.length; ++i) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment