public void setDelegate(ReferenceTypeDelegate delegate) { // Don't copy from BcelObjectType to EclipseSourceType - the context may be tidied (result // null'd) after previous weaving if (this.delegate != null && !(this.delegate instanceof BcelObjectType) && this.delegate.getSourceContext() != SourceContextImpl.UNKNOWN_SOURCE_CONTEXT) ((AbstractReferenceTypeDelegate) delegate).setSourceContext(this.delegate.getSourceContext()); this.delegate = delegate; for (Iterator it = this.derivativeTypes.iterator(); it.hasNext(); ) { ReferenceType dependent = (ReferenceType) it.next(); dependent.setDelegate(delegate); } // If we are raw, we have a generic type - we should ensure it uses the // same delegate if (isRawType() && getGenericType() != null) { ReferenceType genType = (ReferenceType) getGenericType(); if (genType.getDelegate() != delegate) { // avoids circular updates genType.setDelegate(delegate); } } clearParameterizationCaches(); }