Class DetachedVarSymbol

java.lang.Object
com.sun.tools.javac.code.AnnoConstruct
com.sun.tools.javac.code.Symbol
com.sun.tools.javac.code.Symbol.VarSymbol
org.checkerframework.javacutil.trees.DetachedVarSymbol
All Implemented Interfaces:
com.sun.tools.javac.jvm.PoolConstant, AnnotatedConstruct, Element, VariableElement

public class DetachedVarSymbol extends com.sun.tools.javac.code.Symbol.VarSymbol
A DetachedVarSymbol represents a variable that is not part of any AST Tree. DetachedVarSymbols are created when desugaring source code constructs and they carry important type information, but some methods such as TreeInfo.declarationFor do not work on them.
  • Nested Class Summary

    Nested classes/interfaces inherited from class com.sun.tools.javac.code.Symbol

    com.sun.tools.javac.code.Symbol.BindingSymbol, com.sun.tools.javac.code.Symbol.ClassSymbol, com.sun.tools.javac.code.Symbol.Completer, com.sun.tools.javac.code.Symbol.CompletionFailure, com.sun.tools.javac.code.Symbol.DelegatedSymbol<T extends com.sun.tools.javac.code.Symbol>, com.sun.tools.javac.code.Symbol.DynamicMethodSymbol, com.sun.tools.javac.code.Symbol.DynamicVarSymbol, com.sun.tools.javac.code.Symbol.MethodHandleSymbol, com.sun.tools.javac.code.Symbol.MethodSymbol, com.sun.tools.javac.code.Symbol.ModuleFlags, com.sun.tools.javac.code.Symbol.ModuleResolutionFlags, com.sun.tools.javac.code.Symbol.ModuleSymbol, com.sun.tools.javac.code.Symbol.OperatorSymbol, com.sun.tools.javac.code.Symbol.PackageSymbol, com.sun.tools.javac.code.Symbol.ParamSymbol, com.sun.tools.javac.code.Symbol.RecordComponent, com.sun.tools.javac.code.Symbol.RootPackageSymbol, com.sun.tools.javac.code.Symbol.TypeSymbol, com.sun.tools.javac.code.Symbol.TypeVariableSymbol, com.sun.tools.javac.code.Symbol.VarSymbol, com.sun.tools.javac.code.Symbol.Visitor<R,P>

    Nested classes/interfaces inherited from interface com.sun.tools.javac.jvm.PoolConstant

    com.sun.tools.javac.jvm.PoolConstant.Dynamic, com.sun.tools.javac.jvm.PoolConstant.LoadableConstant, com.sun.tools.javac.jvm.PoolConstant.NameAndType
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    The declaration tree for this variable, or null if it has not been set.

    Fields inherited from class com.sun.tools.javac.code.Symbol.VarSymbol

    adr, pos

    Fields inherited from class com.sun.tools.javac.code.Symbol

    completer, erasure_field, flags_field, kind, metadata, name, owner, type
  • Constructor Summary

    Constructors
    Constructor
    Description
    DetachedVarSymbol(long flags, com.sun.tools.javac.util.Name name, com.sun.tools.javac.code.Type type, com.sun.tools.javac.code.Symbol owner)
    Constructs a detached variable symbol, given its flags, name, type, and owner.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the declaration tree for the variable.
    void
    Sets the declaration tree for the variable.

    Methods inherited from class com.sun.tools.javac.code.Symbol.VarSymbol

    accept, accept, asMemberOf, asMethodHandle, clone, getConstantValue, getConstValue, getKind, isExceptionParameter, isResourceVariable, isUnnamedVariable, poolTag, setData, setLazyConstValue, toString

    Methods inherited from class com.sun.tools.javac.code.Symbol

    annotationsPendingCompletion, apiComplete, appendAttributes, appendClassInitTypeAttributes, appendInitTypeAttributes, appendUniqueTypeAttributes, asType, attribute, baseSymbol, complete, enclClass, erasure, exists, externalType, flags, flatName, getAnnotationMirrors, getClassInitTypeAttributes, getDeclarationAttributes, getEnclosedElements, getEnclosingElement, getInitTypeAttributes, getMetadata, getModifiers, getQualifiedName, getRawAttributes, getRawTypeAttributes, getSimpleName, getTypeParameters, hasAnnotations, hasDeprecatedAnnotation, hasOuterInstance, hasTypeAnnotations, isAbstract, isAccessibleIn, isAnonymous, isCompleted, isConstructor, isDeprecatableViaAnnotation, isDeprecated, isDeprecatedForRemoval, isDirectlyOrIndirectlyLocal, isDynamic, isEnclosedBy, isEnum, isFinal, isInheritedIn, isInner, isInterface, isMemberOf, isNonSealed, isPreviewApi, isPrivate, isPublic, isSealed, isStatic, isSubClass, location, location, members, outermostClass, overrides, packge, prependAttributes, resetAnnotations, setAttributes, setClassInitTypeAttributes, setDeclarationAttributes, setInitTypeAttributes, setTypeAttributes

    Methods inherited from class com.sun.tools.javac.code.AnnoConstruct

    getAnnotation, getAnnotationsByType, getAttribute, getInheritedAnnotations

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface javax.lang.model.element.Element

    equals, getAnnotation, getAnnotationMirrors, getAnnotationsByType, getEnclosedElements, getModifiers, hashCode

    Methods inherited from interface com.sun.tools.javac.jvm.PoolConstant

    poolKey

    Methods inherited from interface javax.lang.model.element.VariableElement

    asType, getEnclosingElement, getSimpleName, isUnnamed
  • Field Details

    • decl

      protected @Nullable VariableTree decl
      The declaration tree for this variable, or null if it has not been set.
  • Constructor Details

    • DetachedVarSymbol

      public DetachedVarSymbol(long flags, com.sun.tools.javac.util.Name name, com.sun.tools.javac.code.Type type, com.sun.tools.javac.code.Symbol owner)
      Constructs a detached variable symbol, given its flags, name, type, and owner.
      Parameters:
      flags - the modifier flags of the variable
      name - the name of the variable
      type - the type of the variable
      owner - the symbol that owns the variable, such as a method
  • Method Details

    • setDeclaration

      public void setDeclaration(VariableTree decl)
      Sets the declaration tree for the variable.
      Parameters:
      decl - the declaration tree for the variable
    • getDeclaration

      public @Nullable VariableTree getDeclaration()
      Returns the declaration tree for the variable.
      Returns:
      the declaration tree for the variable, or null if it has not been set