edu.rice.cs.javalanglevels
Class Augmentor

java.lang.Object
  extended by edu.rice.cs.javalanglevels.tree.JExpressionIFDepthFirstVisitor<java.lang.Void>
      extended by edu.rice.cs.javalanglevels.Augmentor
All Implemented Interfaces:
JExpressionIFVisitor<java.lang.Void>
Direct Known Subclasses:
Augmentor.MethodBodyAugmentor

public class Augmentor
extends JExpressionIFDepthFirstVisitor<java.lang.Void>


Nested Class Summary
static class Augmentor.AugmentorTest
          Test class for the Augmentor class.
static class Augmentor.Exception
           
static class Augmentor.MethodBodyAugmentor
           
 
Constructor Summary
  Augmentor(boolean safeSupportCode, java.io.BufferedReader fileIn, java.io.BufferedWriter fileOut, LanguageLevelVisitor llv)
          Main constructor for Augmentor: Used by the LanguageLevelConverter when converting language level files.
protected Augmentor(SymbolData d)
          Create another Augmentor sharing the same static fields as the current Augmentor, but with a new _enclosingData d.
 
Method Summary
protected  void augmentVariableDeclarationModifiers(VariableDeclaration that)
          Writes out implicit variableDeclarationModfiers that must be added to augmented file.
protected  java.lang.Void defaultCase(JExpressionIF that)
          This method is called by default from cases that do not override forCASEOnly.
 java.lang.Void forAbstractMethodDef(AbstractMethodDef md)
          Delegate the augmentation of this AbstractMethodDef to forMethodDef.
 java.lang.Void forAnonymousClassInstantiation(AnonymousClassInstantiation e)
           
 java.lang.Void forClassDef(ClassDef cd)
          Class Defs can only appear at the top level of a source file.
 java.lang.Void forComplexAnonymousClassInstantiation(ComplexAnonymousClassInstantiation e)
          Visit the encosing part of this ComplexAnonymousClass name, and then delegate to forAnonymousClassInstantiation(e).
 java.lang.Void forConcreteMethodDef(ConcreteMethodDef that)
          Delegate the augmentation of this method def's declaration to forMethodDef.
 java.lang.Void forConstructorDef(ConstructorDef that)
          Do the augmentation necessary for a ConstructorDef.
 java.lang.Void forFormalParameter(FormalParameter that)
          All formal parameters (parameters to a method or in a catch clause) are augmented to be "final".
 java.lang.Void forInnerClassDef(InnerClassDef cd)
          Look up this inner class in the enclosing data, and then visits its body.
 java.lang.Void forInnerInterfaceDef(InnerInterfaceDef cd)
          Look up this inner interface in the enclosing data, and then visit its body with a new Augmentor.
 java.lang.Void forInterfaceDef(InterfaceDef cd)
          Look up this top level interface in the symbolTable, and then visit its body.
protected static TypeData[] formalParameters2TypeDatas(FormalParameter[] fps, SymbolData enclosing)
          Convert the provided FormalParameter array into an array of TypeData corresponding to the types of the FormalParameters.
 java.lang.Void forMethodDef(MethodDef that)
          Do the augmentation necessary for a MethodDef.
 java.lang.Void forSimpleAnonymousClassInstantiation(SimpleAnonymousClassInstantiation e)
          Delegate to for AnonymousClassInstantiation(e).
 java.lang.Void forSourceFile(SourceFile sf)
          Sort the Class and Interface defs based on the order they appear in the file.
 java.lang.Void forVariableDeclaration(VariableDeclaration that)
          Do the augmenting appropriate for a Variable Declaration: all Variable Declarations should be augmented with "final" if such a modifier is not already present.
static java.util.SortedMap<java.lang.Integer,java.lang.Integer> getLineNumberMap()
          Returns a copy of the line number map that maps original dj* line numbers to generated java line numbers.
protected  java.lang.Void[] makeArrayOfRetType(int len)
          Return a Void array of the specified size.
protected static void writeAccessors(SymbolData sd, int baseIndent)
          Write an accessor method for each previously generated (determined by MethodData.isGenerated()) accessor.
protected static void writeAnonEquals(int baseIndent)
          AnonymousClasses are only equal if they are identical.
protected static void writeConstructor(java.lang.String className, SymbolData sd, int baseIndent)
          Write a constructor for a previously generated (determined by MethodData.isGenerated()) constructor, if one exists.
protected static void writeEquals(java.lang.String className, SymbolData sd, int baseIndent, java.lang.String valueEqualsName)
          Write an equals method that requires the Object parameter to be an instanceof this type and have matching fields for each of the fields with visible accessors.
protected static void writeHashCode(java.lang.String className, SymbolData sd, int baseIndent, boolean waitForVarDef, java.lang.String valueHashCodeName)
          Write a hashCode method that is consistent with the generated equals(Object) method.
protected static void writeSafeEquals(java.lang.String className, SymbolData sd, int baseIndent, java.lang.String valueEqualsName, MethodData[] accessors)
          Helper to writeEquals; writes an equals that handles infinitely-recursive data structures.
protected static void writeSafeHashCode(java.lang.String className, SymbolData sd, int baseIndent, boolean waitForVarDef, java.lang.String valueHashCodeName, MethodData[] accessors)
          Helper to writeHashCode; writes a hashCode that handles infinitely-recursive data structures.
protected static void writeSafeToString(SymbolData sd, int baseIndent, java.lang.String valueToStringName, MethodData[] accessors)
          Helper to writeToString; writes a toString that handles infinitely-recursive data structures.
protected static void writeSimpleEquals(java.lang.String className, SymbolData sd, int baseIndent, java.lang.String valueEqualsName, MethodData[] accessors)
          Helper to writeEquals; writes a simple equals that does not handle infinitely-recursive data structures.
protected static void writeSimpleHashCode(java.lang.String className, SymbolData sd, int baseIndent, boolean waitForVarDef, java.lang.String valueHashCodeName, MethodData[] accessors)
          Helper to writeHashCode; writes a simple hashCode that does not handle infinitely-recursive data structures.
protected static void writeSimpleToString(SymbolData sd, int baseIndent, java.lang.String valueToStringName, MethodData[] accessors)
          Helper to writeToString; writes a short toString that does not handle infinitely-recursive data structures.
protected static void writeToString(SymbolData sd, int baseIndent, java.lang.String valueToStringName)
          Write a toString method that prints out each field with a visible accessor.
 
Methods inherited from class edu.rice.cs.javalanglevels.tree.JExpressionIFDepthFirstVisitor
forAbstractMethodDefOnly, forAndExpression, forAndExpressionOnly, forAnonymousClassInstantiationOnly, forArrayAccess, forArrayAccessOnly, forArrayInitializer, forArrayInitializerOnly, forArrayInstantiationOnly, forArrayType, forArrayTypeOnly, forAssignmentExpressionOnly, forBinaryExpressionOnly, forBitwiseAndAssignmentExpression, forBitwiseAndAssignmentExpressionOnly, forBitwiseAndExpression, forBitwiseAndExpressionOnly, forBitwiseAssignmentExpressionOnly, forBitwiseBinaryExpressionOnly, forBitwiseNotExpression, forBitwiseNotExpressionOnly, forBitwiseOrAssignmentExpression, forBitwiseOrAssignmentExpressionOnly, forBitwiseOrExpression, forBitwiseOrExpressionOnly, forBitwiseXorAssignmentExpression, forBitwiseXorAssignmentExpressionOnly, forBitwiseXorExpression, forBitwiseXorExpressionOnly, forBlock, forBlockOnly, forBodyOnly, forBooleanExpressionOnly, forBooleanLiteral, forBooleanLiteralOnly, forBracedBody, forBracedBodyOnly, forBreakStatementOnly, forCastExpression, forCastExpressionOnly, forCatchBlock, forCatchBlockOnly, forCharLiteral, forCharLiteralOnly, forClassDefOnly, forClassImportStatement, forClassImportStatementOnly, forClassInstantiationOnly, forClassLiteral, forClassLiteralOnly, forClassOrInterfaceType, forClassOrInterfaceTypeOnly, forComparisonExpressionOnly, forComplexAnonymousClassInstantiationOnly, forComplexInitializedArrayInstantiation, forComplexInitializedArrayInstantiationOnly, forComplexMethodInvocation, forComplexMethodInvocationOnly, forComplexNamedClassInstantiation, forComplexNamedClassInstantiationOnly, forComplexNameReference, forComplexNameReferenceOnly, forComplexSuperConstructorInvocation, forComplexSuperConstructorInvocationOnly, forComplexSuperReference, forComplexSuperReferenceOnly, forComplexThisConstructorInvocation, forComplexThisConstructorInvocationOnly, forComplexThisReference, forComplexThisReferenceOnly, forComplexUninitializedArrayInstantiation, forComplexUninitializedArrayInstantiationOnly, forCompoundWord, forCompoundWordOnly, forConcreteMethodDefOnly, forConditionalExpression, forConditionalExpressionOnly, forConstructorDefOnly, forContinueStatementOnly, forDefaultCase, forDefaultCaseOnly, forDimensionExpressionList, forDimensionExpressionListOnly, forDivideAssignmentExpression, forDivideAssignmentExpressionOnly, forDivideExpression, forDivideExpressionOnly, forDoStatement, forDoStatementOnly, forDoubleLiteral, forDoubleLiteralOnly, forEmptyExpression, forEmptyExpressionOnly, forEmptyForCondition, forEmptyForConditionOnly, forEmptyStatement, forEmptyStatementOnly, forEqualityExpressionOnly, forEqualsExpression, forEqualsExpressionOnly, forExpressionListOnly, forExpressionOnly, forExpressionStatement, forExpressionStatementOnly, forFloatLiteral, forFloatLiteralOnly, forFormalParameterOnly, forForStatement, forForStatementOnly, forFunctionInvocationOnly, forGreaterThanExpression, forGreaterThanExpressionOnly, forGreaterThanOrEqualExpression, forGreaterThanOrEqualExpressionOnly, forIfThenElseStatement, forIfThenElseStatementOnly, forIfThenStatement, forIfThenStatementOnly, forImportStatementOnly, forIncrementExpressionOnly, forInitializedArrayInstantiationOnly, forInitializedVariableDeclarator, forInitializedVariableDeclaratorOnly, forInitializerOnly, forInnerClassDefOnly, forInnerInterfaceDefOnly, forInstanceInitializer, forInstanceInitializerOnly, forInstanceofExpression, forInstanceofExpressionOnly, forInstantiationOnly, forIntegerLiteral, forIntegerLiteralOnly, forInterfaceDefOnly, forJExpressionOnly, forLabeledBreakStatement, forLabeledBreakStatementOnly, forLabeledCase, forLabeledCaseOnly, forLabeledContinueStatement, forLabeledContinueStatementOnly, forLabeledStatement, forLabeledStatementOnly, forLeftShiftAssignmentExpression, forLeftShiftAssignmentExpressionOnly, forLeftShiftExpression, forLeftShiftExpressionOnly, forLessThanExpression, forLessThanExpressionOnly, forLessThanOrEqualExpression, forLessThanOrEqualExpressionOnly, forLexicalLiteralOnly, forLongLiteral, forLongLiteralOnly, forMemberType, forMemberTypeOnly, forMethodDefOnly, forMethodInvocationOnly, forMinusAssignmentExpression, forMinusAssignmentExpressionOnly, forMinusExpression, forMinusExpressionOnly, forModAssignmentExpression, forModAssignmentExpressionOnly, forModExpression, forModExpressionOnly, forModifiersAndVisibility, forModifiersAndVisibilityOnly, forMultiplyAssignmentExpression, forMultiplyAssignmentExpressionOnly, forMultiplyExpression, forMultiplyExpressionOnly, forNamedClassInstantiationOnly, forNameReferenceOnly, forNegativeExpression, forNegativeExpressionOnly, forNegativePostfixIncrementExpression, forNegativePostfixIncrementExpressionOnly, forNegativePrefixIncrementExpression, forNegativePrefixIncrementExpressionOnly, forNoOpExpression, forNoOpExpressionOnly, forNormalTryCatchStatement, forNormalTryCatchStatementOnly, forNotEqualExpression, forNotEqualExpressionOnly, forNotExpression, forNotExpressionOnly, forNullLiteral, forNullLiteralOnly, forNumericAssignmentExpressionOnly, forNumericBinaryExpressionOnly, forNumericUnaryExpressionOnly, forOrExpression, forOrExpressionOnly, forPackageImportStatement, forPackageImportStatementOnly, forPackageStatement, forPackageStatementOnly, forParenthesized, forParenthesizedExpressionList, forParenthesizedExpressionListOnly, forParenthesizedOnly, forPlusAssignmentExpression, forPlusAssignmentExpressionOnly, forPlusExpression, forPlusExpressionOnly, forPositiveExpression, forPositiveExpressionOnly, forPositivePostfixIncrementExpression, forPositivePostfixIncrementExpressionOnly, forPositivePrefixIncrementExpression, forPositivePrefixIncrementExpressionOnly, forPostfixIncrementExpressionOnly, forPrefixIncrementExpressionOnly, forPrimaryOnly, forPrimitiveType, forPrimitiveTypeOnly, forReferenceTypeOnly, forReturnStatementOnly, forRightSignedShiftAssignmentExpression, forRightSignedShiftAssignmentExpressionOnly, forRightSignedShiftExpression, forRightSignedShiftExpressionOnly, forRightUnsignedShiftAssignmentExpression, forRightUnsignedShiftAssignmentExpressionOnly, forRightUnsignedShiftExpression, forRightUnsignedShiftExpressionOnly, forShiftAssignmentExpressionOnly, forShiftBinaryExpressionOnly, forSimpleAnonymousClassInstantiationOnly, forSimpleAssignmentExpression, forSimpleAssignmentExpressionOnly, forSimpleInitializedArrayInstantiation, forSimpleInitializedArrayInstantiationOnly, forSimpleMethodInvocation, forSimpleMethodInvocationOnly, forSimpleNamedClassInstantiation, forSimpleNamedClassInstantiationOnly, forSimpleNameReference, forSimpleNameReferenceOnly, forSimpleSuperConstructorInvocation, forSimpleSuperConstructorInvocationOnly, forSimpleSuperReference, forSimpleSuperReferenceOnly, forSimpleThisConstructorInvocation, forSimpleThisConstructorInvocationOnly, forSimpleThisReference, forSimpleThisReferenceOnly, forSimpleUninitializedArrayInstantiation, forSimpleUninitializedArrayInstantiationOnly, forSourceFileOnly, forStatementOnly, forStaticInitializer, forStaticInitializerOnly, forStringLiteral, forStringLiteralOnly, forSuperConstructorInvocationOnly, forSuperReferenceOnly, forSwitchCaseOnly, forSwitchStatement, forSwitchStatementOnly, forSynchronizedStatement, forSynchronizedStatementOnly, forThisConstructorInvocationOnly, forThisReferenceOnly, forThrowStatement, forThrowStatementOnly, forTryCatchFinallyStatement, forTryCatchFinallyStatementOnly, forTryCatchStatementOnly, forTypeDefBaseOnly, forTypeOnly, forTypeParameter, forTypeParameterOnly, forTypeVariable, forTypeVariableOnly, forUnaryExpressionOnly, forUnbracedBody, forUnbracedBodyOnly, forUninitializedArrayInstantiationOnly, forUninitializedVariableDeclarator, forUninitializedVariableDeclaratorOnly, forUnlabeledBreakStatement, forUnlabeledBreakStatementOnly, forUnlabeledContinueStatement, forUnlabeledContinueStatementOnly, forUnparenthesizedExpressionList, forUnparenthesizedExpressionListOnly, forValueReturnStatement, forValueReturnStatementOnly, forVariableDeclarationOnly, forVariableDeclaratorOnly, forVariableReferenceOnly, forVoidReturn, forVoidReturnOnly, forVoidReturnStatement, forVoidReturnStatementOnly, forWhileStatement, forWhileStatementOnly, forWord, forWordOnly
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Augmentor

public Augmentor(boolean safeSupportCode,
                 java.io.BufferedReader fileIn,
                 java.io.BufferedWriter fileOut,
                 LanguageLevelVisitor llv)
Main constructor for Augmentor: Used by the LanguageLevelConverter when converting language level files.

Parameters:
safeSupportCode - true if the user wants safe support code to be generated (this comes with a high overhead)
fileIn - A BufferedReader corresponding to the LanguageLevel file we should read from
fileOut - A BufferedWriter corresponding to the .java file we should write to.
llv - The LanguageLevelVisitor that was used to traverse the language level file.

Augmentor

protected Augmentor(SymbolData d)
Create another Augmentor sharing the same static fields as the current Augmentor, but with a new _enclosingData d. This constructor should only be called from within another Augmentor.

Parameters:
d - The EnclosingData from which this Augmentor works.
Method Detail

defaultCase

protected java.lang.Void defaultCase(JExpressionIF that)
This method is called by default from cases that do not override forCASEOnly.

Specified by:
defaultCase in class JExpressionIFDepthFirstVisitor<java.lang.Void>

makeArrayOfRetType

protected java.lang.Void[] makeArrayOfRetType(int len)
Return a Void array of the specified size.

Specified by:
makeArrayOfRetType in class JExpressionIFDepthFirstVisitor<java.lang.Void>

augmentVariableDeclarationModifiers

protected void augmentVariableDeclarationModifiers(VariableDeclaration that)
Writes out implicit variableDeclarationModfiers that must be added to augmented file. If no visibility modifier is present, this method makes static fields "public final" and instance fields "private final". If a visibility modifier is present, it overrides this default. But all fields are forced to be "final".

Parameters:
that - is the field declaration being augmented

forVariableDeclaration

public java.lang.Void forVariableDeclaration(VariableDeclaration that)
Do the augmenting appropriate for a Variable Declaration: all Variable Declarations should be augmented with "final" if such a modifier is not already present.

Specified by:
forVariableDeclaration in interface JExpressionIFVisitor<java.lang.Void>
Overrides:
forVariableDeclaration in class JExpressionIFDepthFirstVisitor<java.lang.Void>
Parameters:
that - The VariableDeclaration we are augmenting.

forFormalParameter

public java.lang.Void forFormalParameter(FormalParameter that)
All formal parameters (parameters to a method or in a catch clause) are augmented to be "final". Always read up to the start of the FormalParameter before beginning augmentation.

Specified by:
forFormalParameter in interface JExpressionIFVisitor<java.lang.Void>
Overrides:
forFormalParameter in class JExpressionIFDepthFirstVisitor<java.lang.Void>
Parameters:
that - The FormalParameter we are augmenting.

forConstructorDef

public java.lang.Void forConstructorDef(ConstructorDef that)
Do the augmentation necessary for a ConstructorDef. If no visibility modifier is present, augment with "public" by default. The Formal Parameters to the MethodDef need to be visited so that they can be augmented with "final". Always read up to the start of the ConstructorDef before beginning augmentation.

Specified by:
forConstructorDef in interface JExpressionIFVisitor<java.lang.Void>
Overrides:
forConstructorDef in class JExpressionIFDepthFirstVisitor<java.lang.Void>
Parameters:
that - The ConstructorDef we are augmenting.

forMethodDef

public java.lang.Void forMethodDef(MethodDef that)
Do the augmentation necessary for a MethodDef. If the user did not specify a visibility level, the method is automatically augmented to be "public". Otherwise, the user's modifier is left unchanged. At all levels, the Formal Parameters to the MethodDef need to be visited so that they can be augmented with "final" if "final" is not already present. Always read up to the start of the MethodDef before beginning augmentation.

Parameters:
that - The MethodDef being visited.

forAbstractMethodDef

public java.lang.Void forAbstractMethodDef(AbstractMethodDef md)
Delegate the augmentation of this AbstractMethodDef to forMethodDef.

Specified by:
forAbstractMethodDef in interface JExpressionIFVisitor<java.lang.Void>
Overrides:
forAbstractMethodDef in class JExpressionIFDepthFirstVisitor<java.lang.Void>
Parameters:
that - The AbstractMethodDef being augmented.

forConcreteMethodDef

public java.lang.Void forConcreteMethodDef(ConcreteMethodDef that)
Delegate the augmentation of this method def's declaration to forMethodDef. Then, visit the body with a MethodBodyAugmentor so that each piece of the body can be correctly augmented.

Specified by:
forConcreteMethodDef in interface JExpressionIFVisitor<java.lang.Void>
Overrides:
forConcreteMethodDef in class JExpressionIFDepthFirstVisitor<java.lang.Void>
Parameters:
that - The ConcreteMethodDef being augmented.

forClassDef

public java.lang.Void forClassDef(ClassDef cd)
Class Defs can only appear at the top level of a source file. If the class type is public but "public" does not appear as a visibility modifier, add it. Visit the body of the class definition with a new Augmentor. Then, (so that this appears after the rest of the class body) add any necessary augmented methods.

Specified by:
forClassDef in interface JExpressionIFVisitor<java.lang.Void>
Overrides:
forClassDef in class JExpressionIFDepthFirstVisitor<java.lang.Void>
Parameters:
cd - The ClassDef we're augmenting.

forInnerClassDef

public java.lang.Void forInnerClassDef(InnerClassDef cd)
Look up this inner class in the enclosing data, and then visits its body. InnerClassDefs can appear inside method or class or interface bodies. No augmentation is done, because an InnerClass can only appear at the AdvancedLevel, and we do not do augmentation at the Advanced Level. If this were to change, we would need to add the Augmentation back in.

Specified by:
forInnerClassDef in interface JExpressionIFVisitor<java.lang.Void>
Overrides:
forInnerClassDef in class JExpressionIFDepthFirstVisitor<java.lang.Void>
Parameters:
cd - The InnerClassDef we are augmenting.

forInterfaceDef

public java.lang.Void forInterfaceDef(InterfaceDef cd)
Look up this top level interface in the symbolTable, and then visit its body. Write any necessary extra variable definitions at the end of the file. InterfaceDefs can only appear at the top level of a source file.

Specified by:
forInterfaceDef in interface JExpressionIFVisitor<java.lang.Void>
Overrides:
forInterfaceDef in class JExpressionIFDepthFirstVisitor<java.lang.Void>
Parameters:
cd - The InterfaceDef being augmented.

forInnerInterfaceDef

public java.lang.Void forInnerInterfaceDef(InnerInterfaceDef cd)
Look up this inner interface in the enclosing data, and then visit its body with a new Augmentor. No code augmentation is done since InnerInterfaces can only appear at the Advanced Level, and we are not doing code augmentation at the Advanced Level. If we were to start doing code augmentation at the Advanced level, this might need to change. InnerInterfaceDefs can appear inside method or class or interface bodies.

Specified by:
forInnerInterfaceDef in interface JExpressionIFVisitor<java.lang.Void>
Overrides:
forInnerInterfaceDef in class JExpressionIFDepthFirstVisitor<java.lang.Void>

forAnonymousClassInstantiation

public java.lang.Void forAnonymousClassInstantiation(AnonymousClassInstantiation e)

forSimpleAnonymousClassInstantiation

public java.lang.Void forSimpleAnonymousClassInstantiation(SimpleAnonymousClassInstantiation e)
Delegate to for AnonymousClassInstantiation(e).

Specified by:
forSimpleAnonymousClassInstantiation in interface JExpressionIFVisitor<java.lang.Void>
Overrides:
forSimpleAnonymousClassInstantiation in class JExpressionIFDepthFirstVisitor<java.lang.Void>

forComplexAnonymousClassInstantiation

public java.lang.Void forComplexAnonymousClassInstantiation(ComplexAnonymousClassInstantiation e)
Visit the encosing part of this ComplexAnonymousClass name, and then delegate to forAnonymousClassInstantiation(e).

Specified by:
forComplexAnonymousClassInstantiation in interface JExpressionIFVisitor<java.lang.Void>
Overrides:
forComplexAnonymousClassInstantiation in class JExpressionIFDepthFirstVisitor<java.lang.Void>

forSourceFile

public java.lang.Void forSourceFile(SourceFile sf)
Sort the Class and Interface defs based on the order they appear in the file. Then visit each in turn. Finally, write whatever remains in the file. (If this is an ElementaryLevel file that needs to import junit.framework.TestCase, make this the very first line of the augmented file. This is okay, because at the ElementaryLevel, there are no package statements we might get in trouble with.

Specified by:
forSourceFile in interface JExpressionIFVisitor<java.lang.Void>
Overrides:
forSourceFile in class JExpressionIFDepthFirstVisitor<java.lang.Void>

formalParameters2TypeDatas

protected static TypeData[] formalParameters2TypeDatas(FormalParameter[] fps,
                                                       SymbolData enclosing)
Convert the provided FormalParameter array into an array of TypeData corresponding to the types of the FormalParameters.


writeConstructor

protected static void writeConstructor(java.lang.String className,
                                       SymbolData sd,
                                       int baseIndent)
Write a constructor for a previously generated (determined by MethodData.isGenerated()) constructor, if one exists.

Parameters:
sd - The method's enclosing class.
baseIndent - The base indent level (number of spaces).

writeAccessors

protected static void writeAccessors(SymbolData sd,
                                     int baseIndent)
Write an accessor method for each previously generated (determined by MethodData.isGenerated()) accessor.

Parameters:
sd - The method's enclosing class.
baseIndent - The base indent level (number of spaces).

writeToString

protected static void writeToString(SymbolData sd,
                                    int baseIndent,
                                    java.lang.String valueToStringName)
Write a toString method that prints out each field with a visible accessor.

Parameters:
sd - The method's enclosing class.
baseIndent - The base indent level (number of spaces).
valueToStringName - The name of the generated valueToString method

writeSafeToString

protected static void writeSafeToString(SymbolData sd,
                                        int baseIndent,
                                        java.lang.String valueToStringName,
                                        MethodData[] accessors)
Helper to writeToString; writes a toString that handles infinitely-recursive data structures.


writeSimpleToString

protected static void writeSimpleToString(SymbolData sd,
                                          int baseIndent,
                                          java.lang.String valueToStringName,
                                          MethodData[] accessors)
Helper to writeToString; writes a short toString that does not handle infinitely-recursive data structures.


writeEquals

protected static void writeEquals(java.lang.String className,
                                  SymbolData sd,
                                  int baseIndent,
                                  java.lang.String valueEqualsName)
Write an equals method that requires the Object parameter to be an instanceof this type and have matching fields for each of the fields with visible accessors.

Parameters:
className - The unqualified name of this method's class or, in the case of anonymous inner classes, the name of its superclass (or implemented interface).
sd - The method's enclosing class.
baseIndent - The base indent level (number of spaces).
valueEqualsName - The name of the generated valueEquals method

writeSafeEquals

protected static void writeSafeEquals(java.lang.String className,
                                      SymbolData sd,
                                      int baseIndent,
                                      java.lang.String valueEqualsName,
                                      MethodData[] accessors)
Helper to writeEquals; writes an equals that handles infinitely-recursive data structures.


writeSimpleEquals

protected static void writeSimpleEquals(java.lang.String className,
                                        SymbolData sd,
                                        int baseIndent,
                                        java.lang.String valueEqualsName,
                                        MethodData[] accessors)
Helper to writeEquals; writes a simple equals that does not handle infinitely-recursive data structures.


writeAnonEquals

protected static void writeAnonEquals(int baseIndent)
AnonymousClasses are only equal if they are identical.


writeHashCode

protected static void writeHashCode(java.lang.String className,
                                    SymbolData sd,
                                    int baseIndent,
                                    boolean waitForVarDef,
                                    java.lang.String valueHashCodeName)
Write a hashCode method that is consistent with the generated equals(Object) method.

Parameters:
className - The unqualified name of this method's class or, in the case of anonymous inner classes, the name of its superclass (or implemented interface).
sd - The method's enclosing class.
baseIndent - The base indent level (number of spaces).
waitForVarDef - True iff static variables cannot be defined in the current context and should be deferred by adding them to _endOfClassVarDefs.
valueHashCodeName - The name of the generated valueHashCode method

writeSafeHashCode

protected static void writeSafeHashCode(java.lang.String className,
                                        SymbolData sd,
                                        int baseIndent,
                                        boolean waitForVarDef,
                                        java.lang.String valueHashCodeName,
                                        MethodData[] accessors)
Helper to writeHashCode; writes a hashCode that handles infinitely-recursive data structures.

Parameters:
className - The unqualified name of this method's class or, in the case of anonymous inner classes, the name of its superclass (or implemented interface).
sd - The method's enclosing class.
baseIndent - The base indent level (number of spaces).
waitForVarDef - True iff static variables cannot be defined in the current context and should be deferred by adding them to _endOfClassVarDefs.
valueHashCodeName - The name of the generated valueHashCode method
accessors - An Array of the MethodDatas corresponding to the accessors for this class.

writeSimpleHashCode

protected static void writeSimpleHashCode(java.lang.String className,
                                          SymbolData sd,
                                          int baseIndent,
                                          boolean waitForVarDef,
                                          java.lang.String valueHashCodeName,
                                          MethodData[] accessors)
Helper to writeHashCode; writes a simple hashCode that does not handle infinitely-recursive data structures.

Parameters:
className - The unqualified name of this method's class or, in the case of anonymous inner classes, the name of its superclass (or implemented interface).
sd - The method's enclosing class.
baseIndent - The base indent level (number of spaces).
waitForVarDef - True iff static variables cannot be defined in the current context and should be deferred by adding them to _endOfClassVarDefs.
valueHashCodeName - The name of the generated valueHashCode method
accessors - An Array of the MethodDatas corresponding to the accessors for this class.

getLineNumberMap

public static java.util.SortedMap<java.lang.Integer,java.lang.Integer> getLineNumberMap()
Returns a copy of the line number map that maps original dj* line numbers to generated java line numbers.

Returns:
copy of line number map