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

com.android.build.gradle.shrinker.PostProcessingData Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (C) 2016 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.build.gradle.shrinker;

import com.android.annotations.NonNull;
import com.google.common.base.MoreObjects;
import com.google.common.collect.Sets;

import java.util.Set;

/**
 * Data object that records all "tasks" that need to be done, once all the graph nodes are in place.
 *
 * 

Many edges can only be added to the graph, once the whole class structure is known. That's why * we record nodes that need "additional attention" for later, when reading input classes. */ class PostProcessingData { @NonNull private final Set virtualMethods = Sets.newConcurrentHashSet(); @NonNull private final Set multipleInheritance = Sets.newConcurrentHashSet(); @NonNull private final Set interfaceInheritance = Sets.newConcurrentHashSet(); @NonNull private final Set> unresolvedReferences = Sets.newConcurrentHashSet(); @NonNull Set getVirtualMethods() { return virtualMethods; } @NonNull Set getMultipleInheritance() { return multipleInheritance; } @NonNull Set getInterfaceInheritance() { return interfaceInheritance; } @NonNull Set> getUnresolvedReferences() { return unresolvedReferences; } static class UnresolvedReference { @NonNull final T method; @NonNull final T target; final boolean invokespecial; @NonNull final DependencyType dependencyType; UnresolvedReference(@NonNull T method, @NonNull T target, boolean invokespecial) { this.method = method; this.target = target; this.invokespecial = invokespecial; this.dependencyType = DependencyType.REQUIRED_CODE_REFERENCE; } public UnresolvedReference( @NonNull T method, @NonNull T target, boolean invokespecial, @NonNull DependencyType dependencyType) { this.method = method; this.target = target; this.dependencyType = dependencyType; this.invokespecial = invokespecial; } @Override public String toString() { return MoreObjects.toStringHelper(this) .add("method", method) .add("target", target) .add("invokespecial", invokespecial) .toString(); } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy