Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 397888 | Differences between
and this patch

Collapse All | Expand All

(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java (-1 / +67 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
2
 * Copyright (c) 2000, 2013 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 2749-2753 Link Here
2749
		"}\n"
2749
		"}\n"
2750
		});
2750
		});
2751
}
2751
}
2752
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=397888
2753
public void test397888a() {
2754
	Map customOptions = getCompilerOptions();
2755
	customOptions.put(JavaCore.COMPILER_DOC_COMMENT_SUPPORT, JavaCore.ENABLED);
2756
	customOptions.put(CompilerOptions.OPTION_ReportUnusedTypeParameter, CompilerOptions.ERROR);
2757
	customOptions.put(CompilerOptions.OPTION_ReportUnusedParameter, CompilerOptions.ERROR);
2758
	customOptions.put(CompilerOptions.OPTION_ReportUnusedParameterIncludeDocCommentReference,
2759
	          CompilerOptions.ENABLED);
2752
2760
2761
	this.runNegativeTest(
2762
		 new String[] {
2763
 		"X.java",
2764
         "/***\n" +
2765
         " * @param <T>\n" +
2766
         " */\n" +
2767
         "public class X <T> {\n"+
2768
         "/***\n" +
2769
         " * @param <S>\n" +
2770
         " */\n" +
2771
         "	public <S> void ph(int i) {\n"+
2772
         "	}\n"+
2773
         "}\n"
2774
         },
2775
 		"----------\n" + 
2776
 		"1. ERROR in X.java (at line 8)\n" + 
2777
 		"	public <S> void ph(int i) {\n" + 
2778
 		"	                       ^\n" + 
2779
 		"The value of the parameter i is not used\n" + 
2780
 		"----------\n",
2781
 		null, true, customOptions);
2782
}        
2783
2784
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=397888
2785
public void test397888b() {
2786
	Map customOptions = getCompilerOptions();
2787
	customOptions.put(JavaCore.COMPILER_DOC_COMMENT_SUPPORT, JavaCore.ENABLED);
2788
	customOptions.put(CompilerOptions.OPTION_ReportUnusedTypeParameter, CompilerOptions.ERROR);
2789
	customOptions.put(CompilerOptions.OPTION_ReportUnusedParameterIncludeDocCommentReference,
2790
        CompilerOptions.DISABLED);
2791
2792
	this.runNegativeTest(
2793
        new String[] {
2794
     		   "X.java",
2795
                "/***\n" +
2796
                " * @param <T>\n" +
2797
                " */\n" +
2798
                "public class X <T> {\n"+
2799
                "/***\n" +
2800
                " * @param <S>\n" +
2801
                " */\n" +
2802
                "public <S> void ph() {\n"+
2803
                "}\n"+
2804
                "}\n"
2805
        },
2806
		"----------\n" + 
2807
		"1. ERROR in X.java (at line 4)\n" + 
2808
		"	public class X <T> {\n" + 
2809
		"	                ^\n" + 
2810
		"Unused type parameter T\n" + 
2811
		"----------\n" + 
2812
		"2. ERROR in X.java (at line 8)\n" + 
2813
		"	public <S> void ph() {\n" + 
2814
		"	        ^\n" + 
2815
		"Unused type parameter S\n" + 
2816
		"----------\n",
2817
		null, true, customOptions);
2818
}
2753
}
2819
}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java (-2 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
2
 * Copyright (c) 2000, 2013 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 493-500 Link Here
493
			return false;
493
			return false;
494
494
495
		ReferenceBinding refType = (ReferenceBinding) type;
495
		ReferenceBinding refType = (ReferenceBinding) type;
496
		// https://bugs.eclipse.org/bugs/show_bug.cgi?id=397888
496
		// https://bugs.eclipse.org/bugs/show_bug.cgi?id=385780
497
		// https://bugs.eclipse.org/bugs/show_bug.cgi?id=385780
497
		if (refType instanceof TypeVariableBinding) {
498
		if ((this.bits & ASTNode.InsideJavadoc) == 0  && refType instanceof TypeVariableBinding) {
498
			refType.modifiers |= ExtraCompilerModifiers.AccLocallyUsed;
499
			refType.modifiers |= ExtraCompilerModifiers.AccLocallyUsed;
499
		}
500
		}
500
		// ignore references insing Javadoc comments
501
		// ignore references insing Javadoc comments
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java (-1 / +6 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2013 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 604-609 Link Here
604
					TypeBinding paramBindind = param.internalResolveType(scope);
604
					TypeBinding paramBindind = param.internalResolveType(scope);
605
					if (paramBindind != null && paramBindind.isValidBinding()) {
605
					if (paramBindind != null && paramBindind.isValidBinding()) {
606
						if (paramBindind.isTypeVariable()) {
606
						if (paramBindind.isTypeVariable()) {
607
							// https://bugs.eclipse.org/bugs/show_bug.cgi?id=397888
608
							if (scope.compilerOptions().reportUnusedParameterIncludeDocCommentReference) {
609
								TypeVariableBinding typeVariableBinding = (TypeVariableBinding) paramBindind;
610
								typeVariableBinding.modifiers |= ExtraCompilerModifiers.AccLocallyUsed;
611
							}
607
							// Verify duplicated tags
612
							// Verify duplicated tags
608
							boolean duplicate = false;
613
							boolean duplicate = false;
609
							for (int j = 0; j < i && !duplicate; j++) {
614
							for (int j = 0; j < i && !duplicate; j++) {

Return to bug 397888