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 45328 Details for
Bug 148370
[formatter] new Class<?>[] {} kills formatter
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix
patch_148370.txt (text/plain), 3.65 KB, created by
Olivier Thomann
on 2006-06-26 16:16:32 EDT
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2006-06-26 16:16:32 EDT
Size:
3.65 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java,v >retrieving revision 1.181 >diff -u -r1.181 CodeFormatterVisitor.java >--- formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java 29 Mar 2006 02:59:16 -0000 1.181 >+++ formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java 26 Jun 2006 20:16:02 -0000 >@@ -2060,26 +2060,33 @@ > > this.localScanner.resetTo(this.scribe.scanner.currentPosition, this.scribe.scannerEndPosition - 1); > int dimensions = 0; >+ int balance = 0; > try { > int token; >- while ((token = this.localScanner.getNextToken()) != TerminalTokens.TokenNameEOF) { >+ loop: while ((token = this.localScanner.getNextToken()) != TerminalTokens.TokenNameEOF) { > switch(token) { > case TerminalTokens.TokenNameRBRACKET: > dimensions++; >+ balance--; > break; > case TerminalTokens.TokenNameCOMMENT_BLOCK : > case TerminalTokens.TokenNameCOMMENT_JAVADOC : > case TerminalTokens.TokenNameCOMMENT_LINE : >+ break; > case TerminalTokens.TokenNameLBRACKET : >+ balance++; > break; > default: >- return dimensions; >+ break loop; > } > } > } catch(InvalidInputException e) { > // ignore > } >- return dimensions; >+ if (balance == 0) { >+ return dimensions; >+ } >+ return 0; > } > > private boolean hasComments() { >@@ -2400,21 +2407,23 @@ > this.scribe.space(); > arrayAllocationExpression.type.traverse(this, scope); > >- final Expression[] dimensions = arrayAllocationExpression.dimensions; >- int dimensionsLength = dimensions.length; >- for (int i = 0; i < dimensionsLength; i++) { >- if (this.preferences.insert_space_before_opening_bracket_in_array_allocation_expression) { >- this.scribe.space(); >- } >- this.scribe.printNextToken(TerminalTokens.TokenNameLBRACKET, false); >- if (dimensions[i] != null) { >- if (this.preferences.insert_space_after_opening_bracket_in_array_allocation_expression) { >+ if (isNextToken(TerminalTokens.TokenNameLBRACKET)) { >+ final Expression[] dimensions = arrayAllocationExpression.dimensions; >+ int dimensionsLength = dimensions.length; >+ for (int i = 0; i < dimensionsLength; i++) { >+ if (this.preferences.insert_space_before_opening_bracket_in_array_allocation_expression) { > this.scribe.space(); > } >- dimensions[i].traverse(this, scope); >- this.scribe.printNextToken(TerminalTokens.TokenNameRBRACKET, this.preferences.insert_space_before_closing_bracket_in_array_allocation_expression); >- } else { >- this.scribe.printNextToken(TerminalTokens.TokenNameRBRACKET, this.preferences.insert_space_between_empty_brackets_in_array_allocation_expression); >+ this.scribe.printNextToken(TerminalTokens.TokenNameLBRACKET, false); >+ if (dimensions[i] != null) { >+ if (this.preferences.insert_space_after_opening_bracket_in_array_allocation_expression) { >+ this.scribe.space(); >+ } >+ dimensions[i].traverse(this, scope); >+ this.scribe.printNextToken(TerminalTokens.TokenNameRBRACKET, this.preferences.insert_space_before_closing_bracket_in_array_allocation_expression); >+ } else { >+ this.scribe.printNextToken(TerminalTokens.TokenNameRBRACKET, this.preferences.insert_space_between_empty_brackets_in_array_allocation_expression); >+ } > } > } > final ArrayInitializer initializer = arrayAllocationExpression.initializer;
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 148370
: 45328 |
45329