From ac764de72cd4ef15563bdc4f727da4ee63236d9e Mon Sep 17 00:00:00 2001 From: jhugunin Date: Thu, 10 Apr 2003 18:56:04 +0000 Subject: [PATCH] re-implementing support for incremental compilation after move to 2.1 this time we're doing it all ourselves rather than using the Builders which have steadily come to depend more on having an actual eclipse workbench running --- .../compiler/lookup/AjLookupEnvironment.java | 9 +- .../compiler/lookup/EclipseFactory.java | 24 +- .../compiler/lookup/EclipseTypeMunger.java | 35 +- .../lookup/InterTypeFieldBinding.java | 1 + .../lookup/InterTypeMethodBinding.java | 2 + .../internal/compiler/parser/AjParser.java | 602 +++++++++--------- .../internal/core/builder/AjBuildManager.java | 190 +++--- .../ajdt/internal/core/builder/AjState.java | 309 +++++++++ .../core/builder/StatefulNameEnvironment.java | 72 +++ .../core/builder/AjBuildManagerTest.java | 216 +++---- 10 files changed, 939 insertions(+), 521 deletions(-) create mode 100644 org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java create mode 100644 org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/StatefulNameEnvironment.java diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java index 797ae15c3..c2bf0e41a 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java @@ -18,7 +18,6 @@ import java.util.*; import org.aspectj.ajdt.internal.compiler.ast.AspectDeclaration; import org.aspectj.bridge.IMessage; import org.aspectj.weaver.*; -import org.aspectj.weaver.bcel.BcelTypeMunger; import org.aspectj.weaver.patterns.*; import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; import org.eclipse.jdt.internal.compiler.env.IBinaryType; @@ -155,6 +154,12 @@ public class AjLookupEnvironment extends LookupEnvironment { private void weaveInterTypeDeclarations(SourceTypeBinding sourceType, Collection typeMungers, Collection declareParents, boolean skipInners) { +// if (new String(sourceType.sourceName()).equals("Target")) { +// Thread.currentThread().dumpStack(); +// } +// +// System.out.println("weaving types: " + new String(sourceType.sourceName())); +// System.out.println(" mungers: " + typeMungers); ResolvedTypeX onType = factory.fromEclipse(sourceType); onType.clearInterTypeMungers(); @@ -171,7 +176,7 @@ public class AjLookupEnvironment extends LookupEnvironment { for (Iterator i = onType.getInterTypeMungers().iterator(); i.hasNext();) { EclipseTypeMunger munger = (EclipseTypeMunger) i.next(); - //System.err.println("applying: " + munger + " to " + new String(sourceType.sourceName)); + //System.out.println("applying: " + munger + " to " + new String(sourceType.sourceName)); munger.munge(sourceType); } diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java index de33d1796..38241181b 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java @@ -140,21 +140,35 @@ public class EclipseFactory { public void finishTypeMungers() { // make sure that type mungers are - finishedTypeMungers = new ArrayList(); + Collection ret = new ArrayList(); Collection baseTypeMungers = getWorld().getCrosscuttingMembersSet().getTypeMungers(); for (Iterator i = baseTypeMungers.iterator(); i.hasNext(); ) { ConcreteTypeMunger munger = (ConcreteTypeMunger) i.next(); EclipseTypeMunger etm = makeEclipseTypeMunger(munger); - if (etm != null) finishedTypeMungers.add(etm); - } + if (etm != null) ret.add(etm); + } + finishedTypeMungers = ret; } public EclipseTypeMunger makeEclipseTypeMunger(ConcreteTypeMunger concrete) { - if (concrete instanceof EclipseTypeMunger) return (EclipseTypeMunger)concrete; + //System.err.println("make munger: " + concrete); + //!!! can't do this if we want incremental to work right + //if (concrete instanceof EclipseTypeMunger) return (EclipseTypeMunger)concrete; + //System.err.println(" was not eclipse"); + if (concrete.getMunger() != null && EclipseTypeMunger.supportsKind(concrete.getMunger().getKind())) { - return new EclipseTypeMunger(this, concrete.getMunger(), concrete.getAspectType(), null); + AbstractMethodDeclaration method = null; + if (concrete instanceof EclipseTypeMunger) { + method = ((EclipseTypeMunger)concrete).getSourceMethod(); + } + EclipseTypeMunger ret = + new EclipseTypeMunger(this, concrete.getMunger(), concrete.getAspectType(), method); + if (ret.getSourceLocation() == null) { + ret.setSourceLocation(concrete.getSourceLocation()); + } + return ret; } else { return null; } diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseTypeMunger.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseTypeMunger.java index 1b04e85ce..2c4b9489c 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseTypeMunger.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseTypeMunger.java @@ -31,9 +31,12 @@ import org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding; public class EclipseTypeMunger extends ConcreteTypeMunger { - protected ReferenceBinding targetBinding = null; + private ResolvedTypeX targetTypeX; + //protected ReferenceBinding targetBinding = null; private AbstractMethodDeclaration sourceMethod; private EclipseFactory world; + private ISourceLocation sourceLocation; + public EclipseTypeMunger(EclipseFactory world, ResolvedTypeMunger munger, ResolvedTypeX aspectType, AbstractMethodDeclaration sourceMethod) @@ -41,8 +44,13 @@ public class EclipseTypeMunger extends ConcreteTypeMunger { super(munger, aspectType); this.world = world; this.sourceMethod = sourceMethod; - TypeX targetTypeX = munger.getSignature().getDeclaringType(); - targetBinding = (ReferenceBinding)world.makeTypeBinding(targetTypeX); + if (sourceMethod != null) { + this.sourceLocation = + new EclipseSourceLocation(sourceMethod.compilationResult, + sourceMethod.sourceStart, sourceMethod.sourceEnd); + } + targetTypeX = munger.getSignature().getDeclaringType().resolve(world.getWorld()); + //targetBinding = (ReferenceBinding)world.makeTypeBinding(targetTypeX); } public static boolean supportsKind(ResolvedTypeMunger.Kind kind) { @@ -60,7 +68,10 @@ public class EclipseTypeMunger extends ConcreteTypeMunger { * i.e. adds Method|FieldBindings, plays with inheritance, ... */ public boolean munge(SourceTypeBinding sourceType) { - if (sourceType != targetBinding) return false; //??? move this test elsewhere + if (!world.fromEclipse(sourceType).equals(targetTypeX)) return false; //??? move this test elsewhere + //System.out.println("munging: " + sourceType); +// System.out.println("match: " + world.fromEclipse(sourceType) + +// " with " + targetTypeX); if (munger.getKind() == ResolvedTypeMunger.Field) { mungeNewField(sourceType, (NewFieldTypeMunger)munger); } else if (munger.getKind() == ResolvedTypeMunger.Method) { @@ -100,7 +111,7 @@ public class EclipseTypeMunger extends ConcreteTypeMunger { } private void mungeNewField(SourceTypeBinding sourceType, NewFieldTypeMunger munger) { - if (shouldTreatAsPublic() && !targetBinding.isInterface()) { + if (shouldTreatAsPublic() && !targetTypeX.isInterface()) { FieldBinding binding = world.makeFieldBinding(munger.getSignature()); findOrCreateInterTypeMemberFinder(sourceType).addInterTypeField(binding); //classScope.referenceContext.binding.addField(binding); @@ -132,8 +143,18 @@ public class EclipseTypeMunger extends ConcreteTypeMunger { } public ISourceLocation getSourceLocation() { - return new EclipseSourceLocation(sourceMethod.compilationResult, - sourceMethod.sourceStart, sourceMethod.sourceEnd); + return sourceLocation; + } + + public void setSourceLocation(ISourceLocation sourceLocation) { + this.sourceLocation = sourceLocation; + } + + /** + * @return AbstractMethodDeclaration + */ + public AbstractMethodDeclaration getSourceMethod() { + return sourceMethod; } } diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeFieldBinding.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeFieldBinding.java index b12211811..600270db9 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeFieldBinding.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeFieldBinding.java @@ -50,6 +50,7 @@ public class InterTypeFieldBinding extends FieldBinding { } public boolean canBeSeenBy(TypeBinding receiverType, InvocationSite invocationSite, Scope scope) { + scope.compilationUnitScope().recordTypeReference(declaringClass); //System.err.println("canBeSeenBy: " + this + ", " + isPublic()); if (isPublic()) return true; diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMethodBinding.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMethodBinding.java index 027a8251e..f8b0f52a8 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMethodBinding.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMethodBinding.java @@ -59,6 +59,8 @@ public class InterTypeMethodBinding extends MethodBinding { //XXX this is identical to InterTypeFieldBinding public boolean canBeSeenBy(TypeBinding receiverType, InvocationSite invocationSite, Scope scope) { + scope.compilationUnitScope().recordTypeReference(declaringClass); + if (isPublic()) return true; SourceTypeBinding invocationType = scope.invocationType(); diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/AjParser.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/AjParser.java index 78f21e59e..621576e16 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/AjParser.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/AjParser.java @@ -1061,1213 +1061,1213 @@ public class AjParser extends Parser { // This method is part of an automatic generation : do NOT edit-modify - // This method is part of an automatic generation : do NOT edit-modify + // This method is part of an automatic generation : do NOT edit-modify protected void consumeRule(int act) { switch ( act ) { - case 33 : // System.out.println("Type ::= PrimitiveType"); + case 33 : // System.out.println("Type ::= PrimitiveType"); consumePrimitiveType(); break ; - case 47 : // System.out.println("ReferenceType ::= ClassOrInterfaceType"); + case 47 : // System.out.println("ReferenceType ::= ClassOrInterfaceType"); consumeReferenceType(); break ; - case 65 : // System.out.println("AjQualifiedName ::= AjName DOT SimpleName"); + case 65 : // System.out.println("AjQualifiedName ::= AjName DOT SimpleName"); consumeQualifiedName(); break ; - case 69 : // System.out.println("QualifiedName ::= Name DOT JavaIdentifier"); + case 69 : // System.out.println("QualifiedName ::= Name DOT JavaIdentifier"); consumeQualifiedName(); break ; - case 70 : // System.out.println("CompilationUnit ::= EnterCompilationUnit PackageDeclarationopt..."); + case 70 : // System.out.println("CompilationUnit ::= EnterCompilationUnit PackageDeclarationopt ImportDeclarationsopt"); consumeCompilationUnit(); break ; - case 71 : // System.out.println("EnterCompilationUnit ::="); + case 71 : // System.out.println("EnterCompilationUnit ::="); consumeEnterCompilationUnit(); break ; - case 83 : // System.out.println("CatchHeader ::= catch LPAREN FormalParameter RPAREN LBRACE"); + case 83 : // System.out.println("CatchHeader ::= catch LPAREN FormalParameter RPAREN LBRACE"); consumeCatchHeader(); break ; - case 85 : // System.out.println("ImportDeclarations ::= ImportDeclarations ImportDeclaration"); + case 85 : // System.out.println("ImportDeclarations ::= ImportDeclarations ImportDeclaration"); consumeImportDeclarations(); break ; - case 87 : // System.out.println("TypeDeclarations ::= TypeDeclarations TypeDeclaration"); + case 87 : // System.out.println("TypeDeclarations ::= TypeDeclarations TypeDeclaration"); consumeTypeDeclarations(); break ; - case 88 : // System.out.println("PackageDeclaration ::= PackageDeclarationName SEMICOLON"); + case 88 : // System.out.println("PackageDeclaration ::= PackageDeclarationName SEMICOLON"); consumePackageDeclaration(); break ; - case 89 : // System.out.println("PackageDeclarationName ::= package Name"); + case 89 : // System.out.println("PackageDeclarationName ::= package Name"); consumePackageDeclarationName(); break ; - case 92 : // System.out.println("SingleTypeImportDeclaration ::= SingleTypeImportDeclarationName SEMICOLON"); + case 92 : // System.out.println("SingleTypeImportDeclaration ::= SingleTypeImportDeclarationName SEMICOLON"); consumeSingleTypeImportDeclaration(); break ; - case 93 : // System.out.println("SingleTypeImportDeclarationName ::= import Name"); + case 93 : // System.out.println("SingleTypeImportDeclarationName ::= import Name"); consumeSingleTypeImportDeclarationName(); break ; - case 94 : // System.out.println("TypeImportOnDemandDeclaration ::= TypeImportOnDemandDeclarationName SEMICOLON"); + case 94 : // System.out.println("TypeImportOnDemandDeclaration ::= TypeImportOnDemandDeclarationName SEMICOLON"); consumeTypeImportOnDemandDeclaration(); break ; - case 95 : // System.out.println("TypeImportOnDemandDeclarationName ::= import Name DOT MULTIPLY"); + case 95 : // System.out.println("TypeImportOnDemandDeclarationName ::= import Name DOT MULTIPLY"); consumeTypeImportOnDemandDeclarationName(); break ; - case 98 : // System.out.println("TypeDeclaration ::= SEMICOLON"); + case 98 : // System.out.println("TypeDeclaration ::= SEMICOLON"); consumeEmptyTypeDeclaration(); break ; - case 124 : // System.out.println("AspectDeclaration ::= AspectHeader AspectBody"); + case 124 : // System.out.println("AspectDeclaration ::= AspectHeader AspectBody"); consumeAspectDeclaration(); break ; - case 125 : // System.out.println("AspectHeader ::= AspectHeaderName ClassHeaderExtendsopt ClassHeaderImplementsopt"); + case 125 : // System.out.println("AspectHeader ::= AspectHeaderName ClassHeaderExtendsopt ClassHeaderImplementsopt..."); consumeAspectHeader(); break ; - case 126 : // System.out.println("AspectHeaderName ::= Modifiersopt aspect Identifier"); + case 126 : // System.out.println("AspectHeaderName ::= Modifiersopt aspect Identifier"); consumeAspectHeaderName(false); break ; - case 127 : // System.out.println("AspectHeaderName ::= Modifiersopt privileged Modifiersopt aspect Identifier"); + case 127 : // System.out.println("AspectHeaderName ::= Modifiersopt privileged Modifiersopt aspect Identifier"); consumeAspectHeaderName(true); break ; - case 129 : // System.out.println("AspectHeaderRest ::= AspectHeaderRestStart PseudoTokens"); + case 129 : // System.out.println("AspectHeaderRest ::= AspectHeaderRestStart PseudoTokens"); consumeAspectHeaderRest(); break ; - case 130 : // System.out.println("AspectHeaderRestStart ::= Identifier"); + case 130 : // System.out.println("AspectHeaderRestStart ::= Identifier"); consumePseudoTokenIdentifier(); break ; - case 133 : // System.out.println("AspectBodyDeclarations ::= AspectBodyDeclarations AspectBodyDeclaration"); + case 133 : // System.out.println("AspectBodyDeclarations ::= AspectBodyDeclarations AspectBodyDeclaration"); consumeClassBodyDeclarations(); break ; - case 134 : // System.out.println("AspectBodyDeclarationsopt ::="); + case 134 : // System.out.println("AspectBodyDeclarationsopt ::="); consumeEmptyClassBodyDeclarationsopt(); break ; - case 135 : // System.out.println("AspectBodyDeclarationsopt ::= NestedType AspectBodyDeclarations"); + case 135 : // System.out.println("AspectBodyDeclarationsopt ::= NestedType AspectBodyDeclarations"); consumeClassBodyDeclarationsopt(); break ; - case 136 : // System.out.println("AspectBodyDeclaration ::= ClassBodyDeclaration"); + case 136 : // System.out.println("AspectBodyDeclaration ::= ClassBodyDeclaration"); consumeClassBodyDeclarationInAspect(); break ; - case 137 : // System.out.println("PointcutDeclaration ::= PointcutHeader MethodHeaderParameters SEMICOLON"); + case 137 : // System.out.println("PointcutDeclaration ::= PointcutHeader MethodHeaderParameters SEMICOLON"); consumeEmptyPointcutDeclaration(); break ; - case 138 : // System.out.println("PointcutDeclaration ::= PointcutHeader MethodHeaderParameters COLON PseudoTokens"); + case 138 : // System.out.println("PointcutDeclaration ::= PointcutHeader MethodHeaderParameters COLON PseudoTokens..."); consumePointcutDeclaration(); break ; - case 139 : // System.out.println("PointcutHeader ::= Modifiersopt pointcut JavaIdentifier LPAREN"); + case 139 : // System.out.println("PointcutHeader ::= Modifiersopt pointcut JavaIdentifier LPAREN"); consumePointcutHeader(); break ; - case 142 : // System.out.println("AroundDeclaration ::= AroundHeader MethodBody"); + case 142 : // System.out.println("AroundDeclaration ::= AroundHeader MethodBody"); consumeAroundDeclaration(); break ; - case 143 : // System.out.println("AroundHeader ::= AroundHeaderName MethodHeaderParameters..."); + case 143 : // System.out.println("AroundHeader ::= AroundHeaderName MethodHeaderParameters..."); consumeAroundHeader(); break ; - case 144 : // System.out.println("AroundHeaderName ::= Modifiersopt Type around LPAREN"); + case 144 : // System.out.println("AroundHeaderName ::= Modifiersopt Type around LPAREN"); consumeAroundHeaderName(); break ; - case 145 : // System.out.println("BasicAdviceDeclaration ::= BasicAdviceHeader MethodBody"); + case 145 : // System.out.println("BasicAdviceDeclaration ::= BasicAdviceHeader MethodBody"); consumeBasicAdviceDeclaration(); break ; - case 146 : // System.out.println("BasicAdviceHeader ::= BasicAdviceHeaderName MethodHeaderParameters ExtraParamopt"); + case 146 : // System.out.println("BasicAdviceHeader ::= BasicAdviceHeaderName MethodHeaderParameters ExtraParamopt..."); consumeBasicAdviceHeader(); break ; - case 147 : // System.out.println("BasicAdviceHeaderName ::= Modifiersopt before LPAREN"); + case 147 : // System.out.println("BasicAdviceHeaderName ::= Modifiersopt before LPAREN"); consumeBasicAdviceHeaderName(false); break ; - case 148 : // System.out.println("BasicAdviceHeaderName ::= Modifiersopt after LPAREN"); + case 148 : // System.out.println("BasicAdviceHeaderName ::= Modifiersopt after LPAREN"); consumeBasicAdviceHeaderName(true); break ; - case 149 : // System.out.println("ExtraParamopt ::= Identifier LPAREN FormalParameter RPAREN"); + case 149 : // System.out.println("ExtraParamopt ::= Identifier LPAREN FormalParameter RPAREN"); consumeExtraParameterWithFormal(); break ; - case 150 : // System.out.println("ExtraParamopt ::= Identifier LPAREN RPAREN"); + case 150 : // System.out.println("ExtraParamopt ::= Identifier LPAREN RPAREN"); consumeExtraParameterNoFormal(); break ; - case 151 : // System.out.println("ExtraParamopt ::= Identifier"); + case 151 : // System.out.println("ExtraParamopt ::= Identifier"); consumeExtraParameterNoFormal(); break ; - case 154 : // System.out.println("OnType ::= OnType DOT JavaIdentifier"); + case 154 : // System.out.println("OnType ::= OnType DOT JavaIdentifier"); consumeQualifiedName(); break ; - case 159 : // System.out.println("InterTypeMethodDeclaration ::= InterTypeMethodHeader MethodBody"); + case 159 : // System.out.println("InterTypeMethodDeclaration ::= InterTypeMethodHeader MethodBody"); // set to true to consume a method with a body consumeInterTypeMethodDeclaration(true); break ; - case 160 : // System.out.println("InterTypeMethodHeader ::= InterTypeMethodHeaderName MethodHeaderParameters..."); + case 160 : // System.out.println("InterTypeMethodHeader ::= InterTypeMethodHeaderName MethodHeaderParameters..."); consumeInterTypeMethodHeader(); break ; - case 161 : // System.out.println("InterTypeMethodHeaderName ::= Modifiersopt Type OnType DOT JavaIdentifier LPAREN"); + case 161 : // System.out.println("InterTypeMethodHeaderName ::= Modifiersopt Type OnType DOT JavaIdentifier LPAREN"); consumeInterTypeMethodHeaderName(); break ; - case 162 : // System.out.println("AbstractInterTypeMethodDeclaration ::= InterTypeMethodHeader SEMICOLON"); + case 162 : // System.out.println("AbstractInterTypeMethodDeclaration ::= InterTypeMethodHeader SEMICOLON"); // set to false to consume a method without body consumeInterTypeMethodDeclaration(false); break ; - case 163 : // System.out.println("InterTypeConstructorDeclaration ::= InterTypeConstructorHeader ConstructorBody"); + case 163 : // System.out.println("InterTypeConstructorDeclaration ::= InterTypeConstructorHeader ConstructorBody"); // set to true to consume a method with a body consumeInterTypeConstructorDeclaration(); break ; - case 164 : // System.out.println("InterTypeConstructorHeader ::= InterTypeConstructorHeaderName..."); + case 164 : // System.out.println("InterTypeConstructorHeader ::= InterTypeConstructorHeaderName..."); consumeInterTypeConstructorHeader(); break ; - case 165 : // System.out.println("InterTypeConstructorHeaderName ::= Modifiersopt Name DOT new LPAREN"); + case 165 : // System.out.println("InterTypeConstructorHeaderName ::= Modifiersopt Name DOT new LPAREN"); consumeInterTypeConstructorHeaderName(); break ; - case 166 : // System.out.println("InterTypeFieldDeclaration ::= Modifiersopt Type OnType DOT JavaIdentifier..."); + case 166 : // System.out.println("InterTypeFieldDeclaration ::= Modifiersopt Type OnType DOT JavaIdentifier..."); consumeInterTypeFieldDeclaration(); break ; - case 170 : // System.out.println("DeclareDeclaration ::= DeclareHeader PseudoTokens SEMICOLON"); + case 170 : // System.out.println("DeclareDeclaration ::= DeclareHeader PseudoTokens SEMICOLON"); consumeDeclareDeclaration(); break ; - case 171 : // System.out.println("DeclareHeader ::= declare Identifier COLON"); + case 171 : // System.out.println("DeclareHeader ::= declare Identifier COLON"); consumeDeclareHeader(); break ; - case 173 : // System.out.println("PseudoTokens ::= PseudoTokens PseudoToken"); + case 173 : // System.out.println("PseudoTokens ::= PseudoTokens PseudoToken"); consumePseudoTokens(); break ; - case 174 : // System.out.println("PseudoToken ::= JavaIdentifier"); + case 174 : // System.out.println("PseudoToken ::= JavaIdentifier"); consumePseudoTokenIdentifier(); break ; - case 175 : // System.out.println("PseudoToken ::= LPAREN"); + case 175 : // System.out.println("PseudoToken ::= LPAREN"); consumePseudoToken("("); break ; - case 176 : // System.out.println("PseudoToken ::= RPAREN"); + case 176 : // System.out.println("PseudoToken ::= RPAREN"); consumePseudoToken(")"); break ; - case 177 : // System.out.println("PseudoToken ::= DOT"); + case 177 : // System.out.println("PseudoToken ::= DOT"); consumePseudoToken("."); break ; - case 178 : // System.out.println("PseudoToken ::= MULTIPLY"); + case 178 : // System.out.println("PseudoToken ::= MULTIPLY"); consumePseudoToken("*"); break ; - case 179 : // System.out.println("PseudoToken ::= PLUS"); + case 179 : // System.out.println("PseudoToken ::= PLUS"); consumePseudoToken("+"); break ; - case 180 : // System.out.println("PseudoToken ::= AND_AND"); + case 180 : // System.out.println("PseudoToken ::= AND_AND"); consumePseudoToken("&&"); break ; - case 181 : // System.out.println("PseudoToken ::= OR_OR"); + case 181 : // System.out.println("PseudoToken ::= OR_OR"); consumePseudoToken("||"); break ; - case 182 : // System.out.println("PseudoToken ::= NOT"); + case 182 : // System.out.println("PseudoToken ::= NOT"); consumePseudoToken("!"); break ; - case 183 : // System.out.println("PseudoToken ::= COLON"); + case 183 : // System.out.println("PseudoToken ::= COLON"); consumePseudoToken(":"); break ; - case 184 : // System.out.println("PseudoToken ::= COMMA"); + case 184 : // System.out.println("PseudoToken ::= COMMA"); consumePseudoToken(","); break ; - case 185 : // System.out.println("PseudoToken ::= LBRACKET"); + case 185 : // System.out.println("PseudoToken ::= LBRACKET"); consumePseudoToken("["); break ; - case 186 : // System.out.println("PseudoToken ::= RBRACKET"); + case 186 : // System.out.println("PseudoToken ::= RBRACKET"); consumePseudoToken("]"); break ; - case 187 : // System.out.println("PseudoToken ::= PrimitiveType"); + case 187 : // System.out.println("PseudoToken ::= PrimitiveType"); consumePseudoTokenPrimitiveType(); break ; - case 188 : // System.out.println("PseudoToken ::= Modifier"); + case 188 : // System.out.println("PseudoToken ::= Modifier"); consumePseudoTokenModifier(); break ; - case 189 : // System.out.println("PseudoToken ::= Literal"); + case 189 : // System.out.println("PseudoToken ::= Literal"); consumePseudoTokenLiteral(); break ; - case 190 : // System.out.println("PseudoToken ::= this"); + case 190 : // System.out.println("PseudoToken ::= this"); consumePseudoToken("this", 1, true); break ; - case 191 : // System.out.println("PseudoToken ::= super"); + case 191 : // System.out.println("PseudoToken ::= super"); consumePseudoToken("super", 1, true); break ; - case 192 : // System.out.println("PseudoToken ::= if LPAREN Expression RPAREN"); + case 192 : // System.out.println("PseudoToken ::= if LPAREN Expression RPAREN"); consumePseudoTokenIf(); break ; - case 193 : // System.out.println("PseudoToken ::= assert"); + case 193 : // System.out.println("PseudoToken ::= assert"); consumePseudoToken("assert", 1, true); break ; - case 194 : // System.out.println("PseudoToken ::= import"); + case 194 : // System.out.println("PseudoToken ::= import"); consumePseudoToken("import", 1, true); break ; - case 195 : // System.out.println("PseudoToken ::= package"); + case 195 : // System.out.println("PseudoToken ::= package"); consumePseudoToken("package", 1, true); break ; - case 196 : // System.out.println("PseudoToken ::= throw"); + case 196 : // System.out.println("PseudoToken ::= throw"); consumePseudoToken("throw", 1, true); break ; - case 197 : // System.out.println("PseudoToken ::= new"); + case 197 : // System.out.println("PseudoToken ::= new"); consumePseudoToken("new", 1, true); break ; - case 198 : // System.out.println("PseudoToken ::= do"); + case 198 : // System.out.println("PseudoToken ::= do"); consumePseudoToken("do", 1, true); break ; - case 199 : // System.out.println("PseudoToken ::= for"); + case 199 : // System.out.println("PseudoToken ::= for"); consumePseudoToken("for", 1, true); break ; - case 200 : // System.out.println("PseudoToken ::= switch"); + case 200 : // System.out.println("PseudoToken ::= switch"); consumePseudoToken("switch", 1, true); break ; - case 201 : // System.out.println("PseudoToken ::= try"); + case 201 : // System.out.println("PseudoToken ::= try"); consumePseudoToken("try", 1, true); break ; - case 202 : // System.out.println("PseudoToken ::= while"); + case 202 : // System.out.println("PseudoToken ::= while"); consumePseudoToken("while", 1, true); break ; - case 203 : // System.out.println("PseudoToken ::= break"); + case 203 : // System.out.println("PseudoToken ::= break"); consumePseudoToken("break", 1, true); break ; - case 204 : // System.out.println("PseudoToken ::= continue"); + case 204 : // System.out.println("PseudoToken ::= continue"); consumePseudoToken("continue", 1, true); break ; - case 205 : // System.out.println("PseudoToken ::= return"); + case 205 : // System.out.println("PseudoToken ::= return"); consumePseudoToken("return", 1, true); break ; - case 206 : // System.out.println("PseudoToken ::= case"); + case 206 : // System.out.println("PseudoToken ::= case"); consumePseudoToken("case", 1, true); break ; - case 207 : // System.out.println("PseudoToken ::= catch"); + case 207 : // System.out.println("PseudoToken ::= catch"); consumePseudoToken("catch", 0, true); break ; - case 208 : // System.out.println("PseudoToken ::= instanceof"); + case 208 : // System.out.println("PseudoToken ::= instanceof"); consumePseudoToken("instanceof", 0, true); break ; - case 209 : // System.out.println("PseudoToken ::= else"); + case 209 : // System.out.println("PseudoToken ::= else"); consumePseudoToken("else", 0, true); break ; - case 210 : // System.out.println("PseudoToken ::= extends"); + case 210 : // System.out.println("PseudoToken ::= extends"); consumePseudoToken("extends", 0, true); break ; - case 211 : // System.out.println("PseudoToken ::= finally"); + case 211 : // System.out.println("PseudoToken ::= finally"); consumePseudoToken("finally", 0, true); break ; - case 212 : // System.out.println("PseudoToken ::= implements"); + case 212 : // System.out.println("PseudoToken ::= implements"); consumePseudoToken("implements", 0, true); break ; - case 213 : // System.out.println("PseudoToken ::= throws"); + case 213 : // System.out.println("PseudoToken ::= throws"); consumePseudoToken("throws", 0, true); break ; - case 214 : // System.out.println("ClassDeclaration ::= ClassHeader ClassBody"); + case 214 : // System.out.println("ClassDeclaration ::= ClassHeader ClassBody"); consumeClassDeclaration(); break ; - case 215 : // System.out.println("ClassHeader ::= ClassHeaderName ClassHeaderExtendsopt ClassHeaderImplementsopt"); + case 215 : // System.out.println("ClassHeader ::= ClassHeaderName ClassHeaderExtendsopt ClassHeaderImplementsopt"); consumeClassHeader(); break ; - case 216 : // System.out.println("ClassHeaderName ::= Modifiersopt class JavaIdentifier"); + case 216 : // System.out.println("ClassHeaderName ::= Modifiersopt class JavaIdentifier"); consumeClassHeaderName(); break ; - case 217 : // System.out.println("ClassHeaderExtends ::= extends ClassType"); + case 217 : // System.out.println("ClassHeaderExtends ::= extends ClassType"); consumeClassHeaderExtends(); break ; - case 218 : // System.out.println("ClassHeaderImplements ::= implements InterfaceTypeList"); + case 218 : // System.out.println("ClassHeaderImplements ::= implements InterfaceTypeList"); consumeClassHeaderImplements(); break ; - case 220 : // System.out.println("InterfaceTypeList ::= InterfaceTypeList COMMA InterfaceType"); + case 220 : // System.out.println("InterfaceTypeList ::= InterfaceTypeList COMMA InterfaceType"); consumeInterfaceTypeList(); break ; - case 221 : // System.out.println("InterfaceType ::= ClassOrInterfaceType"); + case 221 : // System.out.println("InterfaceType ::= ClassOrInterfaceType"); consumeInterfaceType(); break ; - case 224 : // System.out.println("ClassBodyDeclarations ::= ClassBodyDeclarations ClassBodyDeclaration"); + case 224 : // System.out.println("ClassBodyDeclarations ::= ClassBodyDeclarations ClassBodyDeclaration"); consumeClassBodyDeclarations(); break ; - case 228 : // System.out.println("ClassBodyDeclaration ::= Diet NestedMethod Block"); + case 228 : // System.out.println("ClassBodyDeclaration ::= Diet NestedMethod Block"); consumeClassBodyDeclaration(); break ; - case 229 : // System.out.println("Diet ::="); + case 229 : // System.out.println("Diet ::="); consumeDiet(); break ; - case 230 : // System.out.println("Initializer ::= Diet NestedMethod Block"); + case 230 : // System.out.println("Initializer ::= Diet NestedMethod Block"); consumeClassBodyDeclaration(); break ; - case 237 : // System.out.println("ClassMemberDeclaration ::= SEMICOLON"); + case 237 : // System.out.println("ClassMemberDeclaration ::= SEMICOLON"); consumeEmptyClassMemberDeclaration(); break ; - case 238 : // System.out.println("FieldDeclaration ::= Modifiersopt Type VariableDeclarators SEMICOLON"); + case 238 : // System.out.println("FieldDeclaration ::= Modifiersopt Type VariableDeclarators SEMICOLON"); consumeFieldDeclaration(); break ; - case 240 : // System.out.println("VariableDeclarators ::= VariableDeclarators COMMA VariableDeclarator"); + case 240 : // System.out.println("VariableDeclarators ::= VariableDeclarators COMMA VariableDeclarator"); consumeVariableDeclarators(); break ; - case 243 : // System.out.println("EnterVariable ::="); + case 243 : // System.out.println("EnterVariable ::="); consumeEnterVariable(); break ; - case 244 : // System.out.println("ExitVariableWithInitialization ::="); + case 244 : // System.out.println("ExitVariableWithInitialization ::="); consumeExitVariableWithInitialization(); break ; - case 245 : // System.out.println("ExitVariableWithoutInitialization ::="); + case 245 : // System.out.println("ExitVariableWithoutInitialization ::="); consumeExitVariableWithoutInitialization(); break ; - case 246 : // System.out.println("ForceNoDiet ::="); + case 246 : // System.out.println("ForceNoDiet ::="); consumeForceNoDiet(); break ; - case 247 : // System.out.println("RestoreDiet ::="); + case 247 : // System.out.println("RestoreDiet ::="); consumeRestoreDiet(); break ; - case 252 : // System.out.println("MethodDeclaration ::= MethodHeader MethodBody"); + case 252 : // System.out.println("MethodDeclaration ::= MethodHeader MethodBody"); // set to true to consume a method with a body consumeMethodDeclaration(true); break ; - case 253 : // System.out.println("AbstractMethodDeclaration ::= MethodHeader SEMICOLON"); + case 253 : // System.out.println("AbstractMethodDeclaration ::= MethodHeader SEMICOLON"); // set to false to consume a method without body consumeMethodDeclaration(false); break ; - case 254 : // System.out.println("MethodHeader ::= MethodHeaderName MethodHeaderParameters..."); + case 254 : // System.out.println("MethodHeader ::= MethodHeaderName MethodHeaderParameters MethodHeaderExtendedDims"); consumeMethodHeader(); break ; - case 255 : // System.out.println("MethodPushModifiersHeader ::= MethodPushModifiersHeaderName..."); + case 255 : // System.out.println("MethodPushModifiersHeader ::= MethodPushModifiersHeaderName MethodHeaderParameters"); consumeMethodHeader(); break ; - case 256 : // System.out.println("MethodPushModifiersHeaderName ::= Modifiers Type PushModifiers..."); + case 256 : // System.out.println("MethodPushModifiersHeaderName ::= Modifiers Type PushModifiers..."); consumeMethodPushModifiersHeaderName(); break ; - case 257 : // System.out.println("MethodPushModifiersHeaderName ::= Type PushModifiers JavaIdentifierNoAround..."); + case 257 : // System.out.println("MethodPushModifiersHeaderName ::= Type PushModifiers JavaIdentifierNoAround LPAREN"); consumeMethodPushModifiersHeaderName(); break ; - case 258 : // System.out.println("MethodHeaderName ::= Modifiersopt Type JavaIdentifierNoAround LPAREN"); + case 258 : // System.out.println("MethodHeaderName ::= Modifiersopt Type JavaIdentifierNoAround LPAREN"); consumeMethodHeaderName(); break ; - case 259 : // System.out.println("MethodHeaderParameters ::= FormalParameterListopt RPAREN"); + case 259 : // System.out.println("MethodHeaderParameters ::= FormalParameterListopt RPAREN"); consumeMethodHeaderParameters(); break ; - case 260 : // System.out.println("MethodHeaderExtendedDims ::= Dimsopt"); + case 260 : // System.out.println("MethodHeaderExtendedDims ::= Dimsopt"); consumeMethodHeaderExtendedDims(); break ; - case 261 : // System.out.println("MethodHeaderThrowsClause ::= throws ClassTypeList"); + case 261 : // System.out.println("MethodHeaderThrowsClause ::= throws ClassTypeList"); consumeMethodHeaderThrowsClause(); break ; - case 262 : // System.out.println("ConstructorHeader ::= ConstructorHeaderName MethodHeaderParameters..."); + case 262 : // System.out.println("ConstructorHeader ::= ConstructorHeaderName MethodHeaderParameters..."); consumeConstructorHeader(); break ; - case 263 : // System.out.println("ConstructorHeaderName ::= Modifiersopt Identifier LPAREN"); + case 263 : // System.out.println("ConstructorHeaderName ::= Modifiersopt Identifier LPAREN"); consumeConstructorHeaderName(); break ; - case 264 : // System.out.println("ConstructorHeaderName ::= Modifiersopt aspect LPAREN"); + case 264 : // System.out.println("ConstructorHeaderName ::= Modifiersopt aspect LPAREN"); consumeConstructorHeaderName(); break ; - case 266 : // System.out.println("FormalParameterList ::= FormalParameterList COMMA FormalParameter"); + case 266 : // System.out.println("FormalParameterList ::= FormalParameterList COMMA FormalParameter"); consumeFormalParameterList(); break ; - case 267 : // System.out.println("FormalParameter ::= Modifiersopt Type VariableDeclaratorId"); + case 267 : // System.out.println("FormalParameter ::= Modifiersopt Type VariableDeclaratorId"); // the boolean is used to know if the modifiers should be reset consumeFormalParameter(); break ; - case 269 : // System.out.println("ClassTypeList ::= ClassTypeList COMMA ClassTypeElt"); + case 269 : // System.out.println("ClassTypeList ::= ClassTypeList COMMA ClassTypeElt"); consumeClassTypeList(); break ; - case 270 : // System.out.println("ClassTypeElt ::= ClassType"); + case 270 : // System.out.println("ClassTypeElt ::= ClassType"); consumeClassTypeElt(); break ; - case 271 : // System.out.println("MethodBody ::= NestedMethod LBRACE BlockStatementsopt RBRACE"); + case 271 : // System.out.println("MethodBody ::= NestedMethod LBRACE BlockStatementsopt RBRACE"); consumeMethodBody(); break ; - case 272 : // System.out.println("NestedMethod ::="); + case 272 : // System.out.println("NestedMethod ::="); consumeNestedMethod(); break ; - case 273 : // System.out.println("StaticInitializer ::= StaticOnly Block"); + case 273 : // System.out.println("StaticInitializer ::= StaticOnly Block"); consumeStaticInitializer(); break ; - case 274 : // System.out.println("StaticOnly ::= static"); + case 274 : // System.out.println("StaticOnly ::= static"); consumeStaticOnly(); break ; - case 275 : // System.out.println("ConstructorDeclaration ::= ConstructorHeader ConstructorBody"); + case 275 : // System.out.println("ConstructorDeclaration ::= ConstructorHeader ConstructorBody"); consumeConstructorDeclaration() ; break ; - case 276 : // System.out.println("ConstructorDeclaration ::= ConstructorHeader SEMICOLON"); + case 276 : // System.out.println("ConstructorDeclaration ::= ConstructorHeader SEMICOLON"); consumeInvalidConstructorDeclaration() ; break ; - case 277 : // System.out.println("ConstructorBody ::= NestedMethod LBRACE ConstructorBlockStatementsopt RBRACE"); + case 277 : // System.out.println("ConstructorBody ::= NestedMethod LBRACE ConstructorBlockStatementsopt RBRACE"); consumeConstructorBody(); break ; - case 280 : // System.out.println("ConstructorBlockStatementsopt ::= ExplicitConstructorInvocation BlockStatements"); + case 280 : // System.out.println("ConstructorBlockStatementsopt ::= ExplicitConstructorInvocation BlockStatements"); consumeConstructorBlockStatements(); break ; - case 281 : // System.out.println("ExplicitConstructorInvocation ::= this LPAREN ArgumentListopt RPAREN SEMICOLON"); + case 281 : // System.out.println("ExplicitConstructorInvocation ::= this LPAREN ArgumentListopt RPAREN SEMICOLON"); consumeExplicitConstructorInvocation(0,ExplicitConstructorCall.This); break ; - case 282 : // System.out.println("ExplicitConstructorInvocation ::= super LPAREN ArgumentListopt RPAREN SEMICOLON"); + case 282 : // System.out.println("ExplicitConstructorInvocation ::= super LPAREN ArgumentListopt RPAREN SEMICOLON"); consumeExplicitConstructorInvocation(0,ExplicitConstructorCall.Super); break ; - case 283 : // System.out.println("ExplicitConstructorInvocation ::= Primary DOT super LPAREN ArgumentListopt..."); + case 283 : // System.out.println("ExplicitConstructorInvocation ::= Primary DOT super LPAREN ArgumentListopt RPAREN"); consumeExplicitConstructorInvocation(1, ExplicitConstructorCall.Super); break ; - case 284 : // System.out.println("ExplicitConstructorInvocation ::= Name DOT super LPAREN ArgumentListopt RPAREN"); + case 284 : // System.out.println("ExplicitConstructorInvocation ::= Name DOT super LPAREN ArgumentListopt RPAREN..."); consumeExplicitConstructorInvocation(2, ExplicitConstructorCall.Super); break ; - case 285 : // System.out.println("ExplicitConstructorInvocation ::= Primary DOT this LPAREN ArgumentListopt RPAREN"); + case 285 : // System.out.println("ExplicitConstructorInvocation ::= Primary DOT this LPAREN ArgumentListopt RPAREN..."); consumeExplicitConstructorInvocation(1, ExplicitConstructorCall.This); break ; - case 286 : // System.out.println("ExplicitConstructorInvocation ::= Name DOT this LPAREN ArgumentListopt RPAREN..."); + case 286 : // System.out.println("ExplicitConstructorInvocation ::= Name DOT this LPAREN ArgumentListopt RPAREN..."); consumeExplicitConstructorInvocation(2, ExplicitConstructorCall.This); break ; - case 287 : // System.out.println("InterfaceDeclaration ::= InterfaceHeader InterfaceBody"); + case 287 : // System.out.println("InterfaceDeclaration ::= InterfaceHeader InterfaceBody"); consumeInterfaceDeclaration(); break ; - case 288 : // System.out.println("InterfaceHeader ::= InterfaceHeaderName InterfaceHeaderExtendsopt"); + case 288 : // System.out.println("InterfaceHeader ::= InterfaceHeaderName InterfaceHeaderExtendsopt"); consumeInterfaceHeader(); break ; - case 289 : // System.out.println("InterfaceHeaderName ::= Modifiersopt interface JavaIdentifier"); + case 289 : // System.out.println("InterfaceHeaderName ::= Modifiersopt interface JavaIdentifier"); consumeInterfaceHeaderName(); break ; - case 291 : // System.out.println("InterfaceHeaderExtends ::= extends InterfaceTypeList"); + case 291 : // System.out.println("InterfaceHeaderExtends ::= extends InterfaceTypeList"); consumeInterfaceHeaderExtends(); break ; - case 294 : // System.out.println("InterfaceMemberDeclarations ::= InterfaceMemberDeclarations..."); + case 294 : // System.out.println("InterfaceMemberDeclarations ::= InterfaceMemberDeclarations..."); consumeInterfaceMemberDeclarations(); break ; - case 295 : // System.out.println("InterfaceMemberDeclaration ::= SEMICOLON"); + case 295 : // System.out.println("InterfaceMemberDeclaration ::= SEMICOLON"); consumeEmptyInterfaceMemberDeclaration(); break ; - case 298 : // System.out.println("InterfaceMemberDeclaration ::= InvalidMethodDeclaration"); + case 298 : // System.out.println("InterfaceMemberDeclaration ::= InvalidMethodDeclaration"); ignoreMethodBody(); break ; - case 299 : // System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader ConstructorBody"); + case 299 : // System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader ConstructorBody"); ignoreInvalidConstructorDeclaration(true); break ; - case 300 : // System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader SEMICOLON"); + case 300 : // System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader SEMICOLON"); ignoreInvalidConstructorDeclaration(false); break ; - case 306 : // System.out.println("ArrayInitializer ::= LBRACE ,opt RBRACE"); + case 306 : // System.out.println("ArrayInitializer ::= LBRACE ,opt RBRACE"); consumeEmptyArrayInitializer(); break ; - case 307 : // System.out.println("ArrayInitializer ::= LBRACE VariableInitializers RBRACE"); + case 307 : // System.out.println("ArrayInitializer ::= LBRACE VariableInitializers RBRACE"); consumeArrayInitializer(); break ; - case 308 : // System.out.println("ArrayInitializer ::= LBRACE VariableInitializers COMMA RBRACE"); + case 308 : // System.out.println("ArrayInitializer ::= LBRACE VariableInitializers COMMA RBRACE"); consumeArrayInitializer(); break ; - case 310 : // System.out.println("VariableInitializers ::= VariableInitializers COMMA VariableInitializer"); + case 310 : // System.out.println("VariableInitializers ::= VariableInitializers COMMA VariableInitializer"); consumeVariableInitializers(); break ; - case 311 : // System.out.println("Block ::= OpenBlock LBRACE BlockStatementsopt RBRACE"); + case 311 : // System.out.println("Block ::= OpenBlock LBRACE BlockStatementsopt RBRACE"); consumeBlock(); break ; - case 312 : // System.out.println("OpenBlock ::="); + case 312 : // System.out.println("OpenBlock ::="); consumeOpenBlock() ; break ; - case 314 : // System.out.println("BlockStatements ::= BlockStatements BlockStatement"); + case 314 : // System.out.println("BlockStatements ::= BlockStatements BlockStatement"); consumeBlockStatements() ; break ; - case 318 : // System.out.println("BlockStatement ::= InvalidInterfaceDeclaration"); + case 318 : // System.out.println("BlockStatement ::= InvalidInterfaceDeclaration"); ignoreInterfaceDeclaration(); break ; - case 319 : // System.out.println("LocalVariableDeclarationStatement ::= LocalVariableDeclaration SEMICOLON"); + case 319 : // System.out.println("LocalVariableDeclarationStatement ::= LocalVariableDeclaration SEMICOLON"); consumeLocalVariableDeclarationStatement(); break ; - case 320 : // System.out.println("LocalVariableDeclaration ::= Type PushModifiers VariableDeclarators"); + case 320 : // System.out.println("LocalVariableDeclaration ::= Type PushModifiers VariableDeclarators"); consumeLocalVariableDeclaration(); break ; - case 321 : // System.out.println("LocalVariableDeclaration ::= Modifiers Type PushModifiers VariableDeclarators"); + case 321 : // System.out.println("LocalVariableDeclaration ::= Modifiers Type PushModifiers VariableDeclarators"); consumeLocalVariableDeclaration(); break ; - case 322 : // System.out.println("PushModifiers ::="); + case 322 : // System.out.println("PushModifiers ::="); consumePushModifiers(); break ; - case 346 : // System.out.println("EmptyStatement ::= SEMICOLON"); + case 346 : // System.out.println("EmptyStatement ::= SEMICOLON"); consumeEmptyStatement(); break ; - case 347 : // System.out.println("LabeledStatement ::= JavaIdentifier COLON Statement"); + case 347 : // System.out.println("LabeledStatement ::= JavaIdentifier COLON Statement"); consumeStatementLabel() ; break ; - case 348 : // System.out.println("LabeledStatementNoShortIf ::= JavaIdentifier COLON StatementNoShortIf"); + case 348 : // System.out.println("LabeledStatementNoShortIf ::= JavaIdentifier COLON StatementNoShortIf"); consumeStatementLabel() ; break ; - case 349 : // System.out.println("ExpressionStatement ::= StatementExpression SEMICOLON"); + case 349 : // System.out.println("ExpressionStatement ::= StatementExpression SEMICOLON"); consumeExpressionStatement(); break ; - case 357 : // System.out.println("IfThenStatement ::= if LPAREN Expression RPAREN Statement"); + case 357 : // System.out.println("IfThenStatement ::= if LPAREN Expression RPAREN Statement"); consumeStatementIfNoElse(); break ; - case 358 : // System.out.println("IfThenElseStatement ::= if LPAREN Expression RPAREN StatementNoShortIf else..."); + case 358 : // System.out.println("IfThenElseStatement ::= if LPAREN Expression RPAREN StatementNoShortIf else..."); consumeStatementIfWithElse(); break ; - case 359 : // System.out.println("IfThenElseStatementNoShortIf ::= if LPAREN Expression RPAREN StatementNoShortIf"); + case 359 : // System.out.println("IfThenElseStatementNoShortIf ::= if LPAREN Expression RPAREN StatementNoShortIf..."); consumeStatementIfWithElse(); break ; - case 360 : // System.out.println("SwitchStatement ::= switch OpenBlock LPAREN Expression RPAREN SwitchBlock"); + case 360 : // System.out.println("SwitchStatement ::= switch OpenBlock LPAREN Expression RPAREN SwitchBlock"); consumeStatementSwitch() ; break ; - case 361 : // System.out.println("SwitchBlock ::= LBRACE RBRACE"); + case 361 : // System.out.println("SwitchBlock ::= LBRACE RBRACE"); consumeEmptySwitchBlock() ; break ; - case 364 : // System.out.println("SwitchBlock ::= LBRACE SwitchBlockStatements SwitchLabels RBRACE"); + case 364 : // System.out.println("SwitchBlock ::= LBRACE SwitchBlockStatements SwitchLabels RBRACE"); consumeSwitchBlock() ; break ; - case 366 : // System.out.println("SwitchBlockStatements ::= SwitchBlockStatements SwitchBlockStatement"); + case 366 : // System.out.println("SwitchBlockStatements ::= SwitchBlockStatements SwitchBlockStatement"); consumeSwitchBlockStatements() ; break ; - case 367 : // System.out.println("SwitchBlockStatement ::= SwitchLabels BlockStatements"); + case 367 : // System.out.println("SwitchBlockStatement ::= SwitchLabels BlockStatements"); consumeSwitchBlockStatement() ; break ; - case 369 : // System.out.println("SwitchLabels ::= SwitchLabels SwitchLabel"); + case 369 : // System.out.println("SwitchLabels ::= SwitchLabels SwitchLabel"); consumeSwitchLabels() ; break ; - case 370 : // System.out.println("SwitchLabel ::= case ConstantExpression COLON"); + case 370 : // System.out.println("SwitchLabel ::= case ConstantExpression COLON"); consumeCaseLabel(); break ; - case 371 : // System.out.println("SwitchLabel ::= default COLON"); + case 371 : // System.out.println("SwitchLabel ::= default COLON"); consumeDefaultLabel(); break ; - case 372 : // System.out.println("WhileStatement ::= while LPAREN Expression RPAREN Statement"); + case 372 : // System.out.println("WhileStatement ::= while LPAREN Expression RPAREN Statement"); consumeStatementWhile() ; break ; - case 373 : // System.out.println("WhileStatementNoShortIf ::= while LPAREN Expression RPAREN StatementNoShortIf"); + case 373 : // System.out.println("WhileStatementNoShortIf ::= while LPAREN Expression RPAREN StatementNoShortIf"); consumeStatementWhile() ; break ; - case 374 : // System.out.println("DoStatement ::= do Statement while LPAREN Expression RPAREN SEMICOLON"); + case 374 : // System.out.println("DoStatement ::= do Statement while LPAREN Expression RPAREN SEMICOLON"); consumeStatementDo() ; break ; - case 375 : // System.out.println("ForStatement ::= for LPAREN ForInitopt SEMICOLON Expressionopt SEMICOLON..."); + case 375 : // System.out.println("ForStatement ::= for LPAREN ForInitopt SEMICOLON Expressionopt SEMICOLON..."); consumeStatementFor() ; break ; - case 376 : // System.out.println("ForStatementNoShortIf ::= for LPAREN ForInitopt SEMICOLON Expressionopt..."); + case 376 : // System.out.println("ForStatementNoShortIf ::= for LPAREN ForInitopt SEMICOLON Expressionopt SEMICOLON"); consumeStatementFor() ; break ; - case 377 : // System.out.println("ForInit ::= StatementExpressionList"); + case 377 : // System.out.println("ForInit ::= StatementExpressionList"); consumeForInit() ; break ; - case 381 : // System.out.println("StatementExpressionList ::= StatementExpressionList COMMA StatementExpression"); + case 381 : // System.out.println("StatementExpressionList ::= StatementExpressionList COMMA StatementExpression"); consumeStatementExpressionList() ; break ; - case 382 : // System.out.println("AssertStatement ::= assert Expression SEMICOLON"); + case 382 : // System.out.println("AssertStatement ::= assert Expression SEMICOLON"); consumeSimpleAssertStatement() ; break ; - case 383 : // System.out.println("AssertStatement ::= assert Expression COLON Expression SEMICOLON"); + case 383 : // System.out.println("AssertStatement ::= assert Expression COLON Expression SEMICOLON"); consumeAssertStatement() ; break ; - case 384 : // System.out.println("BreakStatement ::= break SEMICOLON"); + case 384 : // System.out.println("BreakStatement ::= break SEMICOLON"); consumeStatementBreak() ; break ; - case 385 : // System.out.println("BreakStatement ::= break Identifier SEMICOLON"); + case 385 : // System.out.println("BreakStatement ::= break Identifier SEMICOLON"); consumeStatementBreakWithLabel() ; break ; - case 386 : // System.out.println("ContinueStatement ::= continue SEMICOLON"); + case 386 : // System.out.println("ContinueStatement ::= continue SEMICOLON"); consumeStatementContinue() ; break ; - case 387 : // System.out.println("ContinueStatement ::= continue Identifier SEMICOLON"); + case 387 : // System.out.println("ContinueStatement ::= continue Identifier SEMICOLON"); consumeStatementContinueWithLabel() ; break ; - case 388 : // System.out.println("ReturnStatement ::= return Expressionopt SEMICOLON"); + case 388 : // System.out.println("ReturnStatement ::= return Expressionopt SEMICOLON"); consumeStatementReturn() ; break ; - case 389 : // System.out.println("ThrowStatement ::= throw Expression SEMICOLON"); + case 389 : // System.out.println("ThrowStatement ::= throw Expression SEMICOLON"); consumeStatementThrow(); break ; - case 390 : // System.out.println("SynchronizedStatement ::= OnlySynchronized LPAREN Expression RPAREN Block"); + case 390 : // System.out.println("SynchronizedStatement ::= OnlySynchronized LPAREN Expression RPAREN Block"); consumeStatementSynchronized(); break ; - case 391 : // System.out.println("OnlySynchronized ::= synchronized"); + case 391 : // System.out.println("OnlySynchronized ::= synchronized"); consumeOnlySynchronized(); break ; - case 392 : // System.out.println("TryStatement ::= try Block Catches"); + case 392 : // System.out.println("TryStatement ::= try Block Catches"); consumeStatementTry(false); break ; - case 393 : // System.out.println("TryStatement ::= try Block Catchesopt Finally"); + case 393 : // System.out.println("TryStatement ::= try Block Catchesopt Finally"); consumeStatementTry(true); break ; - case 395 : // System.out.println("Catches ::= Catches CatchClause"); + case 395 : // System.out.println("Catches ::= Catches CatchClause"); consumeCatches(); break ; - case 396 : // System.out.println("CatchClause ::= catch LPAREN FormalParameter RPAREN Block"); + case 396 : // System.out.println("CatchClause ::= catch LPAREN FormalParameter RPAREN Block"); consumeStatementCatch() ; break ; - case 398 : // System.out.println("PushLPAREN ::= LPAREN"); + case 398 : // System.out.println("PushLPAREN ::= LPAREN"); consumeLeftParen(); break ; - case 399 : // System.out.println("PushRPAREN ::= RPAREN"); + case 399 : // System.out.println("PushRPAREN ::= RPAREN"); consumeRightParen(); break ; - case 404 : // System.out.println("PrimaryNoNewArray ::= this"); + case 404 : // System.out.println("PrimaryNoNewArray ::= this"); consumePrimaryNoNewArrayThis(); break ; - case 405 : // System.out.println("PrimaryNoNewArray ::= PushLPAREN Expression PushRPAREN"); + case 405 : // System.out.println("PrimaryNoNewArray ::= PushLPAREN Expression PushRPAREN"); consumePrimaryNoNewArray(); break ; - case 408 : // System.out.println("PrimaryNoNewArray ::= Name DOT this"); + case 408 : // System.out.println("PrimaryNoNewArray ::= Name DOT this"); consumePrimaryNoNewArrayNameThis(); break ; - case 409 : // System.out.println("PrimaryNoNewArray ::= Name DOT super"); + case 409 : // System.out.println("PrimaryNoNewArray ::= Name DOT super"); consumePrimaryNoNewArrayNameSuper(); break ; - case 410 : // System.out.println("PrimaryNoNewArray ::= Name DOT class"); + case 410 : // System.out.println("PrimaryNoNewArray ::= Name DOT class"); consumePrimaryNoNewArrayName(); break ; - case 411 : // System.out.println("PrimaryNoNewArray ::= ArrayType DOT class"); + case 411 : // System.out.println("PrimaryNoNewArray ::= ArrayType DOT class"); consumePrimaryNoNewArrayArrayType(); break ; - case 412 : // System.out.println("PrimaryNoNewArray ::= PrimitiveType DOT class"); + case 412 : // System.out.println("PrimaryNoNewArray ::= PrimitiveType DOT class"); consumePrimaryNoNewArrayPrimitiveType(); break ; - case 415 : // System.out.println("AllocationHeader ::= new ClassType LPAREN ArgumentListopt RPAREN"); + case 415 : // System.out.println("AllocationHeader ::= new ClassType LPAREN ArgumentListopt RPAREN"); consumeAllocationHeader(); break ; - case 416 : // System.out.println("ClassInstanceCreationExpression ::= new ClassType LPAREN ArgumentListopt RPAREN"); + case 416 : // System.out.println("ClassInstanceCreationExpression ::= new ClassType LPAREN ArgumentListopt RPAREN..."); consumeClassInstanceCreationExpression(); break ; - case 417 : // System.out.println("ClassInstanceCreationExpression ::= Primary DOT new SimpleName LPAREN..."); + case 417 : // System.out.println("ClassInstanceCreationExpression ::= Primary DOT new SimpleName LPAREN..."); consumeClassInstanceCreationExpressionQualified() ; break ; - case 418 : // System.out.println("ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName new..."); + case 418 : // System.out.println("ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName new..."); consumeClassInstanceCreationExpressionQualified() ; break ; - case 419 : // System.out.println("ClassInstanceCreationExpressionName ::= Name DOT"); + case 419 : // System.out.println("ClassInstanceCreationExpressionName ::= Name DOT"); consumeClassInstanceCreationExpressionName() ; break ; - case 420 : // System.out.println("ClassBodyopt ::="); + case 420 : // System.out.println("ClassBodyopt ::="); consumeClassBodyopt(); break ; - case 422 : // System.out.println("EnterAnonymousClassBody ::="); + case 422 : // System.out.println("EnterAnonymousClassBody ::="); consumeEnterAnonymousClassBody(); break ; - case 424 : // System.out.println("ArgumentList ::= ArgumentList COMMA Expression"); + case 424 : // System.out.println("ArgumentList ::= ArgumentList COMMA Expression"); consumeArgumentList(); break ; - case 425 : // System.out.println("ArrayCreationWithoutArrayInitializer ::= new PrimitiveType DimWithOrWithOutExprs"); + case 425 : // System.out.println("ArrayCreationWithoutArrayInitializer ::= new PrimitiveType DimWithOrWithOutExprs"); consumeArrayCreationExpressionWithoutInitializer(); break ; - case 426 : // System.out.println("ArrayCreationWithArrayInitializer ::= new PrimitiveType DimWithOrWithOutExprs..."); + case 426 : // System.out.println("ArrayCreationWithArrayInitializer ::= new PrimitiveType DimWithOrWithOutExprs..."); consumeArrayCreationExpressionWithInitializer(); break ; - case 427 : // System.out.println("ArrayCreationWithoutArrayInitializer ::= new ClassOrInterfaceType..."); + case 427 : // System.out.println("ArrayCreationWithoutArrayInitializer ::= new ClassOrInterfaceType..."); consumeArrayCreationExpressionWithoutInitializer(); break ; - case 428 : // System.out.println("ArrayCreationWithArrayInitializer ::= new ClassOrInterfaceType..."); + case 428 : // System.out.println("ArrayCreationWithArrayInitializer ::= new ClassOrInterfaceType..."); consumeArrayCreationExpressionWithInitializer(); break ; - case 430 : // System.out.println("DimWithOrWithOutExprs ::= DimWithOrWithOutExprs DimWithOrWithOutExpr"); + case 430 : // System.out.println("DimWithOrWithOutExprs ::= DimWithOrWithOutExprs DimWithOrWithOutExpr"); consumeDimWithOrWithOutExprs(); break ; - case 432 : // System.out.println("DimWithOrWithOutExpr ::= LBRACKET RBRACKET"); + case 432 : // System.out.println("DimWithOrWithOutExpr ::= LBRACKET RBRACKET"); consumeDimWithOrWithOutExpr(); break ; - case 433 : // System.out.println("Dims ::= DimsLoop"); + case 433 : // System.out.println("Dims ::= DimsLoop"); consumeDims(); break ; - case 436 : // System.out.println("OneDimLoop ::= LBRACKET RBRACKET"); + case 436 : // System.out.println("OneDimLoop ::= LBRACKET RBRACKET"); consumeOneDimLoop(); break ; - case 437 : // System.out.println("FieldAccess ::= Primary DOT JavaIdentifier"); + case 437 : // System.out.println("FieldAccess ::= Primary DOT JavaIdentifier"); consumeFieldAccess(false); break ; - case 438 : // System.out.println("FieldAccess ::= super DOT JavaIdentifier"); + case 438 : // System.out.println("FieldAccess ::= super DOT JavaIdentifier"); consumeFieldAccess(true); break ; - case 439 : // System.out.println("MethodInvocation ::= NameOrAj LPAREN ArgumentListopt RPAREN"); + case 439 : // System.out.println("MethodInvocation ::= NameOrAj LPAREN ArgumentListopt RPAREN"); consumeMethodInvocationName(); break ; - case 440 : // System.out.println("MethodInvocation ::= Primary DOT JavaIdentifier LPAREN ArgumentListopt RPAREN"); + case 440 : // System.out.println("MethodInvocation ::= Primary DOT JavaIdentifier LPAREN ArgumentListopt RPAREN"); consumeMethodInvocationPrimary(); break ; - case 441 : // System.out.println("MethodInvocation ::= super DOT JavaIdentifier LPAREN ArgumentListopt RPAREN"); + case 441 : // System.out.println("MethodInvocation ::= super DOT JavaIdentifier LPAREN ArgumentListopt RPAREN"); consumeMethodInvocationSuper(); break ; - case 442 : // System.out.println("ArrayAccess ::= Name LBRACKET Expression RBRACKET"); + case 442 : // System.out.println("ArrayAccess ::= Name LBRACKET Expression RBRACKET"); consumeArrayAccess(true); break ; - case 443 : // System.out.println("ArrayAccess ::= PrimaryNoNewArray LBRACKET Expression RBRACKET"); + case 443 : // System.out.println("ArrayAccess ::= PrimaryNoNewArray LBRACKET Expression RBRACKET"); consumeArrayAccess(false); break ; - case 444 : // System.out.println("ArrayAccess ::= ArrayCreationWithArrayInitializer LBRACKET Expression RBRACKET"); + case 444 : // System.out.println("ArrayAccess ::= ArrayCreationWithArrayInitializer LBRACKET Expression RBRACKET"); consumeArrayAccess(false); break ; - case 446 : // System.out.println("PostfixExpression ::= NameOrAj"); + case 446 : // System.out.println("PostfixExpression ::= NameOrAj"); consumePostfixExpression(); break ; - case 449 : // System.out.println("PostIncrementExpression ::= PostfixExpression PLUS_PLUS"); + case 449 : // System.out.println("PostIncrementExpression ::= PostfixExpression PLUS_PLUS"); consumeUnaryExpression(OperatorExpression.PLUS,true); break ; - case 450 : // System.out.println("PostDecrementExpression ::= PostfixExpression MINUS_MINUS"); + case 450 : // System.out.println("PostDecrementExpression ::= PostfixExpression MINUS_MINUS"); consumeUnaryExpression(OperatorExpression.MINUS,true); break ; - case 451 : // System.out.println("PushPosition ::="); + case 451 : // System.out.println("PushPosition ::="); consumePushPosition(); break ; - case 454 : // System.out.println("UnaryExpression ::= PLUS PushPosition UnaryExpression"); + case 454 : // System.out.println("UnaryExpression ::= PLUS PushPosition UnaryExpression"); consumeUnaryExpression(OperatorExpression.PLUS); break ; - case 455 : // System.out.println("UnaryExpression ::= MINUS PushPosition UnaryExpression"); + case 455 : // System.out.println("UnaryExpression ::= MINUS PushPosition UnaryExpression"); consumeUnaryExpression(OperatorExpression.MINUS); break ; - case 457 : // System.out.println("PreIncrementExpression ::= PLUS_PLUS PushPosition UnaryExpression"); + case 457 : // System.out.println("PreIncrementExpression ::= PLUS_PLUS PushPosition UnaryExpression"); consumeUnaryExpression(OperatorExpression.PLUS,false); break ; - case 458 : // System.out.println("PreDecrementExpression ::= MINUS_MINUS PushPosition UnaryExpression"); + case 458 : // System.out.println("PreDecrementExpression ::= MINUS_MINUS PushPosition UnaryExpression"); consumeUnaryExpression(OperatorExpression.MINUS,false); break ; - case 460 : // System.out.println("UnaryExpressionNotPlusMinus ::= TWIDDLE PushPosition UnaryExpression"); + case 460 : // System.out.println("UnaryExpressionNotPlusMinus ::= TWIDDLE PushPosition UnaryExpression"); consumeUnaryExpression(OperatorExpression.TWIDDLE); break ; - case 461 : // System.out.println("UnaryExpressionNotPlusMinus ::= NOT PushPosition UnaryExpression"); + case 461 : // System.out.println("UnaryExpressionNotPlusMinus ::= NOT PushPosition UnaryExpression"); consumeUnaryExpression(OperatorExpression.NOT); break ; - case 463 : // System.out.println("CastExpression ::= PushLPAREN PrimitiveType Dimsopt PushRPAREN..."); + case 463 : // System.out.println("CastExpression ::= PushLPAREN PrimitiveType Dimsopt PushRPAREN InsideCastExpression"); consumeCastExpression(); break ; - case 464 : // System.out.println("CastExpression ::= PushLPAREN Name Dims PushRPAREN InsideCastExpression..."); + case 464 : // System.out.println("CastExpression ::= PushLPAREN Name Dims PushRPAREN InsideCastExpression..."); consumeCastExpression(); break ; - case 465 : // System.out.println("CastExpression ::= PushLPAREN Expression PushRPAREN InsideCastExpressionLL1..."); + case 465 : // System.out.println("CastExpression ::= PushLPAREN Expression PushRPAREN InsideCastExpressionLL1..."); consumeCastExpressionLL1(); break ; - case 466 : // System.out.println("InsideCastExpression ::="); + case 466 : // System.out.println("InsideCastExpression ::="); consumeInsideCastExpression(); break ; - case 467 : // System.out.println("InsideCastExpressionLL1 ::="); + case 467 : // System.out.println("InsideCastExpressionLL1 ::="); consumeInsideCastExpressionLL1(); break ; - case 469 : // System.out.println("MultiplicativeExpression ::= MultiplicativeExpression MULTIPLY UnaryExpression"); + case 469 : // System.out.println("MultiplicativeExpression ::= MultiplicativeExpression MULTIPLY UnaryExpression"); consumeBinaryExpression(OperatorExpression.MULTIPLY); break ; - case 470 : // System.out.println("MultiplicativeExpression ::= MultiplicativeExpression DIVIDE UnaryExpression"); + case 470 : // System.out.println("MultiplicativeExpression ::= MultiplicativeExpression DIVIDE UnaryExpression"); consumeBinaryExpression(OperatorExpression.DIVIDE); break ; - case 471 : // System.out.println("MultiplicativeExpression ::= MultiplicativeExpression REMAINDER UnaryExpression"); + case 471 : // System.out.println("MultiplicativeExpression ::= MultiplicativeExpression REMAINDER UnaryExpression"); consumeBinaryExpression(OperatorExpression.REMAINDER); break ; - case 473 : // System.out.println("AdditiveExpression ::= AdditiveExpression PLUS MultiplicativeExpression"); + case 473 : // System.out.println("AdditiveExpression ::= AdditiveExpression PLUS MultiplicativeExpression"); consumeBinaryExpression(OperatorExpression.PLUS); break ; - case 474 : // System.out.println("AdditiveExpression ::= AdditiveExpression MINUS MultiplicativeExpression"); + case 474 : // System.out.println("AdditiveExpression ::= AdditiveExpression MINUS MultiplicativeExpression"); consumeBinaryExpression(OperatorExpression.MINUS); break ; - case 476 : // System.out.println("ShiftExpression ::= ShiftExpression LEFT_SHIFT AdditiveExpression"); + case 476 : // System.out.println("ShiftExpression ::= ShiftExpression LEFT_SHIFT AdditiveExpression"); consumeBinaryExpression(OperatorExpression.LEFT_SHIFT); break ; - case 477 : // System.out.println("ShiftExpression ::= ShiftExpression RIGHT_SHIFT AdditiveExpression"); + case 477 : // System.out.println("ShiftExpression ::= ShiftExpression RIGHT_SHIFT AdditiveExpression"); consumeBinaryExpression(OperatorExpression.RIGHT_SHIFT); break ; - case 478 : // System.out.println("ShiftExpression ::= ShiftExpression UNSIGNED_RIGHT_SHIFT AdditiveExpression"); + case 478 : // System.out.println("ShiftExpression ::= ShiftExpression UNSIGNED_RIGHT_SHIFT AdditiveExpression"); consumeBinaryExpression(OperatorExpression.UNSIGNED_RIGHT_SHIFT); break ; - case 480 : // System.out.println("RelationalExpression ::= RelationalExpression LESS ShiftExpression"); + case 480 : // System.out.println("RelationalExpression ::= RelationalExpression LESS ShiftExpression"); consumeBinaryExpression(OperatorExpression.LESS); break ; - case 481 : // System.out.println("RelationalExpression ::= RelationalExpression GREATER ShiftExpression"); + case 481 : // System.out.println("RelationalExpression ::= RelationalExpression GREATER ShiftExpression"); consumeBinaryExpression(OperatorExpression.GREATER); break ; - case 482 : // System.out.println("RelationalExpression ::= RelationalExpression LESS_EQUAL ShiftExpression"); + case 482 : // System.out.println("RelationalExpression ::= RelationalExpression LESS_EQUAL ShiftExpression"); consumeBinaryExpression(OperatorExpression.LESS_EQUAL); break ; - case 483 : // System.out.println("RelationalExpression ::= RelationalExpression GREATER_EQUAL ShiftExpression"); + case 483 : // System.out.println("RelationalExpression ::= RelationalExpression GREATER_EQUAL ShiftExpression"); consumeBinaryExpression(OperatorExpression.GREATER_EQUAL); break ; - case 484 : // System.out.println("RelationalExpression ::= RelationalExpression instanceof ReferenceType"); + case 484 : // System.out.println("RelationalExpression ::= RelationalExpression instanceof ReferenceType"); consumeInstanceOfExpression(OperatorExpression.INSTANCEOF); break ; - case 486 : // System.out.println("EqualityExpression ::= EqualityExpression EQUAL_EQUAL RelationalExpression"); + case 486 : // System.out.println("EqualityExpression ::= EqualityExpression EQUAL_EQUAL RelationalExpression"); consumeEqualityExpression(OperatorExpression.EQUAL_EQUAL); break ; - case 487 : // System.out.println("EqualityExpression ::= EqualityExpression NOT_EQUAL RelationalExpression"); + case 487 : // System.out.println("EqualityExpression ::= EqualityExpression NOT_EQUAL RelationalExpression"); consumeEqualityExpression(OperatorExpression.NOT_EQUAL); break ; - case 489 : // System.out.println("AndExpression ::= AndExpression AND EqualityExpression"); + case 489 : // System.out.println("AndExpression ::= AndExpression AND EqualityExpression"); consumeBinaryExpression(OperatorExpression.AND); break ; - case 491 : // System.out.println("ExclusiveOrExpression ::= ExclusiveOrExpression XOR AndExpression"); + case 491 : // System.out.println("ExclusiveOrExpression ::= ExclusiveOrExpression XOR AndExpression"); consumeBinaryExpression(OperatorExpression.XOR); break ; - case 493 : // System.out.println("InclusiveOrExpression ::= InclusiveOrExpression OR ExclusiveOrExpression"); + case 493 : // System.out.println("InclusiveOrExpression ::= InclusiveOrExpression OR ExclusiveOrExpression"); consumeBinaryExpression(OperatorExpression.OR); break ; - case 495 : // System.out.println("ConditionalAndExpression ::= ConditionalAndExpression AND_AND..."); + case 495 : // System.out.println("ConditionalAndExpression ::= ConditionalAndExpression AND_AND InclusiveOrExpression"); consumeBinaryExpression(OperatorExpression.AND_AND); break ; - case 497 : // System.out.println("ConditionalOrExpression ::= ConditionalOrExpression OR_OR..."); + case 497 : // System.out.println("ConditionalOrExpression ::= ConditionalOrExpression OR_OR ConditionalAndExpression"); consumeBinaryExpression(OperatorExpression.OR_OR); break ; - case 499 : // System.out.println("ConditionalExpression ::= ConditionalOrExpression QUESTION Expression COLON..."); + case 499 : // System.out.println("ConditionalExpression ::= ConditionalOrExpression QUESTION Expression COLON..."); consumeConditionalExpression(OperatorExpression.QUESTIONCOLON) ; break ; - case 502 : // System.out.println("Assignment ::= PostfixExpression AssignmentOperator AssignmentExpression"); + case 502 : // System.out.println("Assignment ::= PostfixExpression AssignmentOperator AssignmentExpression"); consumeAssignment(); break ; - case 504 : // System.out.println("Assignment ::= InvalidArrayInitializerAssignement"); + case 504 : // System.out.println("Assignment ::= InvalidArrayInitializerAssignement"); ignoreExpressionAssignment(); break ; - case 505 : // System.out.println("AssignmentOperator ::= EQUAL"); + case 505 : // System.out.println("AssignmentOperator ::= EQUAL"); consumeAssignmentOperator(EQUAL); break ; - case 506 : // System.out.println("AssignmentOperator ::= MULTIPLY_EQUAL"); + case 506 : // System.out.println("AssignmentOperator ::= MULTIPLY_EQUAL"); consumeAssignmentOperator(MULTIPLY); break ; - case 507 : // System.out.println("AssignmentOperator ::= DIVIDE_EQUAL"); + case 507 : // System.out.println("AssignmentOperator ::= DIVIDE_EQUAL"); consumeAssignmentOperator(DIVIDE); break ; - case 508 : // System.out.println("AssignmentOperator ::= REMAINDER_EQUAL"); + case 508 : // System.out.println("AssignmentOperator ::= REMAINDER_EQUAL"); consumeAssignmentOperator(REMAINDER); break ; - case 509 : // System.out.println("AssignmentOperator ::= PLUS_EQUAL"); + case 509 : // System.out.println("AssignmentOperator ::= PLUS_EQUAL"); consumeAssignmentOperator(PLUS); break ; - case 510 : // System.out.println("AssignmentOperator ::= MINUS_EQUAL"); + case 510 : // System.out.println("AssignmentOperator ::= MINUS_EQUAL"); consumeAssignmentOperator(MINUS); break ; - case 511 : // System.out.println("AssignmentOperator ::= LEFT_SHIFT_EQUAL"); + case 511 : // System.out.println("AssignmentOperator ::= LEFT_SHIFT_EQUAL"); consumeAssignmentOperator(LEFT_SHIFT); break ; - case 512 : // System.out.println("AssignmentOperator ::= RIGHT_SHIFT_EQUAL"); + case 512 : // System.out.println("AssignmentOperator ::= RIGHT_SHIFT_EQUAL"); consumeAssignmentOperator(RIGHT_SHIFT); break ; - case 513 : // System.out.println("AssignmentOperator ::= UNSIGNED_RIGHT_SHIFT_EQUAL"); + case 513 : // System.out.println("AssignmentOperator ::= UNSIGNED_RIGHT_SHIFT_EQUAL"); consumeAssignmentOperator(UNSIGNED_RIGHT_SHIFT); break ; - case 514 : // System.out.println("AssignmentOperator ::= AND_EQUAL"); + case 514 : // System.out.println("AssignmentOperator ::= AND_EQUAL"); consumeAssignmentOperator(AND); break ; - case 515 : // System.out.println("AssignmentOperator ::= XOR_EQUAL"); + case 515 : // System.out.println("AssignmentOperator ::= XOR_EQUAL"); consumeAssignmentOperator(XOR); break ; - case 516 : // System.out.println("AssignmentOperator ::= OR_EQUAL"); + case 516 : // System.out.println("AssignmentOperator ::= OR_EQUAL"); consumeAssignmentOperator(OR); break ; - case 523 : // System.out.println("Expressionopt ::="); + case 523 : // System.out.println("Expressionopt ::="); consumeEmptyExpression(); break ; - case 527 : // System.out.println("ImportDeclarationsopt ::="); + case 527 : // System.out.println("ImportDeclarationsopt ::="); consumeEmptyImportDeclarationsopt(); break ; - case 528 : // System.out.println("ImportDeclarationsopt ::= ImportDeclarations"); + case 528 : // System.out.println("ImportDeclarationsopt ::= ImportDeclarations"); consumeImportDeclarationsopt(); break ; - case 529 : // System.out.println("TypeDeclarationsopt ::="); + case 529 : // System.out.println("TypeDeclarationsopt ::="); consumeEmptyTypeDeclarationsopt(); break ; - case 530 : // System.out.println("TypeDeclarationsopt ::= TypeDeclarations"); + case 530 : // System.out.println("TypeDeclarationsopt ::= TypeDeclarations"); consumeTypeDeclarationsopt(); break ; - case 531 : // System.out.println("ClassBodyDeclarationsopt ::="); + case 531 : // System.out.println("ClassBodyDeclarationsopt ::="); consumeEmptyClassBodyDeclarationsopt(); break ; - case 532 : // System.out.println("ClassBodyDeclarationsopt ::= NestedType ClassBodyDeclarations"); + case 532 : // System.out.println("ClassBodyDeclarationsopt ::= NestedType ClassBodyDeclarations"); consumeClassBodyDeclarationsopt(); break ; - case 533 : // System.out.println("Modifiersopt ::="); + case 533 : // System.out.println("Modifiersopt ::="); consumeDefaultModifiers(); break ; - case 534 : // System.out.println("Modifiersopt ::= Modifiers"); + case 534 : // System.out.println("Modifiersopt ::= Modifiers"); consumeModifiers(); break ; - case 535 : // System.out.println("BlockStatementsopt ::="); + case 535 : // System.out.println("BlockStatementsopt ::="); consumeEmptyBlockStatementsopt(); break ; - case 537 : // System.out.println("Dimsopt ::="); + case 537 : // System.out.println("Dimsopt ::="); consumeEmptyDimsopt(); break ; - case 539 : // System.out.println("ArgumentListopt ::="); + case 539 : // System.out.println("ArgumentListopt ::="); consumeEmptyArgumentListopt(); break ; - case 543 : // System.out.println("FormalParameterListopt ::="); + case 543 : // System.out.println("FormalParameterListopt ::="); consumeFormalParameterListopt(); break ; - case 547 : // System.out.println("InterfaceMemberDeclarationsopt ::="); + case 547 : // System.out.println("InterfaceMemberDeclarationsopt ::="); consumeEmptyInterfaceMemberDeclarationsopt(); break ; - case 548 : // System.out.println("InterfaceMemberDeclarationsopt ::= NestedType InterfaceMemberDeclarations"); + case 548 : // System.out.println("InterfaceMemberDeclarationsopt ::= NestedType InterfaceMemberDeclarations"); consumeInterfaceMemberDeclarationsopt(); break ; - case 549 : // System.out.println("NestedType ::="); + case 549 : // System.out.println("NestedType ::="); consumeNestedType(); break ; - case 550 : // System.out.println("ForInitopt ::="); + case 550 : // System.out.println("ForInitopt ::="); consumeEmptyForInitopt(); break ; - case 552 : // System.out.println("ForUpdateopt ::="); + case 552 : // System.out.println("ForUpdateopt ::="); consumeEmptyForUpdateopt(); break ; - case 556 : // System.out.println("Catchesopt ::="); + case 556 : // System.out.println("Catchesopt ::="); consumeEmptyCatchesopt(); break ; diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java index 3d0f63c91..a39d4d8a9 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java @@ -17,6 +17,7 @@ import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet; @@ -71,19 +72,14 @@ public class AjBuildManager { private StructureModel structureModel; public AjBuildConfig buildConfig; + + AjState state = new AjState(this); - private BcelWeaver bcelWeaver; + BcelWeaver bcelWeaver; public BcelWorld bcelWorld; public CountingMessageHandler handler; - long lastStructuralBuildTime; - - Set addedFiles; - Set deletedFiles; - - List addedClassFiles; - public AjBuildManager(IMessageHandler holder) { super(); this.handler = CountingMessageHandler.makeCountingMessageHandler(holder); @@ -102,6 +98,7 @@ public class AjBuildManager { try { setBuildConfig(buildConfig); + state.prepareForNextBuild(buildConfig); String check = checkRtJar(buildConfig); if (check != null) { @@ -115,27 +112,22 @@ public class AjBuildManager { if (handler.hasErrors()) { return false; } -// initJavaBuilder(counter); -// if (counter.hasErrors()) { -// return false; -// } if (buildConfig.isEmacsSymMode() || buildConfig.isGenerateModelMode()) { bcelWorld.setModel(StructureModelManager.INSTANCE.getStructureModel()); } - performCompilation(); - -// BatchBuilder builder = new BatchBuilder(javaBuilder, counter); -// State newState = builder.run(); + performCompilation(buildConfig.getFiles()); + if (buildConfig.isEmacsSymMode()) { new org.aspectj.ajdt.internal.core.builder.EmacsStructureModelManager().externalizeModel(); } -// System.err.println("check error: " + counter + ", " + -// counter.numMessages(IMessage.ERROR) + ", " + counter.numMessages(IMessage.FAIL, false)); + if (handler.hasErrors()) { return false; } + + state.successfulCompile(buildConfig); //!!! a waste of time when not incremental boolean weaved = weaveAndGenerateClassFiles(); @@ -169,8 +161,61 @@ public class AjBuildManager { } //XXX fake incremental - public boolean incrementalBuild(AjBuildConfig buildConfig, IMessageHandler messageHandler) throws IOException { - return batchBuild(buildConfig, messageHandler); + public boolean incrementalBuild(AjBuildConfig buildConfig, IMessageHandler baseHandler) throws IOException { + if (!state.prepareForNextBuild(buildConfig)) { + return batchBuild(buildConfig, baseHandler); + } + + //!!! too much cut-and-paste from batchBuild + this.handler = CountingMessageHandler.makeCountingMessageHandler(baseHandler); + + try { + setBuildConfig(buildConfig); + + //setupModel(); +// initBcelWorld(handler); +// if (handler.hasErrors()) { +// return false; +// } + +// if (buildConfig.isEmacsSymMode() || buildConfig.isGenerateModelMode()) { +// bcelWorld.setModel(StructureModelManager.INSTANCE.getStructureModel()); +// } + int count = 0; + List filesToCompile; + while ( !(filesToCompile = state.getFilesToCompile(count == 0)).isEmpty() ) { + //if (count > 0) return batchBuild(buildConfig, baseHandler); //??? only 1 try + performCompilation(filesToCompile); + + if (handler.hasErrors()) return false; + + if (count++ > 5) { + return batchBuild(buildConfig, baseHandler); + } + } + + //System.err.println("built in " + count + " cycles"); + +// if (buildConfig.isEmacsSymMode()) { +// new org.aspectj.ajdt.internal.core.builder.EmacsStructureModelManager().externalizeModel(); +// } + + if (handler.hasErrors()) { + return false; + } + + state.successfulCompile(buildConfig); + + boolean weaved = weaveAndGenerateClassFiles(); + + if (buildConfig.isGenerateModelMode()) { + StructureModelManager.INSTANCE.fireModelUpdated(); + } + return !handler.hasErrors(); + } finally { + handler = null; + } + } // if (javaBuilder == null || javaBuilder.currentProject == null || javaBuilder.lastState == null) { @@ -211,20 +256,7 @@ public class AjBuildManager { // currentHandler = null; // } // -// } - - - - void updateBuildConfig(AjBuildConfig newBuildConfig) { - Set oldFiles = new HashSet(buildConfig.getFiles()); - Set newFiles = new HashSet(newBuildConfig.getFiles()); - - addedFiles = new HashSet(newFiles); - addedFiles.removeAll(oldFiles); - deletedFiles = new HashSet(oldFiles); - deletedFiles.removeAll(newFiles); - setBuildConfig(newBuildConfig); - } +// } private void initBcelWorld(IMessageHandler handler) throws IOException { bcelWorld = new BcelWorld(buildConfig.getClasspath(), handler); @@ -259,25 +291,18 @@ public class AjBuildManager { return bcelWorld; } - void addAspectClassFilesToWeaver() throws IOException { - //System.out.println("added or changed: " + classFileCache.getAddedOrChanged()); - + void addAspectClassFilesToWeaver(List addedClassFiles) throws IOException { for (Iterator i = addedClassFiles.iterator(); i.hasNext(); ) { UnwovenClassFile classFile = (UnwovenClassFile) i.next(); bcelWeaver.addClassFile(classFile); } -// for (Iterator i = classFileCache.getDeleted().iterator(); i.hasNext(); ) { -// UnwovenClassFile classFile = (UnwovenClassFile) i.next(); -// bcelWeaver.deleteClassFile(classFile.getClassName()); -// classFile.deleteRealFile(); -// } } public boolean weaveAndGenerateClassFiles() throws IOException { handler.handleMessage(MessageUtil.info("weaving")); if (progressListener != null) progressListener.setText("weaving aspects"); //!!! doesn't provide intermediate progress during weaving - addAspectClassFilesToWeaver(); + addAspectClassFilesToWeaver(state.addedClassFiles); if (buildConfig.isNoWeave()) { if (buildConfig.getOutputJar() != null) { bcelWeaver.dumpUnwoven(buildConfig.getOutputJar()); @@ -320,6 +345,7 @@ public class AjBuildManager { defaultEncoding = null; //$NON-NLS-1$ for (int i = 0; i < fileCount; i++) { +// these tests are performed for AjBuildConfig // char[] charName = filenames[i].toCharArray(); // if (knownFileNames.get(charName) != null) { // MessageUtil.error(handler, "duplicate file " + filenames[i]); @@ -330,7 +356,6 @@ public class AjBuildManager { // if (!file.exists()) { // MessageUtil.error(handler, "missing file " + filenames[i]); // } - // these tests are performed for AjBuildConfig String encoding = encodings[i]; if (encoding == null) encoding = defaultEncoding; @@ -353,17 +378,12 @@ public class AjBuildManager { } - public void performCompilation() { - List files = buildConfig.getFiles(); - + public void performCompilation(List files) { if (progressListener != null) { compiledCount = 0; sourceFileCount = files.size(); progressListener.setText("compiling source files"); } - - - //System.err.println("got files: " + files); String[] filenames = new String[files.size()]; String[] encodings = new String[files.size()]; @@ -381,6 +401,10 @@ public class AjBuildManager { //System.out.println("compiling"); INameEnvironment environment = getLibraryAccess(classpaths, filenames); + if (!state.classesFromName.isEmpty()) { + environment = new StatefulNameEnvironment(environment, state.classesFromName); + } + // Compiler batchCompiler = // new Compiler( // environment, @@ -421,11 +445,7 @@ public class AjBuildManager { CompilerOptions options = compiler.options; - // set the non-externally configurable options. - //options.setVerboseMode(verbose); - //TODO: options.produceReferenceInfo(produceRefInfo); - - addedClassFiles = new ArrayList(); + options.produceReferenceInfo(true); //TODO turn off when not needed compiler.compile(getCompilationUnits(filenames, encodings)); @@ -463,8 +483,11 @@ public class AjBuildManager { } public void outputClassFiles(CompilationResult unitResult) { - //System.err.println("writing: " + new String(unitResult.fileName)); - if (!((unitResult == null) || (unitResult.hasErrors() && !proceedOnError()))) { + if (unitResult == null) return; + + String sourceFileName = new String(unitResult.fileName); + if (!(unitResult.hasErrors() && !proceedOnError())) { + List unwovenClassFiles = new ArrayList(); Enumeration classFiles = unitResult.compiledTypes.elements(); while (classFiles.hasMoreElements()) { ClassFile classFile = (ClassFile) classFiles.nextElement(); @@ -477,41 +500,28 @@ public class AjBuildManager { } filename = new File(destinationPath, filename).getPath(); //System.out.println("classfile: " + filename); - addedClassFiles.add(new UnwovenClassFile(filename, classFile.getBytes())); + unwovenClassFiles.add(new UnwovenClassFile(filename, classFile.getBytes())); } + state.noteClassesFromFile(unitResult, sourceFileName, unwovenClassFiles); +// System.out.println("file: " + sourceFileName); +// for (int i=0; i < unitResult.simpleNameReferences.length; i++) { +// System.out.println("simple: " + new String(unitResult.simpleNameReferences[i])); +// } +// for (int i=0; i < unitResult.qualifiedReferences.length; i++) { +// System.out.println("qualified: " + +// new String(CharOperation.concatWith(unitResult.qualifiedReferences[i], '/'))); +// } + } else { + state.noteClassesFromFile(null, sourceFileName, Collections.EMPTY_LIST); } } - - - - private void setBuildConfig(AjBuildConfig buildConfig) { this.buildConfig = buildConfig; handler.reset(); } - private Collection getModifiedFiles() { - return getModifiedFiles(lastStructuralBuildTime); - } - - Collection getModifiedFiles(long lastBuildTime) { - List ret = new ArrayList(); - //not our job to account for new and deleted files - for (Iterator i = buildConfig.getFiles().iterator(); i.hasNext(); ) { - File file = (File)i.next(); - - long modTime = file.lastModified(); - //System.out.println("check: " + file + " mod " + modTime + " build " + lastBuildTime); - if (modTime > lastBuildTime) { - ret.add(file); - } - } - return ret; - } - - String makeClasspathString() { if (buildConfig == null || buildConfig.getClasspath() == null) return ""; StringBuffer buf = new StringBuffer(); @@ -597,20 +607,6 @@ public class AjBuildManager { public StructureModel getStructureModel() { return structureModel; } - -// public void setBuildNotifier(BuildNotifier notifier) { -// buildNotifier = notifier; -// } - - /** callback for builders used only during build */ - private boolean handleProblem(ICompilationUnit unit, IProblem problem) { - if (handler == null) { - throw new IllegalStateException("no current handler when handling " - + problem + " in " + unit); - } - IMessage message = EclipseAdapterUtils.makeMessage(unit, problem); - return handler.handleMessage(message); - } public IProgressListener getProgressListener() { return progressListener; @@ -619,7 +615,5 @@ public class AjBuildManager { public void setProgressListener(IProgressListener progressListener) { this.progressListener = progressListener; } - - } // class AjBuildManager diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java new file mode 100644 index 000000000..040d0e6c8 --- /dev/null +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java @@ -0,0 +1,309 @@ +/* ******************************************************************* + * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC). + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Common Public License v1.0 + * which accompanies this distribution and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * PARC initial implementation + * ******************************************************************/ + + +package org.aspectj.ajdt.internal.core.builder; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.aspectj.weaver.bcel.UnwovenClassFile; +import org.eclipse.jdt.internal.compiler.CompilationResult; +import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader; +import org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException; +import org.eclipse.jdt.internal.core.builder.ReferenceCollection; + + +/** + * Holds state needed for incremental compilation + */ +public class AjState { + AjBuildManager buildManager; + + long lastSuccessfulBuildTime = -1; + long currentBuildTime = -1; + AjBuildConfig buildConfig; + AjBuildConfig newBuildConfig; + + Map/**/ classesFromFile = new HashMap(); + Map/**/ references = new HashMap(); + + Map/**/ classesFromName = new HashMap(); + + ArrayList/**/ qualifiedStrings; + ArrayList/**/ simpleStrings; + + Set addedFiles; + Set deletedFiles; + + List addedClassFiles; + + public AjState(AjBuildManager buildManager) { + this.buildManager = buildManager; + } + + void successfulCompile(AjBuildConfig config) { + buildConfig = config; + lastSuccessfulBuildTime = currentBuildTime; + } + + /** + * Returns false if a batch build is needed. + */ + boolean prepareForNextBuild(AjBuildConfig newBuildConfig) { + currentBuildTime = System.currentTimeMillis(); + + addedClassFiles = new ArrayList(); + + if (lastSuccessfulBuildTime == -1 || buildConfig == null) { + return false; + } + + simpleStrings = new ArrayList(); + qualifiedStrings = new ArrayList(); + + Set oldFiles = new HashSet(buildConfig.getFiles()); + Set newFiles = new HashSet(newBuildConfig.getFiles()); + + addedFiles = new HashSet(newFiles); + addedFiles.removeAll(oldFiles); + deletedFiles = new HashSet(oldFiles); + deletedFiles.removeAll(newFiles); + + this.newBuildConfig = newBuildConfig; + + return true; + } + + private Collection getModifiedFiles() { + return getModifiedFiles(lastSuccessfulBuildTime); + } + + Collection getModifiedFiles(long lastBuildTime) { + List ret = new ArrayList(); + //not our job to account for new and deleted files + for (Iterator i = buildConfig.getFiles().iterator(); i.hasNext(); ) { + File file = (File)i.next(); + if (!file.exists()) continue; + + long modTime = file.lastModified(); + //System.out.println("check: " + file + " mod " + modTime + " build " + lastBuildTime); + if (modTime >= lastBuildTime) { + ret.add(file); + } + } + return ret; + } + + + public List getFilesToCompile(boolean firstPass) { + List sourceFiles = new ArrayList(); + if (firstPass) { + Collection modifiedFiles = getModifiedFiles(); + //System.out.println("modified: " + modifiedFiles); + sourceFiles.addAll(modifiedFiles); + //??? eclipse IncrementalImageBuilder appears to do this + // for (Iterator i = modifiedFiles.iterator(); i.hasNext();) { + // File file = (File) i.next(); + // addDependentsOf(file); + // } + + sourceFiles.addAll(addedFiles); + + deleteClassFiles(); + + addAffectedSourceFiles(sourceFiles); + } else { + + addAffectedSourceFiles(sourceFiles); + } + return sourceFiles; + } + + private void deleteClassFiles() { + for (Iterator i = deletedFiles.iterator(); i.hasNext(); ) { + File deletedFile = (File)i.next(); + //System.out.println("deleting: " + deletedFile); + addDependentsOf(deletedFile); + List unwovenClassFiles = (List)classesFromFile.get(deletedFile); + classesFromFile.remove(deletedFile); + //System.out.println("deleting: " + unwovenClassFiles); + if (unwovenClassFiles == null) continue; + for (Iterator j = unwovenClassFiles.iterator(); j.hasNext(); ) { + UnwovenClassFile classFile = (UnwovenClassFile)j.next(); + deleteClassFile(classFile); + } + } + } + + private void deleteClassFile(UnwovenClassFile classFile) { + classesFromName.remove(classFile.getClassName()); + + buildManager.bcelWeaver.deleteClassFile(classFile.getClassName()); + try { + classFile.deleteRealFile(); + } catch (IOException e) { + //!!! might be okay to ignore + } + } + + public void noteClassesFromFile(CompilationResult result, String sourceFileName, List unwovenClassFiles) { + File sourceFile = new File(sourceFileName); + + if (result != null) { + references.put(sourceFile, new ReferenceCollection(result.qualifiedReferences, result.simpleNameReferences)); + } + + List previous = (List)classesFromFile.get(sourceFile); + List newClassFiles = new ArrayList(); + for (Iterator i = unwovenClassFiles.iterator(); i.hasNext();) { + UnwovenClassFile cf = (UnwovenClassFile) i.next(); + cf = writeClassFile(cf, findAndRemoveClassFile(cf.getClassName(), previous)); + newClassFiles.add(cf); + classesFromName.put(cf.getClassName(), cf); + } + + if (previous != null && !previous.isEmpty()) { + for (Iterator i = previous.iterator(); i.hasNext();) { + UnwovenClassFile cf = (UnwovenClassFile) i.next(); + deleteClassFile(cf); + } + } + + classesFromFile.put(sourceFile, newClassFiles); + } + + private UnwovenClassFile findAndRemoveClassFile(String name, List previous) { + if (previous == null) return null; + for (Iterator i = previous.iterator(); i.hasNext();) { + UnwovenClassFile cf = (UnwovenClassFile) i.next(); + if (cf.getClassName().equals(name)) { + i.remove(); + return cf; + } + } + return null; + } + + private UnwovenClassFile writeClassFile(UnwovenClassFile cf, UnwovenClassFile previous) { + if (simpleStrings == null) { // batch build + addedClassFiles.add(cf); + return cf; + } + + try { + if (previous == null) { + addedClassFiles.add(cf); + addDependentsOf(cf.getClassName()); + return cf; + } + + byte[] oldBytes = previous.getBytes(); + byte[] newBytes = cf.getBytes(); + //if (this.compileLoop > 1) { // only optimize files which were recompiled during the dependent pass, see 33990 + notEqual : if (newBytes.length == oldBytes.length) { + for (int i = newBytes.length; --i >= 0;) { + if (newBytes[i] != oldBytes[i]) break notEqual; + } + //addedClassFiles.add(previous); //!!! performance wasting + buildManager.bcelWorld.addSourceObjectType(previous.getJavaClass()); + return previous; // bytes are identical so skip them + } + //} + ClassFileReader reader = new ClassFileReader(oldBytes, previous.getFilename().toCharArray()); + // ignore local types since they're only visible inside a single method + if (!(reader.isLocal() || reader.isAnonymous()) && reader.hasStructuralChanges(newBytes)) { + addDependentsOf(cf.getClassName()); + } + } catch (ClassFormatException e) { + addDependentsOf(cf.getClassName()); + } + addedClassFiles.add(cf); + return cf; + } + + + protected void addAffectedSourceFiles(List sourceFiles) { + if (qualifiedStrings.isEmpty() && simpleStrings.isEmpty()) return; + + // the qualifiedStrings are of the form 'p1/p2' & the simpleStrings are just 'X' + char[][][] qualifiedNames = ReferenceCollection.internQualifiedNames(qualifiedStrings); + // if a well known qualified name was found then we can skip over these + if (qualifiedNames.length < qualifiedStrings.size()) + qualifiedNames = null; + char[][] simpleNames = ReferenceCollection.internSimpleNames(simpleStrings); + // if a well known name was found then we can skip over these + if (simpleNames.length < simpleStrings.size()) + simpleNames = null; + + //System.err.println("simple: " + simpleStrings); + //System.err.println("qualif: " + qualifiedStrings); + + for (Iterator i = references.entrySet().iterator(); i.hasNext();) { + Map.Entry entry = (Map.Entry) i.next(); + ReferenceCollection refs = (ReferenceCollection)entry.getValue(); + if (refs != null && refs.includes(qualifiedNames, simpleNames)) { + File file = (File)entry.getKey(); + if (file.exists()) { + if (!sourceFiles.contains(file)) { //??? O(n**2) + sourceFiles.add(file); + } + } + } + } + + qualifiedStrings.clear(); + simpleStrings.clear(); + } + + protected void addDependentsOf(String qualifiedTypeName) { + int lastDot = qualifiedTypeName.lastIndexOf('.'); + String typeName; + if (lastDot != -1) { + String packageName = qualifiedTypeName.substring(0,lastDot).replace('.', '/'); + if (!qualifiedStrings.contains(packageName)) { //??? O(n**2) + qualifiedStrings.add(packageName); + } + typeName = qualifiedTypeName.substring(lastDot+1); + } else { + qualifiedStrings.add(""); + typeName = qualifiedTypeName; + } + + + int memberIndex = typeName.indexOf('$'); + if (memberIndex > 0) + typeName = typeName.substring(0, memberIndex); + if (!simpleStrings.contains(typeName)) { //??? O(n**2) + simpleStrings.add(typeName); + } + //System.err.println("adding: " + qualifiedTypeName); + } + + protected void addDependentsOf(File sourceFile) { + List l = (List)classesFromFile.get(sourceFile); + if (l == null) return; + + for (Iterator i = l.iterator(); i.hasNext();) { + UnwovenClassFile cf = (UnwovenClassFile) i.next(); + addDependentsOf(cf.getClassName()); + } + } +} diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/StatefulNameEnvironment.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/StatefulNameEnvironment.java new file mode 100644 index 000000000..552a409dd --- /dev/null +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/StatefulNameEnvironment.java @@ -0,0 +1,72 @@ +/* ******************************************************************* + * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC). + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Common Public License v1.0 + * which accompanies this distribution and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * PARC initial implementation + * ******************************************************************/ + + +package org.aspectj.ajdt.internal.core.builder; + +import java.util.Map; + +import org.aspectj.weaver.bcel.UnwovenClassFile; +import org.eclipse.jdt.core.compiler.CharOperation; +import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader; +import org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException; +import org.eclipse.jdt.internal.compiler.env.INameEnvironment; +import org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer; + + +public class StatefulNameEnvironment implements INameEnvironment { + Map classesFromName; + INameEnvironment baseEnvironment; + + public StatefulNameEnvironment(INameEnvironment baseEnvironment, Map classesFromName) { + this.classesFromName = classesFromName; + this.baseEnvironment = baseEnvironment; + } + + public void cleanup() { + baseEnvironment.cleanup(); + } + + private NameEnvironmentAnswer findType(String name) { + UnwovenClassFile cf = (UnwovenClassFile)classesFromName.get(name); + if (cf == null) return null; + + try { + //System.out.println("from cache: " + name); + return new NameEnvironmentAnswer(new ClassFileReader(cf.getBytes(), cf.getFilename().toCharArray())); + } catch (ClassFormatException e) { + return null; //!!! seems to match FileSystem behavior + } + } + + public NameEnvironmentAnswer findType( + char[] typeName, + char[][] packageName) + { + NameEnvironmentAnswer ret = findType(new String(CharOperation.concatWith(packageName, typeName, '.'))); + if (ret != null) return ret; + return baseEnvironment.findType(typeName, packageName); + } + + public NameEnvironmentAnswer findType(char[][] compoundName) { + NameEnvironmentAnswer ret = findType(new String(CharOperation.concatWith(compoundName, '.'))); + if (ret != null) return ret; + return baseEnvironment.findType(compoundName); + } + + public boolean isPackage(char[][] parentPackageName, char[] packageName) { + //!!! need to use cache here too + return baseEnvironment.isPackage(parentPackageName, packageName); + + } + +} diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjBuildManagerTest.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjBuildManagerTest.java index c07d60fbd..4c97612ca 100644 --- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjBuildManagerTest.java +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjBuildManagerTest.java @@ -95,114 +95,114 @@ public class AjBuildManagerTest extends TestCase { //XXX add test for resource deltas - - public void testUpdateBuildConfig() { - final File FILE_1 = new File("testdata/testclasses/Temp1.java"); - final File FILE_2 = new File("testdata/testclasses/Temp2.java"); - final File FILE_3 = new File("testdata/testclasses/Temp3.java"); - List files = new ArrayList(); - files.add(FILE_1); - files.add(FILE_2); - - AjBuildManager manager = new AjBuildManager(messageWriter); - AjBuildConfig buildConfig = new AjBuildConfig(); - manager.buildConfig = buildConfig; - buildConfig.setFiles(files); - - manager.updateBuildConfig(buildConfig); - assertTrue("no change", manager.deletedFiles.isEmpty()); - - AjBuildConfig newConfig = new AjBuildConfig(); - newConfig.getFiles().add(FILE_1); - newConfig.getFiles().add(FILE_2); - newConfig.getFiles().add(FILE_3); - manager.updateBuildConfig(newConfig); - assertTrue("added file", manager.deletedFiles.isEmpty()); - assertTrue(manager.addedFiles.size() == 1); - assertTrue(manager.addedFiles.contains(FILE_3)); - - newConfig = new AjBuildConfig(); - newConfig.getFiles().add(FILE_3); - manager.updateBuildConfig(newConfig); - assertTrue("deleted 2 files", manager.addedFiles.isEmpty()); - assertTrue(manager.deletedFiles.size() == 2); - assertTrue(manager.deletedFiles.contains(FILE_1)); - - newConfig = new AjBuildConfig(); - newConfig.getFiles().add(FILE_2); - manager.updateBuildConfig(newConfig); - assertTrue("added file", manager.addedFiles.size() == 1); - assertTrue("deleted file", manager.deletedFiles.size() == 1); - assertTrue(manager.deletedFiles.size() == 1); - assertTrue(manager.addedFiles.contains(FILE_2)); - assertTrue(manager.deletedFiles.contains(FILE_3)); - } - - /** - * Pretends that the files 'have been' modified in the future and waits. - * Tests: - * 1) no change, - * 2) added file, - * 3) removed file - * - * XXX should just test modified - */ - public void testGetModifiedFiles() throws IOException, InterruptedException { - final File TEMP_1 = new File("testdata/testclasses/TempChanged.java"); - final File EXISTS_2 = new File("testdata/testclasses/p1/Foo.java"); - final File NEW = new File("testdata/testclasses/TempNew.java"); - NEW.delete(); - touch(TEMP_1, false); - List files = new ArrayList(); - files.add(TEMP_1); - files.add(EXISTS_2); - - assertTrue("input files", TEMP_1.exists() && EXISTS_2.exists()); - assertTrue("new file", !NEW.exists()); - - Thread.sleep(100); - long lastBuildTime = System.currentTimeMillis(); - - AjBuildManager manager = new AjBuildManager(messageWriter); - manager.buildConfig = new AjBuildConfig(); - manager.buildConfig.setFiles(files); - Collection changedFiles = manager.getModifiedFiles(lastBuildTime); - assertTrue("nothing changed: " + changedFiles, changedFiles.isEmpty()); - - lastBuildTime = System.currentTimeMillis(); - Thread.sleep(100); - - touch(NEW, false); - - //NEW.createNewFile(); - files.add(NEW); - changedFiles = manager.getModifiedFiles(lastBuildTime); - assertTrue("new file: " + changedFiles, changedFiles.contains(NEW)); - - lastBuildTime = System.currentTimeMillis(); - Thread.sleep(100); - - files.remove(NEW); - changedFiles = manager.getModifiedFiles(lastBuildTime); - assertTrue("nothing changed", changedFiles.isEmpty()); - - lastBuildTime = System.currentTimeMillis(); - Thread.sleep(100); - - touch(TEMP_1, true); - changedFiles = manager.getModifiedFiles(lastBuildTime); - assertTrue("touched file: " + changedFiles, changedFiles.contains(TEMP_1)); - - lastBuildTime = System.currentTimeMillis(); - Thread.sleep(100); - - files.remove(NEW); - changedFiles = manager.getModifiedFiles(lastBuildTime); - assertTrue("nothing changed", changedFiles.isEmpty()); - - TEMP_1.delete(); - NEW.delete(); - } +// +// public void testUpdateBuildConfig() { +// final File FILE_1 = new File("testdata/testclasses/Temp1.java"); +// final File FILE_2 = new File("testdata/testclasses/Temp2.java"); +// final File FILE_3 = new File("testdata/testclasses/Temp3.java"); +// List files = new ArrayList(); +// files.add(FILE_1); +// files.add(FILE_2); +// +// AjBuildManager manager = new AjBuildManager(messageWriter); +// AjBuildConfig buildConfig = new AjBuildConfig(); +// manager.buildConfig = buildConfig; +// buildConfig.setFiles(files); +// +// manager.updateBuildConfig(buildConfig); +// assertTrue("no change", manager.deletedFiles.isEmpty()); +// +// AjBuildConfig newConfig = new AjBuildConfig(); +// newConfig.getFiles().add(FILE_1); +// newConfig.getFiles().add(FILE_2); +// newConfig.getFiles().add(FILE_3); +// manager.updateBuildConfig(newConfig); +// assertTrue("added file", manager.deletedFiles.isEmpty()); +// assertTrue(manager.addedFiles.size() == 1); +// assertTrue(manager.addedFiles.contains(FILE_3)); +// +// newConfig = new AjBuildConfig(); +// newConfig.getFiles().add(FILE_3); +// manager.updateBuildConfig(newConfig); +// assertTrue("deleted 2 files", manager.addedFiles.isEmpty()); +// assertTrue(manager.deletedFiles.size() == 2); +// assertTrue(manager.deletedFiles.contains(FILE_1)); +// +// newConfig = new AjBuildConfig(); +// newConfig.getFiles().add(FILE_2); +// manager.updateBuildConfig(newConfig); +// assertTrue("added file", manager.addedFiles.size() == 1); +// assertTrue("deleted file", manager.deletedFiles.size() == 1); +// assertTrue(manager.deletedFiles.size() == 1); +// assertTrue(manager.addedFiles.contains(FILE_2)); +// assertTrue(manager.deletedFiles.contains(FILE_3)); +// } +// +// /** +// * Pretends that the files 'have been' modified in the future and waits. +// * Tests: +// * 1) no change, +// * 2) added file, +// * 3) removed file +// * +// * XXX should just test modified +// */ +// public void testGetModifiedFiles() throws IOException, InterruptedException { +// final File TEMP_1 = new File("testdata/testclasses/TempChanged.java"); +// final File EXISTS_2 = new File("testdata/testclasses/p1/Foo.java"); +// final File NEW = new File("testdata/testclasses/TempNew.java"); +// NEW.delete(); +// touch(TEMP_1, false); +// List files = new ArrayList(); +// files.add(TEMP_1); +// files.add(EXISTS_2); +// +// assertTrue("input files", TEMP_1.exists() && EXISTS_2.exists()); +// assertTrue("new file", !NEW.exists()); +// +// Thread.sleep(100); +// long lastBuildTime = System.currentTimeMillis(); +// +// AjBuildManager manager = new AjBuildManager(messageWriter); +// manager.buildConfig = new AjBuildConfig(); +// manager.buildConfig.setFiles(files); +// Collection changedFiles = manager.getModifiedFiles(lastBuildTime); +// assertTrue("nothing changed: " + changedFiles, changedFiles.isEmpty()); +// +// lastBuildTime = System.currentTimeMillis(); +// Thread.sleep(100); +// +// touch(NEW, false); +// +// //NEW.createNewFile(); +// files.add(NEW); +// changedFiles = manager.getModifiedFiles(lastBuildTime); +// assertTrue("new file: " + changedFiles, changedFiles.contains(NEW)); +// +// lastBuildTime = System.currentTimeMillis(); +// Thread.sleep(100); +// +// files.remove(NEW); +// changedFiles = manager.getModifiedFiles(lastBuildTime); +// assertTrue("nothing changed", changedFiles.isEmpty()); +// +// lastBuildTime = System.currentTimeMillis(); +// Thread.sleep(100); +// +// touch(TEMP_1, true); +// changedFiles = manager.getModifiedFiles(lastBuildTime); +// assertTrue("touched file: " + changedFiles, changedFiles.contains(TEMP_1)); +// +// lastBuildTime = System.currentTimeMillis(); +// Thread.sleep(100); +// +// files.remove(NEW); +// changedFiles = manager.getModifiedFiles(lastBuildTime); +// assertTrue("nothing changed", changedFiles.isEmpty()); +// +// TEMP_1.delete(); +// NEW.delete(); +// } // don't do delta's anymore // public void testMakeDeltas() throws IOException, InterruptedException { -- 2.39.5