mirror of
https://github.com/revanced/smali.git
synced 2025-05-29 12:20:11 +02:00
- fixed an issue where java.lang.Object from core.jar couldn't be re-assembled, because it has no superclass
git-svn-id: https://smali.googlecode.com/svn/trunk@221 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
parent
3249b724ea
commit
69c3abb483
@ -92,7 +92,11 @@ public class ClassDefinition {
|
||||
}
|
||||
|
||||
public String getSuperType() {
|
||||
return classDefItem.getSuperclass().getTypeDescriptor();
|
||||
TypeIdItem superClass = classDefItem.getSuperclass();
|
||||
if (superClass != null) {
|
||||
return superClass.getTypeDescriptor();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getSourceFile() {
|
||||
|
@ -3,8 +3,10 @@ group baksmali;
|
||||
smaliFile(classDef) ::=
|
||||
<<
|
||||
.class <classDef.AccessFlags: {<it> }><classDef.ClassType>
|
||||
<if(classDef.SuperType)>
|
||||
.super <classDef.SuperType>
|
||||
|
||||
</n>
|
||||
<endif>
|
||||
<if(classDef.SourceFile)>
|
||||
.source "<classDef.SourceFile>"
|
||||
|
||||
|
@ -191,18 +191,20 @@ smali_file
|
||||
}
|
||||
|
||||
if (!$smali_file::hasSuperSpec) {
|
||||
throw new SemanticException(input, "The file must contain a .super directive");
|
||||
if (!$class_spec.className.equals("Ljava/lang/Object;")) {
|
||||
throw new SemanticException(input, "The file must contain a .super directive");
|
||||
}
|
||||
}
|
||||
}
|
||||
-> ^(I_CLASS_DEF
|
||||
class_spec
|
||||
super_spec
|
||||
super_spec?
|
||||
implements_spec*
|
||||
source_spec?
|
||||
^(I_METHODS method*) ^(I_FIELDS field*) ^(I_ANNOTATIONS annotation*));
|
||||
|
||||
class_spec
|
||||
: CLASS_DIRECTIVE access_list CLASS_DESCRIPTOR -> CLASS_DESCRIPTOR access_list;
|
||||
class_spec returns[String className]
|
||||
: CLASS_DIRECTIVE access_list CLASS_DESCRIPTOR {$className = $CLASS_DESCRIPTOR.text;} -> CLASS_DESCRIPTOR access_list;
|
||||
|
||||
super_spec
|
||||
: SUPER_DIRECTIVE CLASS_DESCRIPTOR -> ^(I_SUPER[$start, "I_SUPER"] CLASS_DESCRIPTOR);
|
||||
|
@ -142,7 +142,7 @@ smali_file
|
||||
|
||||
|
||||
header returns[TypeIdItem classType, int accessFlags, TypeIdItem superType, TypeListItem implementsList, StringIdItem sourceSpec]
|
||||
: class_spec super_spec implements_list source_spec
|
||||
: class_spec super_spec? implements_list source_spec
|
||||
{
|
||||
classDataItem = new ClassDataItem(dexFile, 0);
|
||||
classDefItem = new ClassDefItem(dexFile, $class_spec.type, $class_spec.accessFlags,
|
||||
|
Loading…
x
Reference in New Issue
Block a user