java.lang.Object | |
↳ | sun.tools.java.ClassDefinition |
Known Direct Subclasses |
This class is a Java class definition 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.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
sun.tools.java.Constants
| |||||||||||
From interface
sun.tools.java.RuntimeConstants
|
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
classContext | |||||||||||
declaration | |||||||||||
doInheritanceChecks | A flag used by turnOffInheritanceChecks() to indicate if inheritance checks are on or off. | ||||||||||
documentation | |||||||||||
error | |||||||||||
firstMember | |||||||||||
innerClassMember | |||||||||||
interfaceIds | |||||||||||
interfaces | |||||||||||
lastMember | |||||||||||
localName | |||||||||||
modifiers | |||||||||||
nestError | |||||||||||
outerClass | |||||||||||
outerMember | |||||||||||
references | |||||||||||
referencesFrozen | |||||||||||
resolved | |||||||||||
source | |||||||||||
superClass | |||||||||||
superClassId | |||||||||||
supersCheckStarted | |||||||||||
where |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
sun.tools.java.Constants
| |||||||||||
From interface
sun.tools.java.RuntimeConstants
|
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructor
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Add a dependency
| |||||||||||
Add a field (subclasses make checks)
| |||||||||||
Add a field (no checks)
| |||||||||||
Check if another class can be accessed from within the body of this class.
| |||||||||||
Check if a field can be accessed from a class
| |||||||||||
Check this class.
| |||||||||||
After the class has been written to disk, try to free up
some storage.
| |||||||||||
Return true if the given documentation string contains a deprecation
paragraph.
| |||||||||||
Check to see if a class which implements interface `this' could
possibly implement the interface `intDef'.
| |||||||||||
Given the fact that this class has no method "nm" matching "argTypes",
find out if the mismatch can be blamed on a particular actual argument
which disagrees with all of the overloadings.
| |||||||||||
Check if this is an enclosing class of another class
| |||||||||||
Check if another class can be accessed from the 'extends' or 'implements'
clause of this class.
| |||||||||||
Find any method with a given name.
| |||||||||||
Find a method, ie: exact match in this class or any of the super
classes.
| |||||||||||
If inner, return an innermost uplevel self pointer, if any exists.
| |||||||||||
Find or create an access method for a private member,
or return null if this is not possible.
| |||||||||||
Get the class declaration
| |||||||||||
Get helper method for class literal lookup.
| |||||||||||
Get the class' documentation
| |||||||||||
Check if there were any errors in this class.
| |||||||||||
Get the class' first field or first match
| |||||||||||
Get an inner class.
| |||||||||||
If inner, get the field for this class in the enclosing class
| |||||||||||
Get the class' interfaces
| |||||||||||
Maintain a hash table of local and anonymous classes
whose internal names are prefixed by the current class.
| |||||||||||
Return a simple identifier for this class (idNull if anonymous).
| |||||||||||
Get an Iterator of all methods which could be accessed in an
instance of this class.
| |||||||||||
Get an Iterator of all methods which could be accessed in an
instance of this class.
| |||||||||||
Get the class' modifiers
| |||||||||||
Get the class' name
| |||||||||||
Check if there were any errors in our class nest.
| |||||||||||
Get the class' enclosing class (or null if not inner)
| |||||||||||
Find or create an uplevel reference for the given target.
| |||||||||||
Return the list of all uplevel references.
| |||||||||||
Return the same value as getReferences.
| |||||||||||
Get the source of the class
| |||||||||||
Get the class' super class
| |||||||||||
Get the super class, and resolve names now if necessary.
| |||||||||||
Get the class' top-level enclosing class
| |||||||||||
Get the class' type
| |||||||||||
Find or create an update method for a private member,
or return null if this is not possible.
| |||||||||||
Get a field from this class.
| |||||||||||
Get the position in the input
| |||||||||||
Check if this class is implemented by another class
| |||||||||||
While resolving import directives, the question has arisen:
does a given inner class exist? If the top-level class exists,
we ask it about an inner class via this method.
| |||||||||||
Tell if the class is inner.
| |||||||||||
Tell if the class is local or inside a local class,
which means it cannot be mentioned outside of its file.
| |||||||||||
Tell if the class is local or or anonymous class, or inside
such a class, which means it cannot be mentioned outside of
its file.
| |||||||||||
Checks
| |||||||||||
Tell if the class is a member of another class.
| |||||||||||
See if this is a (nested) static class.
| |||||||||||
Tell if the class is "top-level", which is either a package member,
or a static member of another top-level class.
| |||||||||||
A version of matchMethod to be used only for constructors
when we cannot pass in a sourceClass argument.
| |||||||||||
Lookup a method.
| |||||||||||
Lookup a method.
| |||||||||||
Check to see if a class must be abstract.
| |||||||||||
Note that this class is being used somehow by ref.
| |||||||||||
Check if a class is entitled to inline access to a method from
another class.
| |||||||||||
Check if a class is entitled to inline access to a class from
another class.
| |||||||||||
Print for debugging
| |||||||||||
We know the the field is marked protected (and not public) and that
the field is visible (as per canAccess).
| |||||||||||
assertion check
| |||||||||||
Tells whether to report a deprecation error for this class.
| |||||||||||
Interpret a qualified class name, which may have further subcomponents..
| |||||||||||
Look up an inner class name, from somewhere inside this class.
| |||||||||||
We create a stub for this.
| |||||||||||
Mark this class to be erroneous.
| |||||||||||
Set the local name of a class.
| |||||||||||
Mark this class, and all siblings in its class nest, to be
erroneous.
| |||||||||||
Check if this is a sub class of another class
| |||||||||||
Check if this is a super class of another class
| |||||||||||
Convert to String
| |||||||||||
This is a workaround to allow javadoc to turn off certain
inheritance/override checks which interfere with javadoc
badly.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Add a list of methods to this class as miranda methods.
| |||||||||||
Collect all methods defined in this class or inherited from any of our superclasses or interfaces. | |||||||||||
This method returns an Iterator of all abstract methods
in our superclasses which we are unable to implement.
| |||||||||||
Set the class' enclosing class.
| |||||||||||
Set the class' enclosing current instance pointer.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
A flag used by turnOffInheritanceChecks() to indicate if inheritance checks are on or off.
Constructor
Add a field (subclasses make checks)
Check if another class can be accessed from within the body of this class.
ClassNotFound |
---|
Check if a field can be accessed from a class
ClassNotFound |
---|
ClassNotFound |
---|
After the class has been written to disk, try to free up some storage.
Return true if the given documentation string contains a deprecation paragraph. This is true if the string contains the tag @deprecated is the first word in a line.
Check to see if a class which implements interface `this' could possibly implement the interface `intDef'. Note that the only way that this can fail is if `this' and `intDef' have methods which are of the same signature and different return types. This method is used by Environment.explicitCast() to determine if a cast between two interfaces is legal. This method should only be called on a class after it has been basicCheck()'ed.
Given the fact that this class has no method "nm" matching "argTypes", find out if the mismatch can be blamed on a particular actual argument which disagrees with all of the overloadings. If so, return the code (i<<2)+(castOK<<1)+ambig, where "i" is the number of the offending argument, and "castOK" is 1 if a cast could fix the problem. The target type for the argument is returned in margTypeResult[0]. If not all methods agree on this type, "ambig" is 1. If there is more than one method, the choice of target type is arbitrary.
Return -1 if every argument is acceptable to at least one method. Return -2 if there are no methods of the required arity. The value "start" gives the index of the first argument to begin checking.
ClassNotFound |
---|
Check if this is an enclosing class of another class
Check if another class can be accessed from the 'extends' or 'implements' clause of this class.
ClassNotFound |
---|
Find any method with a given name.
ClassNotFound |
---|
Find a method, ie: exact match in this class or any of the super classes. Only called by javadoc. For now I am holding off rewriting this code to rely on collectInheritedMethods(), as that code has not gotten along with javadoc in the past.
ClassNotFound |
---|
If inner, return an innermost uplevel self pointer, if any exists. Otherwise, return null.
Find or create an access method for a private member, or return null if this is not possible.
Get helper method for class literal lookup.
Check if there were any errors in this class.
Get an inner class. Look in supers but not outers. (This is used directly to resolve expressions like "site.K", and inside a loop to resolve lone names like "K" or the "K" in "K.L".) Called from 'Context' and 'FieldExpression' as well as this class.
ClassNotFound |
---|
If inner, get the field for this class in the enclosing class
Maintain a hash table of local and anonymous classes whose internal names are prefixed by the current class. The key is the simple internal name, less the prefix.
Get an Iterator of all methods which could be accessed in an instance of this class.
Get an Iterator of all methods which could be accessed in an instance of this class. Throw a compiler error if we haven't generated this information yet.
Get the class' modifiers
Check if there were any errors in our class nest.
Find or create an uplevel reference for the given target.
Return the same value as getReferences. Also, mark the set of references frozen. After that, it is an error to add new references.
Get the super class, and resolve names now if necessary. It is only possible to resolve names at this point if we are a source class. The provision of this method at this level in the class hierarchy is dubious, but see 'getInnerClass' below. All other calls to 'getSuperClass(env)' appear in 'SourceClass'. NOTE: An older definition of this method has been moved to 'SourceClass', where it overrides this one.
Find or create an update method for a private member, or return null if this is not possible.
Get a field from this class. Report ambiguous fields. If no accessible field is found, this method may return an inaccessible field to allow a useful error message. getVariable now takes the source class `source' as an argument. This allows getVariable to check whether a field is inaccessible before it signals that a field is ambiguous. The compiler used to signal an ambiguity even when one of the fields involved was not accessible. (bug 4053724)
AmbiguousMember | |
---|---|
ClassNotFound |
Get the position in the input
Check if this class is implemented by another class
ClassNotFound |
---|
While resolving import directives, the question has arisen: does a given inner class exist? If the top-level class exists, we ask it about an inner class via this method. This method looks only at the literal name of the class, and does not attempt to follow inheritance links. This is necessary, since at the time imports are being processed, inheritance links have not been resolved yet. (Thus, an import directive must always spell a class name exactly.)
Tell if the class is inner. This predicate also returns true for top-level nested types. To test for a true inner class as seen by the programmer, use !isTopLevel().
Tell if the class is local or inside a local class, which means it cannot be mentioned outside of its file.
Tell if the class is local or or anonymous class, or inside such a class, which means it cannot be mentioned outside of its file.
Checks
Tell if the class is a member of another class. This is false for package members and for block-local classes.
See if this is a (nested) static class.
Tell if the class is "top-level", which is either a package member, or a static member of another top-level class.
A version of matchMethod to be used only for constructors when we cannot pass in a sourceClass argument. We just assert our package name. This is used only for anonymous classes, where we have to look up a (potentially) protected constructor with no valid sourceClass parameter available.
AmbiguousMember | |
---|---|
ClassNotFound |
Lookup a method. This code implements the method lookup mechanism specified in JLS 15.11.2. This mechanism cannot be used to lookup synthetic methods.
AmbiguousMember | |
---|---|
ClassNotFound |
Lookup a method. This code implements the method lookup mechanism specified in JLS 15.11.2. This mechanism cannot be used to lookup synthetic methods.
AmbiguousMember | |
---|---|
ClassNotFound |
Check to see if a class must be abstract. This method replaces isAbstract(env)
Note that this class is being used somehow by ref. Report deprecation errors, etc.
Check if a class is entitled to inline access to a method from another class.
ClassNotFound |
---|
Check if a class is entitled to inline access to a class from another class.
ClassNotFound |
---|
We know the the field is marked protected (and not public) and that
the field is visible (as per canAccess). Can we access the field as
ClassNotFound |
---|
assertion check
Tells whether to report a deprecation error for this class.
Interpret a qualified class name, which may have further subcomponents.. Follow inheritance links, as in: class C { class N { } } class D extends C { } ... new D.N() ... Ignore outer scopes and packages.
Look up an inner class name, from somewhere inside this class. Since supers and outers are in scope, search them too.
If no inner class is found, env.resolveName() is then called, to interpret the ambient package and import directives.
This routine operates on a "best-efforts" basis. If at some point a class is not found, the partially-resolved identifier is returned. Eventually, someone else has to try to get the ClassDefinition and diagnose the ClassNotFound.
resolveName() looks at surrounding scopes, and hence pulling in both inherited and uplevel types. By contrast, resolveInnerClass() is intended only for interpreting explicitly qualified names, and so look only at inherited types. Also, resolveName() looks for package prefixes, which appear similar to "very uplevel" outer classes.
A similar (but more complex) name-lookup process happens when field and identifier expressions denoting qualified names are type-checked. The added complexity comes from the fact that variables may occur in such names, and take precedence over class and package names.
In the expression type-checker, resolveInnerClass() is paralleled by code in FieldExpression.checkAmbigName(), which also calls ClassDefinition.getInnerClass() to interpret names of the form "OuterClass.Inner" (and also outerObject.Inner). The checking of an identifier expression that fails to be a variable is referred directly to resolveName().
We create a stub for this. Source classes do more work. Some calls from 'SourceClass.checkSupers' execute this method.
Mark this class to be erroneous.
Mark this class, and all siblings in its class nest, to be erroneous.
Check if this is a sub class of another class
ClassNotFound |
---|
Check if this is a super class of another class
ClassNotFound |
---|
This is a workaround to allow javadoc to turn off certain inheritance/override checks which interfere with javadoc badly. In the future it might be good to eliminate the shared sources of javadoc and javac to avoid the need for this sort of workaround.
Add a list of methods to this class as miranda methods. This gets overridden with a meaningful implementation in SourceClass. BinaryClass should not need to do anything -- it should already have its miranda methods and, if it doesn't, then that doesn't affect our compilation.
Collect all methods defined in this class or inherited from any of our superclasses or interfaces. Look for any incompatible definitions.
This function is also responsible for collecting the Miranda methods for a class. For a definition of Miranda methods, see the comment in addMirandaMethods() below.
This method returns an Iterator of all abstract methods in our superclasses which we are unable to implement.
Set the class' enclosing class. Must be done at most once.
Set the class' enclosing current instance pointer. Must be done at most once.