7
7
import com .telerik .metadata .desc .MethodDescriptor ;
8
8
9
9
import org .apache .bcel .classfile .Attribute ;
10
+ import org .apache .bcel .classfile .ConstantClass ;
11
+ import org .apache .bcel .classfile .ConstantPool ;
10
12
import org .apache .bcel .classfile .ConstantUtf8 ;
11
13
import org .apache .bcel .classfile .Field ;
12
14
import org .apache .bcel .classfile .InnerClass ;
@@ -36,19 +38,18 @@ private void init() {
36
38
return ;
37
39
}
38
40
boolean found = false ;
41
+ String fullClassName = getClassName (clazz .getClassNameIndex ());
42
+ if (fullClassName == null ) {
43
+ return ;
44
+ }
45
+
39
46
for (Attribute a : clazz .getAttributes ()) {
40
47
if (a instanceof InnerClasses ) {
41
48
InnerClass [] i = ((InnerClasses ) a ).getInnerClasses ();
42
49
for (InnerClass ic : i ) {
50
+ String innerClassName = getClassName (ic .getInnerClassIndex ());
43
51
44
- ConstantUtf8 cname = (ConstantUtf8 ) clazz
45
- .getConstantPool ().getConstant (ic .getInnerNameIndex ());
46
- if (cname == null ) {
47
- continue ;
48
- }
49
-
50
- String innerClassname = cname .getBytes ();
51
- if (name .equals (innerClassname )) {
52
+ if (fullClassName .equals (innerClassName )) {
52
53
int flags = ic .getInnerAccessFlags ();
53
54
clazz .setAccessFlags (flags );
54
55
found = true ;
@@ -63,6 +64,19 @@ private void init() {
63
64
}
64
65
}
65
66
67
+ private String getClassName (int classIndex ) {
68
+ ConstantPool constantPool = clazz .getConstantPool ();
69
+ ConstantClass innerClassNameIndex = (ConstantClass )constantPool .getConstant (classIndex );
70
+ if (innerClassNameIndex == null ) {
71
+ return null ;
72
+ }
73
+ ConstantUtf8 className = (ConstantUtf8 )constantPool .getConstant (innerClassNameIndex .getNameIndex ());
74
+ if (className == null ) {
75
+ return null ;
76
+ }
77
+ return className .getBytes ();
78
+ }
79
+
66
80
@ Override
67
81
public boolean isClass () {
68
82
return clazz .isClass ();
0 commit comments