Translate the given dependency descriptor to the an artifact specification while overriding the scope as well.

@param desc  the dependency descriptor reference.
@param scope the scope that needs to be set on the result.
@return an artifact sepcification.
559383
private static ArtifactSpec toArtifactSpec(DependencyDescriptor desc, String scope) {
        return new ArtifactSpec(scope, desc.getGroup(), desc.getName(), desc.getVersion(), desc.getType(),
                                desc.getClassifier(), desc.getFile());
    }
1044363
public void makeScope(IScope scope) {
        log.debug("makeScope: {}", scope);
        String path = scope.getContextPath();
        WebSocketScope wsScope = null;
        if (!scopes.containsKey(path)) {
            // add the name to the collection (no '/' prefix)
            activeRooms.add(scope.getName());
            // new websocket scope for the server scope
            wsScope = new WebSocketScope();
            wsScope.setPath(path);
            wsScope.setScope(scope);
            notifyListeners(WebSocketEvent.SCOPE_CREATED, wsScope);
            addWebSocketScope(wsScope);
            log.debug("Use the IWebSocketScopeListener interface to be notified of new scopes");
        } else {
            log.debug("Scope already exists: {}", path);
        }
    }
771986
public void addDescription(String desc) {
		XmpArray array = new XmpArray(XmpArray.ALTERNATIVE);
		array.add(desc);
		setProperty(DESCRIPTION, array);
	}
192715
private KeyScope resolveIntermediate(final KeyScope scope) {
        final Map<String, KeyDef> keys = new HashMap<>(scope.keyDefinition);
        for (final Map.Entry<String, KeyDef> e: scope.keyDefinition.entrySet()) {
            final KeyDef res = resolveIntermediate(scope, e.getValue(), Collections.singletonList(e.getValue()));
            keys.put(e.getKey(), res);
        }
        final List<KeyScope> children = new ArrayList<>();
        for (final KeyScope child: scope.childScopes) {
            final KeyScope resolvedChild = resolveIntermediate(child);
            children.add(resolvedChild);
        }
        return new KeyScope(scope.id, scope.name, keys, children);
    }
629781
<S extends StaticScope> void addScopes(Collection<S> scopes) {
    for (S scope : scopes) {
      createScopeFrom(scope);
    }
  }
714184
public static TableFormat makeTableFormat(final TableDescription desc)
    {
        return new AdvancedWritableTableFormat()
        {
            public Class getColumnClass(int i)
            {
                return desc.getType(i);
            }

            public Comparator getColumnComparator(int i)
            {
                Comparator comp = desc.getColumnComparator(i);
                if (comp != null)
                    return comp;

                Class type = getColumnClass(i);
                if (Boolean.class.isAssignableFrom(type) || Boolean.TYPE.isAssignableFrom(type))
                    return GlazedLists.booleanComparator();
                else if (String.class.isAssignableFrom(type))
                    return getLowerCaseStringComparator();
                else if(Comparable.class.isAssignableFrom(type))
                    return GlazedLists.comparableComparator();
                else
                    return null;
            }

            public int getColumnCount()
            {
                return desc.getColumnCount();
            }

            public String getColumnName(int i)
            {
                return desc.getHeader(i);
            }

            public Object getColumnValue(Object obj, int i)
            {
                return desc.getValue(obj, i);
            }

            public boolean isEditable(Object baseObject, int column)
            {
                return desc.getColumnEditor(column) != null;
            }

            public Object setColumnValue(Object baseObject, Object editedValue, int column)
            {
                desc.setValue(baseObject, column, editedValue);
                return baseObject;
            }
        };
    }
531776
public List<Dependency> getDependencies(List<String> scopes) {
        log.debug( "Valid scopes: {}", scopes );
        List<Dependency> dependencies = new ArrayList<Dependency>();

        for (Dependency dependency : getMavenModel().getDependencies()) {

            // Substitute Properties
            // XXX: There has to be a way maven handles this automatically
            log.debug( "Project properties: {} ", this.mavenModel.getProperties() );
            String artifactId = substituteProperty(dependency.getArtifactId());
            String groupId    = substituteProperty(dependency.getGroupId());
            String version    = substituteProperty(dependency.getVersion());
            String type       = substituteProperty(dependency.getType());
            String classifier = substituteProperty(dependency.getClassifier());
            String systemPath = substituteProperty(dependency.getSystemPath());

            dependency.setSystemPath(systemPath);
            dependency.setArtifactId(artifactId);
            dependency.setGroupId(groupId);
            dependency.setVersion(version);
            dependency.setType(type);
            dependency.setClassifier( classifier );

            dependencies.add(dependency);
        }


        if ( scopes == null ) {
            scopes = Arrays.asList( "compile", "runtime" );
        }

        for ( Iterator<Dependency> iterator = dependencies.iterator(); iterator.hasNext(); ) {
            Dependency dependency = iterator.next();

            String scope = dependency.getScope();

            // Default scope for dependencies is compile
            if ( scope == null ) {
                scope = "compile";
            }

            if ( !scopes.contains( scope ) ) {
                log.debug( "Removing {} with scope {}", dependency, dependency.getScope() );
                iterator.remove();
            }
        }

        return dependencies;
    }
83265
protected CompositeScope createCompositeScope(EObject featureCall, IScope parent, IFeatureScopeSession session) {
		return new CompositeScope(parent, session, asAbstractFeatureCall(featureCall));
	}
996932
public function setDescription($desc)
    {
        $descAttribute = $this->descriptionAttribute;
        return is_string($descAttribute) ? $this->$descAttribute = $desc : null;
    }
1100911
public IScope createFeatureCallScope(EObject context, EReference reference, IFeatureScopeSession session, IResolvedTypes resolvedTypes) {
		if (!isFeatureCallScope(reference)) {
			throw new IllegalArgumentException(String.valueOf(reference));
		}
		if (!(context instanceof XAbstractFeatureCall)) {
			return IScope.NULLSCOPE;
		}
		XAbstractFeatureCall call = (XAbstractFeatureCall) context;
		final XExpression syntacticalReceiver = getSyntacticalReceiver(call);
		if (syntacticalReceiver == null) {
			IScope result = createSimpleFeatureCallScope(call, session, resolvedTypes);
			return result;
		}
		IScope result = createFeatureCallScopeForReceiver(call, syntacticalReceiver, session, resolvedTypes);
		return result;
	}
89332
public static <ContainingType extends Message, Type>
      GeneratedExtension<ContainingType, Type>
      newMessageScopedGeneratedExtension(final Message scope,
                                         final int descriptorIndex,
                                         final Class singularType,
                                         final Message defaultInstance) {
    // For extensions scoped within a Message, we use the Message to resolve
    // the outer class's descriptor, from which the extension descriptor is
    // obtained.
    return new GeneratedExtension<ContainingType, Type>(
        new ExtensionDescriptorRetriever() {
          //@Override (Java 1.6 override semantics, but we must support 1.5)
          public FieldDescriptor getDescriptor() {
            return scope.getDescriptorForType().getExtensions()
                .get(descriptorIndex);
          }
        },
        singularType,
        defaultInstance);
  }
1325648
public <T, E extends T> void copyPropertiesOfInheritedClass(final T src, final E dest) {
        if (src == null) {
            throw new IllegalArgumentException("src can't be null");
        }
        if (dest == null) {
            throw new IllegalArgumentException("dest can't be null");
        }
        final Class<? extends Object> srcClz = src.getClass();
        final Class<? extends Object> destClz = dest.getClass();
        if (srcClz.isArray()) {
            if (!destClz.isArray()) {
                throw new IllegalArgumentException("can't copy from array to non-array class " + destClz);
            }
            final int length = Array.getLength(src);
            for (int i = 0; i < length; i++) {
                final Object v = Array.get(src, i);
                Array.set(dest, i, v);
            }
            return;
        }
        final List<Field> fields = allFields(srcClz);
        for (final Field field : fields) {
            if (!Modifier.isStatic(field.getModifiers())) {
                try {
                    final Object fieldObject = field.get(src);
                    field.set(dest, fieldObject);
                } catch (final IllegalArgumentException e) {
                    throw new RuntimeException(e);
                } catch (final IllegalAccessException e) {
                    throw new RuntimeException(e);
                }
            }
        }
    }
940159
public static Scope splitScope(Scope scope) {
        Scope result = new Scope(scope.getType());
        result.symbolTable = scope.symbolTable;
        scope.symbolTable = null;
        result.parent = scope.parent;
        result.setParentScope(scope.getParentScope());
        result.setParentScope(result);
        scope.parent = result;
        result.top = scope.top;
        return result;
    }
7578
public CompletableFuture<CreateScopeStatus> createScope(final String scope) {
        Exceptions.checkNotNullOrEmpty(scope, "scope");
        try {
            NameUtils.validateScopeName(scope);
        } catch (IllegalArgumentException | NullPointerException e) {
            log.warn("Create scope failed due to invalid scope name {}", scope);
            return CompletableFuture.completedFuture(CreateScopeStatus.newBuilder().setStatus(
                    CreateScopeStatus.Status.INVALID_SCOPE_NAME).build());
        }
        return streamStore.createScope(scope);
    }
104934
function ReferencedIdentifier(node, parent, scope, state) {
    var ref = state.letReferences[node.name];

    // not a part of our scope
    if (!ref) return;

    // this scope has a variable with the same name so it couldn't belong
    // to our let scope
    var localBinding = scope.getBindingIdentifier(node.name);
    if (localBinding && localBinding !== ref) return;

    state.closurify = true;
  }
861205
public static String getTofuExtensionImport(FieldDescriptor desc) {
    // This is run by GenerateParseInfoVisitor, which doesn't necessarily have a classpath
    // dependency on the proto, just a data dependency on the descriptor.

    String extensionFieldName = JavaQualifiedNames.getFieldName(desc, false);

    String extensionFieldHolderClassName;
    if (desc.getExtensionScope() != null) {
      extensionFieldHolderClassName = JavaQualifiedNames.getQualifiedName(desc.getExtensionScope());
    } else {
      // else we have a 'top level extension'
      extensionFieldHolderClassName =
          JavaQualifiedNames.getPackage(desc.getFile())
              + "."
              + JavaQualifiedNames.getOuterClassname(desc.getFile());
    }
    return extensionFieldHolderClassName + "." + extensionFieldName + ".getDescriptor()";
  }
859220
@SuppressWarnings("static-method")
	public Dependency toDependency(Artifact artifact) {
		final Dependency result = new Dependency();
		result.setArtifactId(artifact.getArtifactId());
		result.setClassifier(artifact.getClassifier());
		result.setGroupId(artifact.getGroupId());
		result.setOptional(artifact.isOptional());
		result.setScope(artifact.getScope());
		result.setType(artifact.getType());
		result.setVersion(artifact.getVersion());
		return result;
	}