public FeatureScopeSessionWithContext(AbstractFeatureScopeSession parent, LightweightTypeReference contextType) { super(parent); this.visibilityHelper = new ContextualVisibilityHelper(parent, contextType); }
@Override public boolean isVisible(JvmMember member) { return visibilityHelper.isVisible(member); }
currentDeclarator = owner.newParameterizedTypeReference(declaration.getDeclaringType()); if (!(new ContextualVisibilityHelper(visibilityHelper, currentDeclarator).isVisible(overridden))) { return new LazyOverrideCheckResult(overriding, overridden, OverrideCheckDetails.NOT_VISIBLE);
JvmType contextType = visibilityHelper.getRawContextType(); if (contextType instanceof JvmDeclaredType) { String packageName = visibilityHelper.getPackageName(); JvmDeclaredType declaringType = member.getDeclaringType(); String memberPackageName = declaringType.getPackageName();
this.superTypeNames = computeSuperTypeNames();
public FeatureScopeSessionWithContext(AbstractFeatureScopeSession parent, LightweightTypeReference contextType, String packageName) { super(parent); this.visibilityHelper = new ContextualVisibilityHelper(parent, contextType, packageName); }
protected List<JvmOperation> getAllDispatchMethods(DispatchSignature signature, JvmDeclaredType type, ContextualVisibilityHelper contextualVisibilityHelper) { List<JvmOperation> allOperations = Lists.newArrayListWithExpectedSize(5); Iterable<JvmFeature> allFeatures = type.findAllFeaturesByName(signature.getDispatchCaseName()); for(JvmFeature feature: allFeatures) { if (feature instanceof JvmOperation) { JvmOperation operationByName = (JvmOperation) feature; if (signature.isDispatchCase(operationByName) && contextualVisibilityHelper.isVisible(operationByName)) { allOperations.add(operationByName); } } } sort(allOperations); return allOperations; }
public IVisibilityHelper getVisibilityHelper(final Resource resource) { IVisibilityHelper _switchResult = null; boolean _matched = false; if (resource instanceof XtextResource) { _matched=true; IVisibilityHelper _xblockexpression = null; { final String packageName = this._iImportsConfiguration.getPackageName(((XtextResource)resource)); IVisibilityHelper _xifexpression = null; if ((packageName == null)) { _xifexpression = this.visibilityHelper; } else { _xifexpression = new ContextualVisibilityHelper(this.visibilityHelper, packageName); } _xblockexpression = _xifexpression; } _switchResult = _xblockexpression; } if (!_matched) { _switchResult = this.visibilityHelper; } return _switchResult; } }
public List<IResolvedExecutable> getImplementationCandidates(final JvmDeclaredType type, final boolean isAnonymous) { if (((type == null) || (!(type instanceof JvmGenericType)))) { return Collections.<IResolvedExecutable>emptyList(); } JavaVersion sourceVersion = this.generatorConfigProvider.get(type).getJavaSourceVersion(); ResolvedFeatures resolvedFeatures = this.overrideHelper.getResolvedFeatures(type, sourceVersion); List<IResolvedExecutable> result = Lists.<IResolvedExecutable>newArrayList(); LightweightTypeReference _type = resolvedFeatures.getType(); ContextualVisibilityHelper contextualVisibilityHelper = new ContextualVisibilityHelper(this.visibilityHelper, _type); this.addOperationCandidates(resolvedFeatures, contextualVisibilityHelper, result); if (((!isAnonymous) && (!((JvmGenericType) type).isInterface()))) { this.addConstructorCandidates(resolvedFeatures, contextualVisibilityHelper, result); } return result; }
/** * Return all the cases that are associated with the given dispatch operation. */ public List<JvmOperation> getAllDispatchCases(JvmOperation dispatcherOperation) { DispatchSignature dispatchSignature = new DispatchSignature(dispatcherOperation.getSimpleName(), dispatcherOperation.getParameters().size()); JvmDeclaredType type = dispatcherOperation.getDeclaringType(); ITypeReferenceOwner owner = new StandardTypeReferenceOwner(services, type); ContextualVisibilityHelper contextualVisibilityHelper = new ContextualVisibilityHelper(visibilityHelper, owner.newParameterizedTypeReference(type)); return getAllDispatchMethods(dispatchSignature, type, contextualVisibilityHelper); }
protected void process(JvmMember context, Map<String, JvmIdentifiableElement> result) { if (context instanceof JvmDeclaredType) { if (!result.containsKey(context.getSimpleName())) result.put(context.getSimpleName(), context); JvmDeclaredType contextType = (JvmDeclaredType) context; ContextualVisibilityHelper visibilityHelper = new ContextualVisibilityHelper(this.visibilityHelper, contextType); addInnerTypes(contextType, "", visibilityHelper, result); Set<JvmType> superTypes = rawSuperTypes.collect(contextType); for (JvmType superType : superTypes) { if (superType instanceof JvmDeclaredType) addInnerTypes((JvmDeclaredType) superType, "", visibilityHelper, result); } } if (context instanceof JvmTypeParameterDeclarator) addTypeParameters((JvmTypeParameterDeclarator) context, result); JvmDeclaredType declaringType = context.getDeclaringType(); if (declaringType != null) process(declaringType, result); }
public JvmOperation findOverriddenOperation(JvmOperation operation) { if (operation.getVisibility() == JvmVisibility.PRIVATE) { return null; } ITypeReferenceOwner owner = new StandardTypeReferenceOwner(services, operation.eResource().getResourceSet()); LightweightTypeReference declaringType = owner.toLightweightTypeReference(operation.getDeclaringType()); TypeParameterSubstitutor<?> substitutor = createSubstitutor(owner, declaringType); return findOverriddenOperation(operation, declaringType, substitutor, owner, new ContextualVisibilityHelper(visibilityHelper, declaringType)); }
Iterable<JvmOperation> operations = type.getDeclaredOperations(); ITypeReferenceOwner owner = new StandardTypeReferenceOwner(services, type); ContextualVisibilityHelper contextualVisibilityHelper = new ContextualVisibilityHelper(visibilityHelper, owner.newParameterizedTypeReference(type)); for(JvmOperation operation: operations) { if (isDispatchFunction(operation)) {
operationsMissingImplementation = Lists.newArrayList(); IVisibilityHelper visibilityHelper = new ContextualVisibilityHelper(this.visibilityHelper, resolvedFeatures.getType()); boolean flaggedType = false; for (IResolvedOperation operation : resolvedFeatures.getAllOperations()) {