TODO some code is duplicated in ResolvedFeature - extract delegator
972774
protected void resolveKnownArgumentType(XExpression argument, LightweightTypeReference knownType,
			/* @Nullable */ LightweightTypeReference declaredType, ITypeComputationState argumentState) {
		if (!(argumentState instanceof AbstractLinkingCandidate.ArgumentTypeComputationState))
			throw new IllegalArgumentException("argumentState was " + argumentState);
		AbstractLinkingCandidate<?>.ArgumentTypeComputationState castedArgumentState = (AbstractLinkingCandidate<?>.ArgumentTypeComputationState) argumentState;
		ResolvedTypes resolvedTypes = getState().getResolvedTypes();
		LightweightTypeReference copiedDeclaredType = declaredType != null ? declaredType.copyInto(resolvedTypes.getReferenceOwner()) : null;
		TypeExpectation expectation = new TypeExpectation(copiedDeclaredType, castedArgumentState, false);
		LightweightTypeReference copiedReceiverType = knownType.copyInto(resolvedTypes.getReferenceOwner());
		// TODO should we use the result of #acceptType?
		int defaultFlags = castedArgumentState.getDefaultFlags();
		resolvedTypes.acceptType(argument, expectation, copiedReceiverType, false, ConformanceFlags.UNCHECKED | defaultFlags);
		if (copiedDeclaredType != null)
			resolveAgainstActualType(copiedDeclaredType, copiedReceiverType, castedArgumentState);
	}
1241439
@Nullable static PolymerClassDefinition extractFromCallNode(
      Node callNode, AbstractCompiler compiler, GlobalNamespace globalNames) {
    Node descriptor = NodeUtil.getArgumentForCallOrNew(callNode, 0);
    if (descriptor == null || !descriptor.isObjectLit()) {
      // report bad class definition
      compiler.report(JSError.make(callNode, PolymerPassErrors.POLYMER_DESCRIPTOR_NOT_VALID));
      return null;
    }

    int paramCount = callNode.getChildCount() - 1;
    if (paramCount != 1) {
      compiler.report(JSError.make(callNode, PolymerPassErrors.POLYMER_UNEXPECTED_PARAMS));
      return null;
    }

    Node elName = NodeUtil.getFirstPropMatchingKey(descriptor, "is");
    if (elName == null) {
      compiler.report(JSError.make(callNode, PolymerPassErrors.POLYMER_MISSING_IS));
      return null;
    }

    Node target;
    if (NodeUtil.isNameDeclaration(callNode.getGrandparent())) {
      target = IR.name(callNode.getParent().getString());
    } else if (callNode.getParent().isAssign()) {
      target = callNode.getParent().getFirstChild().cloneTree();
    } else {
      String elNameStringBase =
          elName.isQualifiedName()
              ? elName.getQualifiedName().replace('.', '$')
              : elName.getString();
      String elNameString = CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_CAMEL, elNameStringBase);
      elNameString += "Element";
      target = IR.name(elNameString);
    }

    JSDocInfo classInfo = NodeUtil.getBestJSDocInfo(target);

    JSDocInfo ctorInfo = null;
    Node constructor = NodeUtil.getFirstPropMatchingKey(descriptor, "factoryImpl");
    if (constructor == null) {
      constructor = NodeUtil.emptyFunction();
      compiler.reportChangeToChangeScope(constructor);
      constructor.useSourceInfoFromForTree(callNode);
    } else {
      ctorInfo = NodeUtil.getBestJSDocInfo(constructor);
    }

    Node baseClass = NodeUtil.getFirstPropMatchingKey(descriptor, "extends");
    String nativeBaseElement = baseClass == null ? null : baseClass.getString();

    Node behaviorArray = NodeUtil.getFirstPropMatchingKey(descriptor, "behaviors");
    PolymerBehaviorExtractor behaviorExtractor =
        new PolymerBehaviorExtractor(compiler, globalNames);
    ImmutableList<BehaviorDefinition> behaviors = behaviorExtractor.extractBehaviors(behaviorArray);
    List<MemberDefinition> allProperties = new ArrayList<>();
    for (BehaviorDefinition behavior : behaviors) {
      overwriteMembersIfPresent(allProperties, behavior.props);
    }
    overwriteMembersIfPresent(
        allProperties,
        PolymerPassStaticUtils.extractProperties(
            descriptor,
            DefinitionType.ObjectLiteral,
            compiler,
            /** constructor= */
            null));

    FeatureSet newFeatures = null;
    if (!behaviors.isEmpty()) {
      newFeatures = behaviors.get(0).features;
      for (int i = 1; i < behaviors.size(); i++) {
        newFeatures = newFeatures.union(behaviors.get(i).features);
      }
    }

    List<MemberDefinition> methods = new ArrayList<>();
    for (Node keyNode : descriptor.children()) {
      boolean isFunctionDefinition =
          keyNode.isMemberFunctionDef()
              || (keyNode.isStringKey() && keyNode.getFirstChild().isFunction());
      if (isFunctionDefinition) {
        methods.add(
            new MemberDefinition(
                NodeUtil.getBestJSDocInfo(keyNode), keyNode, keyNode.getFirstChild()));
      }
    }

    return new PolymerClassDefinition(
        DefinitionType.ObjectLiteral,
        callNode,
        target,
        descriptor,
        classInfo,
        new MemberDefinition(ctorInfo, null, constructor),
        nativeBaseElement,
        allProperties,
        methods,
        behaviors,
        newFeatures);
  }
369347
function compileExtractionResult(orderedFiles, extractions) {
  const extractedVariables = { global: {} };

  orderedFiles.map(filename => {
    const globalFileVariables = extractions[filename].variables.global;

    Object.keys(globalFileVariables).map(variableKey => {
      globalFileVariables[variableKey].forEach(extractedVariable => {
        let variable = extractedVariables.global[variableKey];
        let currentVariableSources = [];
        let currentVariableDeclarations = [];

        if(variable) {
          currentVariableSources = variable.sources;
          currentVariableDeclarations = variable.declarations;
        }

        const hasOnlyDefaults = currentVariableDeclarations.every(declaration => declaration.flags.default);
        const currentIsDefault = extractedVariable.declaration.flags.default;

        if(currentVariableDeclarations.length === 0 || !currentIsDefault || hasOnlyDefaults) {
          variable = extractedVariables.global[variableKey] = Object.assign({}, extractedVariable.value);
        }
        variable.sources = currentVariableSources.indexOf(filename) < 0 ? [...currentVariableSources, filename] : currentVariableSources;
        variable.declarations = [...currentVariableDeclarations, {
          expression: extractedVariable.declaration.expression,
          flags: extractedVariable.declaration.flags,
          in: filename,
          position: extractedVariable.declaration.position,
        }];
      });
    });
  });

  return extractedVariables;
}
380547
public FunctionDescr function( PackageDescrBuilder pkg ) throws RecognitionException {
        FunctionDescrBuilder function = null;
        try {
            function = helper.start( pkg,
                                     FunctionDescrBuilder.class,
                                     null );

            // 'function'
            match( input,
                   DRL5Lexer.ID,
                   DroolsSoftKeywords.FUNCTION,
                   null,
                   DroolsEditorType.KEYWORD );
            if ( state.failed ) return null;

            if ( input.LA( 1 ) != DRL5Lexer.ID || input.LA( 2 ) != DRL5Lexer.LEFT_PAREN ) {
                // type
                String type = type();
                if ( state.failed ) return null;
                if ( state.backtracking == 0 ) function.returnType( type );
            }

            // name
            Token id = match( input,
                              DRL5Lexer.ID,
                              null,
                              null,
                              DroolsEditorType.IDENTIFIER );
            if ( state.failed ) return null;
            if ( state.backtracking == 0 ) {
                function.name( id.getText() );
                helper.setParaphrasesValue( DroolsParaphraseTypes.FUNCTION,
                                            "\"" + id.getText() + "\"" );
            }

            // arguments
            parameters( function,
                        true );
            if ( state.failed ) return null;

            // body
            String body = chunk( DRL5Lexer.LEFT_CURLY,
                                 DRL5Lexer.RIGHT_CURLY,
                                 -1 );
            if ( state.failed ) return null;
            if ( state.backtracking == 0 ) function.body( body );

        } catch ( RecognitionException re ) {
            reportError( re );
        } finally {
            helper.end( FunctionDescrBuilder.class,
                        function );
        }
        return (function != null) ? function.getDescr() : null;
    }
255893
private static BiFunction<AnnotatedValueResolver, ResolverContext, Object>
    resolver(List<RequestObjectResolver> objectResolvers, BeanFactoryId beanFactoryId) {
        return (resolver, ctx) -> {
            Object value = null;
            for (final RequestObjectResolver objectResolver : objectResolvers) {
                try {
                    value = objectResolver.convert(ctx, resolver.elementType(), beanFactoryId);
                    break;
                } catch (FallthroughException ignore) {
                    // Do nothing.
                } catch (Throwable cause) {
                    Exceptions.throwUnsafely(cause);
                }
            }
            if (value != null) {
                return value;
            }
            throw new IllegalArgumentException("No suitable request converter found for a @" +
                                               RequestObject.class.getSimpleName() + " '" +
                                               resolver.elementType().getSimpleName() + '\'');
        };
    }
245704
@Override
    protected void visitMethodCFG(MethodDescriptor methodDescriptor, CFG cfg) throws CheckedAnalysisException {
        if (METHOD != null && !methodDescriptor.getName().equals(METHOD)) {
            return;
        }

        if (methodDescriptor.getName().startsWith("access$")) {
            return;
        }

        XMethod xMethod = XFactory.createXMethod(methodDescriptor);
        if (DEBUG) {
            System.out.println("CheckTypeQualifiers: checking " + methodDescriptor.toString());
        }

        Collection<TypeQualifierValue<?>> relevantQualifiers = Analysis.getRelevantTypeQualifiers(methodDescriptor, cfg);
        for(Iterator<TypeQualifierValue<?>> i = relevantQualifiers.iterator(); i.hasNext();  ) {
            if (i.next().getTypeQualifierClassDescriptor().getClassName().equals(NONNULL_ANNOTATION)) {
                i.remove();
            }
        }
        if (relevantQualifiers.isEmpty()) {
            return;
        }
        if (DEBUG) {
            System.out.println("  Relevant type qualifiers are " + relevantQualifiers);
        }
        IAnalysisCache analysisCache = Global.getAnalysisCache();
        ForwardTypeQualifierDataflowFactory forwardDataflowFactory = analysisCache.getMethodAnalysis(
                ForwardTypeQualifierDataflowFactory.class, methodDescriptor);
        BackwardTypeQualifierDataflowFactory backwardDataflowFactory = analysisCache.getMethodAnalysis(
                BackwardTypeQualifierDataflowFactory.class, methodDescriptor);
        ValueNumberDataflow vnaDataflow = analysisCache.getMethodAnalysis(ValueNumberDataflow.class, methodDescriptor);

        for (TypeQualifierValue<?> typeQualifierValue : relevantQualifiers) {

            try {
                checkQualifier(xMethod, cfg, typeQualifierValue, forwardDataflowFactory, backwardDataflowFactory,
                        vnaDataflow);
            } catch (MissingClassException e) {
                AnalysisContext.reportMissingClass(e);
            } catch (CheckedAnalysisException e) {
                bugReporter.logError("Exception checking type qualifier " + typeQualifierValue.toString() + " on method "
                        + methodDescriptor.toString(), e);
            }
        }
    }
1058966
static ResolveResult<? extends AbstractConfigValue> resolveSubstitutions(ReplaceableMergeStack replaceable,
            List<AbstractConfigValue> stack,
            ResolveContext context, ResolveSource source) throws NotPossibleToResolve {
        if (ConfigImpl.traceSubstitutionsEnabled()) {
            ConfigImpl.trace(context.depth(), "delayed merge stack has " + stack.size() + " items:");
            int count = 0;
            for (AbstractConfigValue v : stack) {
                ConfigImpl.trace(context.depth() + 1, count + ": " + v);
                count += 1;
            }
        }

        // to resolve substitutions, we need to recursively resolve
        // the stack of stuff to merge, and merge the stack so
        // we won't be a delayed merge anymore. If restrictToChildOrNull
        // is non-null, or resolve options allow partial resolves,
        // we may remain a delayed merge though.

        ResolveContext newContext = context;
        int count = 0;
        AbstractConfigValue merged = null;
        for (AbstractConfigValue end : stack) {
            // the end value may or may not be resolved already

            ResolveSource sourceForEnd;

            if (end instanceof ReplaceableMergeStack)
                throw new ConfigException.BugOrBroken("A delayed merge should not contain another one: " + replaceable);
            else if (end instanceof Unmergeable) {
                // the remainder could be any kind of value, including another
                // ConfigDelayedMerge
                AbstractConfigValue remainder = replaceable.makeReplacement(context, count + 1);

                if (ConfigImpl.traceSubstitutionsEnabled())
                    ConfigImpl.trace(newContext.depth(), "remainder portion: " + remainder);

                // If, while resolving 'end' we come back to the same
                // merge stack, we only want to look _below_ 'end'
                // in the stack. So we arrange to replace the
                // ConfigDelayedMerge with a value that is only
                // the remainder of the stack below this one.

                if (ConfigImpl.traceSubstitutionsEnabled())
                    ConfigImpl.trace(newContext.depth(), "building sourceForEnd");

                // we resetParents() here because we'll be resolving "end"
                // against a root which does NOT contain "end"
                sourceForEnd = source.replaceWithinCurrentParent((AbstractConfigValue) replaceable, remainder);

                if (ConfigImpl.traceSubstitutionsEnabled())
                    ConfigImpl.trace(newContext.depth(), "  sourceForEnd before reset parents but after replace: "
                            + sourceForEnd);

                sourceForEnd = sourceForEnd.resetParents();
            } else {
                if (ConfigImpl.traceSubstitutionsEnabled())
                    ConfigImpl.trace(newContext.depth(),
                            "will resolve end against the original source with parent pushed");

                sourceForEnd = source.pushParent(replaceable);
            }

            if (ConfigImpl.traceSubstitutionsEnabled()) {
                ConfigImpl.trace(newContext.depth(), "sourceForEnd      =" + sourceForEnd);
            }

            if (ConfigImpl.traceSubstitutionsEnabled())
                ConfigImpl.trace(newContext.depth(), "Resolving highest-priority item in delayed merge " + end
                        + " against " + sourceForEnd + " endWasRemoved=" + (source != sourceForEnd));
            ResolveResult<? extends AbstractConfigValue> result = newContext.resolve(end, sourceForEnd);
            AbstractConfigValue resolvedEnd = result.value;
            newContext = result.context;

            if (resolvedEnd != null) {
                if (merged == null) {
                    merged = resolvedEnd;
                } else {
                    if (ConfigImpl.traceSubstitutionsEnabled())
                        ConfigImpl.trace(newContext.depth() + 1, "merging " + merged + " with fallback " + resolvedEnd);
                    merged = merged.withFallback(resolvedEnd);
                }
            }

            count += 1;

            if (ConfigImpl.traceSubstitutionsEnabled())
                ConfigImpl.trace(newContext.depth(), "stack merged, yielding: " + merged);
        }

        return ResolveResult.make(newContext, merged);
    }
1038632
ImmutableList<AnnotationMirror> annotationsToCopy(
      Element autoValueType, Element typeOrMethod, Set<String> excludedAnnotations) {
    ImmutableList.Builder<AnnotationMirror> result = ImmutableList.builder();
    for (AnnotationMirror annotation : typeOrMethod.getAnnotationMirrors()) {
      String annotationFqName = getAnnotationFqName(annotation);
      // To be included, the annotation should not be in com.google.auto.value,
      // and it should not be in the excludedAnnotations set.
      if (!isInAutoValuePackage(annotationFqName)
          && !excludedAnnotations.contains(annotationFqName)
          && annotationVisibleFrom(annotation, autoValueType)) {
        result.add(annotation);
      }
    }

    return result.build();
  }
796780
void resolveFeatures(ResolutionMode mode) {
        boolean allowMultipleVersions = mode == ResolutionMode.IGNORE_CONFLICTS ? true : false;
        FeatureResolver resolver = new FeatureResolverImpl();
        Result result = resolver.resolveFeatures(resolverRepository, featureNamesToResolve, Collections.<String> emptySet(), allowMultipleVersions);
        for (String name : result.getResolvedFeatures()) {
            ProvisioningFeatureDefinition feature = resolverRepository.getFeature(name);
            resolvedFeatures.put(feature.getSymbolicName(), feature);
        }

        for (String missingFeature : result.getMissing()) {
            Collection<ApplicableToProduct> featureOtherProducts = resolverRepository.getNonApplicableResourcesForName(missingFeature);
            if (featureOtherProducts.isEmpty()) {
                featuresMissing.add(missingFeature);
            } else {
                requirementsFoundForOtherProducts.add(missingFeature);
                for (ApplicableToProduct feature : featureOtherProducts) {
                    resourcesWrongProduct.add(feature);
                }
            }
        }
    }
513086
function reportDuplicateLabels( ast, session ) {

    let check;

    function checkExpressionWithClonedEnv( node, env ) {

        check( node.expression, util.clone( env ) );

    }

    check = session.buildVisitor( {
        rule( node ) {

            check( node.expression, {} );

        },

        choice( node, env ) {

            node.alternatives.forEach( alternative => {

                check( alternative, util.clone( env ) );

            } );

        },

        action: checkExpressionWithClonedEnv,

        labeled( node, env ) {

            const label = node.label;

            if ( label && __hasOwnProperty.call( env, label ) ) {

                const start = env[ label ].start;

                session.error(
                    `Label "${ label }" is already defined at line ${ start.line }, column ${ start.column }.`,
                    node.location
                );

            }

            check( node.expression, env );

            if ( label ) env[ label ] = node.location;

        },

        text: checkExpressionWithClonedEnv,
        simple_and: checkExpressionWithClonedEnv,
        simple_not: checkExpressionWithClonedEnv,
        optional: checkExpressionWithClonedEnv,
        zero_or_more: checkExpressionWithClonedEnv,
        one_or_more: checkExpressionWithClonedEnv,
        group: checkExpressionWithClonedEnv
    } );

    check( ast );

}
1089902
function preprocessRawResults(rawResults, resolvedConfig) {
    rawResults.forEach((rawResult, resultId) => {
        if (!rawResult.attributePath) return; // e.g. sub-filter results don't need indexing

        // link resultIds into attribute tree (per DataSource):
        const attrNode = getAttribute(rawResult.attributePath, resolvedConfig);
        attrNode.dataSources[rawResult.dataSourceName].resultId = resultId;

        // index rows by childKey if available
        // (top-level result has no childKey and does not need to be indexed):
        if (rawResult.childKey) {
            const keyAttr = rawResult.childKey.length === 1 ? rawResult.childKey[0] : null;
            rawResult.indexedData = {};
            rawResult.data.forEach((row, i) => {
                function dereferenceKeyAttr(keyAttrib) {
                    const keyVal = row[keyAttrib];
                    if (keyVal === undefined) {
                        const attrPath =
                            rawResult.attributePath.length > 0 ? rawResult.attributePath.join('.') : '{root}';
                        throw new DataError(
                            `Result-row ${i} of "${attrPath}" (DataSource "${
                                rawResult.dataSourceName
                            }") misses child key attribute "${keyAttr}"`
                        );
                    }
                    return keyVal;
                }

                const key = keyAttr
                    ? '' + dereferenceKeyAttr(keyAttr) // speed up non-composite keys
                    : rawResult.childKey.map(dereferenceKeyAttr).join(keySeparator);

                if (!rawResult.uniqueChildKey) {
                    if (!rawResult.indexedData[key]) rawResult.indexedData[key] = [];
                    rawResult.indexedData[key].push(row);
                } else {
                    if (rawResult.indexedData[key]) {
                        const attrPath =
                            rawResult.attributePath.length > 0 ? rawResult.attributePath.join('.') : '{root}';
                        throw new DataError(
                            `Result-row ${i} of "${attrPath}" (DataSource "${
                                rawResult.dataSourceName
                            }") has duplicate child key "${key}"`
                        );
                    }
                    rawResult.indexedData[key] = row;
                }
            });
        }
    });
}
247792
private static void extractFromReturnDescendant(Builder builder, Node node)
      throws MalformedException {

    switch (node.getToken()) {
      case STRING:
        builder.appendStringPart(node.getString());
        break;
      case NAME:
        builder.appendPlaceholderReference(node.getString());
        break;
      case ADD:
        for (Node child : node.children()) {
          extractFromReturnDescendant(builder, child);
        }
        break;
      default:
        throw new MalformedException(
            "STRING, NAME, or ADD node expected; found: " + node.getToken(), node);
    }
  }
1256344
@SuppressWarnings("unchecked")
    private static <V> V resolve(ProvidenceConfigContext context,
                                 Token token,
                                 Tokenizer tokenizer,
                                 PDescriptor descriptor) throws TokenizerException {
        Object value = resolveAny(context, token, tokenizer);
        if (value == null) {
            return null;
        }
        return (V) asType(descriptor, value);
    }
302681
@Override
  public Description matchMethodInvocation(MethodInvocationTree t, VisitorState state) {
    String arg1;
    String arg2;
    if (instanceEqualsMatcher.matches(t, state)) {
      arg1 = state.getSourceForNode(((JCFieldAccess) t.getMethodSelect()).getExpression());
      arg2 = state.getSourceForNode(t.getArguments().get(0));
    } else if (staticEqualsMatcher.matches(t, state)) {
      arg1 = state.getSourceForNode(t.getArguments().get(0));
      arg2 = state.getSourceForNode(t.getArguments().get(1));
    } else {
      return NO_MATCH;
    }

    Fix fix =
        SuggestedFix.builder()
            .replace(t, "Arrays.equals(" + arg1 + ", " + arg2 + ")")
            .addImport("java.util.Arrays")
            .build();
    return describeMatch(t, fix);
  }
528672
@Override
	@SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity"})
	protected void doCheckFunctionOverrides(EObject sourceElement, IResolvedOperation resolved,
			List<IResolvedOperation> allInherited) {
		boolean overrideProblems = false;
		List<IResolvedOperation> exceptionMismatch = null;
		for (final IResolvedOperation inherited: allInherited) {
			if (inherited.getOverrideCheckResult().hasProblems()) {
				overrideProblems = true;
				final EnumSet<OverrideCheckDetails> details = inherited.getOverrideCheckResult().getDetails();
				if (details.contains(OverrideCheckDetails.IS_FINAL)) {
					error(MessageFormat.format(Messages.SARLValidator_43, inherited.getSimpleSignature()),
							sourceElement,
							nameFeature(sourceElement), OVERRIDDEN_FINAL);
				} else if (details.contains(OverrideCheckDetails.REDUCED_VISIBILITY)) {
					error(MessageFormat.format(Messages.SARLValidator_44,
							inherited.getSimpleSignature()),
							sourceElement, nameFeature(sourceElement), OVERRIDE_REDUCES_VISIBILITY);
				} else if (details.contains(OverrideCheckDetails.EXCEPTION_MISMATCH)) {
					if (exceptionMismatch == null) {
						exceptionMismatch = Lists.newArrayListWithCapacity(allInherited.size());
					}
					exceptionMismatch.add(inherited);
				} else if (details.contains(OverrideCheckDetails.RETURN_MISMATCH)) {
					final JvmTypeReference inheritedReturnType = inherited.getOverrideCheckResult().getGivenOperation().getReturnType();
					final LightweightTypeReference resolvedReturnType = inherited.getOverrideCheckResult().getThisOperation().getResolvedReturnType();
					final String signature = inherited.getSimpleSignature();
					final EStructuralFeature sourceReturnTypeFeature = returnTypeFeature(sourceElement);
					// FIXME: The following test is due to the fact that the resource sets of the two types may be different.
					final String resolvedIdentifier = resolvedReturnType.getIdentifier();
					final String inheritedIdentifier = inheritedReturnType.getIdentifier();
					if (!Objects.equal(resolvedIdentifier, inheritedIdentifier)) {
						error(MessageFormat.format(Messages.SARLValidator_45,
								signature,
								resolvedIdentifier,
								inheritedIdentifier),
								sourceElement,
								sourceReturnTypeFeature,
								INCOMPATIBLE_RETURN_TYPE,
								resolvedIdentifier);
					}
				}
			} else if (!isIgnored(RETURN_TYPE_SPECIFICATION_IS_RECOMMENDED, sourceElement)
					&& sourceElement instanceof SarlAction) {
				final SarlAction function = (SarlAction) sourceElement;
				if (function.getReturnType() == null && !inherited.getResolvedReturnType().isPrimitiveVoid()) {
					warning(MessageFormat.format(Messages.SARLValidator_46,
							resolved.getResolvedReturnType().getHumanReadableName()),
							sourceElement,
							returnTypeFeature(sourceElement), RETURN_TYPE_SPECIFICATION_IS_RECOMMENDED,
							inherited.getResolvedReturnType().getIdentifier());
				}
			}
		}
		if (exceptionMismatch != null) {
			createExceptionMismatchError(resolved, sourceElement, exceptionMismatch);
		}
		if (sourceElement instanceof SarlAction) {
			final SarlAction function = (SarlAction) sourceElement;
			if (!overrideProblems && !function.isOverride() && !function.isStatic()
					&& !isIgnored(MISSING_OVERRIDE, sourceElement)) {
				warning(MessageFormat.format(Messages.SARLValidator_47,
						resolved.getSimpleSignature(),
						getDeclaratorName(resolved)),
						function,
						XTEND_FUNCTION__NAME, MISSING_OVERRIDE);
			}
			if (!overrideProblems && function.isOverride() && function.isStatic()) {
				for (final IResolvedOperation inherited: allInherited) {
					error(MessageFormat.format(Messages.SARLValidator_48,
							resolved.getSimpleSignature(),
							getDeclaratorName(resolved),
							resolved.getSimpleSignature(),
							getDeclaratorName(inherited)),
							function, XTEND_FUNCTION__NAME,
							function.getModifiers().indexOf(Messages.SARLValidator_49),
							OBSOLETE_OVERRIDE);
				}
			}
		}
	}
379384
private Class<? extends ConsoleEditor> resolve(String flavor) throws EditorInitializationException {
        ClassLoader classLoader = getClass().getClassLoader();
        try {
            Enumeration<URL> urls = classLoader.getResources(RESOURCE_PATH + flavor);
            while (urls.hasMoreElements()) {
                URL url = urls.nextElement();
                String txt = Resources.toString(url);
                String[] jleditClasses = txt.split("\n");
                for (String jleditClass : jleditClasses) {
                    if (!jleditClass.isEmpty()) {
                        Class clazz = classLoader.loadClass(jleditClass);
                        if (ConsoleEditor.class.isAssignableFrom(clazz)) {
                            return clazz;
                        }
                    }
                }
            }
        } catch (Exception e) {
            throw new EditorInitializationException(e);
        }
        throw new EditorInitializationException("No Editor found for flavor:" + flavor);
    }
754037
protected void dupHideCheck(List<PDefinition> list, NameScope scope)
	{
		LexNameList allnames = af.createPDefinitionListAssistant().getVariableNames(list);

		for (ILexNameToken n1 : allnames)
		{
			LexNameList done = new LexNameList();

			for (ILexNameToken n2 : allnames)
			{
				if (n1 != n2 && n1.equals(n2) && !done.contains(n1))
				{
					TypeChecker.warning(5007, "Duplicate definition: " + n1, n1.getLocation());
					done.add(n1);
				}
			}

			if (outer != null)
			{
				// We search for any scoped name (ie. the first), but then check
				// the scope matches what we can see. If we pass scope to findName
				// it throws errors if the name does not match the scope.

				PDefinition def = outer.findName(n1, NameScope.NAMESANDSTATE);

				// TODO: RWL: This is not sound, however the behaviour below is not sound
				// in case def.getNameScope is null.
				if (def != null && def.getNameScope() == null)
				{
					def.setNameScope(NameScope.GLOBAL);
				}

				if (def != null && !def.getLocation().equals(n1.getLocation())
						&& def.getNameScope().matches(scope))
				{
					// Reduce clutter for names in the same module/class
					String message = null;

					if (def.getLocation().getFile().equals(n1.getLocation().getFile()))
					{
						message = def.getName() + " "
								+ def.getLocation().toShortString()
								+ " hidden by " + n1.getFullName();
					} else
					{
						message = def.getName() + " " + def.getLocation()
								+ " hidden by " + n1.getFullName();
					}

					TypeChecker.warning(5008, message, n1.getLocation());
				}
			}
		}
	}