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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/core/compiler/IProblem.java (+5 lines)
Lines 1090-1095 Link Here
1090
	 */
1090
	 */
1091
	/** @since 3.1 */
1091
	/** @since 3.1 */
1092
	int CorruptedSignature = Internal + 700;
1092
	int CorruptedSignature = Internal + 700;
1093
	/**
1094
	 * Corrupted source
1095
	 */
1096
	/** @since 3.1 */
1097
	int CannotReadSource = Internal + 701;
1093
1098
1094
	/**
1099
	/**
1095
	 * Autoboxing
1100
	 * Autoboxing
(-)compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties (+3 lines)
Lines 525-530 Link Here
525
### CORRUPTED BINARIES
525
### CORRUPTED BINARIES
526
700 = The class file {0} contains a signature ''{1}'' ill-formed at position {2}
526
700 = The class file {0} contains a signature ''{1}'' ill-formed at position {2}
527
527
528
### CORRUPTED SOURCES
529
701 = Cannot read source from {0} due to internal exception {1}
530
528
### AUTOBOXING
531
### AUTOBOXING
529
720 = The expression of type {0} is boxed into {1}
532
720 = The expression of type {0} is boxed into {1}
530
721 = The expression of type {0} is unboxed into {1}
533
721 = The expression of type {0} is unboxed into {1}
(-)compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java (+16 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.compiler.problem;
11
package org.eclipse.jdt.internal.compiler.problem;
12
12
13
import java.io.PrintWriter;
14
import java.io.StringWriter;
13
import java.text.MessageFormat;
15
import java.text.MessageFormat;
14
16
15
import org.eclipse.jdt.core.compiler.CategorizedProblem;
17
import org.eclipse.jdt.core.compiler.CategorizedProblem;
Lines 815-820 Link Here
815
		constructorCall.sourceStart,
817
		constructorCall.sourceStart,
816
		constructorCall.sourceEnd);
818
		constructorCall.sourceEnd);
817
}
819
}
820
public void cannotReadSource(CompilationUnitDeclaration unit, Throwable e) {
821
	String fileName = new String(unit.compilationResult.fileName);
822
	StringWriter stringWriter = new StringWriter();
823
	PrintWriter writer = new PrintWriter(stringWriter);
824
	e.printStackTrace(writer);
825
	String exceptionTrace = stringWriter.toString();
826
	String[] arguments = new String[]{ fileName, exceptionTrace, };
827
	this.handle(
828
			IProblem.CannotReadSource,
829
			arguments,
830
			arguments,
831
			0,
832
			0);
833
}
818
public void cannotReferToNonFinalOuterLocal(LocalVariableBinding local, ASTNode location) {
834
public void cannotReferToNonFinalOuterLocal(LocalVariableBinding local, ASTNode location) {
819
	String[] arguments =new String[]{ new String(local.readableName())};
835
	String[] arguments =new String[]{ new String(local.readableName())};
820
	this.handle(
836
	this.handle(
(-)compiler/org/eclipse/jdt/internal/compiler/problem/AbortCompilationUnit.java (+4 lines)
Lines 26-29 Link Here
26
public AbortCompilationUnit(CompilationResult compilationResult, CategorizedProblem problem) {
26
public AbortCompilationUnit(CompilationResult compilationResult, CategorizedProblem problem) {
27
	super(compilationResult, problem);
27
	super(compilationResult, problem);
28
}
28
}
29
30
public AbortCompilationUnit(CompilationResult compilationResult, Throwable exception) {
31
	super(compilationResult, exception);
32
}
29
}
33
}
(-)compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java (-10 / +18 lines)
Lines 38-43 Link Here
38
import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
38
import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
39
import org.eclipse.jdt.internal.compiler.parser.diagnose.DiagnoseParser;
39
import org.eclipse.jdt.internal.compiler.parser.diagnose.DiagnoseParser;
40
import org.eclipse.jdt.internal.compiler.problem.AbortCompilation;
40
import org.eclipse.jdt.internal.compiler.problem.AbortCompilation;
41
import org.eclipse.jdt.internal.compiler.problem.AbortCompilationUnit;
41
import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
42
import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
42
import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
43
import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
43
import org.eclipse.jdt.internal.compiler.util.Messages;
44
import org.eclipse.jdt.internal.compiler.util.Messages;
Lines 7704-7711 Link Here
7704
	try {
7705
	try {
7705
		this.diet = true;
7706
		this.diet = true;
7706
		parsedUnit = parse(sourceUnit, compilationResult);
7707
		parsedUnit = parse(sourceUnit, compilationResult);
7707
	}
7708
	} finally {
7708
	finally {
7709
		this.diet = old;
7709
		this.diet = old;
7710
	}
7710
	}
7711
	return parsedUnit;
7711
	return parsedUnit;
Lines 9033-9041 Link Here
9033
		initialize(true);
9033
		initialize(true);
9034
		goForCompilationUnit();
9034
		goForCompilationUnit();
9035
9035
9036
		/* unit creation */
9037
		this.referenceContext = 
9038
			this.compilationUnit = 
9039
				new CompilationUnitDeclaration(
9040
					this.problemReporter, 
9041
					compilationResult, 
9042
					0);
9043
9036
		/* scanners initialization */
9044
		/* scanners initialization */
9037
		char[] contents = sourceUnit.getContents();
9045
		char[] contents;
9046
		try {
9047
			contents = sourceUnit.getContents();
9048
		} catch(AbortCompilationUnit e) {
9049
			this.problemReporter().cannotReadSource(this.compilationUnit, e.exception);
9050
			contents = CharOperation.NO_CHAR; // pretend empty from thereon
9051
		}
9038
		this.scanner.setSource(contents);
9052
		this.scanner.setSource(contents);
9053
		this.compilationUnit.sourceEnd = this.scanner.source.length - 1;
9039
		if (end != -1) this.scanner.resetTo(start, end);
9054
		if (end != -1) this.scanner.resetTo(start, end);
9040
		if (this.javadocParser != null && this.javadocParser.checkDocComment) {
9055
		if (this.javadocParser != null && this.javadocParser.checkDocComment) {
9041
			this.javadocParser.scanner.setSource(contents);
9056
			this.javadocParser.scanner.setSource(contents);
Lines 9043-9055 Link Here
9043
				this.javadocParser.scanner.resetTo(start, end);
9058
				this.javadocParser.scanner.resetTo(start, end);
9044
			}
9059
			}
9045
		}
9060
		}
9046
		/* unit creation */
9047
		this.referenceContext = 
9048
			this.compilationUnit = 
9049
				new CompilationUnitDeclaration(
9050
					this.problemReporter, 
9051
					compilationResult, 
9052
					this.scanner.source.length);
9053
		/* run automaton */
9061
		/* run automaton */
9054
		parse();
9062
		parse();
9055
	} finally {
9063
	} finally {
(-)batch/org/eclipse/jdt/internal/compiler/batch/CompilationUnit.java (-2 / +3 lines)
Lines 15-20 Link Here
15
15
16
import org.eclipse.jdt.core.compiler.CharOperation;
16
import org.eclipse.jdt.core.compiler.CharOperation;
17
import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
17
import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
18
import org.eclipse.jdt.internal.compiler.problem.AbortCompilationUnit;
18
import org.eclipse.jdt.internal.compiler.util.Util;
19
import org.eclipse.jdt.internal.compiler.util.Util;
19
20
20
public class CompilationUnit implements ICompilationUnit {
21
public class CompilationUnit implements ICompilationUnit {
Lines 56-64 Link Here
56
	try {
57
	try {
57
		return Util.getFileCharContent(new File(new String(this.fileName)), this.encoding);
58
		return Util.getFileCharContent(new File(new String(this.fileName)), this.encoding);
58
	} catch (IOException e) {
59
	} catch (IOException e) {
59
		// assume no content then
60
		this.contents = CharOperation.NO_CHAR; // assume no source if asked again
61
		throw new AbortCompilationUnit(null, e);
60
	}
62
	}
61
	return CharOperation.NO_CHAR;
62
}
63
}
63
/**
64
/**
64
 * @see org.eclipse.jdt.internal.compiler.env.IDependent#getFileName()
65
 * @see org.eclipse.jdt.internal.compiler.env.IDependent#getFileName()

Return to bug 130980