View | Details | Raw Unified | Return to bug 222213
Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java (+20 lines)
Lines 800-805 Link Here
800
		this.deltaListener.getCompilationUnitAST(this.workingCopy));
800
		this.deltaListener.getCompilationUnitAST(this.workingCopy));
801
}
801
}
802
/*
802
/*
803
 * Ensures that the AST broadcasted doesn't have a type root that is caching its contents
804
 * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=222213 )
805
 */
806
public void testBroadcastAST5() throws JavaModelException {
807
	setWorkingCopyContents(
808
		"package p1;\n" +
809
		"import p2.*;\n" +
810
		"public class X {\n" +
811
		"}");
812
	this.workingCopy.reconcile(AST.JLS3, false/*don't force problem detection*/, null/*primary owner*/, null/*no progress*/);
813
	org.eclipse.jdt.core.dom.CompilationUnit compilationUnit = this.deltaListener.getCompilationUnitAST(this.workingCopy);
814
	String newContents = 
815
		"package p1;\n" +
816
		"public class X {\n" +
817
		"}";
818
	setWorkingCopyContents(newContents);
819
	org.eclipse.jdt.internal.compiler.env.ICompilationUnit compilerCU = (org.eclipse.jdt.internal.compiler.env.ICompilationUnit) compilationUnit.getTypeRoot();
820
	assertSourceEquals("Unexpected contents", newContents, new String(compilerCU.getContents()));
821
}
822
/*
803
 * Ensures that reconciling a subclass doesn't close the buffer while resolving its superclass.
823
 * Ensures that reconciling a subclass doesn't close the buffer while resolving its superclass.
804
 * (regression test for bug 62854 refactoring does not trigger reconcile)
824
 * (regression test for bug 62854 refactoring does not trigger reconcile)
805
 */
825
 */
(-)model/org/eclipse/jdt/internal/core/CompilationUnit.java (+9 lines)
Lines 221-226 Link Here
221
				this.cachedContents = CompilationUnit.this.getContents();
221
				this.cachedContents = CompilationUnit.this.getContents();
222
			return this.cachedContents;
222
			return this.cachedContents;
223
		}
223
		}
224
		public CompilationUnit originalFromClone() {
225
			return CompilationUnit.this;
226
		}
224
	};
227
	};
225
}
228
}
226
/*
229
/*
Lines 1149-1154 Link Here
1149
	// else don't open ancestors for a working copy to speed up the first becomeWorkingCopy
1152
	// else don't open ancestors for a working copy to speed up the first becomeWorkingCopy
1150
	// (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=89411)
1153
	// (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=89411)
1151
}
1154
}
1155
/*
1156
 * @see #cloneCachingContents()
1157
 */
1158
public CompilationUnit originalFromClone() {
1159
	return this;
1160
}
1152
/**
1161
/**
1153
 * @see ICompilationUnit#reconcile()
1162
 * @see ICompilationUnit#reconcile()
1154
 * @deprecated
1163
 * @deprecated
(-)dom/org/eclipse/jdt/core/dom/AST.java (-1 / +1 lines)
Lines 276-282 Link Here
276
276
277
		CompilationUnit unit = converter.convert(compilationUnitDeclaration, workingCopy.getContents());
277
		CompilationUnit unit = converter.convert(compilationUnitDeclaration, workingCopy.getContents());
278
		unit.setLineEndTable(compilationUnitDeclaration.compilationResult.getLineSeparatorPositions());
278
		unit.setLineEndTable(compilationUnitDeclaration.compilationResult.getLineSeparatorPositions());
279
		unit.setTypeRoot(workingCopy);
279
		unit.setTypeRoot(workingCopy.originalFromClone());
280
		ast.setDefaultNodeFlag(savedDefaultNodeFlag);
280
		ast.setDefaultNodeFlag(savedDefaultNodeFlag);
281
		return unit;
281
		return unit;
282
	}
282
	}

Return to bug 222213