/* * Copyright (C) 2015 RoboVM AB * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/gpl-2.0.html>. */ package org.robovm.compiler.clazz; /** * Records a dependency on a method. */ public abstract class MethodDependency extends Dependency { private static final long serialVersionUID = 1L; private final String owner; private final String name; private final String desc; MethodDependency(String owner, String methodName, String methodDesc, String path, boolean inBootClasspath, boolean weak) { super(owner, path, inBootClasspath, weak); this.owner = owner; this.name = methodName; this.desc = methodDesc; } public String getOwner() { return owner; } public String getMethodName() { return name; } public String getMethodDesc() { return desc; } @Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((desc == null) ? 0 : desc.hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + ((owner == null) ? 0 : owner.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (getClass() != obj.getClass()) { return false; } MethodDependency other = (MethodDependency) obj; if (desc == null) { if (other.desc != null) { return false; } } else if (!desc.equals(other.desc)) { return false; } if (name == null) { if (other.name != null) { return false; } } else if (!name.equals(other.name)) { return false; } if (owner == null) { if (other.owner != null) { return false; } } else if (!owner.equals(other.owner)) { return false; } return true; } }