new JField(info, "$MAP", mapClass, typeMap.get(mapType), true, Disposition.FINAL);
mapClass.addField(mapField);
JMethodCall call = new JMethodCall(info, null, typeMap.get(createValueOfMapBinding));
call.addArg(new JMethodCall(info, null, valuesMethod));
JFieldRef mapRef = new JFieldRef(info, null, mapField, mapClass);
JDeclarationStatement declStmt = new JDeclarationStatement(info, mapRef, call);
JMethod clinit =
createSyntheticMethod(info, "$clinit", mapClass, JPrimitiveType.VOID, false, true,
true, AccessModifier.PRIVATE);
JBlock clinitBlock = ((JMethodBody) clinit.getBody()).getBlock();
clinitBlock.addStmt(declStmt);
}
/*
* return Enum.valueOf(Enum$Map.Map.$MAP, name);
*/
{
SourceInfo info = method.getSourceInfo();
MethodBinding valueOfBinding =
enumType.getExactMethod(VALUE_OF, new TypeBinding[]{
mapType, curCud.scope.getJavaLangString()}, curCud.scope);
assert valueOfBinding != null;
JFieldRef mapRef = new JFieldRef(info, null, mapField, type);
JParameterRef nameRef = new JParameterRef(info, method.getParams().get(0));
JMethodCall call = new JMethodCall(info, null, typeMap.get(valueOfBinding));
call.addArgs(mapRef, nameRef);
implementMethod(method, call);
}