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

(-)model/org/eclipse/jdt/internal/core/Member.java (-1 / +1 lines)
Lines 301-307 Link Here
301
				}
301
				}
302
			}
302
			}
303
			if (docOffset != -1) {
303
			if (docOffset != -1) {
304
				return new SourceRange(docOffset + start, docEnd - docOffset + 1);
304
				return new SourceRange(docOffset + start, docEnd - docOffset);
305
			}
305
			}
306
		} catch (InvalidInputException ex) {
306
		} catch (InvalidInputException ex) {
307
			// try if there is inherited Javadoc
307
			// try if there is inherited Javadoc
(-)src/org/eclipse/jdt/core/tests/model/GetSourceTests.java (+48 lines)
Lines 163-168 Link Here
163
		assertNull("Should not be a constant", constant);
163
		assertNull("Should not be a constant", constant);
164
	}
164
	}
165
165
166
	/*
167
	 * Ensures that the Javadoc range for a method is correct.
168
	 * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=232944 )
169
	 */
170
	public void testJavadocRange01() throws CoreException {
171
		try {
172
			String cuSource = 
173
				"package p;\n" + 
174
				"class A{\n" + 
175
				"    /**\n" + 
176
				"     * swsw\n" + 
177
				"     */\n" + 
178
				"    void m(){\n" + 
179
				"    }\n" + 
180
				"}";
181
			createFile("/P/p/A.java", cuSource);
182
			IMethod method = getCompilationUnit("/P/p/A.java").getType("A").getMethod("m", new String[0]);
183
			assertSourceEquals(
184
				"Unexpected Javadoc'", 
185
				"/**\n" + 
186
				"     * swsw\n" + 
187
				"     */",
188
				getSource(cuSource, method.getJavadocRange()));
189
		} finally {
190
			deleteFile("/P/p/A.java");
191
		}
192
	}
193
		
194
	/*
195
	 * Ensures that the Javadoc range for a class is correct.
196
	 * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=232944 )
197
	 */
198
	public void testJavadocRange02() throws CoreException {
199
		try {
200
			String cuSource = 
201
				"package p;\n" + 
202
				"/** X */class A {}";
203
			createFile("/P/p/A.java", cuSource);
204
			IType type = getCompilationUnit("/P/p/A.java").getType("A");
205
			assertSourceEquals(
206
				"Unexpected Javadoc'", 
207
				"/** X */",
208
				getSource(cuSource, type.getJavadocRange()));
209
		} finally {
210
			deleteFile("/P/p/A.java");
211
		}
212
	}
213
		
166
	/**
214
	/**
167
	 * Ensure the source for an import contains the 'import' keyword,
215
	 * Ensure the source for an import contains the 'import' keyword,
168
	 * name, and terminator.
216
	 * name, and terminator.

Return to bug 232944