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 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_ReportUnusedParameter, CompilerOptions.ERROR);
2759
    customOptions.put(CompilerOptions.OPTION_ReportUnusedParameterIncludeDocCommentReference,
2760
             CompilerOptions.ENABLED);
2761
2762
    this.runConformTest(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() {\n"+
2772
            "	}\n"+
2773
            "}\n"
2774
            },
2775
            null /* no expected output string */,
2776
            null /* no extra class libraries */,
2777
            true /* flush output directory */,
2778
            null /* no vm arguments */,
2779
            customOptions,
2780
            null /* no custom requestor*/,
2781
            false /* do not skip javac for this peculiar test */);
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/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
				Binding binding = param.binding != null ? param.binding : scope.getType(param.token);
592
				if (binding != null && binding.isValidBinding() && binding instanceof TypeVariableBinding) {
593
					TypeVariableBinding typeVariableBinding = (TypeVariableBinding) binding;
594
					typeVariableBinding.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