View | Details | Raw Unified | Return to bug 110172 | Differences between
and this patch

Collapse All | Expand All

(-)model/org/eclipse/jdt/internal/core/Member.java (+41 lines)
Lines 15-20 Link Here
15
15
16
import org.eclipse.jdt.core.*;
16
import org.eclipse.jdt.core.*;
17
import org.eclipse.jdt.core.compiler.CharOperation;
17
import org.eclipse.jdt.core.compiler.CharOperation;
18
import org.eclipse.jdt.core.compiler.IScanner;
19
import org.eclipse.jdt.core.compiler.ITerminalSymbols;
20
import org.eclipse.jdt.core.compiler.InvalidInputException;
18
import org.eclipse.jdt.internal.compiler.impl.Constant;
21
import org.eclipse.jdt.internal.compiler.impl.Constant;
19
import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
22
import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
20
import org.eclipse.jdt.internal.core.util.MementoTokenizer;
23
import org.eclipse.jdt.internal.core.util.MementoTokenizer;
Lines 247-252 Link Here
247
	} 
250
	} 
248
	return lastLocalContext;
251
	return lastLocalContext;
249
}
252
}
253
public ISourceRange getJavadocRange() throws JavaModelException {
254
	ISourceRange range= this.getSourceRange();
255
	if (range == null) return null;
256
	IBuffer buf= this.isBinary() ? this.getClassFile().getBuffer() : this.getCompilationUnit().getBuffer();
257
	final int start= range.getOffset();
258
	final int length= range.getLength();
259
	if (length > 0 && buf.getChar(start) == '/') {
260
		IScanner scanner= ToolFactory.createScanner(true, false, false, false);
261
		scanner.setSource(buf.getText(start, length).toCharArray());
262
		try {
263
			int docOffset= -1;
264
			int docEnd= -1;
265
			
266
			int terminal= scanner.getNextToken();
267
			loop: while (true) {
268
				switch(terminal) {
269
					case ITerminalSymbols.TokenNameCOMMENT_JAVADOC :
270
						docOffset= scanner.getCurrentTokenStartPosition();
271
						docEnd= scanner.getCurrentTokenEndPosition() + 1;
272
						terminal= scanner.getNextToken();
273
						break;
274
					case ITerminalSymbols.TokenNameCOMMENT_LINE :
275
					case ITerminalSymbols.TokenNameCOMMENT_BLOCK :
276
						terminal= scanner.getNextToken();
277
						continue loop;
278
					default :
279
						break loop;
280
				}
281
			}
282
			if (docOffset != -1) {
283
				return new SourceRange(docOffset + start, docEnd - docOffset + 1);
284
			}
285
		} catch (InvalidInputException ex) {
286
			// try if there is inherited Javadoc
287
		}
288
	}
289
	return null;
290
}
250
/**
291
/**
251
 * @see IMember
292
 * @see IMember
252
 */
293
 */
(-)model/org/eclipse/jdt/core/IMember.java (+16 lines)
Lines 72-77 Link Here
72
 */
72
 */
73
int getFlags() throws JavaModelException;
73
int getFlags() throws JavaModelException;
74
/**
74
/**
75
 * Returns the Javadoc range if this element is from source or if this element
76
 * is a binary element with an attached source, null otherwise.
77
 * 
78
 * <p>If this element is from source, the javadoc range is 
79
 * extracted from the corresponding source.</p>
80
 * <p>If this element is from a binary, the javadoc is extracted from the
81
 * attached source if present.</p>
82
 *
83
 * @exception JavaModelException if this element does not exist or if an
84
 *      exception occurs while accessing its corresponding resource.
85
 * @return a source range corresponding to the javadoc source or <code>null</code>
86
 * if no source is available or the element has no javadoc comment.
87
 * @since 3.2
88
 */
89
ISourceRange getJavadocRange() throws JavaModelException;
90
/**
75
 * Returns the source range of this member's simple name,
91
 * Returns the source range of this member's simple name,
76
 * or <code>null</code> if this member does not have a name
92
 * or <code>null</code> if this member does not have a name
77
 * (for example, an initializer), or if this member does not have
93
 * (for example, an initializer), or if this member does not have

Return to bug 110172