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

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java (-12 / +41 lines)
Lines 7326-7335 Link Here
7326
	String[] units = new String[] {
7326
	String[] units = new String[] {
7327
		"X.java",
7327
		"X.java",
7328
		"/**\n" +
7328
		"/**\n" +
7329
		" * @author\n" +
7330
		" * {@code}\n" +
7329
		" * {@code}\n" +
7331
		" * @deprecated\n" +
7332
		" * {@literal}\n" +
7330
		" * {@literal}\n" +
7331
		" * @author\n" +
7332
		" * @deprecated\n" +
7333
		" * @since\n" +
7333
		" * @since\n" +
7334
		" * @version\n" +
7334
		" * @version\n" +
7335
		" * @generated\n" + // should not get a warning for missing description on non-standard tag
7335
		" * @generated\n" + // should not get a warning for missing description on non-standard tag
Lines 7359-7383 Link Here
7359
	runConformTest(true, units,
7359
	runConformTest(true, units,
7360
		"----------\n" +
7360
		"----------\n" +
7361
		"1. WARNING in X.java (at line 2)\n" +
7361
		"1. WARNING in X.java (at line 2)\n" +
7362
		"	* @author\n" +
7363
		"	   ^^^^^^\n" +
7364
		"Javadoc: Description expected after @author\n" +
7365
		"----------\n" +
7366
		"2. WARNING in X.java (at line 3)\n" +
7367
		"	* {@code}\n" +
7362
		"	* {@code}\n" +
7368
		"	    ^^^^\n" +
7363
		"	    ^^^^\n" +
7369
		"Javadoc: Description expected after @code\n" +
7364
		"Javadoc: Description expected after @code\n" +
7370
		"----------\n" +
7365
		"----------\n" +
7366
		"2. WARNING in X.java (at line 3)\n" +
7367
		"	* {@literal}\n" +
7368
		"	    ^^^^^^^\n" +
7369
		"Javadoc: Description expected after @literal\n" +
7370
		"----------\n" +
7371
		"3. WARNING in X.java (at line 4)\n" +
7371
		"3. WARNING in X.java (at line 4)\n" +
7372
		"	* @author\n" +
7373
		"	   ^^^^^^\n" +
7374
		"Javadoc: Description expected after @author\n" +
7375
		"----------\n" +
7376
		"4. WARNING in X.java (at line 5)\n" +
7372
		"	* @deprecated\n" +
7377
		"	* @deprecated\n" +
7373
		"	   ^^^^^^^^^^\n" +
7378
		"	   ^^^^^^^^^^\n" +
7374
		"Javadoc: Description expected after @deprecated\n" +
7379
		"Javadoc: Description expected after @deprecated\n" +
7375
		"----------\n" +
7380
		"----------\n" +
7376
		"4. WARNING in X.java (at line 5)\n" +
7377
		"	* {@literal}\n" +
7378
		"	    ^^^^^^^\n" +
7379
		"Javadoc: Description expected after @literal\n" +
7380
		"----------\n" +
7381
		"5. WARNING in X.java (at line 6)\n" +
7381
		"5. WARNING in X.java (at line 6)\n" +
7382
		"	* @since\n" +
7382
		"	* @since\n" +
7383
		"	   ^^^^^\n" +
7383
		"	   ^^^^^\n" +
Lines 7566-7571 Link Here
7566
		}
7566
		}
7567
	);
7567
	);
7568
}
7568
}
7569
public void testBug246712b() {
7570
	this.reportMissingJavadocDescription = CompilerOptions.ALL_STANDARD_TAGS;
7571
	runConformTest(
7572
		new String[] {
7573
			"src/X.java",
7574
			"/**\n" + 
7575
			" * @author {@link String}\n" + 
7576
			" * @since {@link String}\n" + 
7577
			" * @version {@link String}\n" + 
7578
			" * @deprecated {@link String}\n" + 
7579
			"*/\n" + 
7580
			"public class X {\n" + 
7581
			"	/**\n" + 
7582
			"	 * @return {@link String}\n" + 
7583
			"	 * @since {@link String}\n" + 
7584
			"	 * @throws  Exception {@link String}\n" + 
7585
			"	 * @exception Exception {@link String}\n" + 
7586
			"	 * @serial {@link String}\n" + 
7587
			"	 * @serialData {@link String}\n" + 
7588
			"	 * @serialField {@link String}\n" + 
7589
			"	 * @deprecated {@link String}\n" + 
7590
			"	 */\n" + 
7591
			"	public String foo(String aParam) throws Exception {\n" + 
7592
			"		return new String();\n" + 
7593
			"	}\n" + 
7594
			"}"
7595
		}
7596
	);
7597
}
7569
// duplicate
7598
// duplicate
7570
public void testBug246715() {
7599
public void testBug246715() {
7571
	this.reportMissingJavadocDescription = CompilerOptions.ALL_STANDARD_TAGS;
7600
	this.reportMissingJavadocDescription = CompilerOptions.ALL_STANDARD_TAGS;
(-)compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java (-6 / +14 lines)
Lines 407-417 Link Here
407
407
408
	protected boolean parseTag(int previousPosition) throws InvalidInputException {
408
	protected boolean parseTag(int previousPosition) throws InvalidInputException {
409
409
410
		// Signal tag missing description if necessary
410
		// Complain when tag is missing a description
411
		// Note that if the parse of an inline tag has already started, consider it
412
		// as the expected description, hence do not report any warning
411
		switch (this.tagWaitingForDescription) {
413
		switch (this.tagWaitingForDescription) {
412
			case TAG_PARAM_VALUE:
414
			case TAG_PARAM_VALUE:
413
			case TAG_THROWS_VALUE:
415
			case TAG_THROWS_VALUE:
414
				if (!this.inlineTagStarted) { // if an inline tag is started, then consider as the expected description...
416
				if (!this.inlineTagStarted) {
415
					int start = (int) (this.identifierPositionStack[0] >>> 32);
417
					int start = (int) (this.identifierPositionStack[0] >>> 32);
416
					int end = (int) this.identifierPositionStack[this.identifierPtr];
418
					int end = (int) this.identifierPositionStack[this.identifierPtr];
417
					this.sourceParser.problemReporter().javadocMissingTagDescriptionAfterReference(start, end, this.sourceParser.modifiers);
419
					this.sourceParser.problemReporter().javadocMissingTagDescriptionAfterReference(start, end, this.sourceParser.modifiers);
Lines 420-426 Link Here
420
			case NO_TAG_VALUE:
422
			case NO_TAG_VALUE:
421
				break;
423
				break;
422
			default:
424
			default:
423
				this.sourceParser.problemReporter().javadocMissingTagDescription(TAG_NAMES[this.tagWaitingForDescription], this.tagSourceStart, this.tagSourceEnd, this.sourceParser.modifiers);
425
				if (!this.inlineTagStarted) {
426
					this.sourceParser.problemReporter().javadocMissingTagDescription(TAG_NAMES[this.tagWaitingForDescription], this.tagSourceStart, this.tagSourceEnd, this.sourceParser.modifiers);
427
				}
424
				break;
428
				break;
425
		}
429
		}
426
		this.tagWaitingForDescription = NO_TAG_VALUE;
430
		this.tagWaitingForDescription = NO_TAG_VALUE;
Lines 835-845 Link Here
835
	 */
839
	 */
836
	protected void updateDocComment() {
840
	protected void updateDocComment() {
837
841
838
		// Signal tag missing description if necessary
842
		// Complain when tag is missing a description
843
		// Note that if the parse of an inline tag has already started, consider it
844
		// as the expected description, hence do not report any warning
839
		switch (this.tagWaitingForDescription) {
845
		switch (this.tagWaitingForDescription) {
840
			case TAG_PARAM_VALUE:
846
			case TAG_PARAM_VALUE:
841
			case TAG_THROWS_VALUE:
847
			case TAG_THROWS_VALUE:
842
				if (!this.inlineTagStarted) { // if an inline tag is started, then consider as the expected description...
848
				if (!this.inlineTagStarted) {
843
					int start = (int) (this.identifierPositionStack[0] >>> 32);
849
					int start = (int) (this.identifierPositionStack[0] >>> 32);
844
					int end = (int) this.identifierPositionStack[this.identifierPtr];
850
					int end = (int) this.identifierPositionStack[this.identifierPtr];
845
					this.sourceParser.problemReporter().javadocMissingTagDescriptionAfterReference(start, end, this.sourceParser.modifiers);
851
					this.sourceParser.problemReporter().javadocMissingTagDescriptionAfterReference(start, end, this.sourceParser.modifiers);
Lines 848-854 Link Here
848
			case NO_TAG_VALUE:
854
			case NO_TAG_VALUE:
849
				break;
855
				break;
850
			default:
856
			default:
851
				this.sourceParser.problemReporter().javadocMissingTagDescription(TAG_NAMES[this.tagWaitingForDescription], this.tagSourceStart, this.tagSourceEnd, this.sourceParser.modifiers);
857
				if (!this.inlineTagStarted) {
858
					this.sourceParser.problemReporter().javadocMissingTagDescription(TAG_NAMES[this.tagWaitingForDescription], this.tagSourceStart, this.tagSourceEnd, this.sourceParser.modifiers);
859
				}
852
				break;
860
				break;
853
		}
861
		}
854
		this.tagWaitingForDescription = NO_TAG_VALUE;
862
		this.tagWaitingForDescription = NO_TAG_VALUE;

Return to bug 246712