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

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/compiler/regression/DeprecatedTest.java (+292 lines)
Lines 796-801 Link Here
796
		// javac options
796
		// javac options
797
		JavacTestOptions.Excuse.EclipseWarningConfiguredAsError /* javac test options */);
797
		JavacTestOptions.Excuse.EclipseWarningConfiguredAsError /* javac test options */);
798
}
798
}
799
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=247206
800
public void test020() {
801
	Map customOptions = new HashMap();
802
	customOptions.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.ERROR);
803
	customOptions.put(CompilerOptions.OPTION_ReportDeprecationWhenOverridingDeprecatedMethod, CompilerOptions.IGNORE);
804
	
805
	this.runConformTest(
806
			new String[] {
807
					"test1/E.java",
808
					"package test1;\n" + 
809
					"\n" + 
810
					"public class E implements I {\n" + 
811
					"	public I2 foo() {\n" + 
812
					"		return null;\n" + 
813
					"	}\n" + 
814
					"}\n" + 
815
					"interface I {\n" + 
816
					"	/** @deprecated */\n" + 
817
					"	public I2 foo();\n" + 
818
					"}\n" + 
819
					"/** @deprecated */\n" + 
820
					"interface I2 {}",
821
			},
822
			"", // expected output
823
			null,
824
			true, // flush previous output dir content
825
			null, // special vm args
826
			customOptions,  // custom options
827
			null); // custom requestor
828
}
829
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=247206
830
public void test021() {
831
	Map customOptions = new HashMap();
832
	customOptions.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.ERROR);
833
	customOptions.put(CompilerOptions.OPTION_ReportDeprecationWhenOverridingDeprecatedMethod, CompilerOptions.IGNORE);
834
	
835
	this.runConformTest(
836
			new String[] {
837
				"test1/E.java",
838
				"package test1;\n" + 
839
				"\n" + 
840
				"public class E implements I {\n" + 
841
				"	public I2 foo() {\n" + 
842
				"		return null;\n" + 
843
				"	}\n" + 
844
				"}\n" + 
845
				"interface I {\n" + 
846
				"	/** @deprecated */\n" + 
847
				"	public I2 foo();\n" + 
848
				"}\n",
849
				"test1/I2.java",
850
				"package test1;\n" + 
851
				"/** @deprecated */\n" + 
852
				"interface I2 {}",
853
			},
854
			"", // expected output
855
			null,
856
			true, // flush previous output dir content
857
			null, // special vm args
858
			customOptions,  // custom options
859
			null); // custom requestor
860
}
861
862
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=247206, additional tests that verify that
863
// deprecation messages originate from type parameters, bounds, arguments, return types,
864
// local variables, exception specifications etc. Valid only for 1.5 and above
865
public void test022() {
866
    if (this.complianceLevel <= ClassFileConstants.JDK1_4)
867
        return;
868
    Map customOptions = new HashMap();
869
    customOptions.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.ERROR);
870
    customOptions.put(CompilerOptions.OPTION_ReportDeprecationInDeprecatedCode, CompilerOptions.ENABLED);
871
    customOptions.put(CompilerOptions.OPTION_ReportDeprecationWhenOverridingDeprecatedMethod, CompilerOptions.IGNORE);
872
    
873
    this.runNegativeTest(
874
            // test directory preparation
875
            true /* flush output directory */,
876
            new String[] {
877
                "test1/E.java",
878
                "package test1;\n" + 
879
                "\n" + 
880
                "public class E implements I {\n" + 
881
                "   public <T extends I2 & I2.I3> I2 foo(I2 i2) throws Xception {\n" + 
882
                "       I2 p = null; \n" +
883
                "       return p;\n" + 
884
                "   }\n" + 
885
                "}\n" + 
886
                "interface I {\n" + 
887
                "   /** @deprecated */\n" + 
888
                "   public <T extends I2 & I2.I3> I2 foo(I2 i2) throws Xception;\n" + 
889
                "}\n",
890
                "test1/I2.java",
891
                "package test1;\n" + 
892
                "/** @deprecated */\n" + 
893
                "interface I2 { /** @deprecated */ interface I3 {} }\n" +
894
                "/** @deprecated */\n" + 
895
                "class Xception extends Throwable {\n" +
896
                "   private static final long serialVersionUID = 1L;\n}\n",
897
            },
898
            // compiler options
899
            null /* no class libraries */,
900
            customOptions /* custom options */,
901
            "----------\n" +  // expected output
902
            "1. ERROR in test1\\E.java (at line 4)\n" + 
903
            "\tpublic <T extends I2 & I2.I3> I2 foo(I2 i2) throws Xception {\n" + 
904
            "\t                  ^^\n" + 
905
            "The type I2 is deprecated\n" + 
906
            "----------\n" + 
907
            "2. ERROR in test1\\E.java (at line 4)\n" + 
908
            "\tpublic <T extends I2 & I2.I3> I2 foo(I2 i2) throws Xception {\n" + 
909
            "\t                       ^^^^^\n" + 
910
            "The type I2 is deprecated\n" + 
911
            "----------\n" + 
912
            "3. ERROR in test1\\E.java (at line 4)\n" + 
913
            "\tpublic <T extends I2 & I2.I3> I2 foo(I2 i2) throws Xception {\n" + 
914
            "\t                       ^^^^^\n" + 
915
            "The type I2.I3 is deprecated\n" + 
916
            "----------\n" + 
917
            "4. ERROR in test1\\E.java (at line 4)\n" + 
918
            "\tpublic <T extends I2 & I2.I3> I2 foo(I2 i2) throws Xception {\n" + 
919
            "\t                              ^^\n" + 
920
            "The type I2 is deprecated\n" + 
921
            "----------\n" + 
922
            "5. ERROR in test1\\E.java (at line 4)\n" + 
923
            "\tpublic <T extends I2 & I2.I3> I2 foo(I2 i2) throws Xception {\n" + 
924
            "\t                                     ^^\n" + 
925
            "The type I2 is deprecated\n" + 
926
            "----------\n" + 
927
            "6. ERROR in test1\\E.java (at line 4)\n" + 
928
            "\tpublic <T extends I2 & I2.I3> I2 foo(I2 i2) throws Xception {\n" + 
929
            "\t                                                   ^^^^^^^^\n" + 
930
            "The type Xception is deprecated\n" + 
931
            "----------\n" + 
932
            "7. ERROR in test1\\E.java (at line 5)\n" + 
933
            "\tI2 p = null; \n" + 
934
            "\t^^\n" + 
935
            "The type I2 is deprecated\n" + 
936
            "----------\n" + 
937
            "8. ERROR in test1\\E.java (at line 11)\n" + 
938
            "\tpublic <T extends I2 & I2.I3> I2 foo(I2 i2) throws Xception;\n" + 
939
            "\t                  ^^\n" + 
940
            "The type I2 is deprecated\n" + 
941
            "----------\n" + 
942
            "9. ERROR in test1\\E.java (at line 11)\n" + 
943
            "\tpublic <T extends I2 & I2.I3> I2 foo(I2 i2) throws Xception;\n" + 
944
            "\t                       ^^^^^\n" + 
945
            "The type I2 is deprecated\n" + 
946
            "----------\n" + 
947
            "10. ERROR in test1\\E.java (at line 11)\n" + 
948
            "\tpublic <T extends I2 & I2.I3> I2 foo(I2 i2) throws Xception;\n" + 
949
            "\t                       ^^^^^\n" + 
950
            "The type I2.I3 is deprecated\n" + 
951
            "----------\n" + 
952
            "11. ERROR in test1\\E.java (at line 11)\n" + 
953
            "\tpublic <T extends I2 & I2.I3> I2 foo(I2 i2) throws Xception;\n" + 
954
            "\t                              ^^\n" + 
955
            "The type I2 is deprecated\n" + 
956
            "----------\n" + 
957
            "12. ERROR in test1\\E.java (at line 11)\n" + 
958
            "\tpublic <T extends I2 & I2.I3> I2 foo(I2 i2) throws Xception;\n" + 
959
            "\t                                     ^^\n" + 
960
            "The type I2 is deprecated\n" + 
961
            "----------\n" + 
962
            "13. ERROR in test1\\E.java (at line 11)\n" + 
963
            "\tpublic <T extends I2 & I2.I3> I2 foo(I2 i2) throws Xception;\n" + 
964
            "\t                                                   ^^^^^^^^\n" + 
965
            "The type Xception is deprecated\n" + 
966
            "----------\n",
967
            // javac options
968
            JavacTestOptions.Excuse.EclipseWarningConfiguredAsError /* javac test options */
969
            );    
970
}
971
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=247206, verify that none of the 13 errros produced
972
// by test022 show up when deprecation reporting in an already deprecated context is disabled.
973
public void test023() {
974
    if (this.complianceLevel <= ClassFileConstants.JDK1_4)
975
        return;
976
    Map customOptions = new HashMap();
977
    customOptions.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.ERROR);
978
    customOptions.put(CompilerOptions.OPTION_ReportDeprecationInDeprecatedCode, CompilerOptions.DISABLED);
979
    customOptions.put(CompilerOptions.OPTION_ReportDeprecationWhenOverridingDeprecatedMethod, CompilerOptions.IGNORE);
980
    
981
    this.runConformTest(
982
            new String[] {
983
                "test1/E.java",
984
                "package test1;\n" + 
985
                "\n" + 
986
                "public class E implements I {\n" + 
987
                "   public <T extends I2 & I2.I3> I2 foo(I2 i2) throws Xception {\n" + 
988
                "       I2 p = null; \n" +
989
                "       return p;\n" + 
990
                "   }\n" + 
991
                "}\n" + 
992
                "interface I {\n" + 
993
                "   /** @deprecated */\n" + 
994
                "   public <T extends I2 & I2.I3> I2 foo(I2 i2) throws Xception;\n" + 
995
                "}\n",
996
                "test1/I2.java",
997
                "package test1;\n" + 
998
                "/** @deprecated */\n" + 
999
                "interface I2 { /** @deprecated */ interface I3 {} }\n" +
1000
                "/** @deprecated */\n" + 
1001
                "class Xception extends Throwable {\n" +
1002
                "   private static final long serialVersionUID = 1L;\n}\n",
1003
                },
1004
            "", // expected output
1005
            null,
1006
            true, // flush previous output dir content
1007
            null, // special vm args
1008
            customOptions,  // custom options
1009
            null); // custom requestor
1010
}
1011
1012
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=247206, Note : foo in class E is not overriding
1013
// foo in interface I in this test. It is a new method and as such is not deprecated implicitly.
1014
public void test024() {
1015
 if (this.complianceLevel <= ClassFileConstants.JDK1_4)
1016
     return;
1017
 Map customOptions = new HashMap();
1018
 customOptions.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.ERROR);
1019
 customOptions.put(CompilerOptions.OPTION_ReportDeprecationInDeprecatedCode, CompilerOptions.DISABLED);
1020
 customOptions.put(CompilerOptions.OPTION_ReportDeprecationWhenOverridingDeprecatedMethod, CompilerOptions.IGNORE);
1021
 
1022
 this.runNegativeTest(
1023
         // test directory preparation
1024
         true /* flush output directory */,
1025
         new String[] {
1026
             "test1/E.java",
1027
             "package test1;\n" + 
1028
             "\n" + 
1029
             "public abstract class E implements I {\n" + 
1030
             "   public <T extends I2 & I2.I3> I2 foo(I2 i2) throws Xception {\n" + 
1031
             "       I2 p = null; \n" +
1032
             "       return p;\n" + 
1033
             "   }\n" + 
1034
             "}\n" + 
1035
             "interface I {\n" + 
1036
             "   /** @deprecated */\n" + 
1037
             "   public <T extends I2 & I2.I3> I2 foo() throws Xception;\n" + 
1038
             "}\n",
1039
             "test1/I2.java",
1040
             "package test1;\n" + 
1041
             "/** @deprecated */\n" + 
1042
             "interface I2 { /** @deprecated */ interface I3 {} }\n" +
1043
             "/** @deprecated */\n" + 
1044
             "class Xception extends Throwable {\n" +
1045
             "   private static final long serialVersionUID = 1L;\n}\n",
1046
             },
1047
             // compiler options
1048
             null /* no class libraries */,
1049
             customOptions /* custom options */,
1050
             "----------\n" + 
1051
             "1. ERROR in test1\\E.java (at line 4)\n" + 
1052
             "\tpublic <T extends I2 & I2.I3> I2 foo(I2 i2) throws Xception {\n" + 
1053
             "\t                  ^^\n" + 
1054
             "The type I2 is deprecated\n" + 
1055
             "----------\n" + 
1056
             "2. ERROR in test1\\E.java (at line 4)\n" + 
1057
             "\tpublic <T extends I2 & I2.I3> I2 foo(I2 i2) throws Xception {\n" + 
1058
             "\t                       ^^^^^\n" + 
1059
             "The type I2.I3 is deprecated\n" + 
1060
             "----------\n" + 
1061
             "3. ERROR in test1\\E.java (at line 4)\n" + 
1062
             "\tpublic <T extends I2 & I2.I3> I2 foo(I2 i2) throws Xception {\n" + 
1063
             "\t                       ^^^^^\n" + 
1064
             "The type I2 is deprecated\n" + 
1065
             "----------\n" + 
1066
             "4. ERROR in test1\\E.java (at line 4)\n" + 
1067
             "\tpublic <T extends I2 & I2.I3> I2 foo(I2 i2) throws Xception {\n" + 
1068
             "\t                              ^^\n" + 
1069
             "The type I2 is deprecated\n" + 
1070
             "----------\n" + 
1071
             "5. ERROR in test1\\E.java (at line 4)\n" + 
1072
             "\tpublic <T extends I2 & I2.I3> I2 foo(I2 i2) throws Xception {\n" + 
1073
             "\t                                     ^^\n" + 
1074
             "The type I2 is deprecated\n" + 
1075
             "----------\n" + 
1076
             "6. ERROR in test1\\E.java (at line 4)\n" + 
1077
             "\tpublic <T extends I2 & I2.I3> I2 foo(I2 i2) throws Xception {\n" + 
1078
             "\t                                                   ^^^^^^^^\n" + 
1079
             "The type Xception is deprecated\n" + 
1080
             "----------\n" + 
1081
             "7. ERROR in test1\\E.java (at line 5)\n" + 
1082
             "\tI2 p = null; \n" + 
1083
             "\t^^\n" + 
1084
             "The type I2 is deprecated\n" + 
1085
             "----------\n",
1086
             // javac options
1087
             JavacTestOptions.Excuse.EclipseWarningConfiguredAsError /* javac test options */
1088
             );    
1089
}
1090
799
public static Class testClass() {
1091
public static Class testClass() {
800
	return DeprecatedTest.class;
1092
	return DeprecatedTest.class;
801
}
1093
}
(-)compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java (-1 / +77 lines)
Lines 14-19 Link Here
14
import java.io.CharConversionException;
14
import java.io.CharConversionException;
15
import java.io.PrintWriter;
15
import java.io.PrintWriter;
16
import java.io.StringWriter;
16
import java.io.StringWriter;
17
import java.util.ArrayList;
17
import java.util.Iterator;
18
import java.util.Iterator;
18
import java.util.List;
19
import java.util.List;
19
20
Lines 89-94 Link Here
89
import org.eclipse.jdt.internal.compiler.lookup.InvocationSite;
90
import org.eclipse.jdt.internal.compiler.lookup.InvocationSite;
90
import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
91
import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
91
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
92
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
93
import org.eclipse.jdt.internal.compiler.lookup.MethodScope;
92
import org.eclipse.jdt.internal.compiler.lookup.ParameterizedGenericMethodBinding;
94
import org.eclipse.jdt.internal.compiler.lookup.ParameterizedGenericMethodBinding;
93
import org.eclipse.jdt.internal.compiler.lookup.ProblemMethodBinding;
95
import org.eclipse.jdt.internal.compiler.lookup.ProblemMethodBinding;
94
import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons;
96
import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons;
Lines 119-124 Link Here
119
	  FIELD_ACCESS = 0x4,
121
	  FIELD_ACCESS = 0x4,
120
	  CONSTRUCTOR_ACCESS = 0x8,
122
	  CONSTRUCTOR_ACCESS = 0x8,
121
	  METHOD_ACCESS = 0xC;
123
	  METHOD_ACCESS = 0xC;
124
	
125
	private interface IDeferredProblem {
126
		void doubleCheckIfProblemPersists();
127
	}
128
	
129
	private class DeferredDeprecationProblem implements IDeferredProblem {
130
		private TypeBinding type;
131
		private ASTNode location;
132
		private Scope scope;
133
		private int severity;
134
		public DeferredDeprecationProblem(TypeBinding type, ASTNode location, Scope scope, int severity) {
135
			this.type = type;
136
			this.location = location;
137
			this.scope = scope;
138
			this.severity = severity;
139
		}
140
		public void doubleCheckIfProblemPersists() {
141
			// Double check now. It is the responsibility of the outer layer to ensure that, the element of
142
			// ambiguity/uncertainty that caused us to reserve judgment has gone away now.
143
			if (this.location.isTypeUseDeprecated(this.type, this.scope)) {
144
				this.scope.problemReporter().deprecatedType(this.type, this.location, this.severity);
145
			}			
146
		}
147
	}
148
	private ArrayList deferredProblems = null;
122
149
123
public ProblemReporter(IErrorHandlingPolicy policy, CompilerOptions options, IProblemFactory problemFactory) {
150
public ProblemReporter(IErrorHandlingPolicy policy, CompilerOptions options, IProblemFactory problemFactory) {
124
	super(policy, options, problemFactory);
151
	super(policy, options, problemFactory);
Lines 1366-1375 Link Here
1366
			location.sourceEnd);
1393
			location.sourceEnd);
1367
	}
1394
	}
1368
}
1395
}
1369
public void deprecatedType(TypeBinding type, ASTNode location) {
1396
public void deprecatedType(TypeBinding type, ASTNode location, Scope scope) {
1370
	if (location == null) return; // 1G828DN - no type ref for synthetic arguments
1397
	if (location == null) return; // 1G828DN - no type ref for synthetic arguments
1371
	int severity = computeSeverity(IProblem.UsingDeprecatedType);
1398
	int severity = computeSeverity(IProblem.UsingDeprecatedType);
1372
	if (severity == ProblemSeverities.Ignore) return;
1399
	if (severity == ProblemSeverities.Ignore) return;
1400
	if (!isTypeUseDeprecatedForSure(scope)) {
1401
		// Defer problem reporting till later when we can be sure.
1402
		scope.compilationUnitScope().problemReporter().recordDeferredProblem(new DeferredDeprecationProblem(type, location, scope, severity));
1403
		return;
1404
	}
1405
	deprecatedType(type, location, severity);
1406
}
1407
1408
void deprecatedType(TypeBinding type, ASTNode location, int severity) {
1373
	type = type.leafComponentType();
1409
	type = type.leafComponentType();
1374
	this.handle(
1410
	this.handle(
1375
		IProblem.UsingDeprecatedType,
1411
		IProblem.UsingDeprecatedType,
Lines 1379-1384 Link Here
1379
		location.sourceStart,
1415
		location.sourceStart,
1380
		nodeSourceEnd(null, location));
1416
		nodeSourceEnd(null, location));
1381
}
1417
}
1418
1419
private void recordDeferredProblem(IDeferredProblem aDeferredProblem) {
1420
	if (this.deferredProblems == null)
1421
		this.deferredProblems = new ArrayList(4);
1422
	this.deferredProblems.add(aDeferredProblem);
1423
}
1424
1425
private boolean isTypeUseDeprecatedForSure(Scope scope) {
1426
	if (!scope.compilerOptions().reportDeprecationInsideDeprecatedCode) {
1427
		// Don't be too eager in reporting a deprecated type usage, IFF we got here while analyzing
1428
		// method signatures (CompilationUnitScope.faultInTypes). We cannot conclusively say (until
1429
		// method verification) whether the method is really an implementation of a deprecated interface.
1430
		// https://bugs.eclipse.org/bugs/show_bug.cgi?id=247206
1431
		if (scope instanceof MethodScope) {
1432
			MethodScope mScope = (MethodScope) scope;
1433
			if (!mScope.isInsideInitializer()) {
1434
				MethodBinding method = ((AbstractMethodDeclaration) mScope.referenceContext).binding;
1435
				if (method != null && (method.modifiers & ExtraCompilerModifiers.AccUnresolved) != 0) {
1436
					return false;
1437
				}	
1438
			}
1439
		}
1440
	}
1441
	return true;
1442
}
1443
1382
public void disallowedTargetForAnnotation(Annotation annotation) {
1444
public void disallowedTargetForAnnotation(Annotation annotation) {
1383
	this.handle(
1445
	this.handle(
1384
		IProblem.DisallowedTargetForAnnotation,
1446
		IProblem.DisallowedTargetForAnnotation,
Lines 1998-2003 Link Here
1998
			problemEndPosition);
2060
			problemEndPosition);
1999
}
2061
}
2000
2062
2063
public void handleDeferredDeprecationProblems() {
2064
	if (this.deferredProblems == null)
2065
		return;
2066
	for (int i = this.deferredProblems.size() - 1; i >= 0; --i) {
2067
		Object problem = this.deferredProblems.get(i);
2068
		if (problem instanceof DeferredDeprecationProblem) {
2069
			((DeferredDeprecationProblem) problem).doubleCheckIfProblemPersists();
2070
			this.deferredProblems.remove(i);
2071
		}
2072
	}
2073
	if (this.deferredProblems.isEmpty())
2074
		this.deferredProblems = null;
2075
}
2076
2001
public void hiddenCatchBlock(ReferenceBinding exceptionType, ASTNode location) {
2077
public void hiddenCatchBlock(ReferenceBinding exceptionType, ASTNode location) {
2002
	this.handle(
2078
	this.handle(
2003
		IProblem.MaskedCatch,
2079
		IProblem.MaskedCatch,
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java (-1 / +7 lines)
Lines 168-175 Link Here
168
			if(inheritedMethod.isSynchronized() && !currentMethod.isSynchronized()) {
168
			if(inheritedMethod.isSynchronized() && !currentMethod.isSynchronized()) {
169
				problemReporter(currentMethod).missingSynchronizedOnInheritedMethod(currentMethod, inheritedMethod);
169
				problemReporter(currentMethod).missingSynchronizedOnInheritedMethod(currentMethod, inheritedMethod);
170
			}
170
			}
171
			// https://bugs.eclipse.org/bugs/show_bug.cgi?id=247206
172
			boolean currentMethodIsViewedDeprecated = currentMethod.isViewedAsDeprecated();
173
			if (inheritedMethod.isViewedAsDeprecated()) {
174
				if (currentMethod.isImplementing() && !currentMethodIsViewedDeprecated)
175
					currentMethod.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly;
176
			}
171
			if (options.reportDeprecationWhenOverridingDeprecatedMethod && inheritedMethod.isViewedAsDeprecated()) {
177
			if (options.reportDeprecationWhenOverridingDeprecatedMethod && inheritedMethod.isViewedAsDeprecated()) {
172
				if (!currentMethod.isViewedAsDeprecated() || options.reportDeprecationInsideDeprecatedCode) {
178
				if (!currentMethodIsViewedDeprecated || options.reportDeprecationInsideDeprecatedCode) {
173
					// check against the other inherited methods to see if they hide this inheritedMethod
179
					// check against the other inherited methods to see if they hide this inheritedMethod
174
					ReferenceBinding declaringClass = inheritedMethod.declaringClass;
180
					ReferenceBinding declaringClass = inheritedMethod.declaringClass;
175
					if (declaringClass.isInterface())
181
					if (declaringClass.isInterface())
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java (-2 / +2 lines)
Lines 461-467 Link Here
461
	if (invocationSite instanceof ASTNode) {
461
	if (invocationSite instanceof ASTNode) {
462
		ASTNode invocationNode = (ASTNode) invocationSite;
462
		ASTNode invocationNode = (ASTNode) invocationSite;
463
		if (invocationNode.isTypeUseDeprecated(referenceBinding, this)) {
463
		if (invocationNode.isTypeUseDeprecated(referenceBinding, this)) {
464
			problemReporter().deprecatedType(referenceBinding, invocationNode);
464
			problemReporter().deprecatedType(referenceBinding, invocationNode, this);
465
		}
465
		}
466
	}
466
	}
467
	while (currentIndex < length) {
467
	while (currentIndex < length) {
Lines 501-507 Link Here
501
			referenceBinding = (ReferenceBinding) binding;
501
			referenceBinding = (ReferenceBinding) binding;
502
			ASTNode invocationNode = (ASTNode) invocationSite;
502
			ASTNode invocationNode = (ASTNode) invocationSite;
503
			if (invocationNode.isTypeUseDeprecated(referenceBinding, this)) {
503
			if (invocationNode.isTypeUseDeprecated(referenceBinding, this)) {
504
				problemReporter().deprecatedType(referenceBinding, invocationNode);
504
				problemReporter().deprecatedType(referenceBinding, invocationNode, this);
505
			}
505
			}
506
		}
506
		}
507
	}
507
	}
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java (-1 / +4 lines)
Lines 386-392 Link Here
386
					? ((ProblemReferenceBinding) referenceBinding).closestMatch
386
					? ((ProblemReferenceBinding) referenceBinding).closestMatch
387
					: referenceBinding;
387
					: referenceBinding;
388
				if (importReference.isTypeUseDeprecated(typeToCheck, this))
388
				if (importReference.isTypeUseDeprecated(typeToCheck, this))
389
					problemReporter().deprecatedType(typeToCheck, importReference);
389
					problemReporter().deprecatedType(typeToCheck, importReference, this);
390
390
391
				ReferenceBinding existingType = typesBySimpleNames.get(compoundName[compoundName.length - 1]);
391
				ReferenceBinding existingType = typesBySimpleNames.get(compoundName[compoundName.length - 1]);
392
				if (existingType != null) {
392
				if (existingType != null) {
Lines 812-816 Link Here
812
public void verifyMethods(MethodVerifier verifier) {
812
public void verifyMethods(MethodVerifier verifier) {
813
	for (int i = 0, length = this.topLevelTypes.length; i < length; i++)
813
	for (int i = 0, length = this.topLevelTypes.length; i < length; i++)
814
		this.topLevelTypes[i].verifyMethods(verifier);
814
		this.topLevelTypes[i].verifyMethods(verifier);
815
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=247206, if we have deferred any
816
	// deprecation messages, flush them now.
817
	this.problemReporter().handleDeferredDeprecationProblems();
815
}
818
}
816
}
819
}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java (-1 / +1 lines)
Lines 70-76 Link Here
70
			}
70
			}
71
		}
71
		}
72
		if (isTypeUseDeprecated(memberType, scope))
72
		if (isTypeUseDeprecated(memberType, scope))
73
			scope.problemReporter().deprecatedType(memberType, this);
73
			scope.problemReporter().deprecatedType(memberType, this, scope);
74
		memberType = scope.environment().convertToRawType(memberType, false /*do not force conversion of enclosing types*/);
74
		memberType = scope.environment().convertToRawType(memberType, false /*do not force conversion of enclosing types*/);
75
		if (memberType.isRawType()
75
		if (memberType.isRawType()
76
				&& (this.bits & IgnoreRawTypeCheck) == 0
76
				&& (this.bits & IgnoreRawTypeCheck) == 0
(-)compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java (-1 / +1 lines)
Lines 167-173 Link Here
167
}
167
}
168
168
169
protected void reportDeprecatedType(TypeBinding type, Scope scope) {
169
protected void reportDeprecatedType(TypeBinding type, Scope scope) {
170
	scope.problemReporter().deprecatedType(type, this);
170
	scope.problemReporter().deprecatedType(type, this, scope);
171
}
171
}
172
172
173
protected void reportInvalidType(Scope scope) {
173
protected void reportInvalidType(Scope scope) {
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java (-1 / +1 lines)
Lines 155-161 Link Here
155
				return null;
155
				return null;
156
			}
156
			}
157
			if (isTypeUseDeprecated(currentType, scope))
157
			if (isTypeUseDeprecated(currentType, scope))
158
				scope.problemReporter().deprecatedType(currentType, this);
158
				scope.problemReporter().deprecatedType(currentType, this, scope);
159
			ReferenceBinding currentEnclosing = currentType.enclosingType();
159
			ReferenceBinding currentEnclosing = currentType.enclosingType();
160
			if (currentEnclosing != null && currentEnclosing.erasure() != enclosingType.erasure()) {
160
			if (currentEnclosing != null && currentEnclosing.erasure() != enclosingType.erasure()) {
161
				enclosingType = currentEnclosing; // inherited member type, leave it associated with its enclosing rather than subtype
161
				enclosingType = currentEnclosing; // inherited member type, leave it associated with its enclosing rather than subtype
(-)compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java (-1 / +1 lines)
Lines 884-890 Link Here
884
				//deprecated test
884
				//deprecated test
885
				TypeBinding type = (TypeBinding)this.binding;
885
				TypeBinding type = (TypeBinding)this.binding;
886
				if (isTypeUseDeprecated(type, scope))
886
				if (isTypeUseDeprecated(type, scope))
887
					scope.problemReporter().deprecatedType(type, this);
887
					scope.problemReporter().deprecatedType(type, this, scope);
888
				type = scope.environment().convertToRawType(type, false /*do not force conversion of enclosing types*/);
888
				type = scope.environment().convertToRawType(type, false /*do not force conversion of enclosing types*/);
889
				return this.resolvedType = type;
889
				return this.resolvedType = type;
890
		}
890
		}

Return to bug 247206