Merge changes from topic 'asm5'
* changes: Update mkstubs to Java 8. Upgrade to ASM 5
This commit is contained in:
committed by
Android (Google) Code Review
commit
db2b163581
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="tests"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
|
||||
<classpathentry kind="var" path="ANDROID_SRC/prebuilt/common/asm/asm-4.0.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
1
tools/mkstubs/.gitignore
vendored
1
tools/mkstubs/.gitignore
vendored
@@ -1,2 +1,3 @@
|
||||
bin
|
||||
out
|
||||
|
||||
|
||||
1
tools/mkstubs/.idea/.name
generated
Normal file
1
tools/mkstubs/.idea/.name
generated
Normal file
@@ -0,0 +1 @@
|
||||
mstubs
|
||||
80
tools/mkstubs/.idea/codeStyleSettings.xml
generated
Normal file
80
tools/mkstubs/.idea/codeStyleSettings.xml
generated
Normal file
@@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectCodeStyleSettingsManager">
|
||||
<option name="PER_PROJECT_SETTINGS">
|
||||
<value>
|
||||
<option name="FIELD_NAME_PREFIX" value="m" />
|
||||
<option name="STATIC_FIELD_NAME_PREFIX" value="s" />
|
||||
<option name="INSERT_INNER_CLASS_IMPORTS" value="true" />
|
||||
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
|
||||
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
|
||||
<option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND">
|
||||
<value />
|
||||
</option>
|
||||
<option name="IMPORT_LAYOUT_TABLE">
|
||||
<value>
|
||||
<package name="com.android" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="org" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="android" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="java" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="" withSubpackages="true" static="true" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="RIGHT_MARGIN" value="100" />
|
||||
<option name="WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN" value="true" />
|
||||
<option name="JD_ALIGN_PARAM_COMMENTS" value="false" />
|
||||
<option name="JD_ADD_BLANK_AFTER_PARM_COMMENTS" value="true" />
|
||||
<option name="JD_ADD_BLANK_AFTER_RETURN" value="true" />
|
||||
<option name="JD_DO_NOT_WRAP_ONE_LINE_COMMENTS" value="true" />
|
||||
<option name="WRAP_COMMENTS" value="true" />
|
||||
<JavaCodeStyleSettings>
|
||||
<option name="CLASS_NAMES_IN_JAVADOC" value="3" />
|
||||
</JavaCodeStyleSettings>
|
||||
<XML>
|
||||
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
|
||||
</XML>
|
||||
<codeStyleSettings language="JAVA">
|
||||
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
|
||||
<option name="CALL_PARAMETERS_WRAP" value="1" />
|
||||
<option name="METHOD_PARAMETERS_WRAP" value="1" />
|
||||
<option name="THROWS_LIST_WRAP" value="1" />
|
||||
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
|
||||
<option name="THROWS_KEYWORD_WRAP" value="1" />
|
||||
<option name="BINARY_OPERATION_WRAP" value="1" />
|
||||
<option name="TERNARY_OPERATION_WRAP" value="1" />
|
||||
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
|
||||
<option name="ASSIGNMENT_WRAP" value="1" />
|
||||
<option name="ASSERT_STATEMENT_WRAP" value="1" />
|
||||
<option name="IF_BRACE_FORCE" value="3" />
|
||||
<option name="DOWHILE_BRACE_FORCE" value="3" />
|
||||
<option name="WHILE_BRACE_FORCE" value="3" />
|
||||
<option name="FOR_BRACE_FORCE" value="3" />
|
||||
<arrangement>
|
||||
<groups>
|
||||
<group>
|
||||
<type>GETTERS_AND_SETTERS</type>
|
||||
<order>KEEP</order>
|
||||
</group>
|
||||
<group>
|
||||
<type>OVERRIDDEN_METHODS</type>
|
||||
<order>KEEP</order>
|
||||
</group>
|
||||
</groups>
|
||||
</arrangement>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="XML">
|
||||
<indentOptions>
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
</value>
|
||||
</option>
|
||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||
</component>
|
||||
</project>
|
||||
22
tools/mkstubs/.idea/compiler.xml
generated
Normal file
22
tools/mkstubs/.idea/compiler.xml
generated
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<resourceExtensions />
|
||||
<wildcardResourcePatterns>
|
||||
<entry name="!?*.java" />
|
||||
<entry name="!?*.form" />
|
||||
<entry name="!?*.class" />
|
||||
<entry name="!?*.groovy" />
|
||||
<entry name="!?*.scala" />
|
||||
<entry name="!?*.flex" />
|
||||
<entry name="!?*.kt" />
|
||||
<entry name="!?*.clj" />
|
||||
<entry name="!?*.aj" />
|
||||
</wildcardResourcePatterns>
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="false">
|
||||
<processorPath useClasspath="true" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
</project>
|
||||
9
tools/mkstubs/.idea/copyright/Android.xml
generated
Normal file
9
tools/mkstubs/.idea/copyright/Android.xml
generated
Normal file
@@ -0,0 +1,9 @@
|
||||
<component name="CopyrightManager">
|
||||
<copyright>
|
||||
<option name="notice" value="Copyright (C) &#36;today.year The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License." />
|
||||
<option name="keyword" value="Copyright" />
|
||||
<option name="allowReplaceKeyword" value="" />
|
||||
<option name="myName" value="Android" />
|
||||
<option name="myLocal" value="true" />
|
||||
</copyright>
|
||||
</component>
|
||||
3
tools/mkstubs/.idea/copyright/profiles_settings.xml
generated
Normal file
3
tools/mkstubs/.idea/copyright/profiles_settings.xml
generated
Normal file
@@ -0,0 +1,3 @@
|
||||
<component name="CopyrightManager">
|
||||
<settings default="Android" />
|
||||
</component>
|
||||
6
tools/mkstubs/.idea/encodings.xml
generated
Normal file
6
tools/mkstubs/.idea/encodings.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="PROJECT" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
||||
14
tools/mkstubs/.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
14
tools/mkstubs/.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@@ -0,0 +1,14 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="LoggerInitializedWithForeignClass" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="loggerClassName" value="org.apache.log4j.Logger,org.slf4j.LoggerFactory,org.apache.commons.logging.LogFactory,java.util.logging.Logger" />
|
||||
<option name="loggerFactoryMethodName" value="getLogger,getLogger,getLog,getLogger" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="WeakerAccess" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="SUGGEST_PACKAGE_LOCAL_FOR_MEMBERS" value="true" />
|
||||
<option name="SUGGEST_PACKAGE_LOCAL_FOR_TOP_CLASSES" value="true" />
|
||||
<option name="SUGGEST_PRIVATE_FOR_INNERS" value="false" />
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
||||
7
tools/mkstubs/.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
7
tools/mkstubs/.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="PROJECT_PROFILE" value="Project Default" />
|
||||
<option name="USE_PROJECT_PROFILE" value="true" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
||||
19
tools/mkstubs/.idea/misc.xml
generated
Normal file
19
tools/mkstubs/.idea/misc.xml
generated
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="EntryPointsManager">
|
||||
<entry_points version="2.0" />
|
||||
</component>
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
||||
<OptionsSetting value="true" id="Add" />
|
||||
<OptionsSetting value="true" id="Remove" />
|
||||
<OptionsSetting value="true" id="Checkout" />
|
||||
<OptionsSetting value="true" id="Update" />
|
||||
<OptionsSetting value="true" id="Status" />
|
||||
<OptionsSetting value="true" id="Edit" />
|
||||
<ConfirmationsSetting value="0" id="Add" />
|
||||
<ConfirmationsSetting value="0" id="Remove" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
8
tools/mkstubs/.idea/modules.xml
generated
Normal file
8
tools/mkstubs/.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/mkstubs.iml" filepath="$PROJECT_DIR$/mkstubs.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
6
tools/mkstubs/.idea/vcs.xml
generated
Normal file
6
tools/mkstubs/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>MkStubs</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -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 := mkstubs
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ import java.util.zip.ZipFile;
|
||||
* Analyzes an input Jar to get all the relevant classes according to the given filter.
|
||||
* <p/>
|
||||
* This is mostly a helper extracted for convenience. Callers will want to use
|
||||
* {@link #parseInputJar(String)} followed by {@link #filter(Map, Filter)}.
|
||||
* {@link #parseInputJar(String)} followed by {@link #filter(Map, Filter, Logger)}.
|
||||
*/
|
||||
class AsmAnalyzer {
|
||||
|
||||
@@ -42,7 +42,7 @@ class AsmAnalyzer {
|
||||
* class name => ASM ClassReader. Class names are in the form "android.view.View".
|
||||
*/
|
||||
Map<String,ClassReader> parseInputJar(String inputJarPath) throws IOException {
|
||||
TreeMap<String, ClassReader> classes = new TreeMap<String, ClassReader>();
|
||||
TreeMap<String, ClassReader> classes = new TreeMap<>();
|
||||
|
||||
ZipFile zip = new ZipFile(inputJarPath);
|
||||
Enumeration<? extends ZipEntry> entries = zip.entries();
|
||||
|
||||
@@ -30,10 +30,10 @@ import java.util.TreeSet;
|
||||
* pattern to decide if it should be included.
|
||||
*/
|
||||
class Filter {
|
||||
private TreeSet<String> mIncludePrefix = new TreeSet<String>();
|
||||
private TreeSet<String> mIncludeFull = new TreeSet<String>();
|
||||
private TreeSet<String> mExcludePrefix = new TreeSet<String>();
|
||||
private TreeSet<String> mExcludeFull = new TreeSet<String>();
|
||||
private TreeSet<String> mIncludePrefix = new TreeSet<>();
|
||||
private TreeSet<String> mIncludeFull = new TreeSet<>();
|
||||
private TreeSet<String> mExcludePrefix = new TreeSet<>();
|
||||
private TreeSet<String> mExcludeFull = new TreeSet<>();
|
||||
|
||||
/**
|
||||
* Returns the set of all full patterns to be included.
|
||||
|
||||
@@ -36,7 +36,7 @@ class FilterClassAdapter extends ClassVisitor {
|
||||
private String mClassName;
|
||||
|
||||
public FilterClassAdapter(ClassVisitor writer, Filter filter, Logger log) {
|
||||
super(Opcodes.ASM4, writer);
|
||||
super(Main.ASM_VERSION, writer);
|
||||
mFilter = filter;
|
||||
mLog = log;
|
||||
}
|
||||
|
||||
@@ -16,9 +16,8 @@
|
||||
|
||||
package com.android.mkstubs;
|
||||
|
||||
import com.android.mkstubs.Main.Params;
|
||||
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
@@ -34,6 +33,8 @@ import java.util.Map;
|
||||
*/
|
||||
public class Main {
|
||||
|
||||
public static final int ASM_VERSION = Opcodes.ASM5;
|
||||
|
||||
/**
|
||||
* A struct-like class to hold the various input values (e.g. command-line args)
|
||||
*/
|
||||
|
||||
@@ -58,12 +58,8 @@ class SourceGenerator {
|
||||
|
||||
String name = classNameToJavaPath(cr.getClassName());
|
||||
|
||||
FileWriter fw = null;
|
||||
try {
|
||||
fw = createWriter(baseDir, name);
|
||||
try (FileWriter fw = createWriter(baseDir, name)) {
|
||||
visitClassSource(fw, cr, filter);
|
||||
} finally {
|
||||
fw.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ class StubGenerator {
|
||||
Map<String, ClassReader> classes,
|
||||
Filter filter) throws IOException {
|
||||
|
||||
TreeMap<String, byte[]> all = new TreeMap<String, byte[]>();
|
||||
TreeMap<String, byte[]> all = new TreeMap<>();
|
||||
|
||||
for (Entry<String, ClassReader> entry : classes.entrySet()) {
|
||||
ClassReader cr = entry.getValue();
|
||||
|
||||
@@ -58,7 +58,7 @@ class AccessSourcer {
|
||||
private final int mValue;
|
||||
private final int mFilter;
|
||||
|
||||
private Flag(int value, int filter) {
|
||||
Flag(int value, int filter) {
|
||||
mValue = value;
|
||||
mFilter = filter;
|
||||
}
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
|
||||
package com.android.mkstubs.sourcer;
|
||||
|
||||
import com.android.mkstubs.Main;
|
||||
|
||||
import org.objectweb.asm.AnnotationVisitor;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
|
||||
/**
|
||||
* An annotation visitor that generates Java source for an annotation.
|
||||
@@ -34,7 +35,7 @@ class AnnotationSourcer extends AnnotationVisitor {
|
||||
}
|
||||
|
||||
public AnnotationSourcer(Output output, boolean isArray) {
|
||||
super(Opcodes.ASM4);
|
||||
super(Main.ASM_VERSION);
|
||||
mOutput = output;
|
||||
mOpenChar = isArray ? "[" : "(";
|
||||
mCloseChar = isArray ? "]" : ")";
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.mkstubs.sourcer;
|
||||
|
||||
import com.android.mkstubs.Main;
|
||||
|
||||
import org.objectweb.asm.AnnotationVisitor;
|
||||
import org.objectweb.asm.Attribute;
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
@@ -34,7 +36,7 @@ public class ClassSourcer extends ClassVisitor {
|
||||
private String mClassName;
|
||||
|
||||
public ClassSourcer(Output output) {
|
||||
super(Opcodes.ASM4);
|
||||
super(Main.ASM_VERSION);
|
||||
mOutput = output;
|
||||
mAccessSourcer = new AccessSourcer(mOutput);
|
||||
}
|
||||
|
||||
@@ -16,10 +16,11 @@
|
||||
|
||||
package com.android.mkstubs.sourcer;
|
||||
|
||||
import com.android.mkstubs.Main;
|
||||
|
||||
import org.objectweb.asm.AnnotationVisitor;
|
||||
import org.objectweb.asm.Attribute;
|
||||
import org.objectweb.asm.FieldVisitor;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.objectweb.asm.signature.SignatureReader;
|
||||
|
||||
@@ -35,7 +36,7 @@ class FieldSourcer extends FieldVisitor {
|
||||
private final String mSignature;
|
||||
|
||||
public FieldSourcer(Output output, int access, String name, String desc, String signature) {
|
||||
super(Opcodes.ASM4);
|
||||
super(Main.ASM_VERSION);
|
||||
mOutput = output;
|
||||
mAccess = access;
|
||||
mName = name;
|
||||
|
||||
@@ -16,11 +16,12 @@
|
||||
|
||||
package com.android.mkstubs.sourcer;
|
||||
|
||||
import com.android.mkstubs.Main;
|
||||
|
||||
import org.objectweb.asm.AnnotationVisitor;
|
||||
import org.objectweb.asm.Attribute;
|
||||
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;
|
||||
|
||||
@@ -43,7 +44,7 @@ class MethodSourcer extends MethodVisitor {
|
||||
|
||||
public MethodSourcer(Output output, String className, int access, String name,
|
||||
String desc, String signature, String[] exceptions) {
|
||||
super(Opcodes.ASM4);
|
||||
super(Main.ASM_VERSION);
|
||||
mOutput = output;
|
||||
mClassName = className;
|
||||
mAccess = access;
|
||||
@@ -223,7 +224,7 @@ class MethodSourcer extends MethodVisitor {
|
||||
}
|
||||
|
||||
@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) {
|
||||
// pass
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
|
||||
package com.android.mkstubs.sourcer;
|
||||
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import com.android.mkstubs.Main;
|
||||
|
||||
import org.objectweb.asm.Type;
|
||||
import org.objectweb.asm.signature.SignatureReader;
|
||||
import org.objectweb.asm.signature.SignatureVisitor;
|
||||
@@ -83,7 +84,7 @@ class SignatureSourcer extends SignatureVisitor {
|
||||
* {@link SignatureSourcer}s for each parameters generated when parsing the method parameters
|
||||
* of <em>this</em> signature. Initially empty but not null.
|
||||
*/
|
||||
private ArrayList<SignatureSourcer> mParameters = new ArrayList<SignatureSourcer>();
|
||||
private ArrayList<SignatureSourcer> mParameters = new ArrayList<>();
|
||||
|
||||
|
||||
|
||||
@@ -91,7 +92,7 @@ class SignatureSourcer extends SignatureVisitor {
|
||||
* Constructs a new {@link SignatureWriter} object.
|
||||
*/
|
||||
public SignatureSourcer() {
|
||||
super(Opcodes.ASM4);
|
||||
super(Main.ASM_VERSION);
|
||||
}
|
||||
|
||||
private StringBuilder getBuf() {
|
||||
|
||||
@@ -16,12 +16,13 @@
|
||||
|
||||
package com.android.mkstubs.stubber;
|
||||
|
||||
import com.android.mkstubs.Main;
|
||||
|
||||
import org.objectweb.asm.AnnotationVisitor;
|
||||
import org.objectweb.asm.Attribute;
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.FieldVisitor;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
|
||||
/**
|
||||
* A class visitor that generates stubs for all methods of the visited class.
|
||||
@@ -30,7 +31,7 @@ import org.objectweb.asm.Opcodes;
|
||||
public class ClassStubber extends ClassVisitor {
|
||||
|
||||
public ClassStubber(ClassVisitor cv) {
|
||||
super(Opcodes.ASM4, cv);
|
||||
super(Main.ASM_VERSION, cv);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.mkstubs.stubber;
|
||||
|
||||
import com.android.mkstubs.Main;
|
||||
|
||||
import org.objectweb.asm.AnnotationVisitor;
|
||||
import org.objectweb.asm.Attribute;
|
||||
import org.objectweb.asm.Label;
|
||||
@@ -35,7 +37,7 @@ public class MethodStubber extends MethodVisitor {
|
||||
|
||||
public MethodStubber(MethodVisitor mw,
|
||||
int access, String name, String desc, String signature, String[] exceptions) {
|
||||
super(Opcodes.ASM4, mw);
|
||||
super(Main.ASM_VERSION, mw);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -50,7 +52,8 @@ public class MethodStubber extends MethodVisitor {
|
||||
Opcodes.INVOKESPECIAL, // opcode
|
||||
"java/lang/RuntimeException", // owner
|
||||
"<init>", // name
|
||||
"(Ljava/lang/String;)V"); // desc
|
||||
"(Ljava/lang/String;)V", // desc
|
||||
false);
|
||||
mv.visitInsn(Opcodes.ATHROW);
|
||||
Label l1 = new Label();
|
||||
mv.visitLabel(l1);
|
||||
@@ -153,7 +156,7 @@ public class MethodStubber extends MethodVisitor {
|
||||
}
|
||||
|
||||
@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) {
|
||||
// skip
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user