Bug 94730 [projection] Nondeterministic folding summary
I20050509-2010 With the CU below: - fold the method declaration -> 'bar()' is shown as summary - unfold again - select the method name 'bar' - type 'foo' - fold the method declaration again -> 'void' is shown as summary "interface Bar { void bar(); } "
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/folding/DefaultJavaFoldingStructureProvider.java
String content;
			try {
				content= fCachedDocument.get(start, end - start);
			} catch (BadLocationException e) {
				return null; 
			}
			/* code adapted from CommentFormattingStrategy:
			 * scan the header content up to the first type. Once a comment is
			 * found, accumulate any additional comments up to the stop condition.
			 * The stop condition is reaching a package declaration, import container,
			 * or the end of the input.
			 */
			IScanner scanner= ToolFactory.createScanner(true, false, false, false);
			scanner.setSource(content.toCharArray());
			int headerStart= -1;
			int headerEnd= -1;
			try {
				boolean foundComment= false;
				int terminal= scanner.getNextToken();
				while (terminal != ITerminalSymbols.TokenNameEOF && !(terminal == ITerminalSymbols.TokenNameclass || terminal == ITerminalSymbols.TokenNameinterface || terminal == ITerminalSymbols.TokenNameenum || (foundComment && (terminal == ITerminalSymbols.TokenNameimport || terminal == ITerminalSymbols.TokenNamepackage)))) {
					if (terminal == ITerminalSymbols.TokenNameCOMMENT_JAVADOC || terminal == ITerminalSymbols.TokenNameCOMMENT_BLOCK || terminal == ITerminalSymbols.TokenNameCOMMENT_LINE) {
						if (!foundComment)
							headerStart= scanner.getCurrentTokenStartPosition();
						headerEnd= scanner.getCurrentTokenEndPosition();
						foundComment= true;
					}
					terminal= scanner.getNextToken();
				}
			} catch (InvalidInputException ex) {
				return null;