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 / +59 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 2750-2753 Link Here
2750
		});
2750
		});
2751
}
2751
}
2752
2752
2753
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=397888
2754
public void test397888a() {
2755
    Map customOptions = getCompilerOptions();
2756
	customOptions.put(JavaCore.COMPILER_DOC_COMMENT_SUPPORT, JavaCore.ENABLED);
2757
    customOptions.put(CompilerOptions.OPTION_ReportUnusedTypeParameter, CompilerOptions.ERROR);
2758
    customOptions.put(CompilerOptions.OPTION_ReportUnusedParameterIncludeDocCommentReference,
2759
             CompilerOptions.ENABLED);
2760
2761
    this.runConformTest(new String[] {
2762
    		"X.java",
2763
    		"public class X {\n"+
2764
    		"/***" +
2765
    		" * @param S" +
2766
    		" * @param t" +
2767
    		" * @param k" +
2768
    		" */" +
2769
    		"public <S> void ph(int t) {\n"+
2770
    		"}\n"+
2771
    		"}\n"
2772
            },
2773
            null /* no expected output string */,
2774
            null /* no extra class libraries */,
2775
            true /* flush output directory */,
2776
            null /* no vm arguments */,
2777
            customOptions,
2778
            null /* no custom requestor*/,
2779
            false /* do not skip javac for this peculiar test */);
2780
}
2781
2782
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=397888
2783
public void test397888b() {
2784
	Map customOptions = getCompilerOptions();
2785
	customOptions.put(JavaCore.COMPILER_DOC_COMMENT_SUPPORT, JavaCore.ENABLED);
2786
	customOptions.put(CompilerOptions.OPTION_ReportUnusedTypeParameter, CompilerOptions.ERROR);
2787
	customOptions.put(CompilerOptions.OPTION_ReportUnusedParameterIncludeDocCommentReference,
2788
           CompilerOptions.DISABLED);
2789
2790
	this.runNegativeTest(
2791
           new String[] {
2792
        		   "X.java",
2793
                   "public class X {\n"+
2794
                   "/***" +
2795
                   " * @param S" +
2796
                   " * @param t" +
2797
                   " * @param k" +
2798
                   " */" +
2799
                   "public <S> void ph(int t) {\n"+
2800
                   "}\n"+
2801
                   "}\n"
2802
           },
2803
   		"----------\n" + 
2804
   		"1. ERROR in X.java (at line 2)\n" + 
2805
   		"	/*** * @param S * @param t * @param k */public <S> void ph(int t) {\n" + 
2806
   		"	                                                ^\n" + 
2807
   		"Unused type parameter S\n" + 
2808
   		"----------\n",
2809
   		null, true, customOptions);
2810
}
2753
}
2811
}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java (-1 / +15 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 582-587 Link Here
582
			return;
582
			return;
583
		}
583
		}
584
584
585
		// https://bugs.eclipse.org/bugs/show_bug.cgi?id=397888
586
		boolean considerParamRefAsUsage = scope.compilerOptions().reportUnusedParameterIncludeDocCommentReference;
587
		if (considerParamRefAsUsage) {			
588
			int paramTagsSize = this.paramReferences == null ? 0 : this.paramReferences.length;
589
			for (int i = 0; i < paramTagsSize; i++) {
590
				JavadocSingleNameReference param = this.paramReferences[i];
591
				TypeBinding typeBinding = scope.getType(param.token);
592
				if (typeBinding != null && typeBinding instanceof ReferenceBinding) {
593
					ReferenceBinding referenceBinding = (ReferenceBinding) typeBinding;
594
					referenceBinding.modifiers |= ExtraCompilerModifiers.AccLocallyUsed;
595
				}
596
			}
597
		}
598
585
		// If no param tags then report a problem for each declaration type parameter
599
		// If no param tags then report a problem for each declaration type parameter
586
		if (parameters != null) {
600
		if (parameters != null) {
587
			// https://bugs.eclipse.org/bugs/show_bug.cgi?id=324850, avoid secondary errors when <= 1.4 
601
			// https://bugs.eclipse.org/bugs/show_bug.cgi?id=324850, avoid secondary errors when <= 1.4 

Return to bug 397888