src/share/classes/com/sun/tools/classfile/Type.java

changeset 953
c55928005af4
parent 581
f2fdd52e4e87
child 2525
2eb010b6cb22
equal deleted inserted replaced
952:02ba4ff98742 953:c55928005af4
1 /* 1 /*
2 * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this 7 * published by the Free Software Foundation. Oracle designates this
39 * This code and its internal interfaces are subject to change or 39 * This code and its internal interfaces are subject to change or
40 * deletion without notice.</b> 40 * deletion without notice.</b>
41 */ 41 */
42 public abstract class Type { 42 public abstract class Type {
43 protected Type() { } 43 protected Type() { }
44
45 public boolean isObject() {
46 return false;
47 }
48
44 public abstract <R,D> R accept(Visitor<R,D> visitor, D data); 49 public abstract <R,D> R accept(Visitor<R,D> visitor, D data);
45 50
46 protected static void append(StringBuilder sb, String prefix, List<? extends Type> types, String suffix) { 51 protected static void append(StringBuilder sb, String prefix, List<? extends Type> types, String suffix) {
47 sb.append(prefix); 52 sb.append(prefix);
48 String sep = ""; 53 String sep = "";
260 sb.append(name); 265 sb.append(name);
261 appendIfNotEmpty(sb, "<", typeArgs, ">"); 266 appendIfNotEmpty(sb, "<", typeArgs, ">");
262 return sb.toString(); 267 return sb.toString();
263 } 268 }
264 269
270 @Override
271 public boolean isObject() {
272 return (outerType == null)
273 && name.equals("java/lang/Object")
274 && (typeArgs == null || typeArgs.isEmpty());
275 }
276
265 public final ClassType outerType; 277 public final ClassType outerType;
266 public final String name; 278 public final String name;
267 public final List<Type> typeArgs; 279 public final List<Type> typeArgs;
268 } 280 }
269 281

mercurial