Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/sun/tools/java/IdentifierToken.java
38918 views
/*1* Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package sun.tools.java;2627/**28* Information about the occurrence of an identifier.29* The parser produces these to represent name which cannot yet be30* bound to field definitions.31*32* WARNING: The contents of this source file are not part of any33* supported API. Code that depends on them does so at its own risk:34* they are subject to change or removal without notice.35*36* @see37*/3839public40class IdentifierToken {41long where;42int modifiers;43Identifier id;4445public IdentifierToken(long where, Identifier id) {46this.where = where;47this.id = id;48}4950/** Use this constructor when the identifier is synthesized.51* The location will be 0.52*/53public IdentifierToken(Identifier id) {54this.where = 0;55this.id = id;56}5758public IdentifierToken(long where, Identifier id, int modifiers) {59this.where = where;60this.id = id;61this.modifiers = modifiers;62}6364/** The source location of this identifier occurrence. */65public long getWhere() {66return where;67}6869/** The identifier itself (possibly qualified). */70public Identifier getName() {71return id;72}7374/** The modifiers associated with the occurrence, if any. */75public int getModifiers() {76return modifiers;77}7879public String toString() {80return id.toString();81}8283/**84* Return defaultWhere if id is null or id.where is missing (0).85* Otherwise, return id.where.86*/87public static long getWhere(IdentifierToken id, long defaultWhere) {88return (id != null && id.where != 0) ? id.where : defaultWhere;89}90}919293