1 /* 2 * Copyright 2019 Google Inc. All Rights Reserved. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.google.turbine.binder.sym; 18 19 import com.google.errorprone.annotations.Immutable; 20 import org.jspecify.nullness.Nullable; 21 22 /** A package symbol. */ 23 @Immutable 24 public class PackageSymbol implements Symbol { 25 26 final String binaryName; 27 PackageSymbol(String binaryName)28 public PackageSymbol(String binaryName) { 29 this.binaryName = binaryName; 30 } 31 32 @Override hashCode()33 public int hashCode() { 34 return binaryName.hashCode(); 35 } 36 37 @Override equals(@ullable Object obj)38 public boolean equals(@Nullable Object obj) { 39 return obj instanceof PackageSymbol && binaryName.equals(((PackageSymbol) obj).binaryName); 40 } 41 42 @Override toString()43 public String toString() { 44 return binaryName.replace('/', '.'); 45 } 46 47 @Override symKind()48 public Kind symKind() { 49 return Kind.PACKAGE; 50 } 51 binaryName()52 public String binaryName() { 53 return binaryName; 54 } 55 } 56