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.resolve.jvm.jvmSignature; 018 019 import org.jetbrains.annotations.NotNull; 020 import org.jetbrains.annotations.Nullable; 021 import org.jetbrains.org.objectweb.asm.Type; 022 import org.jetbrains.org.objectweb.asm.commons.Method; 023 024 import java.util.List; 025 026 public class JvmMethodSignature { 027 private final Method asmMethod; 028 private final List<JvmMethodParameterSignature> valueParameters; 029 030 public JvmMethodSignature( 031 @NotNull Method asmMethod, 032 @NotNull List<JvmMethodParameterSignature> valueParameters 033 ) { 034 this.asmMethod = asmMethod; 035 this.valueParameters = valueParameters; 036 } 037 038 @NotNull 039 public Method getAsmMethod() { 040 return asmMethod; 041 } 042 043 044 @NotNull 045 public List<JvmMethodParameterSignature> getValueParameters() { 046 return valueParameters; 047 } 048 049 @NotNull 050 public Type getReturnType() { 051 return asmMethod.getReturnType(); 052 } 053 054 @Override 055 public boolean equals(Object o) { 056 if (this == o) return true; 057 if (!(o instanceof JvmMethodSignature)) return false; 058 059 JvmMethodSignature that = (JvmMethodSignature) o; 060 061 return asmMethod.equals(that.asmMethod) && 062 valueParameters.equals(that.valueParameters); 063 } 064 065 @Override 066 public int hashCode() { 067 int result = asmMethod.hashCode(); 068 result = 31 * result + valueParameters.hashCode(); 069 return result; 070 } 071 072 @Override 073 public String toString() { 074 return asmMethod.toString(); 075 } 076 }