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 44039 Details for
Bug 146324
Batch builds produce "The type X is already defined" errors
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
buildPatch.txt (text/plain), 4.02 KB, created by
Kent Johnson
on 2006-06-09 15:23:42 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Kent Johnson
Created:
2006-06-09 15:23:42 EDT
Size:
4.02 KB
patch
obsolete
>Index: model/org/eclipse/jdt/internal/core/builder/BatchImageBuilder.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/BatchImageBuilder.java,v >retrieving revision 1.62 >diff -u -r1.62 BatchImageBuilder.java >--- model/org/eclipse/jdt/internal/core/builder/BatchImageBuilder.java 29 Mar 2006 03:08:49 -0000 1.62 >+++ model/org/eclipse/jdt/internal/core/builder/BatchImageBuilder.java 9 Jun 2006 19:25:46 -0000 >@@ -212,7 +212,7 @@ > } > > protected void compile(SourceFile[] units, SourceFile[] additionalUnits, boolean compilingFirstGroup) { >- if (!compilingFirstGroup && this.missingSecondaryTypes == null) >+ if (additionalUnits != null && this.missingSecondaryTypes == null) > this.missingSecondaryTypes = new ArrayList(7); > super.compile(units, additionalUnits, compilingFirstGroup); > } >Index: model/org/eclipse/jdt/internal/core/builder/IncrementalImageBuilder.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/IncrementalImageBuilder.java,v >retrieving revision 1.88 >diff -u -r1.88 IncrementalImageBuilder.java >--- model/org/eclipse/jdt/internal/core/builder/IncrementalImageBuilder.java 2 May 2006 18:02:13 -0000 1.88 >+++ model/org/eclipse/jdt/internal/core/builder/IncrementalImageBuilder.java 9 Jun 2006 19:25:46 -0000 >@@ -276,6 +276,25 @@ > this.compileLoop = 0; > } > >+protected void compile(SourceFile[] units, SourceFile[] additionalUnits, boolean compilingFirstGroup) { >+ if (compilingFirstGroup && additionalUnits != null) { >+ // add any source file from additionalUnits to units if it defines secondary types >+ // otherwise its possible during testing with MAX_AT_ONCE == 1 that a secondary type >+ // can cause an infinite loop as it alternates between not found and defined, see bug 106466 >+ for (int i = 0, l = additionalUnits.length; i < l; i++) { >+ SourceFile unit = additionalUnits[i]; >+ if (unit != null && newState.getDefinedTypeNamesFor(unit.typeLocator()) != null) { >+ if (JavaBuilder.DEBUG) >+ System.out.println("About to compile file with secondary types "+ unit.typeLocator()); //$NON-NLS-1$ >+ int next = units.length; >+ System.arraycopy(units, 0, units = new SourceFile[next + 1], 0, next); >+ units[next] = unit; >+ } >+ } >+ } >+ super.compile(units, additionalUnits, compilingFirstGroup); >+} >+ > protected void deleteGeneratedFiles(IFile[] deletedGeneratedFiles) { > // delete generated files and recompile any affected source files > try { >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java,v >retrieving revision 1.100 >diff -u -r1.100 CompilationUnitScope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java 14 Apr 2006 08:34:05 -0000 1.100 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java 9 Jun 2006 19:25:46 -0000 >@@ -108,9 +108,10 @@ > TypeDeclaration typeDecl = types[i]; > ReferenceBinding typeBinding = fPackage.getType0(typeDecl.name); > recordSimpleReference(typeDecl.name); // needed to detect collision cases >- if (typeBinding != null && !(typeBinding instanceof UnresolvedReferenceBinding)) { >- // if a type exists, it must be a valid type - cannot be a NotFound problem type >- // unless its an unresolved type which is now being defined >+ if (typeBinding != null && typeBinding.isValidBinding() && !(typeBinding instanceof UnresolvedReferenceBinding)) { >+ // if a type exists, check that its a valid type >+ // it can be a NotFound problem type if its a secondary type referenced in an earlier compile loop >+ // and it can be an unresolved type which is now being defined > problemReporter().duplicateTypes(referenceContext, typeDecl); > continue nextType; > }
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 146324
: 44039