Lines 13-20
Link Here
|
13 |
package org.eclipse.jdt.core.compiler; |
13 |
package org.eclipse.jdt.core.compiler; |
14 |
|
14 |
|
15 |
import org.eclipse.core.resources.IFile; |
15 |
import org.eclipse.core.resources.IFile; |
16 |
import org.eclipse.jdt.internal.core.builder.CompilationParticipantResult; |
|
|
17 |
import org.eclipse.jdt.internal.core.builder.SourceFile; |
18 |
|
16 |
|
19 |
/** |
17 |
/** |
20 |
* The context of a build event that is notified to interested compilation |
18 |
* The context of a build event that is notified to interested compilation |
Lines 25-41
Link Here
|
25 |
* @noinstantiate This class is not intended to be instantiated by clients. |
23 |
* @noinstantiate This class is not intended to be instantiated by clients. |
26 |
* @noextend This class is not intended to be subclassed by clients. |
24 |
* @noextend This class is not intended to be subclassed by clients. |
27 |
*/ |
25 |
*/ |
28 |
public class BuildContext extends CompilationParticipantResult { |
26 |
public class BuildContext { |
29 |
|
|
|
30 |
/** |
31 |
* Creates a build context for the given source file. |
32 |
* |
33 |
* @param sourceFile the source file being built |
34 |
* @noreference This constructor is not intended to be called by clients. |
35 |
*/ |
36 |
public BuildContext(SourceFile sourceFile) { |
37 |
super(sourceFile); |
38 |
} |
39 |
|
27 |
|
40 |
/** |
28 |
/** |
41 |
* Returns the contents of the compilation unit. |
29 |
* Returns the contents of the compilation unit. |
Lines 43-49
Link Here
|
43 |
* @return the contents of the compilation unit |
31 |
* @return the contents of the compilation unit |
44 |
*/ |
32 |
*/ |
45 |
public char[] getContents() { |
33 |
public char[] getContents() { |
46 |
return this.sourceFile.getContents(); |
34 |
return null; // default overridden by concrete implementation |
47 |
} |
35 |
} |
48 |
|
36 |
|
49 |
/** |
37 |
/** |
Lines 52-58
Link Here
|
52 |
* @return the <code>IFile</code> representing the compilation unit |
40 |
* @return the <code>IFile</code> representing the compilation unit |
53 |
*/ |
41 |
*/ |
54 |
public IFile getFile() { |
42 |
public IFile getFile() { |
55 |
return this.sourceFile.resource; |
43 |
return null; // default overridden by concrete implementation |
56 |
} |
44 |
} |
57 |
|
45 |
|
58 |
/** |
46 |
/** |
Lines 63-69
Link Here
|
63 |
* @return whether the compilation unit contained any annotations when it was compiled |
51 |
* @return whether the compilation unit contained any annotations when it was compiled |
64 |
*/ |
52 |
*/ |
65 |
public boolean hasAnnotations() { |
53 |
public boolean hasAnnotations() { |
66 |
return this.hasAnnotations; // only set during processAnnotations |
54 |
return false; // default overridden by concrete implementation |
67 |
} |
55 |
} |
68 |
|
56 |
|
69 |
/** |
57 |
/** |
Lines 72-86
Link Here
|
72 |
* @param addedGeneratedFiles the added/changed files |
60 |
* @param addedGeneratedFiles the added/changed files |
73 |
*/ |
61 |
*/ |
74 |
public void recordAddedGeneratedFiles(IFile[] addedGeneratedFiles) { |
62 |
public void recordAddedGeneratedFiles(IFile[] addedGeneratedFiles) { |
75 |
int length2 = addedGeneratedFiles.length; |
63 |
// default overridden by concrete implementation |
76 |
if (length2 == 0) return; |
|
|
77 |
|
78 |
int length1 = this.addedFiles == null ? 0 : this.addedFiles.length; |
79 |
IFile[] merged = new IFile[length1 + length2]; |
80 |
if (length1 > 0) // always make a copy even if currently empty |
81 |
System.arraycopy(this.addedFiles, 0, merged, 0, length1); |
82 |
System.arraycopy(addedGeneratedFiles, 0, merged, length1, length2); |
83 |
this.addedFiles = merged; |
84 |
} |
64 |
} |
85 |
|
65 |
|
86 |
/** |
66 |
/** |
Lines 89-103
Link Here
|
89 |
* @param deletedGeneratedFiles the files that need to be deleted |
69 |
* @param deletedGeneratedFiles the files that need to be deleted |
90 |
*/ |
70 |
*/ |
91 |
public void recordDeletedGeneratedFiles(IFile[] deletedGeneratedFiles) { |
71 |
public void recordDeletedGeneratedFiles(IFile[] deletedGeneratedFiles) { |
92 |
int length2 = deletedGeneratedFiles.length; |
72 |
// default overridden by concrete implementation |
93 |
if (length2 == 0) return; |
|
|
94 |
|
95 |
int length1 = this.deletedFiles == null ? 0 : this.deletedFiles.length; |
96 |
IFile[] merged = new IFile[length1 + length2]; |
97 |
if (length1 > 0) // always make a copy even if currently empty |
98 |
System.arraycopy(this.deletedFiles, 0, merged, 0, length1); |
99 |
System.arraycopy(deletedGeneratedFiles, 0, merged, length1, length2); |
100 |
this.deletedFiles = merged; |
101 |
} |
73 |
} |
102 |
|
74 |
|
103 |
/** |
75 |
/** |
Lines 106-120
Link Here
|
106 |
* @param typeNameDependencies the fully-qualified type names of new dependencies |
78 |
* @param typeNameDependencies the fully-qualified type names of new dependencies |
107 |
*/ |
79 |
*/ |
108 |
public void recordDependencies(String[] typeNameDependencies) { |
80 |
public void recordDependencies(String[] typeNameDependencies) { |
109 |
int length2 = typeNameDependencies.length; |
81 |
// default overridden by concrete implementation |
110 |
if (length2 == 0) return; |
|
|
111 |
|
112 |
int length1 = this.dependencies == null ? 0 : this.dependencies.length; |
113 |
String[] merged = new String[length1 + length2]; |
114 |
if (length1 > 0) // always make a copy even if currently empty |
115 |
System.arraycopy(this.dependencies, 0, merged, 0, length1); |
116 |
System.arraycopy(typeNameDependencies, 0, merged, length1, length2); |
117 |
this.dependencies = merged; |
118 |
} |
82 |
} |
119 |
|
83 |
|
120 |
/** |
84 |
/** |
Lines 125-139
Link Here
|
125 |
* @param newProblems the problems to report |
89 |
* @param newProblems the problems to report |
126 |
*/ |
90 |
*/ |
127 |
public void recordNewProblems(CategorizedProblem[] newProblems) { |
91 |
public void recordNewProblems(CategorizedProblem[] newProblems) { |
128 |
int length2 = newProblems.length; |
92 |
// default overridden by concrete implementation |
129 |
if (length2 == 0) return; |
|
|
130 |
|
131 |
int length1 = this.problems == null ? 0 : this.problems.length; |
132 |
CategorizedProblem[] merged = new CategorizedProblem[length1 + length2]; |
133 |
if (length1 > 0) // always make a copy even if currently empty |
134 |
System.arraycopy(this.problems, 0, merged, 0, length1); |
135 |
System.arraycopy(newProblems, 0, merged, length1, length2); |
136 |
this.problems = merged; |
137 |
} |
93 |
} |
138 |
|
94 |
|
139 |
} |
95 |
} |