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

Commit 80dc34e3 authored by Deepanshu Gupta's avatar Deepanshu Gupta Committed by Android (Google) Code Review
Browse files

Merge "Java 8 in layoutlib-create"

parents 8f593ef8 23e47f56
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -21,7 +21,5 @@
        <processorPath useClasspath="true" />
      </profile>
    </annotationProcessing>
    <bytecodeTargetLevel target="1.6" />
  </component>
</project>
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ LOCAL_SRC_FILES := $(call all-java-files-under,src)

LOCAL_JAR_MANIFEST := manifest.txt
LOCAL_STATIC_JAVA_LIBRARIES := \
	asm-4.0
	asm-5.0

LOCAL_MODULE := layoutlib_create

+4 −4
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
  <component name="NewModuleRootManager" inherit-compiler-output="true">
  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="true">
    <exclude-output />
    <content url="file://$MODULE_DIR$">
      <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
@@ -9,12 +9,12 @@
      <sourceFolder url="file://$MODULE_DIR$/tests/mock_data" type="java-test-resource" />
      <excludeFolder url="file://$MODULE_DIR$/.settings" />
    </content>
    <orderEntry type="inheritedJdk" />
    <orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
    <orderEntry type="sourceFolder" forTests="false" />
    <orderEntry type="module-library">
      <library name="asm-4.0">
      <library name="asm-5.0">
        <CLASSES>
          <root url="jar://$MODULE_DIR$/../../../../../prebuilts/misc/common/asm/asm-4.0.jar!/" />
          <root url="jar://$MODULE_DIR$/../../../../../prebuilts/misc/common/asm/asm-5.0.jar!/" />
        </CLASSES>
        <JAVADOC />
        <SOURCES>
+6 −6
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import org.objectweb.asm.signature.SignatureReader;
import org.objectweb.asm.signature.SignatureVisitor;
@@ -44,7 +43,7 @@ public abstract class AbstractClassAdapter extends ClassVisitor {
    abstract String renameInternalType(String name);

    public AbstractClassAdapter(ClassVisitor cv) {
        super(Opcodes.ASM4, cv);
        super(Main.ASM_VERSION, cv);
    }

    /**
@@ -239,7 +238,7 @@ public abstract class AbstractClassAdapter extends ClassVisitor {
         * The names must be full qualified internal ASM names (e.g. com/blah/MyClass$InnerClass).
         */
        public RenameMethodAdapter(MethodVisitor mv) {
            super(Opcodes.ASM4, mv);
            super(Main.ASM_VERSION, mv);
        }

        @Override
@@ -276,7 +275,8 @@ public abstract class AbstractClassAdapter extends ClassVisitor {
        }

        @Override
        public void visitMethodInsn(int opcode, String owner, String name, String desc) {
        public void visitMethodInsn(int opcode, String owner, String name, String desc,
                boolean itf) {
            // The owner sometimes turns out to be a type descriptor. We try to detect it and fix.
            if (owner.indexOf(';') > 0) {
                owner = renameTypeDesc(owner);
@@ -285,7 +285,7 @@ public abstract class AbstractClassAdapter extends ClassVisitor {
            }
            desc = renameMethodDesc(desc);

            super.visitMethodInsn(opcode, owner, name, desc);
            super.visitMethodInsn(opcode, owner, name, desc, itf);
        }

        @Override
@@ -330,7 +330,7 @@ public abstract class AbstractClassAdapter extends ClassVisitor {
        private final SignatureVisitor mSv;

        public RenameSignatureAdapter(SignatureVisitor sv) {
            super(Opcodes.ASM4);
            super(Main.ASM_VERSION);
            mSv = sv;
        }

+15 −15
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import org.objectweb.asm.signature.SignatureReader;
import org.objectweb.asm.signature.SignatureVisitor;
@@ -65,7 +64,7 @@ public class AsmAnalyzer {
    /** Glob patterns of files to keep as is. */
    private final String[] mIncludeFileGlobs;
    /** Internal names of classes that contain method calls that need to be rewritten. */
    private final Set<String> mReplaceMethodCallClasses = new HashSet<String>();
    private final Set<String> mReplaceMethodCallClasses = new HashSet<>();

    /**
     * Creates a new analyzer.
@@ -97,8 +96,8 @@ public class AsmAnalyzer {
     */
    public void analyze() throws IOException, LogAbortException {

        TreeMap<String, ClassReader> zipClasses = new TreeMap<String, ClassReader>();
        Map<String, InputStream> filesFound = new TreeMap<String, InputStream>();
        TreeMap<String, ClassReader> zipClasses = new TreeMap<>();
        Map<String, InputStream> filesFound = new TreeMap<>();

        parseZip(mOsSourceJar, zipClasses, filesFound);
        mLog.info("Found %d classes in input JAR%s.", zipClasses.size(),
@@ -189,7 +188,7 @@ public class AsmAnalyzer {
     */
    Map<String, ClassReader> findIncludes(Map<String, ClassReader> zipClasses)
            throws LogAbortException {
        TreeMap<String, ClassReader> found = new TreeMap<String, ClassReader>();
        TreeMap<String, ClassReader> found = new TreeMap<>();

        mLog.debug("Find classes to include.");

@@ -318,10 +317,10 @@ public class AsmAnalyzer {
    Map<String, ClassReader> findDeps(Map<String, ClassReader> zipClasses,
            Map<String, ClassReader> inOutKeepClasses) {

        TreeMap<String, ClassReader> deps = new TreeMap<String, ClassReader>();
        TreeMap<String, ClassReader> new_deps = new TreeMap<String, ClassReader>();
        TreeMap<String, ClassReader> new_keep = new TreeMap<String, ClassReader>();
        TreeMap<String, ClassReader> temp = new TreeMap<String, ClassReader>();
        TreeMap<String, ClassReader> deps = new TreeMap<>();
        TreeMap<String, ClassReader> new_deps = new TreeMap<>();
        TreeMap<String, ClassReader> new_keep = new TreeMap<>();
        TreeMap<String, ClassReader> temp = new TreeMap<>();

        DependencyVisitor visitor = getVisitor(zipClasses,
                inOutKeepClasses, new_keep,
@@ -399,7 +398,7 @@ public class AsmAnalyzer {
                Map<String, ClassReader> outKeep,
                Map<String,ClassReader> inDeps,
                Map<String,ClassReader> outDeps) {
            super(Opcodes.ASM4);
            super(Main.ASM_VERSION);
            mZipClasses = zipClasses;
            mInKeep = inKeep;
            mOutKeep = outKeep;
@@ -557,7 +556,7 @@ public class AsmAnalyzer {
        private class MyFieldVisitor extends FieldVisitor {

            public MyFieldVisitor() {
                super(Opcodes.ASM4);
                super(Main.ASM_VERSION);
            }

            @Override
@@ -630,7 +629,7 @@ public class AsmAnalyzer {
            private String mOwnerClass;

            public MyMethodVisitor(String ownerClass) {
                super(Opcodes.ASM4);
                super(Main.ASM_VERSION);
                mOwnerClass = ownerClass;
            }

@@ -719,7 +718,8 @@ public class AsmAnalyzer {

            // instruction that invokes a method
            @Override
            public void visitMethodInsn(int opcode, String owner, String name, String desc) {
            public void visitMethodInsn(int opcode, String owner, String name, String desc,
                    boolean itf) {

                // owner is the internal name of the method's owner class
                considerName(owner);
@@ -779,7 +779,7 @@ public class AsmAnalyzer {
        private class MySignatureVisitor extends SignatureVisitor {

            public MySignatureVisitor() {
                super(Opcodes.ASM4);
                super(Main.ASM_VERSION);
            }

            // ---------------------------------------------------
@@ -878,7 +878,7 @@ public class AsmAnalyzer {
        private class MyAnnotationVisitor extends AnnotationVisitor {

            public MyAnnotationVisitor() {
                super(Opcodes.ASM4);
                super(Main.ASM_VERSION);
            }

            // Visits a primitive value of an annotation
Loading