View | Details | Raw Unified | Return to bug 107814
Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/CompilationResult.java (-18 / +18 lines)
Lines 125-153 Link Here
125
	}
125
	}
126
126
127
	public void discardSuppressedWarnings() {
127
	public void discardSuppressedWarnings() {
128
128
	
129
		if (this.suppressWarningsCount == 0) return;
129
		if (this.suppressWarningsCount == 0) return;
130
		int removed = 0;
130
		int removed = 0;
131
		nextProblem: for (int i = 0, length = this.problemCount; i < length; i++) {
131
		nextProblem: for (int i = 0, length = this.problemCount; i < length; i++) {
132
			IProblem problem = this.problems[i];
132
			IProblem problem = this.problems[i];
133
			if (!problem.isWarning()) 
134
				continue nextProblem;
135
			int start = problem.getSourceStart();
136
			int end = problem.getSourceEnd();
137
			int problemID = problem.getID();
133
			int problemID = problem.getID();
138
			nextSuppress: for (int j = 0, max = this.suppressWarningsCount; j < max; j++) {
134
			if (problem.isWarning() || problemID == IProblem.NonExternalizedStringLiteral) { 
139
				long position = this.suppressWarningScopePositions[j];
135
				int start = problem.getSourceStart();
140
				int startSuppress = (int) (position >>> 32);
136
				int end = problem.getSourceEnd();
141
				int endSuppress = (int) position;
137
				nextSuppress: for (int j = 0, max = this.suppressWarningsCount; j < max; j++) {
142
				if (start < startSuppress) continue nextSuppress;
138
					long position = this.suppressWarningScopePositions[j];
143
				if (end > endSuppress) continue nextSuppress;
139
					int startSuppress = (int) (position >>> 32);
144
				if ((ProblemReporter.getIrritant(problemID) & this.suppressWarningIrritants[j]) == 0)
140
					int endSuppress = (int) position;
145
					continue nextSuppress;
141
					if (start < startSuppress) continue nextSuppress;
146
				// discard suppressed warning
142
					if (end > endSuppress) continue nextSuppress;
147
				removed++;
143
					if ((ProblemReporter.getIrritant(problemID) & this.suppressWarningIrritants[j]) == 0)
148
				problems[i] = null;
144
						continue nextSuppress;
149
				if (problemsMap != null) problemsMap.remove(problem);
145
					// discard suppressed warning
150
				continue nextProblem;
146
					removed++;
147
					problems[i] = null;
148
					if (problemsMap != null) problemsMap.remove(problem);
149
					continue nextProblem;
150
				}
151
			}
151
			}
152
		}
152
		}
153
		if (removed > 0) {
153
		if (removed > 0) {
(-)compiler/org/eclipse/jdt/internal/compiler/problem/ProblemHandler.java (-9 / +17 lines)
Lines 89-95 Link Here
89
	// if no reference context, we need to abort from the current compilation process
89
	// if no reference context, we need to abort from the current compilation process
90
	if (referenceContext == null) {
90
	if (referenceContext == null) {
91
		if ((severity & Error) != 0) { // non reportable error is fatal
91
		if ((severity & Error) != 0) { // non reportable error is fatal
92
			IProblem problem = this.createProblem(null, 	problemId, 	problemArguments, messageArguments, severity, 0, 0, 0);			
92
			if (problemId == IProblem.UnusedImport) return; 
93
			IProblem problem = this.createProblem(null, problemId, problemArguments, messageArguments, severity, 0, 0, 0);			
93
			throw new AbortCompilation(null, problem);
94
			throw new AbortCompilation(null, problem);
94
		} else {
95
		} else {
95
			return; // ignore non reportable warning
96
			return; // ignore non reportable warning
Lines 113-126 Link Here
113
	switch (severity & Error) {
114
	switch (severity & Error) {
114
		case Error :
115
		case Error :
115
			this.record(problem, unitResult, referenceContext);
116
			this.record(problem, unitResult, referenceContext);
116
			referenceContext.tagAsHavingErrors();
117
			// we might want to filter other non jls mandatory errors
117
118
			switch(problemId) {
118
			// should abort ?
119
				case IProblem.UnusedImport :
119
			int abortLevel;
120
				case IProblem.NonExternalizedStringLiteral :
120
			if ((abortLevel = 
121
					break;
121
				(this.policy.stopOnFirstError() ? AbortCompilation : severity & Abort)) != 0) {
122
				default: 
122
123
					referenceContext.tagAsHavingErrors();
123
				referenceContext.abort(abortLevel, problem);
124
		
125
					// should abort ?
126
					int abortLevel;
127
					if ((abortLevel = 
128
						(this.policy.stopOnFirstError() ? AbortCompilation : severity & Abort)) != 0) {
129
		
130
						referenceContext.abort(abortLevel, problem);
131
					}
124
			}
132
			}
125
			break;
133
			break;
126
		case Warning :
134
		case Warning :

Return to bug 107814