1 /* 2 * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 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 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 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 java.lang.annotation.Retention; 29 import java.lang.annotation.RetentionPolicy; 30 import java.util.Collections; 31 import java.util.EnumSet; 32 import java.util.Map; 33 import java.util.Set; 34 import java.util.concurrent.ConcurrentHashMap; 35 import java.util.stream.Collectors; 36 37 import javax.lang.model.element.Modifier; 38 39 import com.sun.tools.javac.util.Assert; 40 41 /** Access flags and other modifiers for Java classes and members. 42 * 43 * <p><b>This is NOT part of any supported API. 44 * If you write code that depends on this, you do so at your own risk. 45 * This code and its internal interfaces are subject to change or 46 * deletion without notice.</b> 47 */ 48 public class Flags { 49 50 private Flags() {} // uninstantiable 51 52 public static String toString(long flags) { 53 StringBuilder buf = new StringBuilder(); 54 String sep = ""; 55 for (FlagsEnum flag : asFlagSet(flags)) { 56 buf.append(sep); 57 buf.append(flag); 58 sep = " "; 59 } 60 return buf.toString(); 61 } 62 63 public static EnumSet<FlagsEnum> asFlagSet(long flags) { 64 EnumSet<FlagsEnum> flagSet = EnumSet.noneOf(FlagsEnum.class); 65 for (FlagsEnum flag : FlagsEnum.values()) { 66 if ((flags & flag.value()) != 0) { 67 flagSet.add(flag); 68 flags &= ~flag.value(); 69 } 70 } 71 Assert.check(flags == 0); 72 return flagSet; 73 } 74 75 /* Standard Java flags. 76 */ 77 @Use({FlagTarget.CLASS, FlagTarget.METHOD, FlagTarget.VARIABLE}) 78 public static final int PUBLIC = 1; 79 @Use({FlagTarget.CLASS, FlagTarget.METHOD, FlagTarget.VARIABLE}) 80 public static final int PRIVATE = 1<<1; 81 @Use({FlagTarget.CLASS, FlagTarget.METHOD, FlagTarget.VARIABLE}) 82 public static final int PROTECTED = 1<<2; 83 @Use({FlagTarget.BLOCK, FlagTarget.CLASS, FlagTarget.METHOD, FlagTarget.VARIABLE}) 84 public static final int STATIC = 1<<3; 85 @Use({FlagTarget.CLASS, FlagTarget.METHOD, FlagTarget.VARIABLE}) 86 public static final int FINAL = 1<<4; 87 @Use({FlagTarget.METHOD}) 88 public static final int SYNCHRONIZED = 1<<5; 89 @Use({FlagTarget.VARIABLE}) 90 public static final int VOLATILE = 1<<6; 91 @Use({FlagTarget.VARIABLE}) 92 public static final int TRANSIENT = 1<<7; 93 @Use({FlagTarget.METHOD}) 94 public static final int NATIVE = 1<<8; 95 @Use({FlagTarget.CLASS}) 96 public static final int INTERFACE = 1<<9; 97 @Use({FlagTarget.CLASS, FlagTarget.METHOD}) 98 public static final int ABSTRACT = 1<<10; 99 @Use({FlagTarget.CLASS, FlagTarget.METHOD}) 100 public static final int STRICTFP = 1<<11; 101 102 /* Flag that marks a symbol synthetic, added in classfile v49.0. */ 103 @Use({FlagTarget.CLASS, FlagTarget.METHOD, FlagTarget.VARIABLE}) 104 public static final int SYNTHETIC = 1<<12; 105 106 /** Flag that marks attribute interfaces, added in classfile v49.0. */ 107 @Use({FlagTarget.CLASS}) 108 public static final int ANNOTATION = 1<<13; 109 110 /** An enumeration type or an enumeration constant, added in 111 * classfile v49.0. */ 112 @Use({FlagTarget.CLASS, FlagTarget.VARIABLE}) 113 public static final int ENUM = 1<<14; 114 115 /** Added in SE8, represents constructs implicitly declared in source. */ 116 @Use({FlagTarget.MODULE, FlagTarget.VARIABLE}) 117 public static final int MANDATED = 1<<15; 118 119 @NotFlag 120 public static final int StandardFlags = 0x0fff; 121 122 // Because the following access flags are overloaded with other 123 // bit positions, we translate them when reading and writing class 124 // files into unique bits positions: ACC_SYNTHETIC <-> SYNTHETIC, 125 // for example. 126 @Use({FlagTarget.CLASS}) 127 @NoToStringValue 128 public static final int ACC_SUPER = 1<<5; 129 @Use({FlagTarget.METHOD}) 130 @NoToStringValue 131 public static final int ACC_BRIDGE = 1<<6; 132 @Use({FlagTarget.METHOD}) 133 @NoToStringValue 134 public static final int ACC_VARARGS = 1<<7; 135 @Use({FlagTarget.CLASS}) 136 @NoToStringValue 137 public static final int ACC_MODULE = 1<<15; 138 139 /* *************************************** 140 * Internal compiler flags (no bits in the lower 16). 141 *****************************************/ 142 143 /** Flag is set if symbol is deprecated. See also DEPRECATED_REMOVAL. 144 */ 145 @Use({FlagTarget.CLASS, FlagTarget.METHOD, FlagTarget.MODULE, FlagTarget.PACKAGE, FlagTarget.TYPE_VAR, FlagTarget.VARIABLE}) 146 public static final int DEPRECATED = 1<<17; 147 148 /** Flag is set for a variable symbol if the variable's definition 149 * has an initializer part. 150 */ 151 @Use({FlagTarget.VARIABLE}) 152 public static final int HASINIT = 1<<18; 153 154 /** Class is an implicitly declared top level class. 155 */ 156 @Use({FlagTarget.CLASS}) 157 public static final int IMPLICIT_CLASS = 1<<19; 158 159 /** Flag is set for compiler-generated anonymous method symbols 160 * that `own' an initializer block. 161 */ 162 @Use({FlagTarget.METHOD}) 163 public static final int BLOCK = 1<<20; 164 165 /** Flag is set for ClassSymbols that are being compiled from source. 166 */ 167 @Use({FlagTarget.CLASS}) 168 public static final int FROM_SOURCE = 1<<21; 169 170 /** Flag is set for nested classes that do not access instance members 171 * or `this' of an outer class and therefore don't need to be passed 172 * a this$n reference. This value is currently set only for anonymous 173 * classes in superclass constructor calls. 174 * todo: use this value for optimizing away this$n parameters in 175 * other cases. 176 */ 177 @Use({FlagTarget.CLASS, FlagTarget.VARIABLE}) 178 public static final int NOOUTERTHIS = 1<<22; 179 180 /** Flag is set for package symbols if a package has a member or 181 * directory and therefore exists. 182 */ 183 @Use({FlagTarget.CLASS, FlagTarget.PACKAGE}) 184 public static final int EXISTS = 1<<23; 185 186 /** Flag is set for compiler-generated compound classes 187 * representing multiple variable bounds 188 */ 189 @Use({FlagTarget.CLASS}) 190 public static final int COMPOUND = 1<<24; 191 192 /** Flag is set for class symbols if a class file was found for this class. 193 */ 194 @Use({FlagTarget.CLASS}) 195 public static final int CLASS_SEEN = 1<<25; 196 197 /** Flag is set for class symbols if a source file was found for this 198 * class. 199 */ 200 @Use({FlagTarget.CLASS}) 201 public static final int SOURCE_SEEN = 1<<26; 202 203 /* State flags (are reset during compilation). 204 */ 205 206 /** Flag for class symbols is set and later re-set as a lock in 207 * Enter to detect cycles in the superclass/superinterface 208 * relations. Similarly for constructor call cycle detection in 209 * Attr. 210 */ 211 @Use({FlagTarget.CLASS, FlagTarget.METHOD}) 212 public static final int LOCKED = 1<<27; 213 214 /** Flag for class symbols is set and later re-set to indicate that a class 215 * has been entered but has not yet been attributed. 216 */ 217 @Use({FlagTarget.CLASS}) 218 public static final int UNATTRIBUTED = 1<<28; 219 220 /** Flag for synthesized default constructors of anonymous classes. 221 */ 222 @Use({FlagTarget.METHOD}) 223 public static final int ANONCONSTR = 1<<29; 224 225 /** 226 * Flag to indicate the superclasses of this ClassSymbol has been attributed. 227 */ 228 @Use({FlagTarget.CLASS}) 229 public static final int SUPER_OWNER_ATTRIBUTED = 1<<29; 230 231 /** Flag for class symbols to indicate it has been checked and found 232 * acyclic. 233 */ 234 @Use({FlagTarget.CLASS, FlagTarget.METHOD, FlagTarget.TYPE_VAR}) 235 public static final int ACYCLIC = 1<<30; 236 237 /** Flag that marks bridge methods. 238 */ 239 @Use({FlagTarget.METHOD}) 240 public static final long BRIDGE = 1L<<31; 241 242 /** Flag that marks formal parameters. 243 */ 244 @Use({FlagTarget.VARIABLE}) 245 public static final long PARAMETER = 1L<<33; 246 247 /** Flag that marks varargs methods. 248 */ 249 @Use({FlagTarget.METHOD, FlagTarget.VARIABLE}) 250 public static final long VARARGS = 1L<<34; 251 252 /** Flag for annotation type symbols to indicate it has been 253 * checked and found acyclic. 254 */ 255 @Use({FlagTarget.CLASS}) 256 public static final long ACYCLIC_ANN = 1L<<35; 257 258 /** Flag that marks a generated default constructor. 259 */ 260 @Use({FlagTarget.METHOD}) 261 public static final long GENERATEDCONSTR = 1L<<36; 262 263 /** Flag that marks a hypothetical method that need not really be 264 * generated in the binary, but is present in the symbol table to 265 * simplify checking for erasure clashes - also used for 292 poly sig methods. 266 */ 267 @Use({FlagTarget.METHOD}) 268 public static final long HYPOTHETICAL = 1L<<37; 269 270 /** 271 * Flag that marks an internal proprietary class. 272 */ 273 @Use({FlagTarget.CLASS}) 274 public static final long PROPRIETARY = 1L<<38; 275 276 /** 277 * Flag that marks a multi-catch parameter. 278 */ 279 @Use({FlagTarget.VARIABLE}) 280 public static final long UNION = 1L<<39; 281 282 /** 283 * Flags an erroneous TypeSymbol as viable for recovery. 284 * TypeSymbols only. 285 */ 286 @Use({FlagTarget.CLASS, FlagTarget.TYPE_VAR}) 287 public static final long RECOVERABLE = 1L<<40; 288 289 /** 290 * Flag that marks an 'effectively final' local variable. 291 */ 292 @Use({FlagTarget.VARIABLE}) 293 public static final long EFFECTIVELY_FINAL = 1L<<41; 294 295 /** 296 * Flag that marks non-override equivalent methods with the same signature, 297 * or a conflicting match binding (BindingSymbol). 298 */ 299 @Use({FlagTarget.METHOD, FlagTarget.VARIABLE}) 300 public static final long CLASH = 1L<<42; 301 302 /** 303 * Flag that marks either a default method or an interface containing default methods. 304 */ 305 @Use({FlagTarget.CLASS, FlagTarget.METHOD}) 306 public static final long DEFAULT = 1L<<43; // part of ExtendedStandardFlags, cannot be reused 307 308 /** 309 * Flag that marks class as auxiliary, ie a non-public class following 310 * the public class in a source file, that could block implicit compilation. 311 */ 312 @Use({FlagTarget.CLASS}) 313 public static final long AUXILIARY = 1L<<44; 314 315 /** 316 * Flag that marks that a symbol is not available in the current profile 317 */ 318 @Use({FlagTarget.CLASS}) 319 public static final long NOT_IN_PROFILE = 1L<<45; 320 321 /** 322 * Flag that indicates that an override error has been detected by Check. 323 */ 324 @Use({FlagTarget.METHOD}) 325 public static final long BAD_OVERRIDE = 1L<<45; 326 327 /** 328 * Flag that indicates a signature polymorphic method (292). 329 */ 330 @Use({FlagTarget.METHOD}) 331 public static final long SIGNATURE_POLYMORPHIC = 1L<<46; 332 333 /** 334 * Flag that indicates that an inference variable is used in a 'throws' clause. 335 */ 336 @Use({FlagTarget.TYPE_VAR}) 337 public static final long THROWS = 1L<<47; 338 339 /** 340 * Flag to indicate sealed class/interface declaration. 341 */ 342 @Use({FlagTarget.CLASS}) 343 public static final long SEALED = 1L<<48; // part of ExtendedStandardFlags, cannot be reused 344 345 /** 346 * Flag that marks a synthetic method body for a lambda expression 347 */ 348 @Use({FlagTarget.METHOD}) 349 public static final long LAMBDA_METHOD = 1L<<49; 350 351 /** 352 * Flag that marks a synthetic local capture field in a local/anon class 353 */ 354 @Use({FlagTarget.VARIABLE}) 355 public static final long LOCAL_CAPTURE_FIELD = 1L<<49; 356 357 /** 358 * Flag to control recursion in TransTypes 359 */ 360 @Use({FlagTarget.CLASS}) 361 public static final long TYPE_TRANSLATED = 1L<<50; 362 363 /** 364 * Flag to indicate class symbol is for module-info 365 */ 366 @Use({FlagTarget.CLASS}) 367 public static final long MODULE = 1L<<51; 368 369 /** 370 * Flag to indicate the given ModuleSymbol is an automatic module. 371 */ 372 @Use({FlagTarget.MODULE}) 373 public static final long AUTOMATIC_MODULE = 1L<<52; 374 375 /** 376 * Flag to indicate the given PackageSymbol contains any non-.java and non-.class resources. 377 */ 378 @Use({FlagTarget.PACKAGE}) 379 public static final long HAS_RESOURCE = 1L<<52; 380 381 /** 382 * Flag to indicate the given ParamSymbol has a user-friendly name filled. 383 */ 384 @Use({FlagTarget.VARIABLE}) //ParamSymbols only 385 public static final long NAME_FILLED = 1L<<52; 386 387 /** 388 * Flag to indicate the given ModuleSymbol is a system module. 389 */ 390 @Use({FlagTarget.MODULE}) 391 public static final long SYSTEM_MODULE = 1L<<53; 392 393 /** 394 * Flag to indicate the given ClassSymbol is a value based. 395 */ 396 @Use({FlagTarget.CLASS}) 397 public static final long VALUE_BASED = 1L<<53; 398 399 /** 400 * Flag to indicate the given symbol has a @Deprecated annotation. 401 */ 402 @Use({FlagTarget.CLASS, FlagTarget.METHOD, FlagTarget.MODULE, FlagTarget.PACKAGE, FlagTarget.TYPE_VAR, FlagTarget.VARIABLE}) 403 public static final long DEPRECATED_ANNOTATION = 1L<<54; 404 405 /** 406 * Flag to indicate the given symbol has been deprecated and marked for removal. 407 */ 408 @Use({FlagTarget.CLASS, FlagTarget.METHOD, FlagTarget.MODULE, FlagTarget.PACKAGE, FlagTarget.TYPE_VAR, FlagTarget.VARIABLE}) 409 public static final long DEPRECATED_REMOVAL = 1L<<55; 410 411 /** 412 * Flag to indicate the API element in question is for a preview API. 413 */ 414 @Use({FlagTarget.CLASS, FlagTarget.METHOD, FlagTarget.MODULE, FlagTarget.PACKAGE, FlagTarget.TYPE_VAR, FlagTarget.VARIABLE}) 415 public static final long PREVIEW_API = 1L<<56; //any Symbol kind 416 417 /** 418 * Flag for synthesized default constructors of anonymous classes that have an enclosing expression. 419 */ 420 @Use({FlagTarget.METHOD}) 421 public static final long ANONCONSTR_BASED = 1L<<57; 422 423 /** 424 * Flag that marks finalize block as body-only, should not be copied into catch clauses. 425 * Used to implement try-with-resources. 426 */ 427 @Use({FlagTarget.BLOCK}) 428 public static final long BODY_ONLY_FINALIZE = 1L<<17; 429 430 /** 431 * Flag to indicate the API element in question is for a preview API. 432 */ 433 @Use({FlagTarget.CLASS, FlagTarget.METHOD, FlagTarget.MODULE, FlagTarget.PACKAGE, FlagTarget.TYPE_VAR, FlagTarget.VARIABLE}) 434 public static final long PREVIEW_REFLECTIVE = 1L<<58; //any Symbol kind 435 436 /** 437 * Flag to indicate the given variable is a match binding variable. 438 */ 439 @Use({FlagTarget.VARIABLE}) 440 public static final long MATCH_BINDING = 1L<<59; 441 442 /** 443 * A flag to indicate a match binding variable whose scope extends after the current statement. 444 */ 445 @Use({FlagTarget.VARIABLE}) 446 public static final long MATCH_BINDING_TO_OUTER = 1L<<60; 447 448 /** 449 * Flag to indicate that a class is a record. The flag is also used to mark fields that are 450 * part of the state vector of a record and to mark the canonical constructor 451 */ 452 @Use({FlagTarget.CLASS, FlagTarget.VARIABLE, FlagTarget.METHOD}) 453 public static final long RECORD = 1L<<61; 454 455 /** 456 * Flag to mark a record constructor as a compact one 457 */ 458 @Use({FlagTarget.METHOD}) 459 public static final long COMPACT_RECORD_CONSTRUCTOR = 1L<<51; 460 461 /** 462 * Flag to mark a record field that was not initialized in the compact constructor 463 */ 464 @Use({FlagTarget.VARIABLE}) 465 public static final long UNINITIALIZED_FIELD= 1L<<51; 466 467 /** Flag is set for compiler-generated record members, it could be applied to 468 * accessors and fields 469 */ 470 @Use({FlagTarget.METHOD, FlagTarget.VARIABLE}) 471 public static final int GENERATED_MEMBER = 1<<24; 472 473 /** 474 * Flag to indicate restricted method declaration. 475 */ 476 @Use({FlagTarget.METHOD}) 477 public static final long RESTRICTED = 1L<<62; 478 479 /** 480 * Flag to indicate parameters that require identity. 481 */ 482 @Use({FlagTarget.VARIABLE}) //ParamSymbols only 483 public static final long REQUIRES_IDENTITY = 1L<<62; 484 485 /** 486 * Flag to indicate type annotations have been queued for field initializers. 487 */ 488 @Use({FlagTarget.VARIABLE}) 489 public static final long FIELD_INIT_TYPE_ANNOTATIONS_QUEUED = 1L<<53; 490 491 /** 492 * Flag to indicate that the class/interface was declared with the non-sealed modifier. 493 */ 494 @Use({FlagTarget.CLASS}) 495 @CustomToStringValue("non-sealed") 496 public static final long NON_SEALED = 1L<<63; // part of ExtendedStandardFlags, cannot be reused 497 498 /** 499 * Describe modifier flags as they might appear in source code, i.e., 500 * separated by spaces and in the order suggested by JLS 8.1.1. 501 */ 502 public static String toSource(long flags) { 503 return asModifierSet(flags).stream() 504 .map(Modifier::toString) 505 .collect(Collectors.joining(" ")); 506 } 507 508 /** Modifier masks. 509 */ 510 @NotFlag 511 public static final int 512 AccessFlags = PUBLIC | PROTECTED | PRIVATE, 513 LocalClassFlags = FINAL | ABSTRACT | STRICTFP | ENUM | SYNTHETIC, 514 StaticLocalFlags = LocalClassFlags | STATIC | INTERFACE, 515 MemberClassFlags = LocalClassFlags | INTERFACE | AccessFlags, 516 MemberStaticClassFlags = MemberClassFlags | STATIC, 517 ClassFlags = LocalClassFlags | INTERFACE | PUBLIC | ANNOTATION, 518 InterfaceVarFlags = FINAL | STATIC | PUBLIC, 519 VarFlags = AccessFlags | FINAL | STATIC | 520 VOLATILE | TRANSIENT | ENUM, 521 ConstructorFlags = AccessFlags, 522 InterfaceMethodFlags = ABSTRACT | PUBLIC, 523 MethodFlags = AccessFlags | ABSTRACT | STATIC | NATIVE | 524 SYNCHRONIZED | FINAL | STRICTFP, 525 RecordMethodFlags = AccessFlags | ABSTRACT | STATIC | 526 SYNCHRONIZED | FINAL | STRICTFP; 527 @NotFlag 528 public static final long 529 //NOTE: flags in ExtendedStandardFlags cannot be overlayed across Symbol kinds: 530 ExtendedStandardFlags = (long)StandardFlags | DEFAULT | SEALED | NON_SEALED, 531 ExtendedMemberClassFlags = (long)MemberClassFlags | SEALED | NON_SEALED, 532 ExtendedMemberStaticClassFlags = (long) MemberStaticClassFlags | SEALED | NON_SEALED, 533 ExtendedClassFlags = (long)ClassFlags | SEALED | NON_SEALED, 534 ModifierFlags = ((long)StandardFlags & ~INTERFACE) | DEFAULT | SEALED | NON_SEALED, 535 InterfaceMethodMask = ABSTRACT | PRIVATE | STATIC | PUBLIC | STRICTFP | DEFAULT, 536 AnnotationTypeElementMask = ABSTRACT | PUBLIC, 537 LocalVarFlags = FINAL | PARAMETER, 538 ReceiverParamFlags = PARAMETER; 539 540 public static Set<Modifier> asModifierSet(long flags) { 541 Set<Modifier> modifiers = modifierSets.get(flags); 542 if (modifiers == null) { 543 modifiers = java.util.EnumSet.noneOf(Modifier.class); 544 if (0 != (flags & PUBLIC)) modifiers.add(Modifier.PUBLIC); 545 if (0 != (flags & PROTECTED)) modifiers.add(Modifier.PROTECTED); 546 if (0 != (flags & PRIVATE)) modifiers.add(Modifier.PRIVATE); 547 if (0 != (flags & ABSTRACT)) modifiers.add(Modifier.ABSTRACT); 548 if (0 != (flags & STATIC)) modifiers.add(Modifier.STATIC); 549 if (0 != (flags & SEALED)) modifiers.add(Modifier.SEALED); 550 if (0 != (flags & NON_SEALED)) 551 modifiers.add(Modifier.NON_SEALED); 552 if (0 != (flags & FINAL)) modifiers.add(Modifier.FINAL); 553 if (0 != (flags & TRANSIENT)) modifiers.add(Modifier.TRANSIENT); 554 if (0 != (flags & VOLATILE)) modifiers.add(Modifier.VOLATILE); 555 if (0 != (flags & SYNCHRONIZED)) 556 modifiers.add(Modifier.SYNCHRONIZED); 557 if (0 != (flags & NATIVE)) modifiers.add(Modifier.NATIVE); 558 if (0 != (flags & STRICTFP)) modifiers.add(Modifier.STRICTFP); 559 if (0 != (flags & DEFAULT)) modifiers.add(Modifier.DEFAULT); 560 modifiers = Collections.unmodifiableSet(modifiers); 561 modifierSets.put(flags, modifiers); 562 } 563 return modifiers; 564 } 565 566 // Cache of modifier sets. 567 private static final Map<Long, Set<Modifier>> modifierSets = new ConcurrentHashMap<>(64); 568 569 public static boolean isStatic(Symbol symbol) { 570 return (symbol.flags() & STATIC) != 0; 571 } 572 573 public static boolean isEnum(Symbol symbol) { 574 return (symbol.flags() & ENUM) != 0; 575 } 576 577 public static boolean isConstant(Symbol.VarSymbol symbol) { 578 return symbol.getConstValue() != null; 579 } 580 581 public enum FlagTarget { 582 /** This flag can appear the JCBlock. 583 */ 584 BLOCK, 585 /** This flag can appear on ClassSymbols. 586 */ 587 CLASS, 588 /** This flag can appear on ModuleSymbols. 589 */ 590 MODULE, 591 /** This flag can appear on PackageSymbols. 592 */ 593 PACKAGE, 594 /** This flag can appear on TypeVarSymbols. 595 */ 596 TYPE_VAR, 597 /** This flag can appear on MethodSymbols. 598 */ 599 METHOD, 600 /** This flag can appear on VarSymbols, includes 601 * including ParamSymbol, and BindingSymbol. 602 */ 603 VARIABLE; 604 } 605 606 @Retention(RetentionPolicy.RUNTIME) 607 public @interface Use { 608 public FlagTarget[] value(); 609 } 610 611 @Retention(RetentionPolicy.RUNTIME) 612 public @interface NotFlag {} 613 614 @Retention(RetentionPolicy.RUNTIME) 615 public @interface CustomToStringValue { 616 public String value(); 617 } 618 619 @Retention(RetentionPolicy.RUNTIME) 620 public @interface NoToStringValue { 621 } 622 }