All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.eclipse.jdt.internal.core.dom.rewrite.imports.OnDemandReduction Maven / Gradle / Ivy

/*******************************************************************************
 * Copyright (c) 2015 Google Inc and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     John Glassmyer  - import group sorting is broken - https://bugs.eclipse.org/430303
 *******************************************************************************/
package org.eclipse.jdt.internal.core.dom.rewrite.imports;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;

/**
 * Indicates that one or more single imports ({@code reducibleImports}) are unnecessary or could be
 * rendered unnecessary by the presence of an on-demand (.*) import ({@code containerOnDemand}) of
 * their containing type or package.
 * 

* This "reduction" can be applied by removing all declarations of {@code reducibleImports} * from the compilation unit and adding a declaration of {@code containerOnDemand} to the * compilation unit if one is not already present. */ class OnDemandReduction { final ImportName containerOnDemand; final Collection reducibleImports; OnDemandReduction(ImportName containerName, Collection reducibleImports) { this.containerOnDemand = containerName; this.reducibleImports = Collections.unmodifiableCollection(new ArrayList(reducibleImports)); } @Override public String toString() { return String.format("{%s: %s}", this.containerOnDemand.containerName, this.reducibleImports); //$NON-NLS-1$ } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy