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

(-)src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java (+90 lines)
Lines 7227-7232 Link Here
7227
			null, null,
7227
			null, null,
7228
			JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings);
7228
			JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings);
7229
}
7229
}
7230
7231
/**
7232
 * @bug 222900: [Javadoc] Missing description is warned if valid description is on a new line
7233
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=222900"
7234
 */
7235
public void testBug222900a() {
7236
	String[] units = new String[] {
7237
		"X.java",
7238
		"/**\n" + 
7239
		"* @since\n" + 
7240
		"* 	description\n" + 
7241
		"* @author\n" + 
7242
		"* 	description\n" + 
7243
		"* @version\n" + 
7244
		"* 	description\n" + 
7245
		"*/\n" + 
7246
		"public class X {\n" + 
7247
		"	/**\n" + 
7248
		"	 * @param  aParam\n" + 
7249
		"	 *         description\n" + 
7250
		"	 * @return\n" + 
7251
		"	 *         description\n" + 
7252
		"	 * @since\n" + 
7253
		"	 *         description\n" + 
7254
		"	 * @throws NullPointerException\n" + 
7255
		"	 *         description\n" + 
7256
		"	 * @exception NullPointerException\n" + 
7257
		"	 *            description\n" + 
7258
		"	 * @serial\n" + 
7259
		"	 *         description\n" + 
7260
		"	 * @serialData\n" + 
7261
		"	 *         description\n" + 
7262
		"	 * @serialField\n" + 
7263
		"	 *         description\n" + 
7264
		"	 * @deprecated\n" + 
7265
		"	 *         description\n" + 
7266
		"	 */\n" + 
7267
		"	public String foo(String aParam) {\n" + 
7268
		"		return new String();\n" + 
7269
		"	}\n" + 
7270
		"}\n"
7271
	};
7272
	this.reportMissingJavadocDescription = CompilerOptions.ALL_STANDARD_TAGS;
7273
	runConformTest(units);
7274
}
7275
public void testBug222900b() {
7276
	String[] units = new String[] {
7277
		"X.java",
7278
		"/**\n" + 
7279
		" * {@code\n" + 
7280
		" *        description}\n" + 
7281
		" * {@literal\n" + 
7282
		" *        description}\n" + 
7283
		"*/\n" + 
7284
		"public class X {\n" + 
7285
		"}\n"
7286
	};
7287
	this.reportMissingJavadocDescription = CompilerOptions.ALL_STANDARD_TAGS;
7288
	runConformTest(units);
7289
}
7290
public void testBug222900c() {
7291
	String[] units = new String[] {
7292
		"X.java",
7293
		"/**\n" + 
7294
		" * Test the {@code} missing description\n" + 
7295
		" * Test the {@code\n" + 
7296
		" * } missing description\n" + 
7297
		" * Test the {@code X} with description\n" + 
7298
		" * Test the {@code\n" + 
7299
		" * public class X} with description\n" + 
7300
		"*/\n" + 
7301
		"public class X {\n" + 
7302
		"}\n"
7303
	};
7304
	this.reportMissingJavadocDescription = CompilerOptions.ALL_STANDARD_TAGS;
7305
	runNegativeTest(units,
7306
		"----------\n" + 
7307
		"1. ERROR in X.java (at line 2)\n" + 
7308
		"	* Test the {@code} missing description\n" + 
7309
		"	             ^^^^\n" + 
7310
		"Javadoc: Description expected after @code\n" + 
7311
		"----------\n" + 
7312
		"2. ERROR in X.java (at line 3)\n" + 
7313
		"	* Test the {@code\n" + 
7314
		"	             ^^^^\n" + 
7315
		"Javadoc: Description expected after @code\n" + 
7316
		"----------\n"
7317
	);
7318
}
7230
/**
7319
/**
7231
 * @bug 222902: [Javadoc] Missing description should not be warned in some cases
7320
 * @bug 222902: [Javadoc] Missing description should not be warned in some cases
7232
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=222902"
7321
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=222902"
Lines 7336-7341 Link Here
7336
		JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings
7425
		JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings
7337
	);
7426
	);
7338
}
7427
}
7428
7339
/**
7429
/**
7340
 * @bug 227730: [Javadoc] Missing description should not be warned for @inheritDoc
7430
 * @bug 227730: [Javadoc] Missing description should not be warned for @inheritDoc
7341
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=227730"
7431
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=227730"
(-)compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java (-39 / +68 lines)
Lines 38-43 Link Here
38
	// returns whether this JavadocParser should report errors or not (overrides reportProblems)
38
	// returns whether this JavadocParser should report errors or not (overrides reportProblems)
39
	// see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=192449"
39
	// see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=192449"
40
	public boolean shouldReportProblems = true;
40
	public boolean shouldReportProblems = true;
41
	
42
	// flag to let the parser know that the current tag is waiting for a description
43
	// see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=222900"
44
	private int tagWaitingForDescription;
41
45
42
	public JavadocParser(Parser sourceParser) {
46
	public JavadocParser(Parser sourceParser) {
43
		super(sourceParser);
47
		super(sourceParser);
Lines 58-63 Link Here
58
		this.firstTagPosition = this.sourceParser.scanner.commentTagStarts[commentPtr];
62
		this.firstTagPosition = this.sourceParser.scanner.commentTagStarts[commentPtr];
59
		this.validValuePositions = -1;
63
		this.validValuePositions = -1;
60
		this.invalidValuePositions = -1;
64
		this.invalidValuePositions = -1;
65
		this.tagWaitingForDescription = NO_TAG_VALUE;
61
66
62
		// Init javadoc if necessary
67
		// Init javadoc if necessary
63
		if (this.checkDocComment) {
68
		if (this.checkDocComment) {
Lines 339-351 Link Here
339
	 */
344
	 */
340
	protected boolean parseThrows() {
345
	protected boolean parseThrows() {
341
		boolean valid = super.parseThrows();
346
		boolean valid = super.parseThrows();
342
		if (valid && this.reportProblems && verifyEndLine(this.scanner.currentPosition)) {
347
		this.tagWaitingForDescription = valid && this.reportProblems ? TAG_THROWS_VALUE : NO_TAG_VALUE;
343
			// retrieve last identifier position (valid as, in the super method, we already parsed an identifier)
344
			int start = (int) (this.identifierPositionStack[0] >>> 32);
345
			int end = (int) this.identifierPositionStack[this.identifierPtr];
346
			this.sourceParser.problemReporter().javadocMissingTagDescriptionAfterReference(start, end, this.sourceParser.modifiers);
347
			return false;
348
		}
349
		return valid;
348
		return valid;
350
	}
349
	}
351
350
Lines 408-413 Link Here
408
407
409
	protected boolean parseTag(int previousPosition) throws InvalidInputException {
408
	protected boolean parseTag(int previousPosition) throws InvalidInputException {
410
409
410
		// Signal tag missing description if necessary
411
		switch (this.tagWaitingForDescription) {
412
			case TAG_PARAM_VALUE:
413
			case TAG_THROWS_VALUE:
414
				int start = (int) (this.identifierPositionStack[0] >>> 32);
415
				int end = (int) this.identifierPositionStack[this.identifierPtr];
416
				this.sourceParser.problemReporter().javadocMissingTagDescriptionAfterReference(start, end, this.sourceParser.modifiers);
417
				break;
418
			case NO_TAG_VALUE:
419
				break;
420
			default:
421
				this.sourceParser.problemReporter().javadocMissingTagDescription(TAG_NAMES[this.tagWaitingForDescription], this.tagSourceStart, this.tagSourceEnd, this.sourceParser.modifiers);
422
				break;
423
		}
424
		this.tagWaitingForDescription = NO_TAG_VALUE;
425
411
		// Read tag name
426
		// Read tag name
412
		int currentPosition = this.index;
427
		int currentPosition = this.index;
413
		int token = readTokenAndConsume();
428
		int token = readTokenAndConsume();
Lines 486-492 Link Here
486
501
487
		// Decide which parse to perform depending on tag name
502
		// Decide which parse to perform depending on tag name
488
		this.tagValue = TAG_OTHERS_VALUE;
503
		this.tagValue = TAG_OTHERS_VALUE;
489
		boolean alreadyParsedTag = false;
490
		boolean valid = false;
504
		boolean valid = false;
491
		switch (token) {
505
		switch (token) {
492
			case TerminalTokens.TokenNameIdentifier :
506
			case TerminalTokens.TokenNameIdentifier :
Lines 494-499 Link Here
494
					case 'a':
508
					case 'a':
495
						if (length == TAG_AUTHOR_LENGTH && CharOperation.equals(TAG_AUTHOR, tagName)) {
509
						if (length == TAG_AUTHOR_LENGTH && CharOperation.equals(TAG_AUTHOR, tagName)) {
496
							this.tagValue = TAG_AUTHOR_VALUE;
510
							this.tagValue = TAG_AUTHOR_VALUE;
511
							this.tagWaitingForDescription = this.tagValue;
497
						}
512
						}
498
						break;
513
						break;
499
					case 'c':
514
					case 'c':
Lines 502-507 Link Here
502
							valid = parseIdentifierTag(false); // TODO (frederic) reconsider parameter value when @category will be significant in spec
517
							valid = parseIdentifierTag(false); // TODO (frederic) reconsider parameter value when @category will be significant in spec
503
						} else if (length == TAG_CODE_LENGTH && this.inlineTagStarted && CharOperation.equals(TAG_CODE, tagName)) {
518
						} else if (length == TAG_CODE_LENGTH && this.inlineTagStarted && CharOperation.equals(TAG_CODE, tagName)) {
504
							this.tagValue = TAG_CODE_VALUE;
519
							this.tagValue = TAG_CODE_VALUE;
520
							this.tagWaitingForDescription = this.tagValue;
505
						}
521
						}
506
						break;
522
						break;
507
					case 'd':
523
					case 'd':
Lines 509-527 Link Here
509
							this.deprecated = true;
525
							this.deprecated = true;
510
							valid = true;
526
							valid = true;
511
							this.tagValue = TAG_DEPRECATED_VALUE;
527
							this.tagValue = TAG_DEPRECATED_VALUE;
528
							this.tagWaitingForDescription = this.tagValue;
512
						} else if (length == TAG_DOC_ROOT_LENGTH && CharOperation.equals(TAG_DOC_ROOT, tagName)) {
529
						} else if (length == TAG_DOC_ROOT_LENGTH && CharOperation.equals(TAG_DOC_ROOT, tagName)) {
513
							// https://bugs.eclipse.org/bugs/show_bug.cgi?id=227730
530
							// https://bugs.eclipse.org/bugs/show_bug.cgi?id=227730
514
							// identify @docRoot tag as a base tag that does not expect any argument
531
							// identify @docRoot tag as a base tag that does not expect any argument
515
							valid = true;
532
							valid = true;
516
							this.tagValue = TAG_DOC_ROOT_VALUE;
533
							this.tagValue = TAG_DOC_ROOT_VALUE;
517
							alreadyParsedTag = true;
518
						}
534
						}
519
						break;
535
						break;
520
					case 'e':
536
					case 'e':
521
						if (length == TAG_EXCEPTION_LENGTH && CharOperation.equals(TAG_EXCEPTION, tagName)) {
537
						if (length == TAG_EXCEPTION_LENGTH && CharOperation.equals(TAG_EXCEPTION, tagName)) {
522
							this.tagValue = TAG_EXCEPTION_VALUE;
538
							this.tagValue = TAG_EXCEPTION_VALUE;
523
							valid = parseThrows();
539
							valid = parseThrows();
524
							alreadyParsedTag = true;
525
						}
540
						}
526
						break;
541
						break;
527
					case 'i':
542
					case 'i':
Lines 536-544 Link Here
536
							}
551
							}
537
							valid = true;
552
							valid = true;
538
							this.tagValue = TAG_INHERITDOC_VALUE;
553
							this.tagValue = TAG_INHERITDOC_VALUE;
539
							// https://bugs.eclipse.org/bugs/show_bug.cgi?id=227730
540
							// no argument expected for @inheritedDoc tag
541
							alreadyParsedTag = true;
542
						}
554
						}
543
						break;
555
						break;
544
					case 'l':
556
					case 'l':
Lines 554-560 Link Here
554
									this.sourceParser.problemReporter().javadocUnexpectedTag(this.tagSourceStart, this.tagSourceEnd);
566
									this.sourceParser.problemReporter().javadocUnexpectedTag(this.tagSourceStart, this.tagSourceEnd);
555
								}
567
								}
556
							}
568
							}
557
							alreadyParsedTag = true;
558
						} else if (length == TAG_LINKPLAIN_LENGTH && CharOperation.equals(TAG_LINKPLAIN, tagName)) {
569
						} else if (length == TAG_LINKPLAIN_LENGTH && CharOperation.equals(TAG_LINKPLAIN, tagName)) {
559
							this.tagValue = TAG_LINKPLAIN_VALUE;
570
							this.tagValue = TAG_LINKPLAIN_VALUE;
560
							if (this.inlineTagStarted) {
571
							if (this.inlineTagStarted) {
Lines 565-580 Link Here
565
									this.sourceParser.problemReporter().javadocUnexpectedTag(this.tagSourceStart, this.tagSourceEnd);
576
									this.sourceParser.problemReporter().javadocUnexpectedTag(this.tagSourceStart, this.tagSourceEnd);
566
								}
577
								}
567
							}
578
							}
568
							alreadyParsedTag = true;
569
						} else if (length == TAG_LITERAL_LENGTH && this.inlineTagStarted && CharOperation.equals(TAG_LITERAL, tagName)) {
579
						} else if (length == TAG_LITERAL_LENGTH && this.inlineTagStarted && CharOperation.equals(TAG_LITERAL, tagName)) {
570
							this.tagValue = TAG_LITERAL_VALUE;
580
							this.tagValue = TAG_LITERAL_VALUE;
581
							this.tagWaitingForDescription = this.tagValue;
571
						}
582
						}
572
						break;
583
						break;
573
					case 'p':
584
					case 'p':
574
						if (length == TAG_PARAM_LENGTH && CharOperation.equals(TAG_PARAM, tagName)) {
585
						if (length == TAG_PARAM_LENGTH && CharOperation.equals(TAG_PARAM, tagName)) {
575
							this.tagValue = TAG_PARAM_VALUE;
586
							this.tagValue = TAG_PARAM_VALUE;
576
							valid = parseParam();
587
							valid = parseParam();
577
							alreadyParsedTag = true;
578
						}
588
						}
579
						break;
589
						break;
580
					case 's':
590
					case 's':
Lines 590-604 Link Here
590
								this.tagValue = TAG_SEE_VALUE;
600
								this.tagValue = TAG_SEE_VALUE;
591
								valid = parseReference();
601
								valid = parseReference();
592
							}
602
							}
593
							alreadyParsedTag = true;
594
						} else if (length == TAG_SERIAL_LENGTH && CharOperation.equals(TAG_SERIAL, tagName)) {
603
						} else if (length == TAG_SERIAL_LENGTH && CharOperation.equals(TAG_SERIAL, tagName)) {
595
							this.tagValue = TAG_SERIAL_VALUE;
604
							this.tagValue = TAG_SERIAL_VALUE;
605
							this.tagWaitingForDescription = this.tagValue;
596
						} else if (length == TAG_SERIAL_DATA_LENGTH && CharOperation.equals(TAG_SERIAL_DATA, tagName)) {
606
						} else if (length == TAG_SERIAL_DATA_LENGTH && CharOperation.equals(TAG_SERIAL_DATA, tagName)) {
597
							this.tagValue = TAG_SERIAL_DATA_VALUE;
607
							this.tagValue = TAG_SERIAL_DATA_VALUE;
608
							this.tagWaitingForDescription = this.tagValue;
598
						} else if (length == TAG_SERIAL_FIELD_LENGTH && CharOperation.equals(TAG_SERIAL_FIELD, tagName)) {
609
						} else if (length == TAG_SERIAL_FIELD_LENGTH && CharOperation.equals(TAG_SERIAL_FIELD, tagName)) {
599
							this.tagValue = TAG_SERIAL_FIELD_VALUE;
610
							this.tagValue = TAG_SERIAL_FIELD_VALUE;
611
							this.tagWaitingForDescription = this.tagValue;
600
						} else if (length == TAG_SINCE_LENGTH && CharOperation.equals(TAG_SINCE, tagName)) {
612
						} else if (length == TAG_SINCE_LENGTH && CharOperation.equals(TAG_SINCE, tagName)) {
601
							this.tagValue = TAG_SINCE_VALUE;
613
							this.tagValue = TAG_SINCE_VALUE;
614
							this.tagWaitingForDescription = this.tagValue;
602
						}
615
						}
603
						break;
616
						break;
604
					case 'v':
617
					case 'v':
Lines 626-634 Link Here
626
									if (this.reportProblems) this.sourceParser.problemReporter().javadocUnexpectedTag(this.tagSourceStart, this.tagSourceEnd);
639
									if (this.reportProblems) this.sourceParser.problemReporter().javadocUnexpectedTag(this.tagSourceStart, this.tagSourceEnd);
627
								}
640
								}
628
							}
641
							}
629
							alreadyParsedTag = true;
630
						} else if (length == TAG_VERSION_LENGTH && CharOperation.equals(TAG_VERSION, tagName)) {
642
						} else if (length == TAG_VERSION_LENGTH && CharOperation.equals(TAG_VERSION, tagName)) {
631
							this.tagValue = TAG_VERSION_VALUE;
643
							this.tagValue = TAG_VERSION_VALUE;
644
							this.tagWaitingForDescription = this.tagValue;
632
						} else {
645
						} else {
633
							createTag();
646
							createTag();
634
						}
647
						}
Lines 641-667 Link Here
641
			case TerminalTokens.TokenNamereturn :
654
			case TerminalTokens.TokenNamereturn :
642
				this.tagValue = TAG_RETURN_VALUE;
655
				this.tagValue = TAG_RETURN_VALUE;
643
				valid = parseReturn();
656
				valid = parseReturn();
644
				alreadyParsedTag = true;
645
				/* verify characters after return tag (we're expecting text description)
646
				if(!verifyCharsAfterReturnTag(this.index)) {
647
					if (this.sourceParser != null) {
648
						int end = this.starPosition == -1 || this.lineEnd<this.starPosition ? this.lineEnd : this.starPosition;
649
						this.sourceParser.problemReporter().javadocEmptyReturnTag(this.tagSourceStart, end);
650
					}
651
				}
652
				*/
653
				break;
657
				break;
654
			case TerminalTokens.TokenNamethrows :
658
			case TerminalTokens.TokenNamethrows :
655
				this.tagValue = TAG_THROWS_VALUE;
659
				this.tagValue = TAG_THROWS_VALUE;
656
				valid = parseThrows();
660
				valid = parseThrows();
657
				alreadyParsedTag = true;
658
				break;
661
				break;
659
		}
662
		}
660
		this.textStart = this.index;
663
		this.textStart = this.index;
661
		if (this.tagValue != TAG_OTHERS_VALUE && ! alreadyParsedTag && this.reportProblems && verifyEndLine(this.scanner.currentPosition)) {
662
			this.sourceParser.problemReporter().javadocMissingTagDescription(tagName, this.tagSourceStart, this.tagSourceEnd, this.sourceParser.modifiers);
663
			return false;
664
		}
665
		return valid;
664
		return valid;
666
	}
665
	}
667
666
Lines 670-682 Link Here
670
	 */
669
	 */
671
	protected boolean parseParam() throws InvalidInputException {
670
	protected boolean parseParam() throws InvalidInputException {
672
		boolean valid = super.parseParam();
671
		boolean valid = super.parseParam();
673
		if (valid && this.reportProblems && verifyEndLine(this.scanner.currentPosition)) {
672
		this.tagWaitingForDescription = valid && this.reportProblems ? TAG_PARAM_VALUE : NO_TAG_VALUE;
674
			// retrieve last identifier position (valid as, in the super method, we already parsed an identifier)
675
			int start = (int) (this.identifierPositionStack[0] >>> 32);
676
			int end = (int) this.identifierPositionStack[this.identifierPtr];
677
			this.sourceParser.problemReporter().javadocMissingTagDescriptionAfterReference(start, end, this.sourceParser.modifiers);
678
			return false;
679
		}
680
		return valid;
673
		return valid;
681
	}
674
	}
682
675
Lines 771-776 Link Here
771
		return true;
764
		return true;
772
	}
765
	}
773
766
767
	/* (non-Javadoc)
768
	 * @see org.eclipse.jdt.internal.compiler.parser.AbstractCommentParser#pushText(int, int)
769
	 */
770
	protected void pushText(int start, int end) {
771
		// The tag gets its description => clear the flag
772
		this.tagWaitingForDescription = NO_TAG_VALUE;
773
	}
774
774
	/*
775
	/*
775
	 * Push a throws type ref in ast node stack.
776
	 * Push a throws type ref in ast node stack.
776
	 */
777
	 */
Lines 800-805 Link Here
800
		return true;
801
		return true;
801
	}
802
	}
802
803
804
	/* (non-Javadoc)
805
	 * @see org.eclipse.jdt.internal.compiler.parser.AbstractCommentParser#refreshInlineTagPosition(int)
806
	 */
807
	protected void refreshInlineTagPosition(int previousPosition) {
808
809
		// Signal tag missing description if necessary
810
		if (this.tagWaitingForDescription!= NO_TAG_VALUE) {
811
			this.sourceParser.problemReporter().javadocMissingTagDescription(TAG_NAMES[this.tagWaitingForDescription], this.tagSourceStart, this.tagSourceEnd, this.sourceParser.modifiers);
812
			this.tagWaitingForDescription = NO_TAG_VALUE;
813
		}
814
	}
815
803
	/*
816
	/*
804
	 * Refresh return statement
817
	 * Refresh return statement
805
	 */
818
	 */
Lines 820-825 Link Here
820
	 */
833
	 */
821
	protected void updateDocComment() {
834
	protected void updateDocComment() {
822
835
836
		// Signal tag missing description if necessary
837
		switch (this.tagWaitingForDescription) {
838
			case TAG_PARAM_VALUE:
839
			case TAG_THROWS_VALUE:
840
				int start = (int) (this.identifierPositionStack[0] >>> 32);
841
				int end = (int) this.identifierPositionStack[this.identifierPtr];
842
				this.sourceParser.problemReporter().javadocMissingTagDescriptionAfterReference(start, end, this.sourceParser.modifiers);
843
				break;
844
			case NO_TAG_VALUE:
845
				break;
846
			default:
847
				this.sourceParser.problemReporter().javadocMissingTagDescription(TAG_NAMES[this.tagWaitingForDescription], this.tagSourceStart, this.tagSourceEnd, this.sourceParser.modifiers);
848
				break;
849
		}
850
		this.tagWaitingForDescription = NO_TAG_VALUE;
851
823
		// Set positions
852
		// Set positions
824
		this.docComment.inheritedPositions = this.inheritedPositions;
853
		this.docComment.inheritedPositions = this.inheritedPositions;
825
		this.docComment.valuePositions = this.validValuePositions != -1 ? this.validValuePositions : this.invalidValuePositions;
854
		this.docComment.valuePositions = this.validValuePositions != -1 ? this.validValuePositions : this.invalidValuePositions;
(-)compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java (-22 / +15 lines)
Lines 137-143 Link Here
137
			int invalidTagLineEnd = -1;
137
			int invalidTagLineEnd = -1;
138
			int invalidInlineTagLineEnd = -1;
138
			int invalidInlineTagLineEnd = -1;
139
			boolean lineHasStar = true;
139
			boolean lineHasStar = true;
140
			boolean pushText = (this.kind & TEXT_PARSE) != 0;
141
			boolean verifText = (this.kind & TEXT_VERIF) != 0;
140
			boolean verifText = (this.kind & TEXT_VERIF) != 0;
142
			boolean isDomParser = (this.kind & DOM_PARSER) != 0;
141
			boolean isDomParser = (this.kind & DOM_PARSER) != 0;
143
			boolean isFormatterParser = (this.kind & FORMATTER_COMMENT_PARSER) != 0;
142
			boolean isFormatterParser = (this.kind & FORMATTER_COMMENT_PARSER) != 0;
Lines 210-216 Link Here
210
								}
209
								}
211
								validComment = false;
210
								validComment = false;
212
								if (this.textStart != -1 && this.textStart < textEndPosition) {
211
								if (this.textStart != -1 && this.textStart < textEndPosition) {
213
									if (pushText) pushText(this.textStart, textEndPosition);
212
									pushText(this.textStart, textEndPosition);
214
								}
213
								}
215
								if (isDomParser || isFormatterParser) {
214
								if (isDomParser || isFormatterParser) {
216
									refreshInlineTagPosition(textEndPosition);
215
									refreshInlineTagPosition(textEndPosition);
Lines 219-231 Link Here
219
							if (previousChar == '{') {
218
							if (previousChar == '{') {
220
								if (this.textStart != -1) {
219
								if (this.textStart != -1) {
221
									if (this.textStart < textEndPosition) {
220
									if (this.textStart < textEndPosition) {
222
										if (pushText) pushText(this.textStart, textEndPosition);
221
										pushText(this.textStart, textEndPosition);
223
									}
222
									}
224
								}
223
								}
225
								this.inlineTagStarted = true;
224
								this.inlineTagStarted = true;
226
								invalidInlineTagLineEnd = this.lineEnd;
225
								invalidInlineTagLineEnd = this.lineEnd;
227
							} else if (this.textStart != -1 && this.textStart < invalidTagLineEnd) {
226
							} else if (this.textStart != -1 && this.textStart < invalidTagLineEnd) {
228
								if (pushText) pushText(this.textStart, invalidTagLineEnd);
227
								pushText(this.textStart, invalidTagLineEnd);
229
							}
228
							}
230
							this.scanner.resetTo(this.index, this.javadocEnd);
229
							this.scanner.resetTo(this.index, this.javadocEnd);
231
							this.currentTokenType = -1; // flush token cache at line begin
230
							this.currentTokenType = -1; // flush token cache at line begin
Lines 263-269 Link Here
263
								textEndPosition = previousPosition;
262
								textEndPosition = previousPosition;
264
							}
263
							}
265
							if (this.textStart != -1 && this.textStart < textEndPosition) {
264
							if (this.textStart != -1 && this.textStart < textEndPosition) {
266
								if (pushText) pushText(this.textStart, textEndPosition);
265
								pushText(this.textStart, textEndPosition);
267
							}
266
							}
268
						}
267
						}
269
						this.lineStarted = false;
268
						this.lineStarted = false;
Lines 276-287 Link Here
276
							refreshReturnStatement();
275
							refreshReturnStatement();
277
						}
276
						}
278
						if (this.inlineTagStarted) {
277
						if (this.inlineTagStarted) {
279
							if (pushText) {
278
							if (this.lineStarted && this.textStart != -1 && this.textStart < textEndPosition) {
280
								if (this.lineStarted && this.textStart != -1 && this.textStart < textEndPosition) {
279
								pushText(this.textStart, textEndPosition);
281
									pushText(this.textStart, textEndPosition);
282
								}
283
								refreshInlineTagPosition(previousPosition);
284
							}
280
							}
281
							refreshInlineTagPosition(previousPosition);
285
							if (!isFormatterParser) this.textStart = this.index;
282
							if (!isFormatterParser) this.textStart = this.index;
286
							this.inlineTagStarted = false;
283
							this.inlineTagStarted = false;
287
						} else {
284
						} else {
Lines 304-315 Link Here
304
								int end = previousPosition<invalidInlineTagLineEnd ? previousPosition : invalidInlineTagLineEnd;
301
								int end = previousPosition<invalidInlineTagLineEnd ? previousPosition : invalidInlineTagLineEnd;
305
								this.sourceParser.problemReporter().javadocUnterminatedInlineTag(this.inlineTagStart, end);
302
								this.sourceParser.problemReporter().javadocUnterminatedInlineTag(this.inlineTagStart, end);
306
							}
303
							}
307
							if (pushText) {
304
							if (this.lineStarted && this.textStart != -1 && this.textStart < textEndPosition) {
308
								if (this.lineStarted && this.textStart != -1 && this.textStart < textEndPosition) {
305
								pushText(this.textStart, textEndPosition);
309
									pushText(this.textStart, textEndPosition);
310
								}
311
								refreshInlineTagPosition(textEndPosition);
312
							}
306
							}
307
							refreshInlineTagPosition(textEndPosition);
313
							textEndPosition = this.index;
308
							textEndPosition = this.index;
314
						} else if (peekChar() != '@') {
309
						} else if (peekChar() != '@') {
315
							if (this.textStart == -1) this.textStart = previousPosition;
310
							if (this.textStart == -1) this.textStart = previousPosition;
Lines 344-350 Link Here
344
							if (!ScannerHelper.isWhitespace(previousChar)) {
339
							if (!ScannerHelper.isWhitespace(previousChar)) {
345
								textEndPosition = previousPosition;
340
								textEndPosition = previousPosition;
346
							}
341
							}
347
						} else if (this.lineStarted) {
342
						} else if (this.lineStarted && isDomParser) {
348
							textEndPosition = this.index;
343
							textEndPosition = this.index;
349
						}
344
						}
350
						break;
345
						break;
Lines 391-404 Link Here
391
					if (this.index >= this.javadocEnd) end = invalidInlineTagLineEnd;
386
					if (this.index >= this.javadocEnd) end = invalidInlineTagLineEnd;
392
					this.sourceParser.problemReporter().javadocUnterminatedInlineTag(this.inlineTagStart, end);
387
					this.sourceParser.problemReporter().javadocUnterminatedInlineTag(this.inlineTagStart, end);
393
				}
388
				}
394
				if (pushText) {
389
				if (this.lineStarted && this.textStart != -1 && this.textStart < textEndPosition) {
395
					if (this.lineStarted && this.textStart != -1 && this.textStart < textEndPosition) {
390
					pushText(this.textStart, textEndPosition);
396
						pushText(this.textStart, textEndPosition);
397
					}
398
					refreshInlineTagPosition(textEndPosition);
399
				}
391
				}
392
				refreshInlineTagPosition(textEndPosition);
400
				this.inlineTagStarted = false;
393
				this.inlineTagStarted = false;
401
			} else if (pushText && this.lineStarted && this.textStart != -1 && this.textStart <= textEndPosition) {
394
			} else if (this.lineStarted && this.textStart != -1 && this.textStart <= textEndPosition) {
402
				pushText(this.textStart, textEndPosition);
395
				pushText(this.textStart, textEndPosition);
403
			}
396
			}
404
			updateDocComment();
397
			updateDocComment();
(-)compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java (-1 / +27 lines)
Lines 11-16 Link Here
11
11
12
package org.eclipse.jdt.internal.compiler.parser;
12
package org.eclipse.jdt.internal.compiler.parser;
13
13
14
import org.eclipse.jdt.core.compiler.CharOperation;
15
14
/**
16
/**
15
 * Javadoc tag constants.
17
 * Javadoc tag constants.
16
 *
18
 *
Lines 62-68 Link Here
62
	public static final int TAG_LITERAL_LENGTH = TAG_LITERAL.length;
64
	public static final int TAG_LITERAL_LENGTH = TAG_LITERAL.length;
63
	public static final int TAG_DOC_ROOT_LENGTH = TAG_DOC_ROOT.length;
65
	public static final int TAG_DOC_ROOT_LENGTH = TAG_DOC_ROOT.length;
64
66
65
66
	// tags value
67
	// tags value
67
	public static final int NO_TAG_VALUE = 0;
68
	public static final int NO_TAG_VALUE = 0;
68
	public static final int TAG_DEPRECATED_VALUE = 1;
69
	public static final int TAG_DEPRECATED_VALUE = 1;
Lines 86-91 Link Here
86
	public static final int TAG_LITERAL_VALUE = 19;
87
	public static final int TAG_LITERAL_VALUE = 19;
87
	public static final int TAG_DOC_ROOT_VALUE = 20;
88
	public static final int TAG_DOC_ROOT_VALUE = 20;
88
	public static final int TAG_OTHERS_VALUE = 100;
89
	public static final int TAG_OTHERS_VALUE = 100;
90
	
91
	// Tag names array
92
	public static final char[][] TAG_NAMES = {
93
		CharOperation.NO_CHAR,
94
		TAG_DEPRECATED,		/* 1 */
95
		TAG_PARAM,				/* 2 */
96
		TAG_RETURN,				/* 3 */
97
		TAG_THROWS,				/* 4 */
98
		TAG_EXCEPTION,			/* 5 */
99
		TAG_SEE,						/* 6 */
100
		TAG_LINK,						/* 7 */
101
		TAG_LINKPLAIN,			/* 8 */
102
		TAG_INHERITDOC,		/* 9 */
103
		TAG_VALUE,					/* 10 */
104
		TAG_CATEGORY,			/* 11 */
105
		TAG_AUTHOR,				/* 12 */
106
		TAG_SERIAL,				/* 13 */
107
		TAG_SERIAL_DATA,	/* 14 */
108
		TAG_SERIAL_FIELD,	/* 15 */
109
		TAG_SINCE,					/* 16 */
110
		TAG_VERSION,				/* 17 */
111
		TAG_CODE,					/* 18 */
112
		TAG_LITERAL,				/* 19 */
113
		TAG_DOC_ROOT,			/* 20 */
114
	};
89
115
90
	// tags expected positions
116
	// tags expected positions
91
	public final static int ORDERED_TAGS_NUMBER = 3;
117
	public final static int ORDERED_TAGS_NUMBER = 3;

Return to bug 222900