001 /*
002 * Copyright 2010-2015 JetBrains s.r.o.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017 package org.jetbrains.kotlin.codegen.inline;
018
019 import org.jetbrains.annotations.NotNull;
020
021 import java.util.HashMap;
022 import java.util.HashSet;
023 import java.util.Map;
024 import java.util.Set;
025
026 public class InlineResult {
027
028 private final Set<String> classesToRemove = new HashSet<String>();
029 private final Map<String, String> changedTypes = new HashMap<String, String>();
030 private final ReifiedTypeParametersUsages reifiedTypeParametersUsages = new ReifiedTypeParametersUsages();
031
032 private InlineResult() {
033 }
034
035 @NotNull
036 public static InlineResult create() {
037 return new InlineResult();
038 }
039
040 @NotNull
041 public InlineResult addAllClassesToRemove(@NotNull InlineResult child) {
042 classesToRemove.addAll(child.classesToRemove);
043 return this;
044 }
045
046 public void addClassToRemove(@NotNull String classInternalName) {
047 classesToRemove.add(classInternalName);
048 }
049
050 public void addChangedType(@NotNull String oldClassInternalName, @NotNull String newClassInternalName) {
051 changedTypes.put(oldClassInternalName, newClassInternalName);
052 }
053
054 @NotNull
055 public Set<String> getClassesToRemove() {
056 return classesToRemove;
057 }
058
059 public Map<String, String> getChangedTypes() {
060 return changedTypes;
061 }
062
063 @NotNull
064 public ReifiedTypeParametersUsages getReifiedTypeParametersUsages() {
065 return reifiedTypeParametersUsages;
066 }
067 }