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

Collapse All | Expand All

(-)codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnParameterizedQualifiedTypeReference.java (-4 / +4 lines)
Lines 72-84 Link Here
72
		return this.kind == K_EXCEPTION;
72
		return this.kind == K_EXCEPTION;
73
	}
73
	}
74
	
74
	
75
	public TypeBinding resolveType(BlockScope scope, boolean checkBounds) {
75
	public TypeBinding resolveType(BlockScope scope, int mode) {
76
		super.resolveType(scope, checkBounds);
76
		super.resolveType(scope, mode);
77
		throw new CompletionNodeFound(this, this.resolvedType, scope);
77
		throw new CompletionNodeFound(this, this.resolvedType, scope);
78
	}
78
	}
79
	
79
	
80
	public TypeBinding resolveType(ClassScope scope) {
80
	public TypeBinding resolveType(ClassScope scope, int checkMode) {
81
		super.resolveType(scope);
81
		super.resolveType(scope, checkMode);
82
		throw new CompletionNodeFound(this, this.resolvedType, scope);
82
		throw new CompletionNodeFound(this, this.resolvedType, scope);
83
	}
83
	}
84
	
84
	
(-)codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedAllocationExpression.java (-1 / +1 lines)
Lines 56-62 Link Here
56
		if (this.resolvedType.isInterface()) // handle the anonymous class definition case
56
		if (this.resolvedType.isInterface()) // handle the anonymous class definition case
57
			this.resolvedType = scope.getJavaLangObject();
57
			this.resolvedType = scope.getJavaLangObject();
58
	} else {
58
	} else {
59
		this.resolvedType = type.resolveType(scope, true /* check bounds*/);
59
		this.resolvedType = type.resolveType(scope, TypeReference.CHECK_ALL);
60
		if (!(this.resolvedType instanceof ReferenceBinding))
60
		if (!(this.resolvedType instanceof ReferenceBinding))
61
			throw new CompletionNodeFound(); // no need to continue if its an array or base type
61
			throw new CompletionNodeFound(); // no need to continue if its an array or base type
62
	}
62
	}
(-)codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnStringLiteral.java (-1 / +1 lines)
Lines 47-53 Link Here
47
		this.contentStart = cs;
47
		this.contentStart = cs;
48
		this.contentEnd = ce;
48
		this.contentEnd = ce;
49
	}
49
	}
50
	public TypeBinding resolveType(ClassScope scope) {
50
	public TypeBinding resolveType(ClassScope scope, int checkMode) {
51
		throw new CompletionNodeFound(this, null, scope);
51
		throw new CompletionNodeFound(this, null, scope);
52
	}
52
	}
53
	public TypeBinding resolveType(BlockScope scope) {
53
	public TypeBinding resolveType(BlockScope scope) {
(-)compiler/org/eclipse/jdt/internal/compiler/ast/JavadocImplicitTypeReference.java (-6 / +7 lines)
Lines 57-63 Link Here
57
	 * Resolves type on a Block, Class or CompilationUnit scope.
57
	 * Resolves type on a Block, Class or CompilationUnit scope.
58
	 * We need to modify resoling behavior to avoid raw type creation.
58
	 * We need to modify resoling behavior to avoid raw type creation.
59
	 */
59
	 */
60
	private TypeBinding internalResolveType(Scope scope) {
60
	private TypeBinding internalResolveType(Scope scope, int checkMode) {
61
		// handle the error here
61
		// handle the error here
62
		this.constant = Constant.NotAConstant;
62
		this.constant = Constant.NotAConstant;
63
		if (this.resolvedType != null) // is a shared type reference which was already resolved
63
		if (this.resolvedType != null) // is a shared type reference which was already resolved
Lines 70-86 Link Here
70
			reportInvalidType(scope);
70
			reportInvalidType(scope);
71
			return null;
71
			return null;
72
		}
72
		}
73
		if (isTypeUseDeprecated(this.resolvedType, scope))
73
		if ((checkMode & CHECK_NO_DEPRECATION) == 0 && isTypeUseDeprecated(this.resolvedType, scope)){
74
			reportDeprecatedType(scope);
74
			reportDeprecatedType(scope);
75
		}
75
		return this.resolvedType;
76
		return this.resolvedType;
76
	}
77
	}
77
78
78
	public TypeBinding resolveType(BlockScope blockScope, boolean checkBounds) {
79
	public TypeBinding resolveType(BlockScope blockScope, int checkMode) {
79
		return internalResolveType(blockScope);
80
		return internalResolveType(blockScope, checkMode);
80
	}
81
	}
81
82
82
	public TypeBinding resolveType(ClassScope classScope) {
83
	public TypeBinding resolveType(ClassScope classScope, int checkMode) {
83
		return internalResolveType(classScope);
84
		return internalResolveType(classScope, checkMode);
84
	}
85
	}
85
86
86
	public void traverse(ASTVisitor visitor, BlockScope classScope) {
87
	public void traverse(ASTVisitor visitor, BlockScope classScope) {
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java (-1 / +1 lines)
Lines 291-297 Link Here
291
				boolean argHasError = false; // typeChecks all arguments
291
				boolean argHasError = false; // typeChecks all arguments
292
				this.genericTypeArguments = new TypeBinding[length];
292
				this.genericTypeArguments = new TypeBinding[length];
293
				for (int i = 0; i < length; i++) {
293
				for (int i = 0; i < length; i++) {
294
					if ((this.genericTypeArguments[i] = this.typeArguments[i].resolveType(scope, true /* check bounds*/)) == null) {
294
					if ((this.genericTypeArguments[i] = this.typeArguments[i].resolveType(scope, TypeReference.CHECK_ALL)) == null) {
295
						argHasError = true;
295
						argHasError = true;
296
					}
296
					}
297
				}
297
				}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/JavadocFieldReference.java (-1 / +1 lines)
Lines 119-125 Link Here
119
		return internalResolveType(scope);
119
		return internalResolveType(scope);
120
	}
120
	}
121
121
122
	public TypeBinding resolveType(ClassScope scope) {
122
	public TypeBinding resolveType(ClassScope scope, int checkMode) {
123
		return internalResolveType(scope);
123
		return internalResolveType(scope);
124
	}
124
	}
125
125
(-)compiler/org/eclipse/jdt/internal/compiler/ast/JavadocArgumentExpression.java (-1 / +1 lines)
Lines 77-83 Link Here
77
		return internalResolveType(scope);
77
		return internalResolveType(scope);
78
	}
78
	}
79
79
80
	public TypeBinding resolveType(ClassScope scope) {
80
	public TypeBinding resolveType(ClassScope scope, int checkMode) {
81
		return internalResolveType(scope);
81
		return internalResolveType(scope);
82
	}
82
	}
83
83
(-)compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java (-2 / +2 lines)
Lines 239-245 Link Here
239
			// initialization of an enum constant
239
			// initialization of an enum constant
240
			this.resolvedType = scope.enclosingReceiverType();
240
			this.resolvedType = scope.enclosingReceiverType();
241
		} else {
241
		} else {
242
			this.resolvedType = this.type.resolveType(scope, true /* check bounds*/);
242
			this.resolvedType = this.type.resolveType(scope, TypeReference.CHECK_ALL);
243
			checkParameterizedAllocation: {
243
			checkParameterizedAllocation: {
244
				if (this.type instanceof ParameterizedQualifiedTypeReference) { // disallow new X<String>.Y<Integer>()
244
				if (this.type instanceof ParameterizedQualifiedTypeReference) { // disallow new X<String>.Y<Integer>()
245
					ReferenceBinding currentType = (ReferenceBinding)this.resolvedType;
245
					ReferenceBinding currentType = (ReferenceBinding)this.resolvedType;
Lines 267-273 Link Here
267
			boolean argHasError = false; // typeChecks all arguments
267
			boolean argHasError = false; // typeChecks all arguments
268
			this.genericTypeArguments = new TypeBinding[length];
268
			this.genericTypeArguments = new TypeBinding[length];
269
			for (int i = 0; i < length; i++) {
269
			for (int i = 0; i < length; i++) {
270
				if ((this.genericTypeArguments[i] = this.typeArguments[i].resolveType(scope, true /* check bounds*/)) == null) {
270
				if ((this.genericTypeArguments[i] = this.typeArguments[i].resolveType(scope, TypeReference.CHECK_ALL)) == null) {
271
					argHasError = true;
271
					argHasError = true;
272
				}
272
				}
273
			}
273
			}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/TypeParameter.java (-21 / +27 lines)
Lines 23-47 Link Here
23
    public TypeVariableBinding binding;
23
    public TypeVariableBinding binding;
24
	public TypeReference[] bounds;
24
	public TypeReference[] bounds;
25
25
26
	public void generateCode(BlockScope currentScope, CodeStream codeStream) {
27
	    // nothing to do
28
	}
29
26
	/**
30
	/**
27
	 * @see org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration#getKind()
31
	 * @see org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration#getKind()
28
	 */
32
	 */
29
	public int getKind() {
33
	public int getKind() {
30
		return TYPE_PARAMETER;
34
		return TYPE_PARAMETER;
31
	}
35
	}
32
33
	public void checkBounds(Scope scope) {
34
		
35
		if (this.type != null) {
36
			this.type.checkBounds(scope);
37
		}
38
		if (this.bounds != null) {
39
			for (int i = 0, length = this.bounds.length; i < length; i++) {
40
				this.bounds[i].checkBounds(scope);
41
			}
42
		}
43
	}
44
	
45
	private void internalResolve(Scope scope, boolean staticContext) {
36
	private void internalResolve(Scope scope, boolean staticContext) {
46
	    // detect variable/type name collisions
37
	    // detect variable/type name collisions
47
		if (this.binding != null) {
38
		if (this.binding != null) {
Lines 55-68 Link Here
55
		}
46
		}
56
	}
47
	}
57
	
48
	
58
	public void resolve(BlockScope scope) {
49
	public void performDeferredCheck(Scope scope) {
59
		internalResolve(scope, scope.methodScope().isStatic);
50
		
51
		if (this.type != null) {
52
			this.type.checkBounds(scope);
53
			if (this.type.resolvedType != null && this.type.isTypeUseDeprecated(this.type.resolvedType, scope)) {
54
				this.type.reportDeprecatedType(scope);
55
			}
56
		}
57
		if (this.bounds != null) {
58
			for (int i = 0, length = this.bounds.length; i < length; i++) {
59
				TypeReference bound = this.bounds[i];
60
				bound.checkBounds(scope);
61
				if (bound.resolvedType != null && bound.isTypeUseDeprecated(bound.resolvedType, scope)) {
62
					bound.reportDeprecatedType(scope);
63
				}
64
			}
65
		}
60
	}
66
	}
61
	
67
	
62
	public void resolve(ClassScope scope) {
63
		internalResolve(scope, scope.enclosingSourceType().isStatic());
64
	}
65
66
	/* (non-Javadoc)
68
	/* (non-Javadoc)
67
	 * @see org.eclipse.jdt.internal.compiler.ast.AstNode#print(int, java.lang.StringBuffer)
69
	 * @see org.eclipse.jdt.internal.compiler.ast.AstNode#print(int, java.lang.StringBuffer)
68
	 */
70
	 */
Lines 80-88 Link Here
80
		}
82
		}
81
		return output;
83
		return output;
82
	}
84
	}
85
86
	public void resolve(BlockScope scope) {
87
		internalResolve(scope, scope.methodScope().isStatic);
88
	}
83
	
89
	
84
	public void generateCode(BlockScope currentScope, CodeStream codeStream) {
90
	public void resolve(ClassScope scope) {
85
	    // nothing to do
91
		internalResolve(scope, scope.enclosingSourceType().isStatic());
86
	}
92
	}
87
	
93
	
88
	public void traverse(ASTVisitor visitor, BlockScope scope) {
94
	public void traverse(ASTVisitor visitor, BlockScope scope) {
(-)compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java (-1 / +1 lines)
Lines 316-322 Link Here
316
		boolean argHasError = false; // typeChecks all arguments
316
		boolean argHasError = false; // typeChecks all arguments
317
		this.genericTypeArguments = new TypeBinding[length];
317
		this.genericTypeArguments = new TypeBinding[length];
318
		for (int i = 0; i < length; i++) {
318
		for (int i = 0; i < length; i++) {
319
			if ((this.genericTypeArguments[i] = this.typeArguments[i].resolveType(scope, true /* check bounds*/)) == null) {
319
			if ((this.genericTypeArguments[i] = this.typeArguments[i].resolveType(scope, TypeReference.CHECK_ALL)) == null) {
320
				argHasError = true;
320
				argHasError = true;
321
			}
321
			}
322
		}
322
		}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java (-8 / +10 lines)
Lines 85-91 Link Here
85
    /*
85
    /*
86
     * No need to check for reference to raw type per construction
86
     * No need to check for reference to raw type per construction
87
     */
87
     */
88
	private TypeBinding internalResolveType(Scope scope, ReferenceBinding enclosingType, boolean checkBounds) {
88
	private TypeBinding internalResolveType(Scope scope, ReferenceBinding enclosingType, int checkMode) {
89
89
90
		// handle the error here
90
		// handle the error here
91
		this.constant = Constant.NotAConstant;
91
		this.constant = Constant.NotAConstant;
Lines 114-121 Link Here
114
				scope.problemReporter().invalidEnclosingType(this, this.resolvedType, enclosingType);
114
				scope.problemReporter().invalidEnclosingType(this, this.resolvedType, enclosingType);
115
				return null;
115
				return null;
116
			}
116
			}
117
			if (isTypeUseDeprecated(this.resolvedType, scope))
117
			if ((checkMode & CHECK_NO_DEPRECATION) == 0 && isTypeUseDeprecated(this.resolvedType, scope)) {
118
				scope.problemReporter().deprecatedType(this.resolvedType, this);
118
				scope.problemReporter().deprecatedType(this.resolvedType, this);
119
			}
119
		}
120
		}
120
121
121
		// check generic and arity
122
		// check generic and arity
Lines 162-169 Link Here
162
163
163
    	ParameterizedTypeBinding parameterizedType = scope.environment().createParameterizedType((ReferenceBinding)currentType.erasure(), argTypes, enclosingType);
164
    	ParameterizedTypeBinding parameterizedType = scope.environment().createParameterizedType((ReferenceBinding)currentType.erasure(), argTypes, enclosingType);
164
		// check argument type compatibility
165
		// check argument type compatibility
165
		if (checkBounds) // otherwise will do it in Scope.connectTypeVariables() or generic method resolution
166
		if ((checkMode & CHECK_NO_BOUND) == 0){ // otherwise will do it in Scope.connectTypeVariables() or generic method resolution
166
			parameterizedType.boundCheck(scope, this.typeArguments);
167
			parameterizedType.boundCheck(scope, this.typeArguments);
168
		}
167
169
168
		this.resolvedType = parameterizedType;
170
		this.resolvedType = parameterizedType;
169
		if (isTypeUseDeprecated(this.resolvedType, scope))
171
		if (isTypeUseDeprecated(this.resolvedType, scope))
Lines 201-216 Link Here
201
		return output;
203
		return output;
202
	}
204
	}
203
	
205
	
204
	public TypeBinding resolveType(BlockScope scope, boolean checkBounds) {
206
	public TypeBinding resolveType(BlockScope scope, int checkMode) {
205
	    return internalResolveType(scope, null, checkBounds);
207
	    return internalResolveType(scope, null, checkMode);
206
	}	
208
	}	
207
209
208
	public TypeBinding resolveType(ClassScope scope) {
210
	public TypeBinding resolveType(ClassScope scope, int checkMode) {
209
	    return internalResolveType(scope, null, false /*no bounds check in classScope*/);
211
	    return internalResolveType(scope, null, checkMode|CHECK_NO_BOUND);
210
	}	
212
	}	
211
	
213
	
212
	public TypeBinding resolveTypeEnclosing(BlockScope scope, ReferenceBinding enclosingType) {
214
	public TypeBinding resolveTypeEnclosing(BlockScope scope, ReferenceBinding enclosingType) {
213
	    return internalResolveType(scope, enclosingType, true/*check bounds*/);
215
	    return internalResolveType(scope, enclosingType, CHECK_ALL);
214
	}
216
	}
215
	
217
	
216
	public void traverse(ASTVisitor visitor, BlockScope scope) {
218
	public void traverse(ASTVisitor visitor, BlockScope scope) {
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java (-7 / +9 lines)
Lines 107-113 Link Here
107
    /*
107
    /*
108
     * No need to check for reference to raw type per construction
108
     * No need to check for reference to raw type per construction
109
     */
109
     */
110
	private TypeBinding internalResolveType(Scope scope, boolean checkBounds) {
110
	private TypeBinding internalResolveType(Scope scope, int checkMode) {
111
111
112
		// handle the error here
112
		// handle the error here
113
		this.constant = Constant.NotAConstant;
113
		this.constant = Constant.NotAConstant;
Lines 194-201 Link Here
194
				}
194
				}
195
				ParameterizedTypeBinding parameterizedType = scope.environment().createParameterizedType((ReferenceBinding)currentType.erasure(), argTypes, qualifiedType);
195
				ParameterizedTypeBinding parameterizedType = scope.environment().createParameterizedType((ReferenceBinding)currentType.erasure(), argTypes, qualifiedType);
196
				// check argument type compatibility
196
				// check argument type compatibility
197
				if (checkBounds) // otherwise will do it in Scope.connectTypeVariables() or generic method resolution
197
				if ((checkMode & CHECK_NO_BOUND) == 0){ // otherwise will do it in Scope.connectTypeVariables() or generic method resolution
198
					parameterizedType.boundCheck(scope, args);
198
					parameterizedType.boundCheck(scope, args);
199
				}
199
				qualifiedType = parameterizedType;
200
				qualifiedType = parameterizedType;
200
		    } else {
201
		    } else {
201
				if (isClassScope)
202
				if (isClassScope)
Lines 215-222 Link Here
215
			}
216
			}
216
		}
217
		}
217
		this.resolvedType = qualifiedType;
218
		this.resolvedType = qualifiedType;
218
		if (isTypeUseDeprecated(this.resolvedType, scope))
219
		if ((checkMode & CHECK_NO_DEPRECATION) == 0 && isTypeUseDeprecated(this.resolvedType, scope)) {
219
			reportDeprecatedType(scope);
220
			reportDeprecatedType(scope);
221
		}
220
		// array type ?
222
		// array type ?
221
		if (this.dimensions > 0) {
223
		if (this.dimensions > 0) {
222
			if (dimensions > 255)
224
			if (dimensions > 255)
Lines 268-278 Link Here
268
		return output;
270
		return output;
269
	}	
271
	}	
270
	
272
	
271
	public TypeBinding resolveType(BlockScope scope, boolean checkBounds) {
273
	public TypeBinding resolveType(BlockScope scope, int checkMode) {
272
	    return internalResolveType(scope, checkBounds);
274
	    return internalResolveType(scope, checkMode);
273
	}	
275
	}	
274
	public TypeBinding resolveType(ClassScope scope) {
276
	public TypeBinding resolveType(ClassScope scope, int checkMode) {
275
	    return internalResolveType(scope, false);
277
	    return internalResolveType(scope, checkMode|CHECK_NO_BOUND);
276
	}
278
	}
277
	public void traverse(ASTVisitor visitor, BlockScope scope) {
279
	public void traverse(ASTVisitor visitor, BlockScope scope) {
278
		if (visitor.visit(this, scope)) {
280
		if (visitor.visit(this, scope)) {
(-)compiler/org/eclipse/jdt/internal/compiler/ast/JavadocArraySingleTypeReference.java (-1 / +1 lines)
Lines 26-32 Link Here
26
	protected void reportInvalidType(Scope scope) {
26
	protected void reportInvalidType(Scope scope) {
27
		scope.problemReporter().javadocInvalidType(this, this.resolvedType, scope.getDeclarationModifiers());
27
		scope.problemReporter().javadocInvalidType(this, this.resolvedType, scope.getDeclarationModifiers());
28
	}
28
	}
29
	protected void reportDeprecatedType(Scope scope) {
29
	public void reportDeprecatedType(Scope scope) {
30
		scope.problemReporter().javadocDeprecatedType(this.resolvedType, this, scope.getDeclarationModifiers());
30
		scope.problemReporter().javadocDeprecatedType(this.resolvedType, this, scope.getDeclarationModifiers());
31
	}
31
	}
32
32
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java (-1 / +1 lines)
Lines 76-82 Link Here
76
	public TypeBinding resolveType(BlockScope scope) {
76
	public TypeBinding resolveType(BlockScope scope) {
77
77
78
		constant = Constant.NotAConstant;
78
		constant = Constant.NotAConstant;
79
		if ((targetType = type.resolveType(scope, true /* check bounds*/)) == null)
79
		if ((targetType = type.resolveType(scope, TypeReference.CHECK_ALL)) == null)
80
			return null;
80
			return null;
81
81
82
		if (targetType.isArrayType()
82
		if (targetType.isArrayType()
(-)compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java (-1 / +1 lines)
Lines 99-105 Link Here
99
		// provide the scope with a side effect : insertion of a LOCAL
99
		// provide the scope with a side effect : insertion of a LOCAL
100
		// that represents the argument. The type must be from JavaThrowable
100
		// that represents the argument. The type must be from JavaThrowable
101
101
102
		TypeBinding exceptionType = this.type.resolveType(scope, true /* check bounds*/);
102
		TypeBinding exceptionType = this.type.resolveType(scope, TypeReference.CHECK_ALL);
103
		if (exceptionType == null) return null;
103
		if (exceptionType == null) return null;
104
		if (exceptionType.isBoundParameterizedType()) {
104
		if (exceptionType.isBoundParameterizedType()) {
105
			scope.problemReporter().invalidParameterizedExceptionType(exceptionType, this);
105
			scope.problemReporter().invalidParameterizedExceptionType(exceptionType, this);
(-)compiler/org/eclipse/jdt/internal/compiler/ast/JavadocMessageSend.java (-1 / +1 lines)
Lines 198-204 Link Here
198
		return internalResolveType(scope);
198
		return internalResolveType(scope);
199
	}
199
	}
200
200
201
	public TypeBinding resolveType(ClassScope scope) {
201
	public TypeBinding resolveType(ClassScope scope, int checkMode) {
202
		return internalResolveType(scope);
202
		return internalResolveType(scope);
203
	}
203
	}
204
204
(-)compiler/org/eclipse/jdt/internal/compiler/ast/JavadocQualifiedTypeReference.java (-7 / +8 lines)
Lines 30-36 Link Here
30
	protected void reportInvalidType(Scope scope) {
30
	protected void reportInvalidType(Scope scope) {
31
		scope.problemReporter().javadocInvalidType(this, resolvedType, scope.getDeclarationModifiers());
31
		scope.problemReporter().javadocInvalidType(this, resolvedType, scope.getDeclarationModifiers());
32
	}
32
	}
33
	protected void reportDeprecatedType(Scope scope) {
33
	public void reportDeprecatedType(Scope scope) {
34
		scope.problemReporter().javadocDeprecatedType(resolvedType, this, scope.getDeclarationModifiers());
34
		scope.problemReporter().javadocDeprecatedType(resolvedType, this, scope.getDeclarationModifiers());
35
	}
35
	}
36
36
Lines 50-56 Link Here
50
	/*
50
	/*
51
	 * We need to modify resolving behavior to handle package references
51
	 * We need to modify resolving behavior to handle package references
52
	 */
52
	 */
53
	private TypeBinding internalResolveType(Scope scope, boolean checkBounds) {
53
	private TypeBinding internalResolveType(Scope scope, int checkMode) {
54
		// handle the error here
54
		// handle the error here
55
		constant = Constant.NotAConstant;
55
		constant = Constant.NotAConstant;
56
		if (resolvedType != null) // is a shared type reference which was already resolved
56
		if (resolvedType != null) // is a shared type reference which was already resolved
Lines 66-84 Link Here
66
			}
66
			}
67
			return null;
67
			return null;
68
		}
68
		}
69
		if (isTypeUseDeprecated(resolvedType, scope))
69
		if ((checkMode & CHECK_NO_DEPRECATION) == 0 && isTypeUseDeprecated(resolvedType, scope)) {
70
			reportDeprecatedType(scope);
70
			reportDeprecatedType(scope);
71
		}
71
		if (resolvedType instanceof ParameterizedTypeBinding) {
72
		if (resolvedType instanceof ParameterizedTypeBinding) {
72
			resolvedType = ((ParameterizedTypeBinding)resolvedType).type;
73
			resolvedType = ((ParameterizedTypeBinding)resolvedType).type;
73
		}
74
		}
74
		return resolvedType;
75
		return resolvedType;
75
	}
76
	}
76
77
77
	public TypeBinding resolveType(BlockScope blockScope, boolean checkBounds) {
78
	public TypeBinding resolveType(BlockScope blockScope, int checkMode) {
78
		return internalResolveType(blockScope, checkBounds);
79
		return internalResolveType(blockScope, checkMode);
79
	}
80
	}
80
81
81
	public TypeBinding resolveType(ClassScope classScope) {
82
	public TypeBinding resolveType(ClassScope classScope, int checkMode) {
82
		return internalResolveType(classScope, false);
83
		return internalResolveType(classScope, CHECK_NO_BOUND);
83
	}
84
	}
84
}
85
}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/Wildcard.java (-2 / +2 lines)
Lines 57-64 Link Here
57
	    TypeBinding boundType = null;
57
	    TypeBinding boundType = null;
58
	    if (this.bound != null) {
58
	    if (this.bound != null) {
59
			boundType = scope.kind == Scope.CLASS_SCOPE
59
			boundType = scope.kind == Scope.CLASS_SCOPE
60
	       		? this.bound.resolveType((ClassScope)scope)
60
	       		? this.bound.resolveType((ClassScope)scope, TypeReference.CHECK_ALL)
61
	       		: this.bound.resolveType((BlockScope)scope, true /* check bounds*/);
61
	       		: this.bound.resolveType((BlockScope)scope, TypeReference.CHECK_ALL);
62
	       		        
62
	       		        
63
			if (boundType == null) {
63
			if (boundType == null) {
64
				return null;
64
				return null;
(-)compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java (-2 / +2 lines)
Lines 232-238 Link Here
232
				// initialization of an enum constant
232
				// initialization of an enum constant
233
				receiverType = scope.enclosingSourceType();
233
				receiverType = scope.enclosingSourceType();
234
			} else {
234
			} else {
235
				receiverType = this.type.resolveType(scope, true /* check bounds*/);
235
				receiverType = this.type.resolveType(scope, TypeReference.CHECK_ALL);
236
				checkParameterizedAllocation: {
236
				checkParameterizedAllocation: {
237
					if (receiverType == null) break checkParameterizedAllocation;
237
					if (receiverType == null) break checkParameterizedAllocation;
238
					if (this.type instanceof ParameterizedQualifiedTypeReference) { // disallow new X<String>.Y<Integer>()
238
					if (this.type instanceof ParameterizedQualifiedTypeReference) { // disallow new X<String>.Y<Integer>()
Lines 271-277 Link Here
271
			int length = this.typeArguments.length;
271
			int length = this.typeArguments.length;
272
			this.genericTypeArguments = new TypeBinding[length];
272
			this.genericTypeArguments = new TypeBinding[length];
273
			for (int i = 0; i < length; i++) {
273
			for (int i = 0; i < length; i++) {
274
				TypeBinding argType = this.typeArguments[i].resolveType(scope, true /* check bounds*/);
274
				TypeBinding argType = this.typeArguments[i].resolveType(scope, TypeReference.CHECK_ALL);
275
				if (argType == null) return null; // error already reported
275
				if (argType == null) return null; // error already reported
276
				this.genericTypeArguments[i] = argType;
276
				this.genericTypeArguments[i] = argType;
277
			}
277
			}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/JavadocArrayQualifiedTypeReference.java (-1 / +1 lines)
Lines 28-34 Link Here
28
	protected void reportInvalidType(Scope scope) {
28
	protected void reportInvalidType(Scope scope) {
29
		scope.problemReporter().javadocInvalidType(this, this.resolvedType, scope.getDeclarationModifiers());
29
		scope.problemReporter().javadocInvalidType(this, this.resolvedType, scope.getDeclarationModifiers());
30
	}
30
	}
31
	protected void reportDeprecatedType(Scope scope) {
31
	public void reportDeprecatedType(Scope scope) {
32
		scope.problemReporter().javadocDeprecatedType(this.resolvedType, this, scope.getDeclarationModifiers());
32
		scope.problemReporter().javadocDeprecatedType(this.resolvedType, this, scope.getDeclarationModifiers());
33
	}
33
	}
34
34
(-)compiler/org/eclipse/jdt/internal/compiler/ast/JavadocAllocationExpression.java (-3 / +3 lines)
Lines 35-43 Link Here
35
		if (this.type == null) {
35
		if (this.type == null) {
36
			this.resolvedType = scope.enclosingSourceType();
36
			this.resolvedType = scope.enclosingSourceType();
37
		} else if (scope.kind == Scope.CLASS_SCOPE) {
37
		} else if (scope.kind == Scope.CLASS_SCOPE) {
38
			this.resolvedType = this.type.resolveType((ClassScope)scope);
38
			this.resolvedType = this.type.resolveType((ClassScope)scope, TypeReference.CHECK_ALL);
39
		} else {
39
		} else {
40
			this.resolvedType = this.type.resolveType((BlockScope)scope, true /* check bounds*/);
40
			this.resolvedType = this.type.resolveType((BlockScope)scope, TypeReference.CHECK_ALL);
41
		}
41
		}
42
	
42
	
43
		// buffering the arguments' types
43
		// buffering the arguments' types
Lines 135-141 Link Here
135
		return internalResolveType(scope);
135
		return internalResolveType(scope);
136
	}
136
	}
137
137
138
	public TypeBinding resolveType(ClassScope scope) {
138
	public TypeBinding resolveType(ClassScope scope, int checkMode) {
139
		return internalResolveType(scope);
139
		return internalResolveType(scope);
140
	}
140
	}
141
}
141
}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java (-1 / +1 lines)
Lines 113-119 Link Here
113
		// only at the -end- like new int [4][][]. The parser allows new int[][4][]
113
		// only at the -end- like new int [4][][]. The parser allows new int[][4][]
114
		// so this must be checked here......(this comes from a reduction to LL1 grammar)
114
		// so this must be checked here......(this comes from a reduction to LL1 grammar)
115
115
116
		TypeBinding referenceType = type.resolveType(scope, true /* check bounds*/);
116
		TypeBinding referenceType = type.resolveType(scope, TypeReference.CHECK_ALL);
117
		
117
		
118
		// will check for null after dimensions are checked
118
		// will check for null after dimensions are checked
119
		constant = Constant.NotAConstant;
119
		constant = Constant.NotAConstant;
(-)compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java (-8 / +19 lines)
Lines 20-25 Link Here
20
20
21
public abstract class TypeReference extends Expression {
21
public abstract class TypeReference extends Expression {
22
22
23
	// Depending on location of type references, certain checks are deferred
24
	// until later stages (i.e. when resolving super types or type variables)
25
	public static final int CHECK_ALL = 0;
26
	public static final int CHECK_NO_BOUND = 1;
27
	public static final int CHECK_NO_DEPRECATION = 2;
28
	
23
public TypeReference() {
29
public TypeReference() {
24
		super () ;
30
		super () ;
25
		}
31
		}
Lines 104-110 Link Here
104
}
110
}
105
public TypeBinding resolveSuperType(ClassScope scope) {
111
public TypeBinding resolveSuperType(ClassScope scope) {
106
	// assumes the implementation of resolveType(ClassScope) will call back to detect cycles
112
	// assumes the implementation of resolveType(ClassScope) will call back to detect cycles
107
	if (resolveType(scope) == null) return null;
113
	if (resolveType(scope, CHECK_NO_BOUND|CHECK_NO_DEPRECATION) == null) return null;
108
114
109
	if (this.resolvedType.isTypeVariable()) {
115
	if (this.resolvedType.isTypeVariable()) {
110
		this.resolvedType = new ProblemReferenceBinding(getTypeName(), (ReferenceBinding) this.resolvedType, ProblemReasons.IllegalSuperTypeVariable);
116
		this.resolvedType = new ProblemReferenceBinding(getTypeName(), (ReferenceBinding) this.resolvedType, ProblemReasons.IllegalSuperTypeVariable);
Lines 115-124 Link Here
115
}
121
}
116
122
117
public final TypeBinding resolveType(BlockScope blockScope) {
123
public final TypeBinding resolveType(BlockScope blockScope) {
118
	return resolveType(blockScope, true /* checkbounds if any */);
124
	return resolveType(blockScope, CHECK_ALL);
119
}
125
}
120
126
121
public TypeBinding resolveType(BlockScope scope, boolean checkBounds) {
127
public TypeBinding resolveType(BlockScope scope, int checkMode) {
122
	// handle the error here
128
	// handle the error here
123
	this.constant = Constant.NotAConstant;
129
	this.constant = Constant.NotAConstant;
124
	if (this.resolvedType != null) // is a shared type reference which was already resolved
130
	if (this.resolvedType != null) // is a shared type reference which was already resolved
Lines 131-138 Link Here
131
		reportInvalidType(scope);
137
		reportInvalidType(scope);
132
		return null;
138
		return null;
133
	}
139
	}
134
	if (isTypeUseDeprecated(this.resolvedType, scope))
140
	if ((checkMode & CHECK_NO_DEPRECATION) == 0 && isTypeUseDeprecated(this.resolvedType, scope)) {
135
		reportDeprecatedType(scope);
141
		reportDeprecatedType(scope);
142
	}
136
	type = scope.environment().convertToRawType(type);
143
	type = scope.environment().convertToRawType(type);
137
	if (type.isRawType() 
144
	if (type.isRawType() 
138
			&& (this.bits & IgnoreRawTypeCheck) == 0 
145
			&& (this.bits & IgnoreRawTypeCheck) == 0 
Lines 142-147 Link Here
142
	return this.resolvedType = type;
149
	return this.resolvedType = type;
143
}
150
}
144
public TypeBinding resolveType(ClassScope scope) {
151
public TypeBinding resolveType(ClassScope scope) {
152
	return resolveType(scope, CHECK_NO_BOUND);
153
}
154
public TypeBinding resolveType(ClassScope scope, int checkMode) {
145
	// handle the error here
155
	// handle the error here
146
	this.constant = Constant.NotAConstant;
156
	this.constant = Constant.NotAConstant;
147
	if (this.resolvedType != null) // is a shared type reference which was already resolved
157
	if (this.resolvedType != null) // is a shared type reference which was already resolved
Lines 154-161 Link Here
154
		reportInvalidType(scope);
164
		reportInvalidType(scope);
155
		return null;
165
		return null;
156
	}
166
	}
157
	if (isTypeUseDeprecated(this.resolvedType, scope))
167
	if ((checkMode & CHECK_NO_DEPRECATION) == 0 && isTypeUseDeprecated(this.resolvedType, scope)) {
158
		reportDeprecatedType(scope);
168
		reportDeprecatedType(scope);
169
	}
159
	type = scope.environment().convertToRawType(type);
170
	type = scope.environment().convertToRawType(type);
160
	if (type.isRawType() 
171
	if (type.isRawType() 
161
			&& (this.bits & IgnoreRawTypeCheck) == 0 
172
			&& (this.bits & IgnoreRawTypeCheck) == 0 
Lines 166-182 Link Here
166
}
177
}
167
178
168
public TypeBinding resolveTypeArgument(BlockScope blockScope, ReferenceBinding genericType, int rank) {
179
public TypeBinding resolveTypeArgument(BlockScope blockScope, ReferenceBinding genericType, int rank) {
169
    return resolveType(blockScope, true /* check bounds*/);
180
    return resolveType(blockScope, TypeReference.CHECK_ALL);
170
}
181
}
171
182
172
public TypeBinding resolveTypeArgument(ClassScope classScope, ReferenceBinding genericType, int rank) {
183
public TypeBinding resolveTypeArgument(ClassScope classScope, ReferenceBinding genericType, int rank) {
173
    return resolveType(classScope);
184
    return resolveType(classScope, TypeReference.CHECK_ALL);
174
}
185
}
175
	
186
	
176
protected void reportInvalidType(Scope scope) {
187
protected void reportInvalidType(Scope scope) {
177
	scope.problemReporter().invalidType(this, this.resolvedType);
188
	scope.problemReporter().invalidType(this, this.resolvedType);
178
}
189
}
179
protected void reportDeprecatedType(Scope scope) {
190
public void reportDeprecatedType(Scope scope) {
180
	scope.problemReporter().deprecatedType(this.resolvedType, this);
191
	scope.problemReporter().deprecatedType(this.resolvedType, this);
181
}
192
}
182
public abstract void traverse(ASTVisitor visitor, ClassScope classScope);
193
public abstract void traverse(ASTVisitor visitor, ClassScope classScope);
(-)compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java (-1 / +1 lines)
Lines 405-411 Link Here
405
			// Scan all @param tags
405
			// Scan all @param tags
406
			for (int i = 0; i < paramTypeParamLength; i++) {
406
			for (int i = 0; i < paramTypeParamLength; i++) {
407
				JavadocSingleTypeReference param = this.paramTypeParameters[i];
407
				JavadocSingleTypeReference param = this.paramTypeParameters[i];
408
				TypeBinding paramBindind = param.internalResolveType(scope);
408
				TypeBinding paramBindind = param.internalResolveType(scope, TypeReference.CHECK_ALL);
409
				if (paramBindind != null && paramBindind.isValidBinding()) {
409
				if (paramBindind != null && paramBindind.isValidBinding()) {
410
					if (paramBindind.isTypeVariable()) {
410
					if (paramBindind.isTypeVariable()) {
411
						// Verify duplicated tags
411
						// Verify duplicated tags
(-)compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java (-1 / +1 lines)
Lines 145-151 Link Here
145
	public void resolve(BlockScope scope) {
145
	public void resolve(BlockScope scope) {
146
146
147
		// create a binding and add it to the scope
147
		// create a binding and add it to the scope
148
		TypeBinding variableType = type.resolveType(scope, true /* check bounds*/);
148
		TypeBinding variableType = type.resolveType(scope, TypeReference.CHECK_ALL);
149
149
150
		checkModifiers();
150
		checkModifiers();
151
		if (variableType != null) {
151
		if (variableType != null) {
(-)compiler/org/eclipse/jdt/internal/compiler/ast/JavadocSingleTypeReference.java (-7 / +8 lines)
Lines 30-36 Link Here
30
	protected void reportInvalidType(Scope scope) {
30
	protected void reportInvalidType(Scope scope) {
31
		scope.problemReporter().javadocInvalidType(this, this.resolvedType, scope.getDeclarationModifiers());
31
		scope.problemReporter().javadocInvalidType(this, this.resolvedType, scope.getDeclarationModifiers());
32
	}
32
	}
33
	protected void reportDeprecatedType(Scope scope) {
33
	public void reportDeprecatedType(Scope scope) {
34
		scope.problemReporter().javadocDeprecatedType(this.resolvedType, this, scope.getDeclarationModifiers());
34
		scope.problemReporter().javadocDeprecatedType(this.resolvedType, this, scope.getDeclarationModifiers());
35
	}
35
	}
36
36
Lines 51-57 Link Here
51
	/*
51
	/*
52
	 * We need to modify resolving behavior to handle package references
52
	 * We need to modify resolving behavior to handle package references
53
	 */
53
	 */
54
	TypeBinding internalResolveType(Scope scope) {
54
	TypeBinding internalResolveType(Scope scope, int checkMode) {
55
		// handle the error here
55
		// handle the error here
56
		this.constant = Constant.NotAConstant;
56
		this.constant = Constant.NotAConstant;
57
		if (this.resolvedType != null)// is a shared type reference which was already resolved
57
		if (this.resolvedType != null)// is a shared type reference which was already resolved
Lines 75-82 Link Here
75
			}
75
			}
76
			return null;
76
			return null;
77
		}
77
		}
78
		if (isTypeUseDeprecated(this.resolvedType, scope))
78
		if ((checkMode & CHECK_NO_DEPRECATION) == 0 && isTypeUseDeprecated(this.resolvedType, scope)) {
79
			reportDeprecatedType(scope);
79
			reportDeprecatedType(scope);
80
		}
80
		if (resolvedType instanceof ParameterizedTypeBinding) {
81
		if (resolvedType instanceof ParameterizedTypeBinding) {
81
			resolvedType = ((ParameterizedTypeBinding)resolvedType).type;
82
			resolvedType = ((ParameterizedTypeBinding)resolvedType).type;
82
		}
83
		}
Lines 87-97 Link Here
87
	 * @see org.eclipse.jdt.internal.compiler.ast.Expression#resolveType(org.eclipse.jdt.internal.compiler.lookup.BlockScope)
88
	 * @see org.eclipse.jdt.internal.compiler.ast.Expression#resolveType(org.eclipse.jdt.internal.compiler.lookup.BlockScope)
88
	 * We need to override to handle package references
89
	 * We need to override to handle package references
89
	 */
90
	 */
90
	public TypeBinding resolveType(BlockScope blockScope, boolean checkBounds) {
91
	public TypeBinding resolveType(BlockScope blockScope, int checkMode) {
91
		return internalResolveType(blockScope);
92
		return internalResolveType(blockScope, checkMode);
92
	}
93
	}
93
94
94
	public TypeBinding resolveType(ClassScope classScope) {
95
	public TypeBinding resolveType(ClassScope classScope, int checkMode) {
95
		return internalResolveType(classScope);
96
		return internalResolveType(classScope, checkMode);
96
	}
97
	}
97
}
98
}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java (-1 / +1 lines)
Lines 76-82 Link Here
76
76
77
		constant = Constant.NotAConstant;
77
		constant = Constant.NotAConstant;
78
		TypeBinding expressionType = expression.resolveType(scope);
78
		TypeBinding expressionType = expression.resolveType(scope);
79
		TypeBinding checkedType = type.resolveType(scope, true /* check bounds*/);
79
		TypeBinding checkedType = type.resolveType(scope, TypeReference.CHECK_ALL);
80
		if (expressionType == null || checkedType == null)
80
		if (expressionType == null || checkedType == null)
81
			return null;
81
			return null;
82
82
(-)compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedThisReference.java (-1 / +1 lines)
Lines 75-81 Link Here
75
75
76
		constant = Constant.NotAConstant;
76
		constant = Constant.NotAConstant;
77
		// X.this is not a param/raw type as denoting enclosing instance
77
		// X.this is not a param/raw type as denoting enclosing instance
78
		TypeBinding type = this.qualification.resolveType(scope, true /* check bounds*/);
78
		TypeBinding type = this.qualification.resolveType(scope, TypeReference.CHECK_ALL);
79
		if (type == null) return null;
79
		if (type == null) return null;
80
		// X.this is not a param/raw type as denoting enclosing instance
80
		// X.this is not a param/raw type as denoting enclosing instance
81
		type = type.erasure();
81
		type = type.erasure();
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java (-2 / +2 lines)
Lines 191-199 Link Here
191
		System.arraycopy(resolvedImports, 0, resolvedImports = new ImportBinding[index], 0, index);
191
		System.arraycopy(resolvedImports, 0, resolvedImports = new ImportBinding[index], 0, index);
192
	imports = resolvedImports;
192
	imports = resolvedImports;
193
}
193
}
194
void checkParameterizedTypeBounds() {
194
void performDeferredTypeChecks() {
195
	for (int i = 0, length = topLevelTypes.length; i < length; i++)
195
	for (int i = 0, length = topLevelTypes.length; i < length; i++)
196
		topLevelTypes[i].scope.checkParameterizedTypeBounds();
196
		topLevelTypes[i].scope.performDeferredTypeChecks();
197
}
197
}
198
/*
198
/*
199
 * INTERNAL USE-ONLY
199
 * INTERNAL USE-ONLY
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java (-5 / +5 lines)
Lines 1107-1113 Link Here
1107
				TypeBinding fieldType = 
1107
				TypeBinding fieldType = 
1108
					fieldDecl.getKind() == AbstractVariableDeclaration.ENUM_CONSTANT
1108
					fieldDecl.getKind() == AbstractVariableDeclaration.ENUM_CONSTANT
1109
						? initializationScope.environment().convertToRawType(this) // enum constant is implicitly of declaring enum type
1109
						? initializationScope.environment().convertToRawType(this) // enum constant is implicitly of declaring enum type
1110
						: fieldDecl.type.resolveType(initializationScope, true /* check bounds*/);
1110
						: fieldDecl.type.resolveType(initializationScope, TypeReference.CHECK_ALL);
1111
				field.type = fieldType;
1111
				field.type = fieldType;
1112
				field.modifiers &= ~ExtraCompilerModifiers.AccUnresolved;
1112
				field.modifiers &= ~ExtraCompilerModifiers.AccUnresolved;
1113
				if (fieldType == null) {
1113
				if (fieldType == null) {
Lines 1156-1162 Link Here
1156
		methodDecl.scope.connectTypeVariables(typeParameters);
1156
		methodDecl.scope.connectTypeVariables(typeParameters);
1157
		// Perform deferred bound checks for type variables (only done after type variable hierarchy is connected)
1157
		// Perform deferred bound checks for type variables (only done after type variable hierarchy is connected)
1158
		for (int i = 0, paramLength = typeParameters.length; i < paramLength; i++)
1158
		for (int i = 0, paramLength = typeParameters.length; i < paramLength; i++)
1159
			typeParameters[i].checkBounds(methodDecl.scope);
1159
			typeParameters[i].performDeferredCheck(methodDecl.scope);
1160
	}
1160
	}
1161
	TypeReference[] exceptionTypes = methodDecl.thrownExceptions;
1161
	TypeReference[] exceptionTypes = methodDecl.thrownExceptions;
1162
	if (exceptionTypes != null) {
1162
	if (exceptionTypes != null) {
Lines 1166-1172 Link Here
1166
		int count = 0;
1166
		int count = 0;
1167
		ReferenceBinding resolvedExceptionType;
1167
		ReferenceBinding resolvedExceptionType;
1168
		for (int i = 0; i < size; i++) {
1168
		for (int i = 0; i < size; i++) {
1169
			resolvedExceptionType = (ReferenceBinding) exceptionTypes[i].resolveType(methodDecl.scope, true /* check bounds*/);
1169
			resolvedExceptionType = (ReferenceBinding) exceptionTypes[i].resolveType(methodDecl.scope, TypeReference.CHECK_ALL);
1170
			if (resolvedExceptionType == null)
1170
			if (resolvedExceptionType == null)
1171
				continue;
1171
				continue;
1172
			if (resolvedExceptionType.isBoundParameterizedType()) {
1172
			if (resolvedExceptionType.isBoundParameterizedType()) {
Lines 1192-1198 Link Here
1192
		method.parameters = new TypeBinding[size];
1192
		method.parameters = new TypeBinding[size];
1193
		for (int i = 0; i < size; i++) {
1193
		for (int i = 0; i < size; i++) {
1194
			Argument arg = arguments[i];
1194
			Argument arg = arguments[i];
1195
			TypeBinding parameterType = arg.type.resolveType(methodDecl.scope, true /* check bounds*/);
1195
			TypeBinding parameterType = arg.type.resolveType(methodDecl.scope, TypeReference.CHECK_ALL);
1196
			if (parameterType == null) {
1196
			if (parameterType == null) {
1197
				foundArgProblem = true;
1197
				foundArgProblem = true;
1198
			} else if (parameterType == TypeBinding.VOID) {
1198
			} else if (parameterType == TypeBinding.VOID) {
Lines 1220-1226 Link Here
1220
			method.returnType = null;
1220
			method.returnType = null;
1221
			foundReturnTypeProblem = true;
1221
			foundReturnTypeProblem = true;
1222
		} else {
1222
		} else {
1223
		    TypeBinding methodType = returnType.resolveType(methodDecl.scope, true /* check bounds*/);
1223
		    TypeBinding methodType = returnType.resolveType(methodDecl.scope, TypeReference.CHECK_ALL);
1224
			if (methodType == null) {
1224
			if (methodType == null) {
1225
				foundReturnTypeProblem = true;
1225
				foundReturnTypeProblem = true;
1226
			} else if (methodType.isArrayType() && ((ArrayBinding) methodType).leafComponentType == TypeBinding.VOID) {
1226
			} else if (methodType.isArrayType() && ((ArrayBinding) methodType).leafComponentType == TypeBinding.VOID) {
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java (-4 / +11 lines)
Lines 701-728 Link Here
701
		} while ((currentType = currentType.superclass()) != null && (currentType.tagBits & TagBits.HasNoMemberTypes) == 0);
701
		} while ((currentType = currentType.superclass()) != null && (currentType.tagBits & TagBits.HasNoMemberTypes) == 0);
702
	}
702
	}
703
	// Perform deferred bound checks for parameterized type references (only done after hierarchy is connected)
703
	// Perform deferred bound checks for parameterized type references (only done after hierarchy is connected)
704
	public void  checkParameterizedTypeBounds() {
704
	public void  performDeferredTypeChecks() {
705
		TypeReference superclass = referenceContext.superclass;
705
		TypeReference superclass = referenceContext.superclass;
706
		if (superclass != null) {
706
		if (superclass != null) {
707
			superclass.checkBounds(this);
707
			superclass.checkBounds(this);
708
			if (superclass.resolvedType != null && superclass.isTypeUseDeprecated(superclass.resolvedType, this)) {
709
				superclass.reportDeprecatedType(this);
710
			}
708
		}
711
		}
709
		TypeReference[] superinterfaces = referenceContext.superInterfaces;
712
		TypeReference[] superinterfaces = referenceContext.superInterfaces;
710
		if (superinterfaces != null) {
713
		if (superinterfaces != null) {
711
			for (int i = 0, length = superinterfaces.length; i < length; i++) {
714
			for (int i = 0, length = superinterfaces.length; i < length; i++) {
712
				superinterfaces[i].checkBounds(this);
715
				TypeReference superinterface = superinterfaces[i];
716
				superinterface.checkBounds(this);
717
				if (superinterface.resolvedType != null && superinterface.isTypeUseDeprecated(superinterface.resolvedType, this)) {
718
					superinterface.reportDeprecatedType(this);
719
				}
713
			}
720
			}
714
		}
721
		}
715
		TypeParameter[] typeParameters = referenceContext.typeParameters;
722
		TypeParameter[] typeParameters = referenceContext.typeParameters;
716
		if (typeParameters != null) {
723
		if (typeParameters != null) {
717
			for (int i = 0, paramLength = typeParameters.length; i < paramLength; i++) {
724
			for (int i = 0, paramLength = typeParameters.length; i < paramLength; i++) {
718
				typeParameters[i].checkBounds(this);
725
				typeParameters[i].performDeferredCheck(this);
719
			}
726
			}
720
		}
727
		}
721
		// propagate to member types
728
		// propagate to member types
722
		ReferenceBinding[] memberTypes = referenceContext.binding.memberTypes;
729
		ReferenceBinding[] memberTypes = referenceContext.binding.memberTypes;
723
		if (memberTypes != null && memberTypes != Binding.NO_MEMBER_TYPES) {
730
		if (memberTypes != null && memberTypes != Binding.NO_MEMBER_TYPES) {
724
			for (int i = 0, size = memberTypes.length; i < size; i++)
731
			for (int i = 0, size = memberTypes.length; i < size; i++)
725
				 ((SourceTypeBinding) memberTypes[i]).scope.checkParameterizedTypeBounds();
732
				 ((SourceTypeBinding) memberTypes[i]).scope.performDeferredTypeChecks();
726
		}		
733
		}		
727
	}
734
	}
728
735
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java (-6 / +7 lines)
Lines 182-188 Link Here
182
* case either the faulty import/superinterface/field/method will be skipped or a
182
* case either the faulty import/superinterface/field/method will be skipped or a
183
* suitable replacement will be substituted (such as Object for a missing superclass)
183
* suitable replacement will be substituted (such as Object for a missing superclass)
184
*/
184
*/
185
186
public void completeTypeBindings() {
185
public void completeTypeBindings() {
187
	stepCompleted = BUILD_TYPE_HIERARCHY;
186
	stepCompleted = BUILD_TYPE_HIERARCHY;
188
	
187
	
Lines 197-208 Link Here
197
	stepCompleted = CONNECT_TYPE_HIERARCHY;
196
	stepCompleted = CONNECT_TYPE_HIERARCHY;
198
197
199
	for (int i = this.lastCompletedUnitIndex + 1; i <= this.lastUnitIndex; i++) {
198
	for (int i = this.lastCompletedUnitIndex + 1; i <= this.lastUnitIndex; i++) {
200
		CompilationUnitScope unitScope = (this.unitBeingCompleted = this.units[i]).scope;
199
		(this.unitBeingCompleted = this.units[i]).scope.buildFieldsAndMethods();
201
		unitScope.checkParameterizedTypeBounds();
202
		unitScope.buildFieldsAndMethods();
203
		this.units[i] = null; // release unnecessary reference to the parsed unit
204
	}
200
	}
205
	stepCompleted = BUILD_FIELDS_AND_METHODS;
201
	stepCompleted = BUILD_FIELDS_AND_METHODS;
202
	
203
	for (int i = this.lastCompletedUnitIndex + 1; i <= this.lastUnitIndex; i++) {
204
		(this.unitBeingCompleted = this.units[i]).scope.performDeferredTypeChecks();
205
		this.units[i] = null; // release unnecessary reference to the parsed unit
206
	}
206
	this.lastCompletedUnitIndex = this.lastUnitIndex;
207
	this.lastCompletedUnitIndex = this.lastUnitIndex;
207
	this.unitBeingCompleted = null;
208
	this.unitBeingCompleted = null;
208
}
209
}
Lines 249-257 Link Here
249
250
250
	(this.unitBeingCompleted = parsedUnit).scope.checkAndSetImports();
251
	(this.unitBeingCompleted = parsedUnit).scope.checkAndSetImports();
251
	parsedUnit.scope.connectTypeHierarchy();
252
	parsedUnit.scope.connectTypeHierarchy();
252
	parsedUnit.scope.checkParameterizedTypeBounds();	
253
	if (buildFieldsAndMethods)
253
	if (buildFieldsAndMethods)
254
		parsedUnit.scope.buildFieldsAndMethods();
254
		parsedUnit.scope.buildFieldsAndMethods();
255
	parsedUnit.scope.performDeferredTypeChecks();	
255
	this.unitBeingCompleted = null;
256
	this.unitBeingCompleted = null;
256
}
257
}
257
public TypeBinding computeBoxingType(TypeBinding type) {
258
public TypeBinding computeBoxingType(TypeBinding type) {
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java (-4 / +4 lines)
Lines 471-478 Link Here
471
			if (typeRef == null)
471
			if (typeRef == null)
472
				continue nextVariable;
472
				continue nextVariable;
473
			TypeBinding superType = this.kind == METHOD_SCOPE
473
			TypeBinding superType = this.kind == METHOD_SCOPE
474
				? typeRef.resolveType((BlockScope)this, false/*no bound check*/)
474
				? typeRef.resolveType((BlockScope)this, TypeReference.CHECK_NO_BOUND|TypeReference.CHECK_NO_DEPRECATION)
475
				: typeRef.resolveType((ClassScope)this);
475
				: typeRef.resolveType((ClassScope)this, TypeReference.CHECK_NO_BOUND|TypeReference.CHECK_NO_DEPRECATION);
476
			if (superType == null) {
476
			if (superType == null) {
477
				typeVariable.tagBits |= TagBits.HierarchyHasProblems;
477
				typeVariable.tagBits |= TagBits.HierarchyHasProblems;
478
				noProblems = false;
478
				noProblems = false;
Lines 507-514 Link Here
507
				for (int j = 0, boundLength = boundRefs.length; j < boundLength; j++) {
507
				for (int j = 0, boundLength = boundRefs.length; j < boundLength; j++) {
508
					typeRef = boundRefs[j];
508
					typeRef = boundRefs[j];
509
					superType = this.kind == METHOD_SCOPE
509
					superType = this.kind == METHOD_SCOPE
510
						? typeRef.resolveType((BlockScope)this, false)
510
						? typeRef.resolveType((BlockScope)this, TypeReference.CHECK_NO_BOUND)
511
						: typeRef.resolveType((ClassScope)this);
511
						: typeRef.resolveType((ClassScope)this, TypeReference.CHECK_NO_BOUND);
512
					if (superType == null) {
512
					if (superType == null) {
513
						typeVariable.tagBits |= TagBits.HierarchyHasProblems;
513
						typeVariable.tagBits |= TagBits.HierarchyHasProblems;
514
						noProblems = false;
514
						noProblems = false;
(-)eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java (-1 / +2 lines)
Lines 15-20 Link Here
15
import org.eclipse.jdt.internal.compiler.ast.Expression;
15
import org.eclipse.jdt.internal.compiler.ast.Expression;
16
import org.eclipse.jdt.internal.compiler.ast.MessageSend;
16
import org.eclipse.jdt.internal.compiler.ast.MessageSend;
17
import org.eclipse.jdt.internal.compiler.ast.NameReference;
17
import org.eclipse.jdt.internal.compiler.ast.NameReference;
18
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
18
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
19
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
19
import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
20
import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
20
import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
21
import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
Lines 218-224 Link Here
218
		boolean argHasError = false; // typeChecks all arguments
219
		boolean argHasError = false; // typeChecks all arguments
219
		this.genericTypeArguments = new TypeBinding[length];
220
		this.genericTypeArguments = new TypeBinding[length];
220
		for (int i = 0; i < length; i++) {
221
		for (int i = 0; i < length; i++) {
221
			if ((this.genericTypeArguments[i] = this.typeArguments[i].resolveType(scope, true /* check bounds*/)) == null) {
222
			if ((this.genericTypeArguments[i] = this.typeArguments[i].resolveType(scope, TypeReference.CHECK_ALL)) == null) {
222
				argHasError = true;
223
				argHasError = true;
223
			}
224
			}
224
		}
225
		}
(-)eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java (-1 / +2 lines)
Lines 13-18 Link Here
13
import org.eclipse.jdt.internal.compiler.ast.AllocationExpression;
13
import org.eclipse.jdt.internal.compiler.ast.AllocationExpression;
14
import org.eclipse.jdt.internal.compiler.ast.CastExpression;
14
import org.eclipse.jdt.internal.compiler.ast.CastExpression;
15
import org.eclipse.jdt.internal.compiler.ast.Expression;
15
import org.eclipse.jdt.internal.compiler.ast.Expression;
16
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
16
import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
17
import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
17
import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
18
import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
18
import org.eclipse.jdt.internal.compiler.impl.Constant;
19
import org.eclipse.jdt.internal.compiler.impl.Constant;
Lines 123-129 Link Here
123
public TypeBinding resolveType(BlockScope scope) {
124
public TypeBinding resolveType(BlockScope scope) {
124
	// Propagate the type checking to the arguments, and check if the constructor is defined.
125
	// Propagate the type checking to the arguments, and check if the constructor is defined.
125
	this.constant = Constant.NotAConstant;
126
	this.constant = Constant.NotAConstant;
126
	this.resolvedType = this.type.resolveType(scope, true /* check bounds*/); // will check for null after args are resolved
127
	this.resolvedType = this.type.resolveType(scope, TypeReference.CHECK_ALL); // will check for null after args are resolved
127
128
128
	// buffering the arguments' types
129
	// buffering the arguments' types
129
	boolean argsContainCast = false;
130
	boolean argsContainCast = false;
(-)codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnParameterizedSingleTypeReference.java (-4 / +4 lines)
Lines 21-33 Link Here
21
		super(name, typeArguments, 0, pos);
21
		super(name, typeArguments, 0, pos);
22
	}
22
	}
23
	
23
	
24
	public TypeBinding resolveType(BlockScope scope, boolean checkBounds) {
24
	public TypeBinding resolveType(BlockScope scope, int mode) {
25
		super.resolveType(scope, checkBounds);
25
		super.resolveType(scope, mode);
26
		throw new SelectionNodeFound(this.resolvedType);
26
		throw new SelectionNodeFound(this.resolvedType);
27
	}
27
	}
28
	
28
	
29
	public TypeBinding resolveType(ClassScope scope) {
29
	public TypeBinding resolveType(ClassScope scope, int checkMode) {
30
		super.resolveType(scope);
30
		super.resolveType(scope, checkMode);
31
		throw new SelectionNodeFound(this.resolvedType);
31
		throw new SelectionNodeFound(this.resolvedType);
32
	}
32
	}
33
	
33
	
(-)codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnParameterizedQualifiedTypeReference.java (-4 / +4 lines)
Lines 29-36 Link Here
29
		this.typeArguments[length] = assistTypeArguments;
29
		this.typeArguments[length] = assistTypeArguments;
30
	}
30
	}
31
	
31
	
32
	public TypeBinding resolveType(BlockScope scope, boolean checkBounds) {
32
	public TypeBinding resolveType(BlockScope scope, int mode) {
33
		super.resolveType(scope, checkBounds);
33
		super.resolveType(scope, mode);
34
		//// removed unnecessary code to solve bug 94653
34
		//// removed unnecessary code to solve bug 94653
35
		//if(this.resolvedType != null && this.resolvedType.isRawType()) {
35
		//if(this.resolvedType != null && this.resolvedType.isRawType()) {
36
		//	ParameterizedTypeBinding parameterizedTypeBinding = scope.createParameterizedType(((RawTypeBinding)this.resolvedType).type, new TypeBinding[0], this.resolvedType.enclosingType());
36
		//	ParameterizedTypeBinding parameterizedTypeBinding = scope.createParameterizedType(((RawTypeBinding)this.resolvedType).type, new TypeBinding[0], this.resolvedType.enclosingType());
Lines 39-46 Link Here
39
		throw new SelectionNodeFound(this.resolvedType);
39
		throw new SelectionNodeFound(this.resolvedType);
40
	}
40
	}
41
	
41
	
42
	public TypeBinding resolveType(ClassScope scope) {
42
	public TypeBinding resolveType(ClassScope scope, int checkMode) {
43
		super.resolveType(scope);
43
		super.resolveType(scope, checkMode);
44
		//// removed unnecessary code to solve bug 94653
44
		//// removed unnecessary code to solve bug 94653
45
		//if(this.resolvedType != null && this.resolvedType.isRawType()) {
45
		//if(this.resolvedType != null && this.resolvedType.isRawType()) {
46
		//	ParameterizedTypeBinding parameterizedTypeBinding = scope.createParameterizedType(((RawTypeBinding)this.resolvedType).type, new TypeBinding[0], this.resolvedType.enclosingType());
46
		//	ParameterizedTypeBinding parameterizedTypeBinding = scope.createParameterizedType(((RawTypeBinding)this.resolvedType).type, new TypeBinding[0], this.resolvedType.enclosingType());

Return to bug 124119