Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 132076 Details for
Bug 271680
[compiler] Stack overflow pasting in Java editor
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
bug271680_001.txt (text/plain), 22.63 KB, created by
David Audel
on 2009-04-16 09:30:18 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
David Audel
Created:
2009-04-16 09:30:18 EDT
Size:
22.63 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java,v >retrieving revision 1.57 >diff -u -r1.57 DietRecoveryTest.java >--- src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java 27 Jun 2008 16:04:46 -0000 1.57 >+++ src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java 16 Apr 2009 13:12:48 -0000 >@@ -7675,4 +7675,88 @@ > expectedFullUnitToString, > expectedCompletionDietUnitToString, testName); > } >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=271680 >+public void test125() { >+ String s = >+ "public class Test {\n" + >+ "}\n"; >+ >+ StringBuffer buf = new StringBuffer(); >+ for (int i = 0; i < 1000; i++) { >+ buf.append("class AClass #\n"); >+ } >+ s+= buf.toString(); >+ >+ // expectedDietUnitToString >+ String expectedDietUnitToString = >+ "public class Test {\n" + >+ " public Test() {\n" + >+ " }\n" + >+ "}\n"; >+ buf = new StringBuffer(); >+ int max = 256; >+ for (int i = 0; i < max; i++) { >+ String indent = ""; >+ for (int j = 0; j < i; j++) { >+ indent+= " "; >+ } >+ buf.append(indent).append("class AClass {\n"); >+ } >+ for (int i = max - 1; i >= 0; i--) { >+ String indent = ""; >+ for (int j = 0; j < i; j++) { >+ indent+= " "; >+ } >+ buf.append(indent).append(" AClass() {\n"); >+ buf.append(indent).append(" }\n"); >+ buf.append(indent).append("}\n"); >+ } >+ >+ expectedDietUnitToString += buf.toString(); >+ >+ // expectedDietPlusBodyUnitToString >+ String expectedDietPlusBodyUnitToString = >+ "public class Test {\n" + >+ " public Test() {\n" + >+ " super();\n" + >+ " }\n" + >+ "}\n"; >+ buf = new StringBuffer(); >+ for (int i = 0; i < max; i++) { >+ String indent = ""; >+ for (int j = 0; j < i; j++) { >+ indent+= " "; >+ } >+ buf.append(indent).append("class AClass {\n"); >+ } >+ for (int i = max - 1; i >= 0; i--) { >+ String indent = ""; >+ for (int j = 0; j < i; j++) { >+ indent+= " "; >+ } >+ buf.append(indent).append(" AClass() {\n"); >+ buf.append(indent).append(" super();\n"); >+ buf.append(indent).append(" }\n"); >+ buf.append(indent).append("}\n"); >+ } >+ expectedDietPlusBodyUnitToString += buf.toString(); >+ >+ String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = >+ expectedDietPlusBodyUnitToString; >+ >+ String expectedFullUnitToString = >+ expectedDietUnitToString; >+ >+ String expectedCompletionDietUnitToString = >+ expectedDietUnitToString; >+ >+ String testName = "test"; >+ checkParse( >+ s.toCharArray(), >+ expectedDietUnitToString, >+ expectedDietPlusBodyUnitToString, >+ expectedDietPlusBodyPlusStatementsRecoveryUnitToString, >+ expectedFullUnitToString, >+ expectedCompletionDietUnitToString, testName); >+} > } >#P org.eclipse.jdt.core >Index: codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java,v >retrieving revision 1.205 >diff -u -r1.205 CompletionParser.java >--- codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java 6 Apr 2009 10:12:03 -0000 1.205 >+++ codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java 16 Apr 2009 13:12:50 -0000 >@@ -19,6 +19,9 @@ > * 0 means completion behind the first character > * n means completion behind the n-th character > */ >+ >+import java.util.HashSet; >+ > import org.eclipse.jdt.internal.compiler.*; > import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; > import org.eclipse.jdt.internal.compiler.env.*; >@@ -1053,7 +1056,7 @@ > condition.sourceStart < recoveredLocalVariable.localDeclaration.sourceStart) { > this.currentElement.add(statement, 0); > >- statement = recoveredLocalVariable.updatedStatement(); >+ statement = recoveredLocalVariable.updatedStatement(0, new HashSet()); > > // RecoveredLocalVariable must be removed from its parent because the IfStatement will be added instead > RecoveredBlock recoveredBlock = (RecoveredBlock) recoveredLocalVariable.parent; >Index: compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredType.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredType.java,v >retrieving revision 1.66 >diff -u -r1.66 RecoveredType.java >--- compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredType.java 12 Sep 2008 14:58:36 -0000 1.66 >+++ compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredType.java 16 Apr 2009 13:12:51 -0000 >@@ -10,6 +10,9 @@ > *******************************************************************************/ > package org.eclipse.jdt.internal.compiler.parser; > >+import java.util.HashSet; >+import java.util.Set; >+ > import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; > import org.eclipse.jdt.internal.compiler.ast.ASTNode; > import org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration; >@@ -29,6 +32,8 @@ > */ > > public class RecoveredType extends RecoveredStatement implements TerminalTokens { >+ public static final int MAX_TYPE_DEPTH = 256; >+ > public TypeDeclaration typeDeclaration; > > public RecoveredAnnotation[] annotations; >@@ -439,15 +444,15 @@ > this.foundOpeningBrace = true; > this.typeDeclaration.bodyStart = bodyStart; > } >-public Statement updatedStatement(){ >+public Statement updatedStatement(int depth, Set knownTypes){ > > // ignore closed anonymous type > if ((this.typeDeclaration.bits & ASTNode.IsAnonymousType) != 0 && !this.preserveContent){ > return null; > } > >- TypeDeclaration updatedType = updatedTypeDeclaration(); >- if ((updatedType.bits & ASTNode.IsAnonymousType) != 0){ >+ TypeDeclaration updatedType = updatedTypeDeclaration(depth + 1, knownTypes); >+ if (updatedType != null && (updatedType.bits & ASTNode.IsAnonymousType) != 0){ > /* in presence of an anonymous type, we want the full allocation expression */ > QualifiedAllocationExpression allocation = updatedType.allocation; > >@@ -458,7 +463,12 @@ > } > return updatedType; > } >-public TypeDeclaration updatedTypeDeclaration(){ >+public TypeDeclaration updatedTypeDeclaration(int depth, Set knownTypes){ >+ if (depth >= MAX_TYPE_DEPTH) return null; >+ >+ if(knownTypes.contains(this.typeDeclaration)) return null; >+ knownTypes.add(this.typeDeclaration); >+ > int lastEnd = this.typeDeclaration.bodyStart; > /* update annotations */ > if (this.modifiers != 0) { >@@ -497,12 +507,24 @@ > this.memberTypes[this.memberTypeCount - 1].typeDeclaration.declarationSourceEnd = bodyEndValue; > this.memberTypes[this.memberTypeCount - 1].typeDeclaration.bodyEnd = bodyEndValue; > } >+ >+ int updatedCount = 0; > for (int i = 0; i < this.memberTypeCount; i++){ >- memberTypeDeclarations[existingCount + i] = this.memberTypes[i].updatedTypeDeclaration(); >+ TypeDeclaration updatedTypeDeclaration = this.memberTypes[i].updatedTypeDeclaration(depth + 1, knownTypes); >+ if (updatedTypeDeclaration != null) { >+ memberTypeDeclarations[existingCount + (updatedCount++)] = updatedTypeDeclaration; >+ } > } >- this.typeDeclaration.memberTypes = memberTypeDeclarations; >- if(memberTypeDeclarations[memberTypeDeclarations.length - 1].declarationSourceEnd > lastEnd) { >- lastEnd = memberTypeDeclarations[memberTypeDeclarations.length - 1].declarationSourceEnd; >+ if (updatedCount < this.memberTypeCount) { >+ int length = existingCount + updatedCount; >+ System.arraycopy(memberTypeDeclarations, 0, memberTypeDeclarations = new TypeDeclaration[length], 0, length); >+ } >+ >+ if (memberTypeDeclarations.length > 0) { >+ this.typeDeclaration.memberTypes = memberTypeDeclarations; >+ if(memberTypeDeclarations[memberTypeDeclarations.length - 1].declarationSourceEnd > lastEnd) { >+ lastEnd = memberTypeDeclarations[memberTypeDeclarations.length - 1].declarationSourceEnd; >+ } > } > } > /* update fields */ >@@ -519,7 +541,7 @@ > this.fields[this.fieldCount - 1].fieldDeclaration.declarationEnd = temp; > } > for (int i = 0; i < this.fieldCount; i++){ >- fieldDeclarations[existingCount + i] = this.fields[i].updatedFieldDeclaration(); >+ fieldDeclarations[existingCount + i] = this.fields[i].updatedFieldDeclaration(depth, knownTypes); > } > this.typeDeclaration.fields = fieldDeclarations; > if(fieldDeclarations[fieldDeclarations.length - 1].declarationSourceEnd > lastEnd) { >@@ -546,7 +568,7 @@ > this.methods[this.methodCount - 1].methodDeclaration.bodyEnd = bodyEndValue; > } > for (int i = 0; i < this.methodCount; i++){ >- AbstractMethodDeclaration updatedMethod = this.methods[i].updatedMethodDeclaration(); >+ AbstractMethodDeclaration updatedMethod = this.methods[i].updatedMethodDeclaration(depth, knownTypes); > if (updatedMethod.isConstructor()) hasRecoveredConstructor = true; > if (updatedMethod.isAbstract()) hasAbstractMethods = true; > methodDeclarations[existingCount + i] = updatedMethod; >@@ -731,7 +753,7 @@ > return super.updateOnOpeningBrace(braceStart, braceEnd); > } > public void updateParseTree(){ >- updatedTypeDeclaration(); >+ updatedTypeDeclaration(0, new HashSet()); > } > /* > * Update the declarationSourceEnd of the corresponding parse node >Index: compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredMethod.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredMethod.java,v >retrieving revision 1.66 >diff -u -r1.66 RecoveredMethod.java >--- compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredMethod.java 27 Jun 2008 16:03:51 -0000 1.66 >+++ compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredMethod.java 16 Apr 2009 13:12:51 -0000 >@@ -10,6 +10,9 @@ > *******************************************************************************/ > package org.eclipse.jdt.internal.compiler.parser; > >+import java.util.HashSet; >+import java.util.Set; >+ > import org.eclipse.jdt.core.compiler.*; > import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; > import org.eclipse.jdt.internal.compiler.ast.Annotation; >@@ -329,7 +332,7 @@ > this.foundOpeningBrace = true; > this.methodDeclaration.bodyStart = bodyStart; > } >-public AbstractMethodDeclaration updatedMethodDeclaration(){ >+public AbstractMethodDeclaration updatedMethodDeclaration(int depth, Set knownTypes){ > /* update annotations */ > if (this.modifiers != 0) { > this.methodDeclaration.modifiers |= this.modifiers; >@@ -356,7 +359,7 @@ > } > > if (this.methodBody != null){ >- Block block = this.methodBody.updatedBlock(); >+ Block block = this.methodBody.updatedBlock(depth, knownTypes); > if (block != null){ > this.methodDeclaration.statements = block.statements; > >@@ -564,7 +567,7 @@ > return super.updateOnOpeningBrace(braceStart, braceEnd); > } > public void updateParseTree(){ >- updatedMethodDeclaration(); >+ updatedMethodDeclaration(0, new HashSet()); > } > /* > * Update the declarationSourceEnd of the corresponding parse node >Index: compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredStatement.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredStatement.java,v >retrieving revision 1.26 >diff -u -r1.26 RecoveredStatement.java >--- compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredStatement.java 7 Mar 2009 01:08:07 -0000 1.26 >+++ compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredStatement.java 16 Apr 2009 13:12:51 -0000 >@@ -13,6 +13,9 @@ > /** > * Internal statement structure for parsing recovery > */ >+import java.util.HashSet; >+import java.util.Set; >+ > import org.eclipse.jdt.internal.compiler.ast.ASTNode; > import org.eclipse.jdt.internal.compiler.ast.Statement; > >@@ -38,11 +41,11 @@ > public String toString(int tab){ > return tabString(tab) + "Recovered statement:\n" + this.statement.print(tab + 1, new StringBuffer(10)); //$NON-NLS-1$ > } >-public Statement updatedStatement(){ >+public Statement updatedStatement(int depth, Set knownTypes){ > return this.statement; > } > public void updateParseTree(){ >- updatedStatement(); >+ updatedStatement(0, new HashSet()); > } > /* > * Update the declarationSourceEnd of the corresponding parse node >Index: compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredField.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredField.java,v >retrieving revision 1.37 >diff -u -r1.37 RecoveredField.java >--- compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredField.java 27 Jun 2008 16:03:54 -0000 1.37 >+++ compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredField.java 16 Apr 2009 13:12:51 -0000 >@@ -13,6 +13,9 @@ > /** > * Internal field structure for parsing recovery > */ >+import java.util.HashSet; >+import java.util.Set; >+ > import org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration; > import org.eclipse.jdt.internal.compiler.ast.Annotation; > import org.eclipse.jdt.internal.compiler.ast.ArrayQualifiedTypeReference; >@@ -145,7 +148,7 @@ > } > return buffer.toString(); > } >-public FieldDeclaration updatedFieldDeclaration(){ >+public FieldDeclaration updatedFieldDeclaration(int depth, Set knownTypes){ > /* update annotations */ > if (this.modifiers != 0) { > this.fieldDeclaration.modifiers |= this.modifiers; >@@ -181,12 +184,14 @@ > typeDeclaration.bodyEnd = this.fieldDeclaration.declarationSourceEnd; > } > if (recoveredType.preserveContent){ >- TypeDeclaration anonymousType = recoveredType.updatedTypeDeclaration(); >- this.fieldDeclaration.initialization = anonymousType.allocation; >- if(this.fieldDeclaration.declarationSourceEnd == 0) { >- int end = anonymousType.declarationSourceEnd; >- this.fieldDeclaration.declarationSourceEnd = end; >- this.fieldDeclaration.declarationEnd = end; >+ TypeDeclaration anonymousType = recoveredType.updatedTypeDeclaration(depth + 1, knownTypes); >+ if (anonymousType != null) { >+ this.fieldDeclaration.initialization = anonymousType.allocation; >+ if(this.fieldDeclaration.declarationSourceEnd == 0) { >+ int end = anonymousType.declarationSourceEnd; >+ this.fieldDeclaration.declarationSourceEnd = end; >+ this.fieldDeclaration.declarationEnd = end; >+ } > } > } > } >@@ -200,7 +205,9 @@ > typeDeclaration.declarationSourceEnd = this.fieldDeclaration.declarationSourceEnd; > typeDeclaration.bodyEnd = this.fieldDeclaration.declarationSourceEnd; > } >- recoveredType.updatedTypeDeclaration(); >+ // if the enum is recovered then enum constants must be recovered too. >+ // depth is considered as the same as the depth of the enum >+ recoveredType.updatedTypeDeclaration(depth, knownTypes); > } > } > } >@@ -254,7 +261,7 @@ > return this.parent.updateOnOpeningBrace(braceStart, braceEnd); > } > public void updateParseTree(){ >- updatedFieldDeclaration(); >+ updatedFieldDeclaration(0, new HashSet()); > } > /* > * Update the declarationSourceEnd of the corresponding parse node >Index: compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredUnit.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredUnit.java,v >retrieving revision 1.39 >diff -u -r1.39 RecoveredUnit.java >--- compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredUnit.java 27 Jun 2008 16:03:51 -0000 1.39 >+++ compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredUnit.java 16 Apr 2009 13:12:51 -0000 >@@ -13,6 +13,9 @@ > /** > * Internal field structure for parsing recovery > */ >+import java.util.HashSet; >+import java.util.Set; >+ > import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; > import org.eclipse.jdt.internal.compiler.ast.ASTNode; > import org.eclipse.jdt.internal.compiler.ast.Block; >@@ -250,11 +253,13 @@ > this.types[this.typeCount - 1].typeDeclaration.declarationSourceEnd = this.unitDeclaration.sourceEnd; > this.types[this.typeCount - 1].typeDeclaration.bodyEnd = this.unitDeclaration.sourceEnd; > } >+ >+ Set knownTypes = new HashSet(); > int actualCount = existingCount; > for (int i = 0; i < this.typeCount; i++){ >- TypeDeclaration typeDecl = this.types[i].updatedTypeDeclaration(); >+ TypeDeclaration typeDecl = this.types[i].updatedTypeDeclaration(0, knownTypes); > // filter out local types (12454) >- if ((typeDecl.bits & ASTNode.IsLocalType) == 0){ >+ if (typeDecl != null && (typeDecl.bits & ASTNode.IsLocalType) == 0){ > typeDeclarations[actualCount++] = typeDecl; > } > } >Index: compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredInitializer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredInitializer.java,v >retrieving revision 1.44 >diff -u -r1.44 RecoveredInitializer.java >--- compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredInitializer.java 27 Jun 2008 16:03:54 -0000 1.44 >+++ compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredInitializer.java 16 Apr 2009 13:12:51 -0000 >@@ -10,6 +10,8 @@ > *******************************************************************************/ > package org.eclipse.jdt.internal.compiler.parser; > >+import java.util.Set; >+ > import org.eclipse.jdt.core.compiler.*; > import org.eclipse.jdt.internal.compiler.ast.ASTNode; > import org.eclipse.jdt.internal.compiler.ast.Block; >@@ -256,10 +258,10 @@ > } > return result.toString(); > } >-public FieldDeclaration updatedFieldDeclaration(){ >+public FieldDeclaration updatedFieldDeclaration(int depth, Set knownTypes){ > > if (this.initializerBody != null){ >- Block block = this.initializerBody.updatedBlock(); >+ Block block = this.initializerBody.updatedBlock(depth, knownTypes); > if (block != null){ > Initializer initializer = (Initializer) this.fieldDeclaration; > initializer.block = block; >Index: compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredLocalVariable.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredLocalVariable.java,v >retrieving revision 1.28 >diff -u -r1.28 RecoveredLocalVariable.java >--- compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredLocalVariable.java 27 Jun 2008 16:03:52 -0000 1.28 >+++ compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredLocalVariable.java 16 Apr 2009 13:12:51 -0000 >@@ -13,6 +13,9 @@ > /** > * Internal local variable structure for parsing recovery > */ >+import java.util.HashSet; >+import java.util.Set; >+ > import org.eclipse.jdt.internal.compiler.ast.Annotation; > import org.eclipse.jdt.internal.compiler.ast.ArrayQualifiedTypeReference; > import org.eclipse.jdt.internal.compiler.ast.ArrayTypeReference; >@@ -89,7 +92,7 @@ > public String toString(int tab) { > return tabString(tab) + "Recovered local variable:\n" + this.localDeclaration.print(tab + 1, new StringBuffer(10)); //$NON-NLS-1$ > } >-public Statement updatedStatement(){ >+public Statement updatedStatement(int depth, Set knownTypes){ > /* update annotations */ > if (this.modifiers != 0) { > this.localDeclaration.modifiers |= this.modifiers; >@@ -149,7 +152,7 @@ > return this.parent.updateOnOpeningBrace(braceStart, braceEnd); > } > public void updateParseTree(){ >- updatedStatement(); >+ updatedStatement(0, new HashSet()); > } > /* > * Update the declarationSourceEnd of the corresponding parse node >Index: compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredBlock.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredBlock.java,v >retrieving revision 1.43 >diff -u -r1.43 RecoveredBlock.java >--- compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredBlock.java 27 Jun 2008 16:03:54 -0000 1.43 >+++ compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredBlock.java 16 Apr 2009 13:12:51 -0000 >@@ -10,6 +10,9 @@ > *******************************************************************************/ > package org.eclipse.jdt.internal.compiler.parser; > >+import java.util.HashSet; >+import java.util.Set; >+ > import org.eclipse.jdt.core.compiler.*; > import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; > import org.eclipse.jdt.internal.compiler.ast.Argument; >@@ -276,7 +279,7 @@ > /* > * Rebuild a block from the nested structure which is in scope > */ >-public Block updatedBlock(){ >+public Block updatedBlock(int depth, Set knownTypes){ > > // if block was not marked to be preserved or empty, then ignore it > if (!this.preserveContent || this.statementCount == 0) return null; >@@ -322,7 +325,7 @@ > > // only collect the non-null updated statements > for (int i = 0; i < this.statementCount; i++){ >- Statement updatedStatement = this.statements[i].updatedStatement(); >+ Statement updatedStatement = this.statements[i].updatedStatement(depth, knownTypes); > if (updatedStatement != null){ > updatedStatements[updatedCount++] = updatedStatement; > >@@ -366,9 +369,9 @@ > /* > * Rebuild a statement from the nested structure which is in scope > */ >-public Statement updatedStatement(){ >+public Statement updatedStatement(int depth, Set knownTypes){ > >- return updatedBlock(); >+ return updatedBlock(depth, knownTypes); > } > /* > * A closing brace got consumed, might have closed the current element, >@@ -407,12 +410,12 @@ > */ > public void updateParseTree(){ > >- updatedBlock(); >+ updatedBlock(0, new HashSet()); > } > /* > * Rebuild a flattened block from the nested structure which is in scope > */ >-public Statement updateStatement(){ >+public Statement updateStatement(int depth, Set knownTypes){ > > // if block was closed or empty, then ignore it > if (this.blockDeclaration.sourceEnd != 0 || this.statementCount == 0) return null; >@@ -422,7 +425,7 @@ > > // only collect the non-null updated statements > for (int i = 0; i < this.statementCount; i++){ >- Statement updatedStatement = this.statements[i].updatedStatement(); >+ Statement updatedStatement = this.statements[i].updatedStatement(depth, knownTypes); > if (updatedStatement != null){ > updatedStatements[updatedCount++] = updatedStatement; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 271680
:
131324
| 132076