org.eclipse.xtext.xbase.typesystem.util.IVisibilityHelper Java Examples
The following examples show how to use
org.eclipse.xtext.xbase.typesystem.util.IVisibilityHelper.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FunctionTypeReference.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
@Override public boolean isVisible(IVisibilityHelper visibilityHelper) { if (super.isVisible(visibilityHelper)) { if (returnType != null && !returnType.isVisible(visibilityHelper)) { return false; } if (parameterTypes != null) { for(LightweightTypeReference parameterType: parameterTypes) { if (!parameterType.isVisible(visibilityHelper)) { return false; } } } return true; } return false; }
Example #2
Source File: InteractiveUnresolvedTypeResolver.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
protected void findCandidateTypes(final JvmDeclaredType contextType, final String typeSimpleName, IJavaSearchScope searchScope, final IAcceptor<JvmDeclaredType> acceptor) throws JavaModelException { BasicSearchEngine searchEngine = new BasicSearchEngine(); final IVisibilityHelper contextualVisibilityHelper = new ContextualVisibilityHelper(visibilityHelper, contextType); searchEngine.searchAllTypeNames(null, SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE, typeSimpleName.toCharArray(), SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE, IJavaSearchConstants.TYPE, searchScope, new IRestrictedAccessTypeRequestor() { @Override public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, String path, AccessRestriction access) { final String qualifiedTypeName = getQualifiedTypeName(packageName, enclosingTypeNames, simpleTypeName); if ((access == null || (access.getProblemId() != IProblem.ForbiddenReference && !access.ignoreIfBetter())) && !TypeFilter.isFiltered(packageName, simpleTypeName)) { JvmType importType = typeRefs.findDeclaredType(qualifiedTypeName, contextType.eResource()); if (importType instanceof JvmDeclaredType && contextualVisibilityHelper.isVisible((JvmDeclaredType) importType)) { acceptor.accept((JvmDeclaredType) importType); } } } }, IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, new NullProgressMonitor()); }
Example #3
Source File: OverrideProposalUtil.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
protected boolean isCandidate(LightweightTypeReference type, IResolvedExecutable executable, IVisibilityHelper visibilityHelper) { JvmDeclaredType declaringType = executable.getDeclaration().getDeclaringType(); if (type.getType() != declaringType && isVisible(executable, visibilityHelper)) { JvmExecutable rawExecutable = executable.getDeclaration(); if (rawExecutable instanceof JvmOperation) { JvmOperation operation = (JvmOperation) rawExecutable; if (operation.isFinal() || operation.isStatic()) { return false; } else { if (type.getType() instanceof JvmGenericType && ((JvmGenericType) type.getType()).isInterface()) { return declaringType instanceof JvmGenericType && ((JvmGenericType) declaringType).isInterface() && !operation.isAbstract(); } else { return true; } } } else { return true; } } return false; }
Example #4
Source File: OverrideProposalUtil.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
protected void addConstructorCandidates(ResolvedFeatures resolvedFeatures, IVisibilityHelper visibilityHelper, List<IResolvedExecutable> result) { LightweightTypeReference typeReference = resolvedFeatures.getType(); List<LightweightTypeReference> superTypes = typeReference.getSuperTypes(); for (LightweightTypeReference superType : superTypes) { if (!superType.isInterfaceType()) { List<IResolvedConstructor> declaredConstructors = resolvedFeatures.getDeclaredConstructors(); Set<String> erasedSignatures = Sets.<String>newHashSet(); for (IResolvedConstructor constructor : declaredConstructors) { erasedSignatures.add(constructor.getResolvedErasureSignature()); } ResolvedFeatures superClass = overrideHelper.getResolvedFeatures(superType); for (IResolvedConstructor superclassConstructor : superClass.getDeclaredConstructors()) { IResolvedConstructor overriddenConstructor = new ResolvedConstructor( superclassConstructor.getDeclaration(), typeReference); if (isCandidate(typeReference, overriddenConstructor, visibilityHelper)) { if (erasedSignatures.add(superclassConstructor.getResolvedErasureSignature())) { result.add(overriddenConstructor); } } } return; } } }
Example #5
Source File: OverrideHelper.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
protected JvmOperation findOverriddenOperation(JvmOperation operation, LightweightTypeReference declaringType, TypeParameterSubstitutor<?> substitutor, ITypeReferenceOwner owner, IVisibilityHelper visibilityHelper) { int parameterSize = operation.getParameters().size(); List<LightweightTypeReference> superTypes = declaringType.getSuperTypes(); for(LightweightTypeReference superType: superTypes) { if (superType.getType() instanceof JvmDeclaredType) { JvmDeclaredType declaredSuperType = (JvmDeclaredType) superType.getType(); if (declaredSuperType != null) { Iterable<JvmFeature> equallyNamedFeatures = declaredSuperType.findAllFeaturesByName(operation.getSimpleName()); for(JvmFeature feature: equallyNamedFeatures) { if (feature instanceof JvmOperation) { JvmOperation candidate = (JvmOperation) feature; if (parameterSize == candidate.getParameters().size()) { if (visibilityHelper.isVisible(feature)) { boolean matchesSignature = true; for(int i = 0; i < parameterSize && matchesSignature; i++) { JvmFormalParameter parameter = operation.getParameters().get(i); JvmFormalParameter candidateParameter = candidate.getParameters().get(i); matchesSignature = isMatchesSignature(parameter, candidateParameter, substitutor, owner); } if (matchesSignature) { return candidate; } } } } } } } } return null; }
Example #6
Source File: StaticallyImportedMemberProvider.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
public Iterable<JvmFeature> findAllFeatures(XImportDeclaration it) { JvmDeclaredType importedType = it.getImportedType(); if (!it.isStatic() || importedType == null) { return Collections.emptyList(); } IVisibilityHelper visibilityHelper = getVisibilityHelper(it.eResource()); IResolvedFeatures resolvedFeatures = resolvedFeaturesProvider.getResolvedFeatures(importedType); return Iterables.filter(resolvedFeatures.getAllFeatures(), (JvmFeature feature) -> { return feature.isStatic() && visibilityHelper.isVisible(feature) && (it.getMemberName() == null || feature.getSimpleName().startsWith(it.getMemberName())); }); }
Example #7
Source File: UnboundTypeReference.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Override public boolean isVisible(IVisibilityHelper visibilityHelper) { if (internalIsResolved()) { return resolvedTo.isVisible(visibilityHelper); } return true; }
Example #8
Source File: StaticallyImportedMemberProvider.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
public Iterable<JvmFeature> getAllFeatures(Resource resource, JvmDeclaredType importedType, boolean isStatic, boolean extension, String memberName) { if (!isStatic || importedType == null) { return Collections.emptyList(); } IVisibilityHelper visibilityHelper = getVisibilityHelper(resource); IResolvedFeatures resolvedFeatures = resolvedFeaturesProvider.getResolvedFeatures(importedType); return Iterables.filter(resolvedFeatures.getAllFeatures(memberName), feature -> feature.isStatic() && visibilityHelper.isVisible(feature)); }
Example #9
Source File: CompoundTypeReference.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
/** * {@inheritDoc} * * If this is a multi-type rather than a {@link #isSynonym() synonym}, the Java compliant * type reference is determined from the common super type of all participating, non-interface types. * If there is no such type or this is a synonym, all the component types are used to compute * the common super type and use that one as the type. */ @Override public JvmTypeReference toJavaCompliantTypeReference(IVisibilityHelper visibilityHelper) { if (!isSynonym()) { List<LightweightTypeReference> nonInterfaceTypes = getNonInterfaceTypes(components); if (nonInterfaceTypes != null) { return toJavaCompliantTypeReference(nonInterfaceTypes, visibilityHelper); } } return toJavaCompliantTypeReference(components, visibilityHelper); }
Example #10
Source File: CompoundTypeReference.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Override public boolean isVisible(IVisibilityHelper visibilityHelper) { if (components != null && !components.isEmpty()) { for(LightweightTypeReference component: components) { if (!component.isVisible(visibilityHelper)) { return false; } } } return true; }
Example #11
Source File: InnerTypeReference.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Override public boolean isVisible(IVisibilityHelper visibilityHelper) { if (super.isVisible(visibilityHelper)) { boolean result = outer.isVisible(visibilityHelper); return result; } return false; }
Example #12
Source File: InnerTypeReference.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Override public JvmTypeReference toJavaCompliantTypeReference(IVisibilityHelper visibilityHelper) { if (isTypeVisible(visibilityHelper)) { JvmInnerTypeReference result = getTypesFactory().createJvmInnerTypeReference(); result.setType(getType()); result.setOuter((JvmParameterizedTypeReference) outer.toJavaCompliantTypeReference()); for(LightweightTypeReference typeArgument: getTypeArguments()) { result.getArguments().add(typeArgument.toJavaCompliantTypeReference()); } return result; } else { return toJavaCompliantTypeReference(getSuperTypes(), visibilityHelper); } }
Example #13
Source File: StaticallyImportedMemberProvider.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
public IVisibilityHelper getVisibilityHelper(Resource resource) { if (resource instanceof XtextResource) { String packageName = importsConfiguration.getPackageName(((XtextResource) resource)); if (packageName != null) { return new ContextualVisibilityHelper(visibilityHelper, packageName); } } return visibilityHelper; }
Example #14
Source File: NonOverridableTypesProvider.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
protected void addInnerTypes( JvmDeclaredType type, String prefix, IVisibilityHelper visibilityHelper, Map<String, JvmIdentifiableElement> result) { for (JvmMember member : type.getMembers()) { if (member instanceof JvmDeclaredType && visibilityHelper.isVisible(member)) { String localName = prefix + member.getSimpleName(); if (!result.containsKey(localName)) { result.put(localName, member); } addInnerTypes((JvmDeclaredType) member, prefix + member.getSimpleName() + ".", visibilityHelper, result); } } }
Example #15
Source File: OverrideProposalUtil.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
protected void addOperationCandidates(ResolvedFeatures resolvedFeatures, IVisibilityHelper visibilityHelper, List<IResolvedExecutable> result) { List<IResolvedOperation> allOperations = resolvedFeatures.getAllOperations(); LightweightTypeReference inferredType = resolvedFeatures.getType(); for (IResolvedOperation operation : allOperations) { if (isCandidate(inferredType, operation, visibilityHelper)) { result.add(operation); } } }
Example #16
Source File: LightweightTypeReference.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
protected JvmTypeReference toJavaCompliantTypeReference(List<LightweightTypeReference> types, IVisibilityHelper visibilityHelper) { LightweightTypeReference type = getServices().getTypeConformanceComputer().getCommonSuperType(types, getOwner()); if (type == null) { return getOwner().getServices().getTypeReferences().getTypeForName(Object.class, getOwner().getContextResourceSet()); } return type.toJavaCompliantTypeReference(visibilityHelper); }
Example #17
Source File: WildcardTypeReference.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Override public boolean isVisible(IVisibilityHelper visibilityHelper) { if (upperBounds != null && !upperBounds.isEmpty()) { for(LightweightTypeReference upperBound: upperBounds) { if (!upperBound.isVisible(visibilityHelper)) { return false; } } } if (lowerBound != null && !lowerBound.isVisible(visibilityHelper)) { return false; } return true; }
Example #18
Source File: ParameterizedTypeReference.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Override public JvmTypeReference toJavaCompliantTypeReference(IVisibilityHelper visibilityHelper) { if (isTypeVisible(visibilityHelper)) { JvmParameterizedTypeReference result = getTypesFactory().createJvmParameterizedTypeReference(); result.setType(type); if (typeArguments != null) { for(LightweightTypeReference typeArgument: typeArguments) { result.getArguments().add(typeArgument.toJavaCompliantTypeReference()); } } return result; } else { return toJavaCompliantTypeReference(getSuperTypes(), visibilityHelper); } }
Example #19
Source File: ParameterizedTypeReference.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Override public boolean isVisible(IVisibilityHelper visibilityHelper) { if (isTypeVisible(visibilityHelper)) { if (typeArguments != null) { for(LightweightTypeReference typeArgument: typeArguments) { if (!typeArgument.isVisible(visibilityHelper)) { return false; } } } return true; } else { return false; } }
Example #20
Source File: InnerFunctionTypeReference.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Override public JvmTypeReference toJavaCompliantTypeReference(IVisibilityHelper visibilityHelper) { if (isTypeVisible(visibilityHelper)) { JvmInnerTypeReference result = getTypesFactory().createJvmInnerTypeReference(); result.setType(getType()); result.setOuter((JvmParameterizedTypeReference) outer.toJavaCompliantTypeReference()); for(LightweightTypeReference typeArgument: getTypeArguments()) { result.getArguments().add(typeArgument.toJavaCompliantTypeReference()); } return result; } else { return toJavaCompliantTypeReference(getSuperTypes(), visibilityHelper); } }
Example #21
Source File: InnerFunctionTypeReference.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Override public boolean isVisible(IVisibilityHelper visibilityHelper) { if (super.isVisible(visibilityHelper)) { boolean result = outer.isVisible(visibilityHelper); return result; } return false; }
Example #22
Source File: OverrideProposalUtil.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
protected boolean isVisible(IResolvedExecutable executable, IVisibilityHelper visibilityHelper) { return visibilityHelper.isVisible(executable.getDeclaration()); }
Example #23
Source File: JavaTypeQuickfixes.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
@SuppressWarnings("restriction") protected void createImportProposals(final JvmDeclaredType contextType, final Issue issue, String typeName, IJavaSearchScope searchScope, final IssueResolutionAcceptor acceptor) throws JavaModelException { if(contextType != null) { final IVisibilityHelper visibilityHelper = getVisibilityHelper(contextType); final Pair<String, String> packageAndType = typeNameGuesser.guessPackageAndTypeName(contextType, typeName); final String wantedPackageName = packageAndType.getFirst(); org.eclipse.jdt.internal.core.search.BasicSearchEngine searchEngine = new org.eclipse.jdt.internal.core.search.BasicSearchEngine(); final char[] wantedPackageChars = (isEmpty(wantedPackageName)) ? null : wantedPackageName.toCharArray(); final String wantedTypeName = packageAndType.getSecond(); searchEngine.searchAllTypeNames(wantedPackageChars, SearchPattern.R_EXACT_MATCH, wantedTypeName.toCharArray(), SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE, IJavaSearchConstants.TYPE, searchScope, new org.eclipse.jdt.internal.core.search.IRestrictedAccessTypeRequestor() { @Override public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, String path, org.eclipse.jdt.internal.compiler.env.AccessRestriction access) { final String qualifiedTypeName = getQualifiedTypeName(packageName, enclosingTypeNames, simpleTypeName); if(access == null || (access.getProblemId() != IProblem.ForbiddenReference && !access.ignoreIfBetter())){ JvmType importType = services.getTypeReferences().findDeclaredType(qualifiedTypeName, contextType); if(importType instanceof JvmDeclaredType && visibilityHelper.isVisible((JvmDeclaredType)importType)) { StringBuilder label = new StringBuilder("Import '"); label.append(simpleTypeName); label.append("' ("); label.append(packageName); if(enclosingTypeNames.length > 0) { for(char[] enclosingTypeName: enclosingTypeNames) { label.append("."); label.append(enclosingTypeName); } } label.append(")"); acceptor.accept(issue, label.toString(), label.toString(), "impc_obj.gif", new ISemanticModification() { @Override public void apply(EObject element, IModificationContext context) throws Exception { ReplacingAppendable appendable = appendableFactory.create(context.getXtextDocument(), (XtextResource) element.eResource(), 0, 0); appendable.append(services.getTypeReferences().findDeclaredType(qualifiedTypeName, element)); appendable.insertNewImports(); } }, jdtTypeRelevance.getRelevance(qualifiedTypeName, wantedTypeName) + 100); } } } }, IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, new NullProgressMonitor()); } }
Example #24
Source File: JavaTypeQuickfixes.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
@SuppressWarnings("restriction") protected boolean createConstructorProposals(final JvmDeclaredType contextType, final Issue issue, String typeName, IJavaSearchScope searchScope, final IssueResolutionAcceptor acceptor) throws JavaModelException { final boolean[] result = new boolean[] { false }; if(contextType != null) { final IVisibilityHelper visibilityHelper = getVisibilityHelper(contextType); final Pair<String, String> packageAndType = typeNameGuesser.guessPackageAndTypeName(contextType, typeName); final String wantedPackageName = packageAndType.getFirst(); final String wantedTypeName = packageAndType.getSecond(); if (typeName.endsWith(wantedTypeName)) { return false; } org.eclipse.jdt.internal.core.search.BasicSearchEngine searchEngine = new org.eclipse.jdt.internal.core.search.BasicSearchEngine(); final char[] wantedPackageChars = (isEmpty(wantedPackageName)) ? null : wantedPackageName.toCharArray(); searchEngine.searchAllTypeNames(wantedPackageChars, SearchPattern.R_EXACT_MATCH, wantedTypeName.toCharArray(), SearchPattern.R_EXACT_MATCH, IJavaSearchConstants.TYPE, searchScope, new org.eclipse.jdt.internal.core.search.IRestrictedAccessTypeRequestor() { @Override public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, String path, org.eclipse.jdt.internal.compiler.env.AccessRestriction access) { final String qualifiedTypeName = getQualifiedTypeName(packageName, enclosingTypeNames, simpleTypeName); if(access == null || (access.getProblemId() != IProblem.ForbiddenReference && !access.ignoreIfBetter())){ JvmType importType = services.getTypeReferences().findDeclaredType(qualifiedTypeName, contextType); if(importType instanceof JvmDeclaredType && visibilityHelper.isVisible((JvmDeclaredType)importType)) { result[0] = true; StringBuilder label = new StringBuilder("Change to constructor call 'new "); label.append(simpleTypeName); label.append("()'"); if(!equal(wantedPackageName, new String(packageName))) { label.append(" ("); label.append(packageName); if(enclosingTypeNames.length > 0) { for(char[] enclosingTypeName: enclosingTypeNames) { label.append("."); label.append(enclosingTypeName); } } label.append(")"); } acceptor.accept(issue, label.toString(), label.toString(), "impc_obj.gif", new ISemanticModification() { @Override public void apply(EObject element, IModificationContext context) throws Exception { IXtextDocument document = context.getXtextDocument(); DocumentRewriter rewriter = rewriterFactory.create(document, (XtextResource) element.eResource()); final int typeEndOffset = document.get().indexOf(wantedTypeName, issue.getOffset() + wantedPackageName.length()) + wantedTypeName.length(); final Section section = rewriter.newSection(issue.getOffset(), typeEndOffset - issue.getOffset()); section.append(services.getTypeReferences().findDeclaredType(qualifiedTypeName, element)); section.append("()"); final TextEdit textEdit = replaceConverter.convertToTextEdit(rewriter.getChanges()); textEdit.apply(document); } }, jdtTypeRelevance.getRelevance(qualifiedTypeName, wantedTypeName) + 100); } } } }, IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, new NullProgressMonitor()); } return result[0]; }
Example #25
Source File: ConstructorTypeScopeWrapper.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
public ConstructorTypeScopeWrapper(EObject context, IVisibilityHelper visibilityHelper, IScope typeScope, boolean strict) { this.context = context; this.visibilityHelper = visibilityHelper; this.typeScope = typeScope; this.strict = strict; }
Example #26
Source File: ConstructorTypeScopeWrapper.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
public ConstructorTypeScopeWrapper(EObject context, IVisibilityHelper visibilityHelper, IScope typeScope) { this(context, visibilityHelper, typeScope, false); }
Example #27
Source File: XtendValidator.java From xtext-xtend with Eclipse Public License 2.0 | 4 votes |
protected void doCheckOverriddenMethods(XtendTypeDeclaration xtendType, JvmGenericType inferredType, ResolvedFeatures resolvedFeatures, Set<EObject> flaggedOperations) { List<IResolvedOperation> operationsMissingImplementation = null; boolean doCheckAbstract = !inferredType.isAbstract(); if (doCheckAbstract) { operationsMissingImplementation = Lists.newArrayList(); } IVisibilityHelper visibilityHelper = new ContextualVisibilityHelper(this.visibilityHelper, resolvedFeatures.getType()); boolean flaggedType = false; for (IResolvedOperation operation : resolvedFeatures.getAllOperations()) { JvmDeclaredType operationDeclaringType = operation.getDeclaration().getDeclaringType(); if (operationDeclaringType != inferredType) { if (operationsMissingImplementation != null && operation.getDeclaration().isAbstract()) { operationsMissingImplementation.add(operation); } if (visibilityHelper.isVisible(operation.getDeclaration())) { String erasureSignature = operation.getResolvedErasureSignature(); List<IResolvedOperation> declaredOperationsWithSameErasure = resolvedFeatures.getDeclaredOperations(erasureSignature); for (IResolvedOperation localOperation : declaredOperationsWithSameErasure) { if (!localOperation.isOverridingOrImplementing(operation.getDeclaration()).isOverridingOrImplementing()) { EObject source = findPrimarySourceElement(localOperation); if (operation.getDeclaration().isStatic() && !localOperation.getDeclaration().isStatic()) { if (!isInterface(operationDeclaringType)) { if (flaggedOperations.add(source)) { error("The instance method " + localOperation.getSimpleSignature() + " cannot override the static method " + operation.getSimpleSignature() + " of type " + getDeclaratorName(operation.getDeclaration()) + ".", source, nameFeature(source), DUPLICATE_METHOD); } } } else if (!operation.getDeclaration().isStatic() && localOperation.getDeclaration().isStatic()) { if (flaggedOperations.add(source)) { error("The static method " + localOperation.getSimpleSignature() + " cannot hide the instance method " + operation.getSimpleSignature() + " of type " + getDeclaratorName(operation.getDeclaration()) + ".", source, nameFeature(source), DUPLICATE_METHOD); } } else if (flaggedOperations.add(source)) { error("Name clash: The method " + localOperation.getSimpleSignature() + " of type " + inferredType.getSimpleName() + " has the same erasure as " + operation.getSimpleSignature() + " of type " + getDeclaratorName(operation.getDeclaration()) + " but does not override it.", source, nameFeature(source), DUPLICATE_METHOD); } } } if (operation instanceof ConflictingDefaultOperation && contributesToConflict(inferredType, (ConflictingDefaultOperation) operation) && !flaggedType) { IResolvedOperation conflictingOperation = ((ConflictingDefaultOperation) operation).getConflictingOperations() .get(0); // Include the declaring class in the issue code in order to give better quick fixes String[] uris = new String[] { getDeclaratorName(operation.getDeclaration()) + "|" + EcoreUtil.getURI(operation.getDeclaration()).toString(), getDeclaratorName(conflictingOperation.getDeclaration()) + "|" + EcoreUtil.getURI(conflictingOperation.getDeclaration()).toString() }; if (!operation.getDeclaration().isAbstract() && !conflictingOperation.getDeclaration().isAbstract()) { error("The type " + inferredType.getSimpleName() + " inherits multiple implementations of the method " + conflictingOperation.getSimpleSignature() + " from " + getDeclaratorName(conflictingOperation.getDeclaration()) + " and " + getDeclaratorName(operation.getDeclaration()) + ".", xtendType, XtendPackage.Literals.XTEND_TYPE_DECLARATION__NAME, CONFLICTING_DEFAULT_METHODS, uris); } else { // At least one of the operations is non-abstract IResolvedOperation abstractOp, nonabstractOp; if (operation.getDeclaration().isAbstract()) { abstractOp = operation; nonabstractOp = conflictingOperation; } else { abstractOp = conflictingOperation; nonabstractOp = operation; } error("The non-abstract method " + nonabstractOp.getSimpleSignature() + " inherited from " + getDeclaratorName(nonabstractOp.getDeclaration()) + " conflicts with the method " + abstractOp.getSimpleSignature() + " inherited from " + getDeclaratorName(abstractOp.getDeclaration()) + ".", xtendType, XtendPackage.Literals.XTEND_TYPE_DECLARATION__NAME, CONFLICTING_DEFAULT_METHODS, uris); } flaggedType = true; } } } } if (operationsMissingImplementation != null && !operationsMissingImplementation.isEmpty() && !flaggedType) { reportMissingImplementations(xtendType, inferredType, operationsMissingImplementation); } }
Example #28
Source File: SerializerScopeProvider.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
protected IScope doCreateConstructorCallSerializationScope(XConstructorCall context) { IScope typeScope = getScope(context, TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE); ConstructorTypeScopeWrapper result = new ConstructorTypeScopeWrapper(context, IVisibilityHelper.ALL, typeScope); return result; }
Example #29
Source File: OverrideTester.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
public OverrideTester() { this(IVisibilityHelper.ALL); }
Example #30
Source File: OverrideTester.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
@Inject public OverrideTester(IVisibilityHelper visibilityHelper) { this.visibilityHelper = visibilityHelper; }