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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java (-2 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 325-331 Link Here
325
		// @param tags
325
		// @param tags
326
		CompilerOptions compilerOptions = methScope.compilerOptions();
326
		CompilerOptions compilerOptions = methScope.compilerOptions();
327
		resolveParamTags(methScope, reportMissing, compilerOptions.reportUnusedParameterIncludeDocCommentReference /* considerParamRefAsUsage*/);
327
		resolveParamTags(methScope, reportMissing, compilerOptions.reportUnusedParameterIncludeDocCommentReference /* considerParamRefAsUsage*/);
328
		resolveTypeParameterTags(methScope, reportMissing);
328
		resolveTypeParameterTags(methScope, reportMissing && compilerOptions.reportMissingJavadocTagsMethodTypeParameters);
329
329
330
		// @return tags
330
		// @return tags
331
		if (this.returnStatement == null) {
331
		if (this.returnStatement == null) {
(-)compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java (+13 lines)
Lines 76-81 Link Here
76
	public static final String OPTION_ReportMissingJavadocTags = "org.eclipse.jdt.core.compiler.problem.missingJavadocTags"; //$NON-NLS-1$
76
	public static final String OPTION_ReportMissingJavadocTags = "org.eclipse.jdt.core.compiler.problem.missingJavadocTags"; //$NON-NLS-1$
77
	public static final String OPTION_ReportMissingJavadocTagsVisibility = "org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility"; //$NON-NLS-1$
77
	public static final String OPTION_ReportMissingJavadocTagsVisibility = "org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility"; //$NON-NLS-1$
78
	public static final String OPTION_ReportMissingJavadocTagsOverriding = "org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding"; //$NON-NLS-1$
78
	public static final String OPTION_ReportMissingJavadocTagsOverriding = "org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding"; //$NON-NLS-1$
79
	public static final String OPTION_ReportMissingJavadocTagsMethodTypeParameters = "org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters"; //$NON-NLS-1$
79
	public static final String OPTION_ReportMissingJavadocComments = "org.eclipse.jdt.core.compiler.problem.missingJavadocComments"; //$NON-NLS-1$
80
	public static final String OPTION_ReportMissingJavadocComments = "org.eclipse.jdt.core.compiler.problem.missingJavadocComments"; //$NON-NLS-1$
80
	public static final String OPTION_ReportMissingJavadocTagDescription = "org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription"; //$NON-NLS-1$
81
	public static final String OPTION_ReportMissingJavadocTagDescription = "org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription"; //$NON-NLS-1$
81
	public static final String OPTION_ReportMissingJavadocCommentsVisibility = "org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility"; //$NON-NLS-1$
82
	public static final String OPTION_ReportMissingJavadocCommentsVisibility = "org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility"; //$NON-NLS-1$
Lines 326-331 Link Here
326
	public int reportMissingJavadocTagsVisibility;
327
	public int reportMissingJavadocTagsVisibility;
327
	/** Specify if need to flag missing javadoc tags for overriding method */
328
	/** Specify if need to flag missing javadoc tags for overriding method */
328
	public boolean reportMissingJavadocTagsOverriding;
329
	public boolean reportMissingJavadocTagsOverriding;
330
	/** Specify if need to flag missing javadoc tags for method type parameters (java 1.5 and above)*/
331
	public boolean reportMissingJavadocTagsMethodTypeParameters;
329
	/** Only report missing javadoc comment above a given level of visibility of associated construct */
332
	/** Only report missing javadoc comment above a given level of visibility of associated construct */
330
	public int reportMissingJavadocCommentsVisibility;
333
	public int reportMissingJavadocCommentsVisibility;
331
	/** Specify if need to flag missing javadoc comment for overriding method */
334
	/** Specify if need to flag missing javadoc comment for overriding method */
Lines 857-862 Link Here
857
		optionsMap.put(OPTION_ReportMissingJavadocTags, getSeverityString(MissingJavadocTags));
860
		optionsMap.put(OPTION_ReportMissingJavadocTags, getSeverityString(MissingJavadocTags));
858
		optionsMap.put(OPTION_ReportMissingJavadocTagsVisibility, getVisibilityString(this.reportMissingJavadocTagsVisibility));
861
		optionsMap.put(OPTION_ReportMissingJavadocTagsVisibility, getVisibilityString(this.reportMissingJavadocTagsVisibility));
859
		optionsMap.put(OPTION_ReportMissingJavadocTagsOverriding, this.reportMissingJavadocTagsOverriding ? ENABLED : DISABLED);
862
		optionsMap.put(OPTION_ReportMissingJavadocTagsOverriding, this.reportMissingJavadocTagsOverriding ? ENABLED : DISABLED);
863
		optionsMap.put(OPTION_ReportMissingJavadocTagsMethodTypeParameters, this.reportMissingJavadocTagsMethodTypeParameters ? ENABLED : DISABLED);
860
		optionsMap.put(OPTION_ReportMissingJavadocComments, getSeverityString(MissingJavadocComments));
864
		optionsMap.put(OPTION_ReportMissingJavadocComments, getSeverityString(MissingJavadocComments));
861
		optionsMap.put(OPTION_ReportMissingJavadocTagDescription, this.reportMissingJavadocTagDescription);
865
		optionsMap.put(OPTION_ReportMissingJavadocTagDescription, this.reportMissingJavadocTagDescription);
862
		optionsMap.put(OPTION_ReportMissingJavadocCommentsVisibility, getVisibilityString(this.reportMissingJavadocCommentsVisibility));
866
		optionsMap.put(OPTION_ReportMissingJavadocCommentsVisibility, getVisibilityString(this.reportMissingJavadocCommentsVisibility));
Lines 1018-1023 Link Here
1018
		// check missing javadoc tags
1022
		// check missing javadoc tags
1019
		this.reportMissingJavadocTagsVisibility = ClassFileConstants.AccPublic;
1023
		this.reportMissingJavadocTagsVisibility = ClassFileConstants.AccPublic;
1020
		this.reportMissingJavadocTagsOverriding = false;
1024
		this.reportMissingJavadocTagsOverriding = false;
1025
		this.reportMissingJavadocTagsMethodTypeParameters = false;
1021
1026
1022
		// check missing javadoc comments
1027
		// check missing javadoc comments
1023
		this.reportMissingJavadocCommentsVisibility = ClassFileConstants.AccPublic;
1028
		this.reportMissingJavadocCommentsVisibility = ClassFileConstants.AccPublic;
Lines 1399-1404 Link Here
1399
				this.reportMissingJavadocTagsOverriding = false;
1404
				this.reportMissingJavadocTagsOverriding = false;
1400
			}
1405
			}
1401
		}
1406
		}
1407
		if ((optionValue = optionsMap.get(OPTION_ReportMissingJavadocTagsMethodTypeParameters)) != null) {
1408
			if (ENABLED.equals(optionValue)) {
1409
				this.reportMissingJavadocTagsMethodTypeParameters = true;
1410
			} else if (DISABLED.equals(optionValue)) {
1411
				this.reportMissingJavadocTagsMethodTypeParameters = false;
1412
			}
1413
		}
1402
		if ((optionValue = optionsMap.get(OPTION_ReportMissingJavadocComments)) != null) {
1414
		if ((optionValue = optionsMap.get(OPTION_ReportMissingJavadocComments)) != null) {
1403
			updateSeverity(MissingJavadocComments, optionValue);
1415
			updateSeverity(MissingJavadocComments, optionValue);
1404
		}
1416
		}
Lines 1476-1481 Link Here
1476
		buf.append("\n\t\t+ visibility level to report invalid javadoc tags: ").append(getVisibilityString(this.reportInvalidJavadocTagsVisibility)); //$NON-NLS-1$
1488
		buf.append("\n\t\t+ visibility level to report invalid javadoc tags: ").append(getVisibilityString(this.reportInvalidJavadocTagsVisibility)); //$NON-NLS-1$
1477
		buf.append("\n\t\t+ missing javadoc tags: ").append(getSeverityString(MissingJavadocTags)); //$NON-NLS-1$
1489
		buf.append("\n\t\t+ missing javadoc tags: ").append(getSeverityString(MissingJavadocTags)); //$NON-NLS-1$
1478
		buf.append("\n\t\t+ visibility level to report missing javadoc tags: ").append(getVisibilityString(this.reportMissingJavadocTagsVisibility)); //$NON-NLS-1$
1490
		buf.append("\n\t\t+ visibility level to report missing javadoc tags: ").append(getVisibilityString(this.reportMissingJavadocTagsVisibility)); //$NON-NLS-1$
1491
		buf.append("\n\t\t+ report missing javadoc tags for method type parameters: ").append(this.reportMissingJavadocTagsMethodTypeParameters ? ENABLED : DISABLED); //$NON-NLS-1$
1479
		buf.append("\n\t\t+ report missing javadoc tags in overriding methods: ").append(this.reportMissingJavadocTagsOverriding ? ENABLED : DISABLED); //$NON-NLS-1$
1492
		buf.append("\n\t\t+ report missing javadoc tags in overriding methods: ").append(this.reportMissingJavadocTagsOverriding ? ENABLED : DISABLED); //$NON-NLS-1$
1480
		buf.append("\n\t\t+ missing javadoc comments: ").append(getSeverityString(MissingJavadocComments)); //$NON-NLS-1$
1493
		buf.append("\n\t\t+ missing javadoc comments: ").append(getSeverityString(MissingJavadocComments)); //$NON-NLS-1$
1481
		buf.append("\n\t\t+ report missing tag description option: ").append(this.reportMissingJavadocTagDescription); //$NON-NLS-1$
1494
		buf.append("\n\t\t+ report missing tag description option: ").append(this.reportMissingJavadocTagDescription); //$NON-NLS-1$
(-)model/org/eclipse/jdt/core/JavaCore.java (+15 lines)
Lines 1206-1211 Link Here
1206
	 */
1206
	 */
1207
	public static final String COMPILER_PB_MISSING_JAVADOC_TAGS_OVERRIDING = PLUGIN_ID + ".compiler.problem.missingJavadocTagsOverriding"; //$NON-NLS-1$
1207
	public static final String COMPILER_PB_MISSING_JAVADOC_TAGS_OVERRIDING = PLUGIN_ID + ".compiler.problem.missingJavadocTagsOverriding"; //$NON-NLS-1$
1208
	/**
1208
	/**
1209
	 * Compiler option ID: Reporting Missing Javadoc Tags for Method Type Parameters.
1210
	 * <p>Specify whether a missing <code>@param</code> for a type parameter in a method declaration should be reported.
1211
	 *    When enabled, the compiler will issue a missing Javadoc tag error or warning for a type parameter without a 
1212
	 *    corresponding <code>@param</code> tag.</p>
1213
	 * <p>This option only has an effect if the compiler compliance is 1.5 or greater.</p>
1214
	 * <dl>
1215
	 * <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters"</code></dd>
1216
	 * <dt>Possible values:</dt><dd><code>{ "enabled", "disabled" }</code></dd>
1217
	 * <dt>Default:</dt><dd><code>"disabled"</code></dd>
1218
	 * </dl>
1219
	 * @since 3.7
1220
	 * @category CompilerOptionID
1221
	 */
1222
	public static final String COMPILER_PB_MISSING_JAVADOC_TAGS_METHOD_TYPE_PARAMETERS = PLUGIN_ID + ".compiler.problem.missingJavadocTagsMethodTypeParameters"; //$NON-NLS-1$
1223
	/**
1209
	 * Compiler option ID: Reporting Missing Javadoc Comments.
1224
	 * Compiler option ID: Reporting Missing Javadoc Comments.
1210
	 * <p>This is the generic control for the severity of missing Javadoc comment problems.
1225
	 * <p>This is the generic control for the severity of missing Javadoc comment problems.
1211
	 *    When enabled, the compiler will issue an error or a warning when Javadoc comments are missing.
1226
	 *    When enabled, the compiler will issue an error or a warning when Javadoc comments are missing.
(-)src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java (+1 lines)
Lines 1837-1842 Link Here
1837
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility\" value=\"public\"/>\n" + 
1837
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility\" value=\"public\"/>\n" + 
1838
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription\" value=\"return_tag\"/>\n" + 
1838
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription\" value=\"return_tag\"/>\n" + 
1839
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocTags\" value=\"ignore\"/>\n" + 
1839
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocTags\" value=\"ignore\"/>\n" + 
1840
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters\" value=\"disabled\"/>\n" + 
1840
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding\" value=\"disabled\"/>\n" + 
1841
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding\" value=\"disabled\"/>\n" + 
1841
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility\" value=\"public\"/>\n" + 
1842
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility\" value=\"public\"/>\n" + 
1842
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation\" value=\"ignore\"/>\n" + 
1843
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation\" value=\"ignore\"/>\n" + 
(-)src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest_1_5.java (-1 / +77 lines)
Lines 72-77 Link Here
72
		options.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.ERROR);
72
		options.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.ERROR);
73
		options.put(CompilerOptions.OPTION_ReportUnusedImport, CompilerOptions.ERROR);
73
		options.put(CompilerOptions.OPTION_ReportUnusedImport, CompilerOptions.ERROR);
74
		options.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.IGNORE);
74
		options.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.IGNORE);
75
		options.put(CompilerOptions.OPTION_ReportMissingJavadocTagsMethodTypeParameters, CompilerOptions.ENABLED);
75
		return options;
76
		return options;
76
	}
77
	}
77
	/* (non-Javadoc)
78
	/* (non-Javadoc)
Lines 4143-4147 Link Here
4143
				"	" +
4144
				"	" +
4144
				" }\n"	
4145
				" }\n"	
4145
		});
4146
		});
4146
	}	
4147
	}
4148
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=322581
4149
	// To test the javadoc option CompilerOptions.OPTION_ReportMissingJavadocTagsMethodTypeParameters
4150
	public void testBug322581a() {
4151
		Map options = getCompilerOptions();
4152
		options.put(CompilerOptions.OPTION_ReportMissingJavadocTagsMethodTypeParameters, CompilerOptions.DISABLED);
4153
		this.runNegativeTest(
4154
			true,
4155
			new String[] {
4156
				"X.java",
4157
				" public class X {\n" +
4158
					"	/**\n" +
4159
					"	 * javadoc\n" +
4160
					"	 */\n" +
4161
					"	public <T, U, V> void foo(int val, Object obj) {}\n" +
4162
					"}"
4163
			},
4164
			null,
4165
			options,
4166
			"----------\n" +
4167
			"1. ERROR in X.java (at line 5)\n" + 
4168
			"	public <T, U, V> void foo(int val, Object obj) {}\n" + 
4169
			"	                              ^^^\n" + 
4170
			"Javadoc: Missing tag for parameter val\n" + 
4171
			"----------\n" + 
4172
			"2. ERROR in X.java (at line 5)\n" + 
4173
			"	public <T, U, V> void foo(int val, Object obj) {}\n" + 
4174
			"	                                          ^^^\n" + 
4175
			"Javadoc: Missing tag for parameter obj\n" + 
4176
			"----------\n",
4177
			JavacTestOptions.Excuse.EclipseWarningConfiguredAsError
4178
		);
4179
	}
4180
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=322581
4181
	// To test the javadoc option CompilerOptions.OPTION_ReportMissingJavadocTagsMethodTypeParameters
4182
	public void testBug322581b() {
4183
		Map options = getCompilerOptions();
4184
		options.put(CompilerOptions.OPTION_ReportMissingJavadocTagsMethodTypeParameters, CompilerOptions.DISABLED);
4185
		this.runNegativeTest(
4186
			true,
4187
			new String[] {
4188
				"ListCallable.java",
4189
				" import java.util.Collections;\n" +
4190
				" import java.util.List;\n" +
4191
				" import java.util.concurrent.Callable;\n" +
4192
				"/**\n" +
4193
				" * Callable that returns a list.\n" +
4194
				" */\n" +
4195
				"public abstract class ListCallable<V> implements Callable<List<V>> { // good warning\n" +
4196
				"	public abstract List<V> call() throws Exception;\n" +
4197
				"    /**\n" +
4198
				"	 * Returns a {@link ListCallable} that wraps the result from calling <code>callable</code>.\n" +
4199
				"    * @param callable the {@link Callable} to wrap\n" +
4200
				"	 * @return the wrapper\n" +
4201
				"    */\n" + 
4202
				"	public static <T> ListCallable<T> from(final Callable<T> callable) { // don't warn\n" +
4203
				"		return new ListCallable<T>() {\n" +
4204
				"			@Override\n" +
4205
				"			public List<T> call() throws Exception {\n" +
4206
				"				return Collections.singletonList(callable.call());\n" +
4207
				"			}\n" +
4208
				"		};\n" +
4209
				"	}\n" +
4210
				"}"
4211
			},
4212
			null,
4213
			options,
4214
			"----------\n" +
4215
			"1. ERROR in ListCallable.java (at line 7)\n" + 
4216
			"	public abstract class ListCallable<V> implements Callable<List<V>> { // good warning\n" + 
4217
			"	                                   ^\n" + 
4218
			"Javadoc: Missing tag for parameter V\n" + 
4219
			"----------\n",
4220
			JavacTestOptions.Excuse.EclipseWarningConfiguredAsError
4221
		);
4222
	}
4147
}
4223
}
(-)guide/jdt_api_options.htm (+14 lines)
Lines 794-799 Link Here
794
</tr>
794
</tr>
795
795
796
<tr>
796
<tr>
797
<td colspan=2><b>Reporting Missing Javadoc Tags for Method Type Parameters</b> (<b><a href="../reference/api/org/eclipse/jdt/core/JavaCore.html#COMPILER_PB_MISSING_JAVADOC_TAGS_METHOD_TYPE_PARAMETERS">COMPILER_PB_MISSING_JAVADOC_TAGS_METHOD_TYPE_PARAMETERS</a></b>)</td>
798
</tr>
799
<tr valign="top">
800
<td rowspan=2>Specify whether a missing <code>@param</code> for a type parameter in a method declaration should be reported.
801
When enabled, the compiler will issue a missing Javadoc tag error or warning for a type parameter without a 
802
corresponding <code>@param</code> tag.
803
<br>This option only has an effect if the compiler compliance is 1.5 or greater.</td>
804
<td><b><a href="../reference/api/org/eclipse/jdt/core/JavaCore.html#ENABLED">ENABLED</a></b></td>
805
</tr>
806
<tr valign="top">
807
<td><b><a href="../reference/api/org/eclipse/jdt/core/JavaCore.html#DISABLED"><i>DISABLED</i></a></b></td>
808
</tr>
809
810
<tr>
797
<td colspan=2><b>Visibility Level For Missing Javadoc Tags</b> (<b><a href="../reference/api/org/eclipse/jdt/core/JavaCore.html#COMPILER_PB_MISSING_JAVADOC_TAGS_VISIBILITY">COMPILER_PB_MISSING_JAVADOC_TAGS_VISIBILITY</a></b>)</td>
811
<td colspan=2><b>Visibility Level For Missing Javadoc Tags</b> (<b><a href="../reference/api/org/eclipse/jdt/core/JavaCore.html#COMPILER_PB_MISSING_JAVADOC_TAGS_VISIBILITY">COMPILER_PB_MISSING_JAVADOC_TAGS_VISIBILITY</a></b>)</td>
798
</tr>
812
</tr>
799
<tr valign="top">
813
<tr valign="top">

Return to bug 322581