18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package com.sun.tools.javac.code; 27 28 import com.sun.tools.javac.util.Assert; 29 import com.sun.tools.javac.util.List; 30 import java.util.EnumMap; 31 import java.util.HashSet; 32 import java.util.Set; 33 34 /** 35 * TypeMetadata is essentially an immutable {@code EnumMap<Entry.Kind, <? extends Entry>>} 36 * 37 * A metadata class represented by a subtype of Entry can express a property on a Type instance. 38 * Thers should be at most one instance of an Entry per Entry.Kind on any given Type instance. 39 * 40 * Metadata classes of a specific kind are responsible for how they combine themselvs. 41 * 42 * @implNote {@code Entry:combine} need not be commutative. 43 */ 44 public class TypeMetadata { 45 public static final TypeMetadata EMPTY = new TypeMetadata(); 46 47 private final EnumMap<Entry.Kind, Entry> contents; 48 49 /** 50 * Create a new empty TypeMetadata map. 51 */ 52 private TypeMetadata() { 53 contents = new EnumMap<>(Entry.Kind.class); 54 } 55 56 /** 57 * Create a new TypeMetadata map containing the Entry {@code elem}. 58 * 59 * @param elem the sole contents of this map 60 */ | 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package com.sun.tools.javac.code; 27 28 import com.sun.tools.javac.util.Assert; 29 import com.sun.tools.javac.util.List; 30 import java.util.EnumMap; 31 import java.util.HashSet; 32 import java.util.Set; 33 34 /** 35 * TypeMetadata is essentially an immutable {@code EnumMap<Entry.Kind, <? extends Entry>>} 36 * 37 * A metadata class represented by a subtype of Entry can express a property on a Type instance. 38 * There should be at most one instance of an Entry per Entry.Kind on any given Type instance. 39 * 40 * Metadata classes of a specific kind are responsible for how they combine themselves. 41 * 42 * @implNote {@code Entry:combine} need not be commutative. 43 */ 44 public class TypeMetadata { 45 public static final TypeMetadata EMPTY = new TypeMetadata(); 46 47 private final EnumMap<Entry.Kind, Entry> contents; 48 49 /** 50 * Create a new empty TypeMetadata map. 51 */ 52 private TypeMetadata() { 53 contents = new EnumMap<>(Entry.Kind.class); 54 } 55 56 /** 57 * Create a new TypeMetadata map containing the Entry {@code elem}. 58 * 59 * @param elem the sole contents of this map 60 */ |