public class

MemberDefinition

extends Object
implements Constants
java.lang.Object
   ↳ sun.tools.java.MemberDefinition
Known Direct Subclasses

Class Overview

This class defines a member of a Java class: a variable, a method, or an inner class. WARNING: The contents of this source file are not part of any supported API. Code that depends on them does so at its own risk: they are subject to change or removal without notice.

Summary

[Expand]
Inherited Constants
From interface sun.tools.java.Constants
From interface sun.tools.java.RuntimeConstants
Fields
protected MemberDefinition accessPeer
protected ClassDefinition clazz
protected String documentation
protected ClassDeclaration[] exp
protected IdentifierToken[] expIds
protected ClassDefinition innerClass
protected int modifiers
protected Identifier name
protected MemberDefinition nextMatch
protected MemberDefinition nextMember
protected boolean superAccessMethod
protected Type type
protected Node value
protected long where
[Expand]
Inherited Fields
From interface sun.tools.java.Constants
From interface sun.tools.java.RuntimeConstants
Public Constructors
MemberDefinition(long where, ClassDefinition clazz, int modifiers, Type type, Identifier name, IdentifierToken[] expIds, Node value)
Constructor
MemberDefinition(ClassDefinition innerClass)
Constructor for an inner class.
Public Methods
final void addModifiers(int mod)
final boolean canReach(Environment env, MemberDefinition f)
Check if a field can reach another field (only considers forward references, not the access modifiers).
Vset check(Environment env, Context ctx, Vset vset)
Really check the field definition.
void check(Environment env)
Request a check of the field definition.
boolean checkMeet(Environment env, MemberDefinition method, ClassDeclaration clazz)
Check to see if two method definitions are compatible, that is do they have a `meet'.
boolean checkOverride(Environment env, MemberDefinition method)
Check to see if `this' can override/hide `method'.
void cleanup(Environment env)
void code(Environment env, Assembler asm)
Generate code
void codeInit(Environment env, Context ctx, Assembler asm)
boolean couldOverride(Environment env, MemberDefinition method)
This method is meant to be used to determine if one of two inherited methods could override the other.
MemberDefinition getAccessMethodTarget()
Is this a synthetic method which provides access to a visible private member?
MemberDefinition getAccessUpdateMember()
If this method is a getter for a private field, return the setter.
Vector getArguments()
Get arguments (a vector of LocalMember)
final ClassDeclaration getClassDeclaration()
Get the class declaration
final ClassDefinition getClassDefinition()
Get the class definition
ClassDeclaration getDefiningClassDeclaration()
Get the class declaration in which the field is actually defined
String getDocumentation()
Get the field's documentation
final IdentifierToken[] getExceptionIds()
ClassDeclaration[] getExceptions(Environment env)
Get the exceptions that are thrown by this method.
Object getInitialValue()
ClassDefinition getInnerClass()
Get an inner class.
final int getModifiers()
Get the field's modifiers
final Identifier getName()
Get the field's name
final MemberDefinition getNextMatch()
final MemberDefinition getNextMember()
Get the next field or the next match
final ClassDefinition getTopClass()
Get the field's top-level enclosing class
final Type getType()
Get the field's type
final Node getValue()
Node getValue(Environment env)
Get the field's final value (may return null)
final long getWhere()
Get the position in the input
final boolean isAbstract()
boolean isAccessMethod()
final boolean isBlankFinal()
Tell if this is a final variable without an initializer.
boolean isConstant()
Check if constant: Will it inline away to a constant?
final boolean isConstructor()
final boolean isDeprecated()
final boolean isFinal()
final boolean isInitializer()
boolean isInlineable(Environment env, boolean fromFinal)
final boolean isInnerClass()
boolean isLocal()
final boolean isMethod()
final boolean isNative()
boolean isNeverNull()
final boolean isPackagePrivate()
final boolean isPrivate()
final boolean isProtected()
final boolean isPublic()
Checks
final boolean isStatic()
final boolean isStrict()
final boolean isSuperAccessMethod()
Is this an access method for a field selection or method call of the form '...super.foo' or '...super.foo()'?
final boolean isSynchronized()
final boolean isSynthetic()
final boolean isTransient()
boolean isUplevelValue()
Is this a synthetic field which holds a copy of, or reference to, a local variable or enclosing instance?
final boolean isVariable()
final boolean isVolatile()
static MemberDefinition makeProxyMember(MemberDefinition field, ClassDefinition classDef, Environment env)
Create a member which is externally the same as `field' but is defined in class `classDef'.
void print(PrintStream out)
Print for debugging
boolean reportDeprecated(Environment env)
Tells whether to report a deprecation error for this field.
void resolveTypeStructure(Environment env)
A stub.
boolean sameReturnType(MemberDefinition method)
Convenience method to see if two methods return the same type
void setAccessMethodTarget(MemberDefinition target)
void setAccessUpdateMember(MemberDefinition updater)
final void setIsSuperAccessMethod(boolean b)
Mark this member as an access method for a field selection or method call via the 'super' keyword.
final void setValue(Node value)
final void subModifiers(int mod)
String toString()
toString
[Expand]
Inherited Methods
From class java.lang.Object

Fields

protected MemberDefinition accessPeer

protected ClassDefinition clazz

protected String documentation

protected ClassDeclaration[] exp

protected IdentifierToken[] expIds

protected ClassDefinition innerClass

protected int modifiers

protected Identifier name

protected MemberDefinition nextMatch

protected MemberDefinition nextMember

protected boolean superAccessMethod

protected Type type

protected Node value

protected long where

Public Constructors

public MemberDefinition (long where, ClassDefinition clazz, int modifiers, Type type, Identifier name, IdentifierToken[] expIds, Node value)

Constructor

public MemberDefinition (ClassDefinition innerClass)

Constructor for an inner class. Inner classes are represented as fields right along with variables and methods for simplicity of data structure, and to reflect properly the textual declaration order.

This constructor calls the generic constructor for this class, extracting all necessary values from the innerClass.

Public Methods

public final void addModifiers (int mod)

public final boolean canReach (Environment env, MemberDefinition f)

Check if a field can reach another field (only considers forward references, not the access modifiers).

public Vset check (Environment env, Context ctx, Vset vset)

Really check the field definition.

Throws
ClassNotFound

public void check (Environment env)

Request a check of the field definition.

Throws
ClassNotFound

public boolean checkMeet (Environment env, MemberDefinition method, ClassDeclaration clazz)

Check to see if two method definitions are compatible, that is do they have a `meet'. The meet of two methods is essentially and `intersection' of two methods. This method is called when some class C inherits declarations for some method foo from two parents (superclass, interfaces) but it does not, itself, have a declaration of foo. Caller is responsible for making sure that both methods are indeed visible in clazz.

     A - void foo() throws e1
      \
       \     B void foo() throws e2
        \   /
         \ /
          C
 

public boolean checkOverride (Environment env, MemberDefinition method)

Check to see if `this' can override/hide `method'. Caller is responsible for verifying that `method' has the same signature as `this'. Caller is also responsible for verifying that `method' is visible to the class where this override is occurring. This method is called for the case when class B extends A and both A and B define some method.

       A - void foo() throws e1
       |
       |
       B - void foo() throws e2
 

public void cleanup (Environment env)

public void code (Environment env, Assembler asm)

Generate code

Throws
ClassNotFound

public void codeInit (Environment env, Context ctx, Assembler asm)

Throws
ClassNotFound

public boolean couldOverride (Environment env, MemberDefinition method)

This method is meant to be used to determine if one of two inherited methods could override the other. Unlike checkOverride(), failure is not an error. This method is only meant to be called after checkMeet() has succeeded on the two methods. If you call couldOverride() without doing a checkMeet() first, then you are on your own.

public MemberDefinition getAccessMethodTarget ()

Is this a synthetic method which provides access to a visible private member?

public MemberDefinition getAccessUpdateMember ()

If this method is a getter for a private field, return the setter.

public Vector getArguments ()

Get arguments (a vector of LocalMember)

public final ClassDeclaration getClassDeclaration ()

Get the class declaration

public final ClassDefinition getClassDefinition ()

Get the class definition

public ClassDeclaration getDefiningClassDeclaration ()

Get the class declaration in which the field is actually defined

public String getDocumentation ()

Get the field's documentation

public final IdentifierToken[] getExceptionIds ()

public ClassDeclaration[] getExceptions (Environment env)

Get the exceptions that are thrown by this method.

public Object getInitialValue ()

public ClassDefinition getInnerClass ()

Get an inner class.

public final int getModifiers ()

Get the field's modifiers

public final Identifier getName ()

Get the field's name

public final MemberDefinition getNextMatch ()

public final MemberDefinition getNextMember ()

Get the next field or the next match

public final ClassDefinition getTopClass ()

Get the field's top-level enclosing class

public final Type getType ()

Get the field's type

public final Node getValue ()

public Node getValue (Environment env)

Get the field's final value (may return null)

Throws
ClassNotFound

public final long getWhere ()

Get the position in the input

public final boolean isAbstract ()

public boolean isAccessMethod ()

public final boolean isBlankFinal ()

Tell if this is a final variable without an initializer. Such variables are subject to definite single assignment.

public boolean isConstant ()

Check if constant: Will it inline away to a constant?

public final boolean isConstructor ()

public final boolean isDeprecated ()

public final boolean isFinal ()

public final boolean isInitializer ()

public boolean isInlineable (Environment env, boolean fromFinal)

Throws
ClassNotFound

public final boolean isInnerClass ()

public boolean isLocal ()

public final boolean isMethod ()

public final boolean isNative ()

public boolean isNeverNull ()

public final boolean isPackagePrivate ()

public final boolean isPrivate ()

public final boolean isProtected ()

public final boolean isPublic ()

Checks

public final boolean isStatic ()

public final boolean isStrict ()

public final boolean isSuperAccessMethod ()

Is this an access method for a field selection or method call of the form '...super.foo' or '...super.foo()'?

public final boolean isSynchronized ()

public final boolean isSynthetic ()

public final boolean isTransient ()

public boolean isUplevelValue ()

Is this a synthetic field which holds a copy of, or reference to, a local variable or enclosing instance?

public final boolean isVariable ()

public final boolean isVolatile ()

public static MemberDefinition makeProxyMember (MemberDefinition field, ClassDefinition classDef, Environment env)

Create a member which is externally the same as `field' but is defined in class `classDef'. This is used by code in sun.tools.tree.(MethodExpression,FieldExpression) as part of the fix for bug 4135692. Proxy members should not be added, ala addMember(), to classes. They are merely "stand-ins" to produce modified MethodRef constant pool entries during code generation. We keep a cache of previously created proxy members not to save time or space, but to ensure uniqueness of the proxy member for any (field,classDef) pair. If these are not made unique then we can end up generating duplicate MethodRef constant pool entries during code generation.

public void print (PrintStream out)

Print for debugging

public boolean reportDeprecated (Environment env)

Tells whether to report a deprecation error for this field.

public void resolveTypeStructure (Environment env)

A stub. Subclasses can do more checking.

public boolean sameReturnType (MemberDefinition method)

Convenience method to see if two methods return the same type

public void setAccessMethodTarget (MemberDefinition target)

public void setAccessUpdateMember (MemberDefinition updater)

public final void setIsSuperAccessMethod (boolean b)

Mark this member as an access method for a field selection or method call via the 'super' keyword.

public final void setValue (Node value)

public final void subModifiers (int mod)

public String toString ()

toString

Returns
  • a string representation of the object.