Lines 96-115
Link Here
|
96 |
|
96 |
|
97 |
CompilationResult result = |
97 |
CompilationResult result = |
98 |
new CompilationResult(sourceTypes[0].getFileName(), 1, 1, this.options.maxProblemsPerUnit); |
98 |
new CompilationResult(sourceTypes[0].getFileName(), 1, 1, this.options.maxProblemsPerUnit); |
|
|
99 |
|
100 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=305259 |
101 |
long currentSourceLevel = this.options.sourceLevel; |
102 |
long currentComplianceLevel = this.options.complianceLevel; |
103 |
|
104 |
try { |
105 |
IJavaProject project = ((SourceTypeElementInfo) sourceTypes[0]).getHandle().getJavaProject(); |
106 |
this.options.sourceLevel = CompilerOptions.versionToJdkLevel(project.getOption(JavaCore.COMPILER_SOURCE, true)); |
107 |
this.options.complianceLevel = CompilerOptions.versionToJdkLevel(project.getOption(JavaCore.COMPILER_COMPLIANCE, true)); |
108 |
|
109 |
// need to hold onto this |
110 |
CompilationUnitDeclaration unit = |
111 |
SourceTypeConverter.buildCompilationUnit( |
112 |
sourceTypes,//sourceTypes[0] is always toplevel here |
113 |
SourceTypeConverter.FIELD_AND_METHOD // need field and methods |
114 |
| SourceTypeConverter.MEMBER_TYPE // need member types |
115 |
| SourceTypeConverter.FIELD_INITIALIZATION, // need field initialization |
116 |
this.lookupEnvironment.problemReporter, |
117 |
result); |
99 |
|
118 |
|
100 |
// need to hold onto this |
119 |
if (unit != null) { |
101 |
CompilationUnitDeclaration unit = |
120 |
this.lookupEnvironment.buildTypeBindings(unit, accessRestriction); |
102 |
SourceTypeConverter.buildCompilationUnit( |
121 |
this.lookupEnvironment.completeTypeBindings(unit); |
103 |
sourceTypes,//sourceTypes[0] is always toplevel here |
122 |
} |
104 |
SourceTypeConverter.FIELD_AND_METHOD // need field and methods |
123 |
} finally { |
105 |
| SourceTypeConverter.MEMBER_TYPE // need member types |
124 |
this.options.sourceLevel = currentSourceLevel; |
106 |
| SourceTypeConverter.FIELD_INITIALIZATION, // need field initialization |
125 |
this.options.complianceLevel = currentComplianceLevel; |
107 |
this.lookupEnvironment.problemReporter, |
|
|
108 |
result); |
109 |
|
110 |
if (unit != null) { |
111 |
this.lookupEnvironment.buildTypeBindings(unit, accessRestriction); |
112 |
this.lookupEnvironment.completeTypeBindings(unit); |
113 |
} |
126 |
} |
114 |
} |
127 |
} |
115 |
|
128 |
|