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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java (+35 lines)
Lines 10-17 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.compiler.lookup;
11
package org.eclipse.jdt.internal.compiler.lookup;
12
12
13
14
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
15
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
16
import org.eclipse.jdt.internal.compiler.ast.Argument;
13
import org.eclipse.jdt.internal.compiler.ast.TypeParameter;
17
import org.eclipse.jdt.internal.compiler.ast.TypeParameter;
14
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
18
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
19
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
20
import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
15
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject;
21
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject;
16
import org.eclipse.jdt.internal.compiler.util.SimpleSet;
22
import org.eclipse.jdt.internal.compiler.util.SimpleSet;
17
23
Lines 398-403 Link Here
398
404
399
	return false;
405
	return false;
400
}
406
}
407
408
void reportRawReferences() {
409
	char[][] methodSelectors = this.currentMethods.keyTable;
410
	nextSelector : for (int s = methodSelectors.length; --s >= 0;) {
411
		if (methodSelectors[s] == null) continue nextSelector;
412
		MethodBinding[] current = (MethodBinding[]) this.currentMethods.get(methodSelectors[s]);
413
		for (int i = 0, length = current.length; i < length; i++) {
414
			MethodBinding currentMethod = current[i];
415
			if ((currentMethod.modifiers & (ExtraCompilerModifiers.AccImplementing | ExtraCompilerModifiers.AccOverriding)) == 0) {
416
				AbstractMethodDeclaration methodDecl = currentMethod.sourceMethod();
417
				if (methodDecl == null) return;
418
				TypeBinding [] parameterTypes = currentMethod.parameters;
419
				Argument[] arguments = methodDecl.arguments;
420
421
				for (int j = 0, size = currentMethod.parameters.length; j < size; j++) {
422
					TypeBinding parameterType = parameterTypes[j];
423
					Argument arg = arguments[j];
424
					if (parameterType.leafComponentType().isRawType()
425
					&& (arg.type.bits & ASTNode.IgnoreRawTypeCheck) == 0
426
                    && methodDecl.scope.compilerOptions().getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore) {
427
						methodDecl.scope.problemReporter().rawTypeReference(arg.type, parameterType);
428
				}
429
			}
430
		}
431
		}
432
	}
433
}
401
void checkMethods() {
434
void checkMethods() {
402
	boolean mustImplementAbstractMethods = mustImplementAbstractMethods();
435
	boolean mustImplementAbstractMethods = mustImplementAbstractMethods();
403
	boolean skipInheritedMethods = mustImplementAbstractMethods && canSkipInheritedMethods(); // have a single concrete superclass so only check overridden methods
436
	boolean skipInheritedMethods = mustImplementAbstractMethods && canSkipInheritedMethods(); // have a single concrete superclass so only check overridden methods
Lines 903-908 Link Here
903
		this.type.detectAnnotationCycle();
936
		this.type.detectAnnotationCycle();
904
937
905
	super.verify();
938
	super.verify();
939
	
940
	reportRawReferences();
906
941
907
	for (int i = this.type.typeVariables.length; --i >= 0;) {
942
	for (int i = this.type.typeVariables.length; --i >= 0;) {
908
		TypeVariableBinding var = this.type.typeVariables[i];
943
		TypeVariableBinding var = this.type.typeVariables[i];
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java (+5 lines)
Lines 1377-1383 Link Here
1377
			if (arg.annotations != null) {
1377
			if (arg.annotations != null) {
1378
				method.tagBits |= TagBits.HasParameterAnnotations;
1378
				method.tagBits |= TagBits.HasParameterAnnotations;
1379
			}
1379
			}
1380
			boolean ignoreRawTypeCheck = (arg.type.bits & ASTNode.IgnoreRawTypeCheck) != 0;
1381
			arg.type.bits |= ASTNode.IgnoreRawTypeCheck;
1380
			TypeBinding parameterType = arg.type.resolveType(methodDecl.scope, true /* check bounds*/);
1382
			TypeBinding parameterType = arg.type.resolveType(methodDecl.scope, true /* check bounds*/);
1383
			if (!ignoreRawTypeCheck) 
1384
				arg.type.bits &= ~ASTNode.IgnoreRawTypeCheck;
1385
			
1381
			if (parameterType == null) {
1386
			if (parameterType == null) {
1382
				foundArgProblem = true;
1387
				foundArgProblem = true;
1383
			} else if (parameterType == TypeBinding.VOID) {
1388
			} else if (parameterType == TypeBinding.VOID) {
(-)src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java (+21 lines)
Lines 536-539 Link Here
536
            },
536
            },
537
            ""); // no specific success output string
537
            ""); // no specific success output string
538
}
538
}
539
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=322817
540
public void test322817() {
541
	this.runNegativeTest(
542
			new String[] {
543
					"X.java",
544
					"interface Adaptable {\n" +
545
					"    public Object getAdapter(Class clazz);    \n" +
546
					"}\n" +
547
					"public class X implements Adaptable {\n" +
548
					"    public Object getAdapter(Class clazz) {\n" +
549
					"        return null;\n" +
550
					"    }\n" +
551
					"}\n"
552
			},
553
			"----------\n" + 
554
			"1. WARNING in X.java (at line 2)\n" + 
555
			"	public Object getAdapter(Class clazz);    \n" + 
556
			"	                         ^^^^^\n" + 
557
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
558
			"----------\n");
559
}
539
}
560
}

Return to bug 322817