use of org.eclipse.xtext.common.types.impl.JvmExecutableImplCustom in project xtext-eclipse by eclipse.
the class JdtBasedTypeFactory method enhanceExecutable.
/**
* @since 2.4
*/
protected void enhanceExecutable(StringBuilder fqn, String handleIdentifier, String[] path, JvmExecutable result, IMethodBinding method) {
String name = method.getName();
fqn.append(name);
fqn.append('(');
ITypeBinding[] parameterTypes = method.getParameterTypes();
for (int i = 0; i < parameterTypes.length; i++) {
if (i != 0)
fqn.append(',');
fqn.append(getQualifiedName(parameterTypes[i]));
}
fqn.append(')');
result.internalSetIdentifier(fqn.toString());
result.setSimpleName(name);
setVisibility(result, method.getModifiers());
result.setDeprecated(method.isDeprecated());
if (parameterTypes.length > 0) {
result.setVarArgs(method.isVarargs());
String[] parameterNames = null;
// If the method is derived from source, we can efficiently determine the parameter names now.
//
ITypeBinding declaringClass = method.getDeclaringClass();
if (declaringClass.isFromSource()) {
parameterNames = getParameterNamesFromSource(fqn, method);
} else {
// Use the key to determine the signature for the method.
//
SegmentSequence signaturex = getSignatureAsSegmentSequence(method);
ParameterNameInitializer initializer = jdtCompliance.createParameterNameInitializer(method, workingCopyOwner, result, handleIdentifier, path, name, signaturex);
((JvmExecutableImplCustom) result).setParameterNameInitializer(initializer);
}
setParameterNamesAndAnnotations(method, parameterTypes, parameterNames, result);
}
ITypeBinding[] exceptionTypes = method.getExceptionTypes();
if (exceptionTypes.length > 0) {
InternalEList<JvmTypeReference> exceptions = (InternalEList<JvmTypeReference>) result.getExceptions();
for (ITypeBinding exceptionType : exceptionTypes) {
exceptions.addUnique(createTypeReference(exceptionType));
}
}
}
Aggregations