Package org.codehaus.janino
Class Java.AnonymousClassDeclaration
- java.lang.Object
-
- org.codehaus.janino.Java.AbstractTypeDeclaration
-
- org.codehaus.janino.Java.AbstractClassDeclaration
-
- org.codehaus.janino.Java.AnonymousClassDeclaration
-
- All Implemented Interfaces:
Java.Annotatable
,Java.ClassDeclaration
,Java.Locatable
,Java.Scope
,Java.TypeDeclaration
- Enclosing class:
- Java
public static final class Java.AnonymousClassDeclaration extends Java.AbstractClassDeclaration
Representation of a JLS7 15.9.5 "anonymous class declaration".
-
-
Field Summary
Fields Modifier and Type Field Description Java.Type
baseType
Base class or interface.-
Fields inherited from class org.codehaus.janino.Java.AbstractClassDeclaration
constructors, fieldDeclarationsAndInitializers
-
Fields inherited from class org.codehaus.janino.Java.AbstractTypeDeclaration
anonymousClassCount, localClassCount
-
-
Constructor Summary
Constructors Constructor Description AnonymousClassDeclaration(Location location, Java.Type baseType)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description <R,EX extends java.lang.Throwable>
Raccept(Visitor.TypeDeclarationVisitor<R,EX> visitor)
Invokes the "visit...()
" method ofVisitor.TypeDeclarationVisitor
for the concreteJava.TypeDeclaration
type.void
defineSyntheticField(IClass.IField iField)
Inner classes have zero or more synthetic fields that hold references to their enclosing context:this$<em>n</em>
(Mandatory for non-private non-static member classes; optional for private non-static member classes, local classes in non-static context, and anonymous classes in non-static context; forbidden for static member classes, local classes in static context, and anonymous classes in static context) Holds a reference to the immediately enclosing instance.java.lang.String
getClassName()
Determines the effective class name, e.g.java.lang.String
toString()
-
Methods inherited from class org.codehaus.janino.Java.AbstractClassDeclaration
addConstructor, addFieldDeclaration, addFieldDeclarationOrInitializer, addInitializer, defineSyntheticField, getSyntheticFields, getVariableDeclaratorsAndInitializers
-
Methods inherited from class org.codehaus.janino.Java.AbstractTypeDeclaration
addDeclaredMethod, addMemberTypeDeclaration, createAnonymousClassName, createLocalTypeName, getAnnotations, getEnclosingScope, getLocation, getMemberTypeDeclaration, getMemberTypeDeclarations, getMethodDeclaration, getMethodDeclarations, getModifiers, getOptionalTypeParameters, invalidateMethodCaches, setEnclosingScope, throwCompileException
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.codehaus.janino.Java.Annotatable
getAnnotations
-
Methods inherited from interface org.codehaus.janino.Java.ClassDeclaration
getSyntheticFields, getVariableDeclaratorsAndInitializers
-
Methods inherited from interface org.codehaus.janino.Java.Locatable
getLocation, throwCompileException
-
Methods inherited from interface org.codehaus.janino.Java.Scope
getEnclosingScope
-
Methods inherited from interface org.codehaus.janino.Java.TypeDeclaration
createAnonymousClassName, createLocalTypeName, getMemberTypeDeclaration, getMemberTypeDeclarations, getMethodDeclaration, getMethodDeclarations
-
-
-
-
Field Detail
-
baseType
public final Java.Type baseType
Base class or interface.
-
-
Method Detail
-
accept
@Nullable public <R,EX extends java.lang.Throwable> R accept(Visitor.TypeDeclarationVisitor<R,EX> visitor) throws EX extends java.lang.Throwable
Description copied from interface:Java.TypeDeclaration
Invokes the "visit...()
" method ofVisitor.TypeDeclarationVisitor
for the concreteJava.TypeDeclaration
type.- Specified by:
accept
in interfaceJava.TypeDeclaration
- Throws:
EX extends java.lang.Throwable
-
getClassName
public java.lang.String getClassName()
Description copied from interface:Java.TypeDeclaration
Determines the effective class name, e.g. "pkg.Outer$Inner".- Specified by:
getClassName
in interfaceJava.TypeDeclaration
-
toString
public java.lang.String toString()
- Specified by:
toString
in classJava.AbstractTypeDeclaration
-
defineSyntheticField
public abstract void defineSyntheticField(IClass.IField iField) throws CompileException
Inner classes have zero or more synthetic fields that hold references to their enclosing context:this$<em>n</em>
-
(Mandatory for non-private non-static member classes; optional for private non-static
member classes, local classes in non-static context, and anonymous classes in
non-static context; forbidden for static member classes, local classes in static
context, and anonymous classes in static context)
Holds a reference to the immediately enclosing instance.
<em>n</em>
is N-1 for the Nth nesting level; e.g. the public non-static member class of a package member class has a synthetic fieldthis$0
. val$<em>local-variable-name</em>
-
(Allowed for local classes and anonymous classes; forbidden for member classes)
Hold copies of
final
local variables of the defining context.
Notice that these fields are not included in the
IClass.IField
array returned byIClass.getDeclaredIFields2()
.If a synthetic field with the same name exists already, then it must have the same type and the redefinition is ignored.
- Parameters:
iField
-- Throws:
CompileException
-
-