@@ -1082,35 +1082,30 @@ private static Klass computeEnclosingClass(ObjectKlass klass) {
1082
1082
if (innerClasses == null ) {
1083
1083
return null ;
1084
1084
}
1085
-
1086
1085
RuntimeConstantPool pool = klass .getConstantPool ();
1087
1086
1088
- boolean found = false ;
1089
- Klass outerKlass = null ;
1087
+ // TODO(peterssen): Follow HotSpot implementation described below.
1088
+ // Throws an exception if outer klass has not declared k as an inner klass
1089
+ // We need evidence that each klass knows about the other, or else
1090
+ // the system could allow a spoof of an inner class to gain access rights.
1090
1091
1091
1092
for (InnerClassesAttribute .Entry entry : innerClasses .entries ()) {
1092
1093
if (entry .innerClassIndex != 0 ) {
1093
1094
Symbol <Name > innerDescriptor = pool .classAt (entry .innerClassIndex ).getName (pool );
1094
-
1095
1095
// Check decriptors/names before resolving.
1096
1096
if (innerDescriptor .equals (klass .getName ())) {
1097
1097
Klass innerKlass = pool .resolvedKlassAt (klass , entry .innerClassIndex );
1098
- found = (innerKlass == klass );
1099
- if (found && entry .outerClassIndex != 0 ) {
1100
- outerKlass = pool .resolvedKlassAt (klass , entry .outerClassIndex );
1098
+ if (innerKlass == klass ) {
1099
+ if (entry .outerClassIndex != 0 ) {
1100
+ return pool .resolvedKlassAt (klass , entry .outerClassIndex );
1101
+ } else {
1102
+ return null ;
1103
+ }
1101
1104
}
1102
1105
}
1103
1106
}
1104
- if (found ) {
1105
- break ;
1106
- }
1107
1107
}
1108
-
1109
- // TODO(peterssen): Follow HotSpot implementation described below.
1110
- // Throws an exception if outer klass has not declared k as an inner klass
1111
- // We need evidence that each klass knows about the other, or else
1112
- // the system could allow a spoof of an inner class to gain access rights.
1113
- return outerKlass ;
1108
+ return null ;
1114
1109
}
1115
1110
1116
1111
@ VmImpl (isJni = true )
0 commit comments