Lines 248-274
Link Here
|
248 |
if ((this.flags & LOCAL_TYPE) != 0) { |
248 |
if ((this.flags & LOCAL_TYPE) != 0) { |
249 |
IJavaElement[] children = fieldInfo.getChildren(); |
249 |
IJavaElement[] children = fieldInfo.getChildren(); |
250 |
int childrenLength = children.length; |
250 |
int childrenLength = children.length; |
251 |
if (childrenLength > 0) { |
251 |
if (childrenLength == 1) { |
|
|
252 |
field.initialization = convert(children[0], isEnumConstant ? field : null, compilationResult); |
253 |
} else if (childrenLength > 1) { |
252 |
ArrayInitializer initializer = new ArrayInitializer(); |
254 |
ArrayInitializer initializer = new ArrayInitializer(); |
253 |
field.initialization = initializer; |
255 |
field.initialization = initializer; |
254 |
Expression[] expressions = new Expression[childrenLength]; |
256 |
Expression[] expressions = new Expression[childrenLength]; |
255 |
initializer.expressions = expressions; |
257 |
initializer.expressions = expressions; |
256 |
for (int i = 0; i < childrenLength; i++) { |
258 |
for (int i = 0; i < childrenLength; i++) { |
257 |
IJavaElement localType = children[i]; |
259 |
expressions[i] = convert(children[i], isEnumConstant ? field : null, compilationResult); |
258 |
TypeDeclaration anonymousLocalTypeDeclaration = convert((SourceType) localType, compilationResult); |
|
|
259 |
QualifiedAllocationExpression expression = new QualifiedAllocationExpression(anonymousLocalTypeDeclaration); |
260 |
expression.type = anonymousLocalTypeDeclaration.superclass; |
261 |
anonymousLocalTypeDeclaration.superclass = null; |
262 |
anonymousLocalTypeDeclaration.superInterfaces = null; |
263 |
anonymousLocalTypeDeclaration.allocation = expression; |
264 |
anonymousLocalTypeDeclaration.modifiers &= ~ClassFileConstants.AccEnum; // remove tag in case this is the init of an enum constant |
265 |
expressions[i] = expression; |
266 |
} |
260 |
} |
267 |
} |
261 |
} |
268 |
} |
262 |
} |
269 |
return field; |
263 |
return field; |
270 |
} |
264 |
} |
271 |
|
265 |
|
|
|
266 |
private QualifiedAllocationExpression convert(IJavaElement localType, FieldDeclaration enumConstant, CompilationResult compilationResult) throws JavaModelException { |
267 |
TypeDeclaration anonymousLocalTypeDeclaration = convert((SourceType) localType, compilationResult); |
268 |
QualifiedAllocationExpression expression = new QualifiedAllocationExpression(anonymousLocalTypeDeclaration); |
269 |
expression.type = anonymousLocalTypeDeclaration.superclass; |
270 |
anonymousLocalTypeDeclaration.superclass = null; |
271 |
anonymousLocalTypeDeclaration.superInterfaces = null; |
272 |
anonymousLocalTypeDeclaration.allocation = expression; |
273 |
if (enumConstant != null) { |
274 |
anonymousLocalTypeDeclaration.modifiers &= ~ClassFileConstants.AccEnum; |
275 |
expression.enumConstant = enumConstant; |
276 |
expression.type = null; |
277 |
} |
278 |
return expression; |
279 |
} |
280 |
|
272 |
/* |
281 |
/* |
273 |
* Convert a method source element into a parsed method/constructor declaration |
282 |
* Convert a method source element into a parsed method/constructor declaration |
274 |
*/ |
283 |
*/ |