ReferenceTypeDesc.java revision 3170:dc017a37aac5
12116Sjkh/* 22116Sjkh * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. 32116Sjkh * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 42116Sjkh * 52116Sjkh * This code is free software; you can redistribute it and/or modify it 62116Sjkh * under the terms of the GNU General Public License version 2 only, as 72116Sjkh * published by the Free Software Foundation. Oracle designates this 88870Srgrimes * particular file as subject to the "Classpath" exception as provided 92116Sjkh * by Oracle in the LICENSE file that accompanied this code. 102116Sjkh * 112116Sjkh * This code is distributed in the hope that it will be useful, but WITHOUT 122116Sjkh * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 132116Sjkh * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1450476Speter * version 2 for more details (a copy is included in the LICENSE file that 152116Sjkh * accompanied this code). 162116Sjkh * 172116Sjkh * You should have received a copy of the GNU General Public License version 182116Sjkh * 2 along with this work; if not, write to the Free Software Foundation, 198870Srgrimes * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 202116Sjkh * 212116Sjkh * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 222116Sjkh * or visit www.oracle.com if you need additional information or have any 232116Sjkh * questions. 242116Sjkh */ 258870Srgrimes 262116Sjkhpackage com.sun.tools.sjavac.pubapi; 272116Sjkh 282116Sjkhimport java.io.Serializable; 292116Sjkh 302116Sjkhimport javax.lang.model.type.TypeKind; 318870Srgrimes 322116Sjkhpublic class ReferenceTypeDesc extends TypeDesc implements Serializable { 332116Sjkh 342116Sjkh private static final long serialVersionUID = 3357616754544796372L; 352116Sjkh 362116Sjkh // Example: "java.util.Vector<java.lang.String>" 372116Sjkh String javaType; 388870Srgrimes 392116Sjkh public ReferenceTypeDesc(String javaType) { 402116Sjkh super(TypeKind.DECLARED); 412116Sjkh this.javaType = javaType; 422116Sjkh } 432116Sjkh 442116Sjkh @Override 452116Sjkh public boolean equals(Object obj) { 462116Sjkh if (!super.equals(obj)) 472116Sjkh return false; 482116Sjkh return javaType.equals(((ReferenceTypeDesc) obj).javaType); 492116Sjkh } 502116Sjkh 512116Sjkh @Override 522116Sjkh public int hashCode() { 532116Sjkh return super.hashCode() ^ javaType.hashCode(); 542116Sjkh } 552116Sjkh 562116Sjkh @Override 572116Sjkh public String toString() { 582116Sjkh return String.format("%s[type: %s]", getClass().getSimpleName(), javaType); 592116Sjkh } 602116Sjkh} 6197413Salfred