List of usage examples for org.eclipse.jdt.internal.compiler.lookup TypeBinding equalsEquals
public static boolean equalsEquals(TypeBinding that, TypeBinding other)
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.statemachine.copyinheritance.TypeLevel.java
License:Open Source License
/** * Add the "implements" link that connects a sub-role-ifc to * its implicit super-role-ifc./*from w ww . j a v a 2 s . c o m*/ * Also checks compatibility of visibilities. * @param roleInterfaceDeclaration * @param superrole */ public static void addImplicitInheritance(TypeDeclaration roleInterfaceDeclaration, ReferenceBinding superrole) { assert (roleInterfaceDeclaration.binding.tagBits & TagBits.BeginHierarchyCheck) != 0 : "binding should be connected"; //$NON-NLS-1$ int modifiers = roleInterfaceDeclaration.modifiers; int inheritedModifiers = superrole.modifiers; if (!Protections.isAsVisible(modifiers, inheritedModifiers)) { roleInterfaceDeclaration.scope.problemReporter().reducingRoleVisibility(roleInterfaceDeclaration, modifiers, inheritedModifiers); } // create bindings: ReferenceBinding[] superInterfaces = roleInterfaceDeclaration.binding.superInterfaces; ReferenceBinding[] newSuperInterfaces = null; int len = 0; if (superInterfaces != null) { for (int i = 0; i < superInterfaces.length; i++) if (TypeBinding.equalsEquals(superInterfaces[i], superrole)) return; // superinterface already present. len = superInterfaces.length; newSuperInterfaces = new ReferenceBinding[len + 1]; System.arraycopy(superInterfaces, 0, newSuperInterfaces, 0, len); } else { newSuperInterfaces = new ReferenceBinding[1]; } // this line cannot assign null, would have produced NPE above: newSuperInterfaces[len] = superrole; roleInterfaceDeclaration.scope.compilationUnitScope().recordSuperTypeReference(superrole); roleInterfaceDeclaration.binding.superInterfaces = newSuperInterfaces; }
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.statemachine.copyinheritance.TypeLevel.java
License:Open Source License
/** * After the superclasses of tsuper role and current role have been determined, * find out whether the new 'extends' clause was legal, and adjust superclass * if needed (ie., update references to roles of the super team). * @param destRoleDecl @pre: !isInterface() * @param destTeam//from ww w. j a va 2 s. com * @param tsuperRole (may be null) * @param obligations record here any sub-type relations that need checking after all roles have been adjusted */ private static void checkAdjustSuperclass(TypeDeclaration destRoleDecl, ReferenceBinding destTeam, ReferenceBinding tsuperRole, ArrayList<SupertypeObligation> obligations) { ClassScope destScope = destRoleDecl.scope; ReferenceBinding inheritedSuperclass = null; ReferenceBinding newSuperclass = destRoleDecl.binding.superclass; boolean refineToTeam = false; if (tsuperRole != null) { inheritedSuperclass = tsuperRole.superclass(); refineToTeam = !tsuperRole.isTeam() && destRoleDecl.isTeam(); if (tsuperRole.isTeam() && !destRoleDecl.isTeam()) { destScope.problemReporter().regularOverridesTeam(destRoleDecl, tsuperRole); return; } } TypeReference newExtends = destRoleDecl.superclass; if (newExtends == null // no source-level "extends" -> investige implicit (binding-level) extends: && newSuperclass != null // either implicit super (j.l.Object or o.o.Team) or inherited from other tsuper && !refineToTeam // an implicit extends to org.objectteams.Team is NOT dropped if the tsuper was not a team && ((newSuperclass.id == TypeIds.T_JavaLangObject) || destScope.isOrgObjectteamsTeam(newSuperclass))) // otherwise it was copied from a tsuper role { newSuperclass = null; // drop default 'extends java.lang.Object' or o.o.Team } // extends __OT_Confined overriding nothing or __OT__Confined is OK: if ((newSuperclass != null && CharOperation.equals(newSuperclass.internalName(), IOTConstants.OTCONFINED)) && (inheritedSuperclass == null || CharOperation.equals(inheritedSuperclass.internalName(), IOTConstants.OTCONFINED))) return; if (newSuperclass != null && newSuperclass.isDirectRole()) { // check team compatibility if (!TeamModel.areCompatibleEnclosings(destTeam, newSuperclass.original().enclosingType())) { destScope.problemReporter().extendIncompatibleEnclosingTypes(destRoleDecl, newSuperclass, newSuperclass.enclosingType()); // set a meaningfull superclass instead: destRoleDecl.binding.superclass = (inheritedSuperclass != null) ? inheritedSuperclass : destScope.getJavaLangObject(); return; } } if (newSuperclass != null) newSuperclass = strengthenSuper(destTeam, newSuperclass); if (inheritedSuperclass != null) { inheritedSuperclass = strengthenSuper(destTeam, inheritedSuperclass); if (newSuperclass == null) { newSuperclass = inheritedSuperclass; } else if (TypeBinding.notEquals(newSuperclass, inheritedSuperclass)) { // is the old superclass actually a tsuper version of the new superclass? if (newSuperclass.roleModel == null || !newSuperclass.roleModel.hasTSuperRole(inheritedSuperclass)) { SupertypeObligation oblig = new SupertypeObligation(newSuperclass, inheritedSuperclass, newExtends, tsuperRole); // check now or later? if (obligations != null) obligations.add(oblig); else oblig.check(destRoleDecl); } destRoleDecl.getRoleModel()._refinesExtends = true; } } if (newSuperclass != null) { if (TypeBinding.equalsEquals(newSuperclass, destRoleDecl.binding)) { // a role extends its implicit super role: circularity! // error is already reported on behalf of the interface part (real circularity) } else { if (newSuperclass.isCompatibleWith(destRoleDecl.binding)) { // new super class is also a subclass of current destRoleDecl.scope.problemReporter().hierarchyCircularity(destRoleDecl.binding, newSuperclass, destRoleDecl); destRoleDecl.binding.tagBits |= TagBits.HierarchyHasProblems; newSuperclass.tagBits |= TagBits.HierarchyHasProblems; } else { destRoleDecl.binding.superclass = destRoleDecl.binding.superclass .transferTypeArguments(newSuperclass); destRoleDecl.scope.compilationUnitScope().recordSuperTypeReference(newSuperclass); } } // don't update AST: not needed beside error reporting // and then only the old node has source positions.. } }
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.statemachine.copyinheritance.TypeLevel.java
License:Open Source License
static ReferenceBinding strengthenSuper(ReferenceBinding destTeam, ReferenceBinding superRole) { if (!superRole.isRole()) return superRole; if (TeamModel.isTeamContainingRole(destTeam.superclass(), superRole)) return destTeam.getMemberType(superRole.internalName()); if (destTeam.isRole()) { ReferenceBinding[] tsuperTeams = destTeam.roleModel.getTSuperRoleBindings(); for (int i = tsuperTeams.length - 1; i >= 0; i--) { // check highest prio first (which comes last in the array) if (TypeBinding.equalsEquals(tsuperTeams[i], superRole.enclosingType())) return destTeam.getMemberType(superRole.internalName()); if (TeamModel.isTeamContainingRole(tsuperTeams[i], superRole)) { ReferenceBinding strongEnclosing = destTeam .getMemberType(superRole.enclosingType().internalName()); if (strongEnclosing != null) return strengthenSuper(strongEnclosing, superRole); return superRole; }/*from ww w. j a va 2 s.c om*/ } } return superRole; }
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.statemachine.transformer.PredicateGenerator.java
License:Open Source License
/** Generate the receiver for a call to an outer predicate. */ private static Expression genOuterReceiver(ReferenceBinding receiverType, ReferenceBinding site, boolean staticScope, AstGenerator gen) { if (staticScope && receiverType.isRole()) { return gen.qualifiedNameReference(receiverType); } else {/* w w w. j a va 2s . c o m*/ if (TypeBinding.equalsEquals(receiverType, site)) return gen.thisReference(); else return gen.qualifiedThisReference(receiverType); } }
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.statemachine.transformer.RoleSplitter.java
License:Open Source License
/** * After bindings have been created the synthetic interface is setup * to mirror the extends of the role class. * This method only treats the case of regular superclasses: * + copy signatures for all methods that are directly or inderictly * inherited (not including java.lang.Object). * (role superclasses are treated in linkSuperAndBaseInIfc()). * * @param teamDecl/*w w w . j a v a 2 s. c om*/ * @param roleClass * @param roleIfcDecl */ public static void setupInterfaceForExtends(TypeDeclaration teamDecl, TypeDeclaration roleClass, TypeDeclaration roleIfcDecl) { ReferenceBinding superClass = roleClass.binding.superclass(); if (superClass == null) return; // current must be Confined if (superClass.isDirectRole() && !CharOperation.equals(superClass.internalName(), IOTConstants.OTCONFINED)) { return; // already processed in linkSuperAndBaseInIfc() } ReferenceBinding[] tsupers = roleClass.getRoleModel().getTSuperRoleBindings(); for (ReferenceBinding tsuperRole : tsupers) if (TypeBinding.equalsEquals(tsuperRole.superclass(), superClass)) return; // already included via tsuper. // workaround for mixed binary/source roles (cause for this situation unknown): if (roleIfcDecl == null) return; ReferenceBinding ifcBinding = roleIfcDecl.binding; ReferenceBinding javaLangObject = teamDecl.scope.getJavaLangObject(); AstGenerator gen; if (roleClass.superclass != null) gen = new AstGenerator(roleClass.superclass.sourceStart, roleClass.superclass.sourceEnd); else gen = new AstGenerator(roleClass.sourceStart, roleClass.sourceEnd); while (superClass != null && TypeBinding.notEquals(superClass, javaLangObject)) { MethodBinding[] methods = superClass.methods(); methodLoop: for (int i = 0; i < methods.length; i++) { MethodBinding m = methods[i]; if (m.isConstructor()) continue; // not inherited if (m.isPrivate()) continue; // not inherited if (m.isStatic()) continue; // not applicable in roles if (!m.isPublic()) { // not visible via interface MethodBinding existingMethod = TypeAnalyzer.findMethod(roleIfcDecl.scope, ifcBinding, m.selector, m.parameters); if (existingMethod != null && existingMethod.isValidBinding()) continue; ProblemMethodBinding problemMethod = new ProblemMethodBinding(m, m.selector, m.parameters, ProblemReasons.NotVisible); problemMethod.modifiers = m.modifiers; problemMethod.modifiers |= AccAbstract | AccSemicolonBody; // don't confuse the MethodVerifier with class method in ifc problemMethod.thrownExceptions = m.thrownExceptions; problemMethod.returnType = m.returnType; MethodModel.getModel(problemMethod).problemDetail = ProblemDetail.RoleInheritsNonPublic; ifcBinding.addMethod(problemMethod); // adding binding only as to support error reporting without generating new code continue; } for (int j = 0; j < IOTConstants.OT_KEYWORDS.length; j++) { if (CharOperation.equals(m.selector, IOTConstants.OT_KEYWORDS[j])) { roleClass.scope.problemReporter().inheritedNameIsOTKeyword(m, gen.sourceStart, gen.sourceEnd); continue methodLoop; } } MethodBinding declaredMethod = TypeAnalyzer.findCompatibleMethod(ifcBinding, m); if (declaredMethod == null) { MethodDeclaration newmethod = AstConverter.genIfcMethodFromBinding(teamDecl, m, gen); // the following also creates bindings, which helps to avoid // entering the same signature twice // (next time findCompatibleMethod() above will also find the new method). boolean wasSynthetic = false; if ((newmethod.modifiers & AccSynthetic) != 0) { wasSynthetic = true; newmethod.modifiers &= ~AccSynthetic; } AstEdit.addMethod(roleIfcDecl, newmethod, wasSynthetic, false, null/*copyInheritanceSrc*/); if (newmethod.binding != null) { newmethod.binding.tagBits |= TagBits.ClearPrivateModifier; newmethod.binding.copyInheritanceSrc = m; } } else { if (!Protections.isAsVisible(declaredMethod.modifiers, m.modifiers)) roleClass.scope.problemReporter().visibilityConflict(declaredMethod, m); } } superClass = superClass.superclass(); } }
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.statemachine.transformer.StandardElementGenerator.java
License:Open Source License
/** * Retreive (or create) a team level method used for casting an expression to a role. * After casting also check the containingInstance against the current team. * @param teamModel/*www . ja v a2s .c o m*/ * @param roleType * @param scope (used only for lookup of j.l.Object) * @param searchSuper should super classes of teamClass be search, too? * @param sourceStart * @param sourceEnd * @return the method */ public static MethodBinding getCastMethod(TeamModel teamModel, ReferenceBinding roleType, Scope scope, int dimensions, boolean searchSuper, int sourceStart, int sourceEnd) { /* * protected <role> _OT$castTo$<role> (Object _OT$arg1) { * if (_OT$arg1 == null) return null; * __OT__<role> role = (__OT__<role>) _OT$arg1; * if (role._OT$getTeam() != this) * throw new RuntimeException(); * return role; * } *OR FOR ARRAY: * protected <role>[].. _OT$castTo$<role>$<dims> (Object[].. _OT$arg1) { * if (_OT$arg1 == null) return null; * <role>[].. role = (<role>[]..) _OT$arg1; * if (role.length > 0 && ((__OT__<role>)role[0])._OT$getTeam() != this) // TODO(SH): extract through several dims * throw new RuntimeException(); * return role; * } * NOTE(SH): it suffices to check team equivalence for one element, since at this point it * must already be a role-array, which cannot mix roles from different teams ;-) */ boolean shouldWeaken = (teamModel.getState() >= ITranslationStates.STATE_TYPES_ADJUSTED); // weakening for other methods already done? MethodBinding superMethod = null; roleType = roleType.getRealType(); char[] methodName = CharOperation.concat(CAST_PREFIX, roleType.sourceName()); if (dimensions > 0) methodName = CharOperation.concat(methodName, String.valueOf(dimensions).toCharArray(), '$'); ReferenceBinding teamBinding = teamModel.getBinding(); while (teamBinding != null) { MethodBinding[] methods = teamBinding.getMethods(methodName); if (methods != null && methods.length == 1) { if (TypeBinding.equalsEquals(methods[0].declaringClass, teamModel.getBinding()) || searchSuper) return methods[0]; // go ahead and generate a new method, but use superMethod for weakening after generating: superMethod = methods[0]; break; } if (!searchSuper && !shouldWeaken) break; teamBinding = teamBinding.superclass(); } TypeDeclaration teamClass = teamModel.getAst(); if (teamClass == null) { if (true) {// FIXME(SH): team has error? MethodBinding castMethod = new MethodBinding(AccPublic, methodName, roleType, new TypeBinding[] { scope.getJavaLangObject() }, null, teamModel.getBinding()); teamModel.getBinding().addMethod(castMethod); return castMethod; } throw new InternalCompilerError("Required cast method not found."); //$NON-NLS-1$ } AstGenerator gen = new AstGenerator(sourceStart, sourceEnd); // --- method header --- int modifiers = 0; boolean clearPrivateModifier = false; if (roleType.isPublic()) { modifiers = AccPublic; } else { // this weird combination allows to return a non-public role and will // grant access across packages in the byte code. modifiers = AccProtected; clearPrivateModifier = true; // See also BinaryTypeBinding.resolveTypesFor(MethodBinding) where the Protected flag is restored. } // args char[] argName = OT_DOLLAR_ARG.toCharArray(); // find the appropriate top-level-super-type: ReferenceBinding exprType = teamClass.scope.getJavaLangObject(); // if (!roleType.isStrictlyCompatibleWith(exprType)) { // exprType = (ReferenceBinding)teamClass.scope.getType(ORG_OBJECTTEAMS_ICONFINED, 3); // if (!roleType.isCompatibleWith(exprType)) // exprType = (ReferenceBinding)teamClass.scope.getType( // ORG_OBJECTTEAMS_TEAM_DOT_CONFINED, // 4); // } TypeReference exprTypeRef = gen.typeReference(exprType); MethodDeclaration castMethod = gen.method(teamClass.compilationResult(), modifiers, gen.createArrayTypeReference(roleType, dimensions), methodName, new Argument[] { gen.argument(argName, exprTypeRef) }); // see org.eclipse.objectteams.otdt.tests.otjld.regression.ReportedBugs.testB11_sh15(): // pre-set return type to prevent problems with resolving lateron TypeBinding returnType = dimensions == 0 ? roleType : scope.environment().createArrayType(roleType, dimensions); castMethod.returnType.resolvedType = RoleTypeCreator.maybeWrapUnqualifiedRoleType(returnType, teamBinding); // <role> role = (<role>)_OT$arg; TypeReference arrayCastType = gen.createArrayTypeReference(roleType, dimensions); LocalDeclaration castedLocalVar = gen.localVariable(ROLE, arrayCastType, gen.castExpression(gen.singleNameReference(argName), arrayCastType, CastExpression.RAW)); //STATEMENTS: // if (_OT$arg1 == null) return null; //AND // if (role._OT$getTeam() != this) // throw new RuntimeException(); // OR // if (role.length > 0 && ((<roleClass>)role[0])._OT$getTeam() != this) // throw new RuntimeException(); Statement nullCheck = gen.ifStatement(gen.nullCheck(gen.singleNameReference(argName)), gen.returnStatement(gen.nullLiteral())); Expression teamCheckCondition; teamCheckCondition = genTeamCheck(gen, OperatorIds.NOT_EQUAL, gen.singleNameReference(ROLE), gen.thisReference(), dimensions); if (dimensions > 0) teamCheckCondition = gen .setPos(new AND_AND_Expression( gen.equalExpression(gen.qualifiedNameReference(new char[][] { ROLE, LENGTH }), gen.intLiteral(0), OperatorIds.GREATER), teamCheckCondition, OperatorIds.AND_AND)); // here we go: castMethod.setStatements(new Statement[] { nullCheck, castedLocalVar, gen.ifStatement(teamCheckCondition, gen.throwStatement( gen.allocation(gen.qualifiedTypeReference(ROLE_CAST_EXCEPTION), new Expression[0]))), // return role; gen.returnStatement(gen.singleNameReference(ROLE)) }); castMethod.isGenerated = true; AstEdit.addGeneratedMethod(teamClass, castMethod); if (clearPrivateModifier) castMethod.binding.tagBits = TagBits.ClearPrivateModifier; if (superMethod != null) CopyInheritance.weakenSignature(castMethod, superMethod); return castMethod.binding; }
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.statemachine.transformer.StandardElementGenerator.java
License:Open Source License
private static void checkCreateFakedStrongBaseField(ReferenceBinding superRole, ReferenceBinding roleClass, ReferenceBinding baseTypeBinding) { if (TypeBinding.equalsEquals(superRole.baseclass, baseTypeBinding)) return; // not strengthening ReferenceBinding nextSuper = superRole.superclass(); while (nextSuper.isRole() && nextSuper.roleModel.isBound()) { superRole = nextSuper;/*from ww w. ja va 2s .c o m*/ nextSuper = nextSuper.superclass(); } // create faked base field with exact type information: FieldBinding fakeStrongBaseField = new FieldBinding(_OT_BASE, baseTypeBinding, AccPublic | AccFinal | AccSynthetic, roleClass, Constant.NotAConstant); fakeStrongBaseField.tagBits |= TagBits.IsFakedField; SourceTypeBinding roleSourceClass = (SourceTypeBinding) roleClass; FieldModel model = FieldModel.getModel(fakeStrongBaseField); model.actualDeclaringClass = superRole; FieldBinding superBaseField = superRole.getField(IOTConstants._OT_BASE, false); if (superBaseField != null) fakeStrongBaseField.shareBestName(superBaseField); roleSourceClass.addField(fakeStrongBaseField); }
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.statemachine.transformer.StandardElementGenerator.java
License:Open Source License
/** * @return either a newly created method or a valid, existing one. *//*from w ww . j a v a 2s. c om*/ private static MethodBinding createGetBaseMethod(TypeDeclaration roleType, ReferenceBinding baseType, char[] methodName, int flags) { if (roleType == null) return null; // sanity check, null can be caused by binary ifc-part in a source role. MethodBinding existingMethod = null; AbstractMethodDeclaration decl = TypeAnalyzer.findMethodDecl(roleType, methodName, 0); if (decl != null) existingMethod = decl.binding; if (existingMethod == null) existingMethod = TypeAnalyzer.findMethod(roleType.initializerScope, roleType.binding.superclass(), methodName, Binding.NO_PARAMETERS); if (existingMethod != null && existingMethod.isValidBinding()) { // valid method exists if (existingMethod.isAbstract() == roleType.isInterface()) // abstractness is correct if (TypeBinding.equalsEquals(existingMethod.declaringClass, roleType.binding)// declared here || existingMethod.returnType.isCompatibleWith(baseType)) // inherited but compatible return existingMethod; } AstGenerator gen = roleType.baseclass != null ? new AstGenerator(roleType.baseclass.sourceStart, roleType.baseclass.sourceEnd) : new AstGenerator(roleType.sourceStart, roleType.sourceEnd); gen.replaceableEnclosingClass = roleType.binding.enclosingType(); TypeReference baseclassReference; // must set in if or else TypeParameter methodParam = null; Statement bodyStatement; // must set in if or else if (baseType != null) { baseclassReference = gen.baseclassReference(baseType); bodyStatement = gen.returnStatement(gen.castExpression(gen.singleNameReference(_OT_BASE), baseclassReference, CastExpression.DO_WRAP)); } else { // this role is not bound but create a generic getBase method for use via a <B base R> type: final char[] paramName = "_OT$AnyBase".toCharArray(); //$NON-NLS-1$ used only for this one declaration. methodParam = gen.baseBoundedTypeParameter(paramName, roleType.binding); baseclassReference = gen.singleTypeReference(paramName); final char[][] ABSTRACT_METHOD = new char[][] { "java".toCharArray(), //$NON-NLS-1$ "lang".toCharArray(), //$NON-NLS-1$ "AbstractMethodError".toCharArray() }; //$NON-NLS-1$ bodyStatement = gen.throwStatement(gen.allocation(gen.qualifiedTypeReference(ABSTRACT_METHOD), null)); } MethodDeclaration getBase = gen.method(roleType.compilationResult, flags, baseclassReference, methodName, null); if (methodParam != null) getBase.typeParameters = new TypeParameter[] { methodParam }; AstEdit.addMethod(roleType, getBase); for (ReferenceBinding tsuperRole : roleType.getRoleModel().getTSuperRoleBindings()) { for (MethodBinding tsuperMethod : tsuperRole.getMethods(_OT_GETBASE)) getBase.binding.addOverriddenTSuper(tsuperMethod); } if (methodParam != null) roleType.getRoleModel().unimplementedGetBase = getBase.binding; if ((flags & AccSemicolonBody) == 0) { getBase.setStatements(new Statement[] { bodyStatement }); if (StateMemento.hasMethodResolveStarted(roleType.binding)) getBase.resolveStatements(); } return getBase.binding; }
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.util.AstEdit.java
License:Open Source License
/** * Adds a new binding in the superInterfaces array of type's binding * @param typeDeclaration/*from w w w . j a v a 2 s .c o m*/ * @param resolvedSuper */ public static void addImplementsBinding(TypeDeclaration typeDeclaration, ReferenceBinding resolvedSuper) { boolean bindingPresent = typeDeclaration.binding != null && ((typeDeclaration.binding.tagBits & TagBits.BeginHierarchyCheck) != 0); assert (resolvedSuper != null && bindingPresent); SourceTypeBinding typeBinding = typeDeclaration.binding; ReferenceBinding[] superInterfaces = typeBinding.superInterfaces; int length = 0; if (superInterfaces == null) { superInterfaces = new ReferenceBinding[1]; } else { for (ReferenceBinding superIfc : superInterfaces) if (TypeBinding.equalsEquals(superIfc, resolvedSuper)) return; // already present length = superInterfaces.length; System.arraycopy(superInterfaces, 0, (superInterfaces = new ReferenceBinding[length + 1]), 1, length); } superInterfaces[0] = resolvedSuper; typeBinding.superInterfaces = superInterfaces; // compatibility may have changed, clear negative cache entries: typeBinding.resetIncompatibleTypes(); }
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.util.AstGenerator.java
License:Open Source License
private ReferenceBinding strengthenEnclosing(ReferenceBinding currentType, ReferenceBinding strongEnclosing) { while (strongEnclosing != null) { if (TypeBinding.equalsEquals(strongEnclosing, currentType) || TypeBinding.equalsEquals(strongEnclosing.superclass(), currentType)) return strongEnclosing; ReferenceBinding currentOuter = currentType.enclosingType(); if (currentOuter != null) { ReferenceBinding strongOuter = strengthenEnclosing(currentOuter, strongEnclosing); if (strongOuter != null) return strongOuter.getMemberType(currentType.internalName()); }//from www . ja va 2 s. c om strongEnclosing = strongEnclosing.enclosingType(); } return null; }