Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6a08225c authored by Deepanshu Gupta's avatar Deepanshu Gupta
Browse files

Make layoutlib load on Java 7 VM

Prevent Java 7 VM from verifying the StackMapTable for methods by lying
about the class version.

The changeset also fixes the eclipse project by using the right asm
library in the checkout.

Change-Id: Idabf165380fb75fcc2d5c8fbd72388f52887a5df
parent 124af561
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4,6 +4,6 @@
	<classpathentry excluding="mock_data/" kind="src" path="tests"/>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
	<classpathentry kind="var" path="ANDROID_SRC/prebuilts/tools/common/asm-tools/asm-4.0.jar" sourcepath="/ANDROID_PLAT/prebuilts/tools/common/asm-tools/src-4.0.zip"/>
	<classpathentry kind="var" path="ANDROID_PLAT_SRC/prebuilts/misc/common/asm/asm-4.0.jar" sourcepath="/ANDROID_PLAT_SRC/prebuilts/misc/common/asm/src.zip"/>
	<classpathentry kind="output" path="bin"/>
</classpath>
+11 −0
Original line number Diff line number Diff line
@@ -177,6 +177,17 @@ public abstract class AbstractClassAdapter extends ClassVisitor {
            }
        }

        /* Java 7 verifies the StackMapTable of a class if its version number is greater than 50.0.
         * However, the check is disabled if the class version number is 50.0 or less. Generation
         * of the StackMapTable requires a rewrite using the tree API of ASM. As a workaround,
         * we rewrite the version number of the class to be 50.0
         *
         * http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6693236
         */
        if (version > 50) {
            version = 50;
        }

        super.visit(version, access, name, signature, superName, interfaces);
    }