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

(-)compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java (-1 / +19 lines)
Lines 1149-1155 Link Here
1149
						}
1149
						}
1150
						char[] currentError = this.scanner.getCurrentIdentifierSource();
1150
						char[] currentError = this.scanner.getCurrentIdentifierSource();
1151
						if (currentError.length>0 && currentError[0] == '"') {
1151
						if (currentError.length>0 && currentError[0] == '"') {
1152
							if (this.reportProblems) this.sourceParser.problemReporter().javadocInvalidReference(this.scanner.getCurrentTokenStartPosition(), getTokenEndPosition());
1152
							if (this.reportProblems) {
1153
								boolean isUrlRef = false;
1154
								if (this.tagValue == TAG_SEE_VALUE) {
1155
									int length=currentError.length, i=1 /* first char is " */;
1156
									while (i<length && ScannerHelper.isLetter(currentError[i])) {
1157
										i++;
1158
									}
1159
									if (i<(length-2) && currentError[i] == ':' && currentError[i+1] == '/' && currentError[i+2] == '/') {
1160
										isUrlRef = true;
1161
									}
1162
								}
1163
								if (isUrlRef) {
1164
									// https://bugs.eclipse.org/bugs/show_bug.cgi?id=207765
1165
									// handle invalid URL references in javadoc with dedicated message
1166
									this.sourceParser.problemReporter().javadocInvalidSeeUrlReference(this.scanner.getCurrentTokenStartPosition(), getTokenEndPosition());
1167
								} else {
1168
									this.sourceParser.problemReporter().javadocInvalidReference(this.scanner.getCurrentTokenStartPosition(), getTokenEndPosition());
1169
								}
1170
							}
1153
							return false;
1171
							return false;
1154
						}
1172
						}
1155
						break nextToken;
1173
						break nextToken;
(-)src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java (+35 lines)
Lines 7504-7509 Link Here
7504
}
7504
}
7505
7505
7506
/**
7506
/**
7507
 * @bug 207765: [javadoc] Javadoc warning on @see reference could be improved
7508
 * @test Ensure we have different message depending on tag value
7509
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=207765"
7510
 */
7511
public void testBug207765() {
7512
	runNegativeTest(
7513
		new String[] {
7514
			"pkg/X.java",
7515
			"package pkg;\n" +
7516
			"\n" +
7517
			"public class X {\n" +
7518
			"	/**\n" + 
7519
			"	 * {@link \"http://www.eclipse.org/}\n" +
7520
			"	 * @see \"http://www.eclipse.org/\n" +
7521
			"	 */\n" +
7522
			"	public void foo() { \n" +
7523
			"	 \n" +
7524
			"	}\n" +
7525
			"}\n"
7526
		},
7527
		"----------\n" + 
7528
		"1. ERROR in pkg\\X.java (at line 5)\n" + 
7529
		"	* {@link \"http://www.eclipse.org/}\n" + 
7530
		"	         ^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
7531
		"Javadoc: Invalid reference\n" + 
7532
		"----------\n" + 
7533
		"2. ERROR in pkg\\X.java (at line 6)\n" + 
7534
		"	* @see \"http://www.eclipse.org/\n" + 
7535
		"	       ^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
7536
		"Javadoc: Invalid URL reference. Double quote the reference or use the href syntax\n" + 
7537
		"----------\n"
7538
	);
7539
}
7540
7541
/**
7507
 * @bug 222900: [Javadoc] Missing description is warned if valid description is on a new line
7542
 * @bug 222900: [Javadoc] Missing description is warned if valid description is on a new line
7508
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=222900"
7543
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=222900"
7509
 */
7544
 */

Return to bug 207765