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

Collapse All | Expand All

(-)MethodDeclaration.java (-9 / +10 lines)
Lines 135-150 Link Here
135
		}
135
		}
136
		
136
		
137
		// check @Override annotation
137
		// check @Override annotation
138
		if (this.binding != null) {
138
		checkOverride: {
139
			if (this.binding == null) break checkOverride;
140
			if (scope.compilerOptions().sourceLevel < JDK1_5) break checkOverride;
139
			int bindingModifiers = this.binding.modifiers;
141
			int bindingModifiers = this.binding.modifiers;
140
			if ((this.binding.tagBits & TagBits.AnnotationOverride) != 0 
142
			boolean hasOverrideAnnotation = (this.binding.tagBits & TagBits.AnnotationOverride) != 0;
141
					&& (bindingModifiers & AccOverriding) == 0) {
143
			boolean isInterfaceMethod = this.binding.declaringClass.isInterface();
142
				// claims to override, and doesn't actually do so
144
			if (hasOverrideAnnotation) {
143
				scope.problemReporter().methodMustOverride(this);
145
				if ((bindingModifiers & AccOverriding) == 0 || isInterfaceMethod)
144
			} else	if ((this.binding.tagBits & TagBits.AnnotationOverride) == 0 
146
					// claims to override, and doesn't actually do so
145
						&& (this.binding.declaringClass.modifiers & AccInterface) == 0
147
					scope.problemReporter().methodMustOverride(this);					
146
						&& (bindingModifiers & (AccStatic|AccOverriding)) == AccOverriding
148
			} else if (!isInterfaceMethod 	&& (bindingModifiers & (AccStatic|AccOverriding)) == AccOverriding) {
147
						&& scope.compilerOptions().sourceLevel >= JDK1_5) {
148
				// actually overrides, but did not claim to do so
149
				// actually overrides, but did not claim to do so
149
				scope.problemReporter().missingOverrideAnnotation(this);
150
				scope.problemReporter().missingOverrideAnnotation(this);
150
			}
151
			}

Return to bug 94759