001    /*
002     * Copyright 2010-2013 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.jet.codegen.inline;
018    
019    import org.jetbrains.annotations.NotNull;
020    import org.jetbrains.org.objectweb.asm.Type;
021    
022    import java.util.List;
023    import java.util.Map;
024    
025    public class ConstructorInvocation {
026    
027        private final String ownerInternalName;
028    
029        private final String desc;
030    
031        private final Map<Integer, LambdaInfo> lambdasToInline;
032    
033        private final boolean isSameModule;
034    
035        private Type newLambdaType;
036    
037        private String newConstructorDescriptor;
038    
039        private List<CapturedParamDesc> allRecapturedParameters;
040    
041        private Map<String, LambdaInfo> capturedLambdasToInline;
042    
043        private final boolean capturedOuterRegenerated;
044    
045        ConstructorInvocation(
046                @NotNull String ownerInternalName,
047                @NotNull String desc,
048                @NotNull Map<Integer, LambdaInfo> lambdasToInline,
049                boolean isSameModule,
050                boolean capturedOuterRegenerated
051        ) {
052            this.ownerInternalName = ownerInternalName;
053            this.desc = desc;
054            this.lambdasToInline = lambdasToInline;
055            this.isSameModule = isSameModule;
056            this.capturedOuterRegenerated = capturedOuterRegenerated;
057        }
058    
059        public String getOwnerInternalName() {
060            return ownerInternalName;
061        }
062    
063        public boolean shouldRegenerate() {
064            return !lambdasToInline.isEmpty() || !isSameModule || capturedOuterRegenerated;
065        }
066    
067        public Map<Integer, LambdaInfo> getLambdasToInline() {
068            return lambdasToInline;
069        }
070    
071        public Type getNewLambdaType() {
072            return newLambdaType;
073        }
074    
075        public void setNewLambdaType(Type newLambdaType) {
076            this.newLambdaType = newLambdaType;
077        }
078    
079        public String getNewConstructorDescriptor() {
080            return newConstructorDescriptor;
081        }
082    
083        public void setNewConstructorDescriptor(String newConstructorDescriptor) {
084            this.newConstructorDescriptor = newConstructorDescriptor;
085        }
086    
087        public List<CapturedParamDesc> getAllRecapturedParameters() {
088            return allRecapturedParameters;
089        }
090    
091        public void setAllRecapturedParameters(List<CapturedParamDesc> allRecapturedParameters) {
092            this.allRecapturedParameters = allRecapturedParameters;
093        }
094    
095        public Map<String, LambdaInfo> getCapturedLambdasToInline() {
096            return capturedLambdasToInline;
097        }
098    
099        public void setCapturedLambdasToInline(Map<String, LambdaInfo> capturedLambdasToInline) {
100            this.capturedLambdasToInline = capturedLambdasToInline;
101        }
102    
103        public String getDesc() {
104            return desc;
105        }
106    }