Java Code Examples for org.eclipse.jdt.core.dom.IMethodBinding#getMethodDeclaration()
The following examples show how to use
org.eclipse.jdt.core.dom.IMethodBinding#getMethodDeclaration() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InJavaImporter.java From jdt2famix with Eclipse Public License 1.0 | 6 votes |
/** * We pass the signature because we want to get it from the node, but there can * be different types of nodes (funny JDT). */ public Invocation createInvocationFromMethodBinding(IMethodBinding binding, String signature) { Invocation invocation = new Invocation(); if (topOfContainerStack() instanceof Method) invocation.setSender((Method) topOfContainerStack()); if (binding != null && binding.getMethodDeclaration() != null) { IMethodBinding methodDeclarationBinding = binding.getMethodDeclaration(); ITypeBinding declaringClass = null; if (methodDeclarationBinding.getDeclaringClass() != null) declaringClass = methodDeclarationBinding.getDeclaringClass(); else declaringClass = binding.getDeclaringClass(); Type ensureTypeFromTypeBinding = ensureTypeFromTypeBinding(declaringClass); invocation .addCandidates(ensureMethodFromMethodBinding(methodDeclarationBinding, ensureTypeFromTypeBinding)); } invocation.setSignature(signature); repository.add(invocation); return invocation; }
Example 2
Source File: SuperTypeConstraintsModel.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
/** * Creates a new method parameter variable. * * @param method the method binding * @param index the index of the parameter * @return the created method parameter variable, or <code>null</code> */ public final ConstraintVariable2 createMethodParameterVariable(final IMethodBinding method, final int index) { final ITypeBinding[] parameters= method.getParameterTypes(); if (parameters.length < 1) return null; ITypeBinding binding= parameters[Math.min(index, parameters.length - 1)]; if (binding.isArray()) binding= binding.getElementType(); if (isConstrainedType(binding)) { ConstraintVariable2 variable= null; final TType type= createTType(binding); if (method.getDeclaringClass().isFromSource()) variable= new ParameterTypeVariable2(type, index, method.getMethodDeclaration()); else variable= new ImmutableTypeVariable2(type); return fConstraintVariables.addExisting(variable); } return null; }
Example 3
Source File: JdtUtils.java From j2cl with Apache License 2.0 | 5 votes |
private static boolean isOrOverridesJsFunctionMethod(IMethodBinding methodBinding) { ITypeBinding declaringType = methodBinding.getDeclaringClass(); if (JsInteropUtils.isJsFunction(declaringType) && declaringType.getFunctionalInterfaceMethod() != null && methodBinding.getMethodDeclaration() == declaringType.getFunctionalInterfaceMethod().getMethodDeclaration()) { return true; } for (IMethodBinding overriddenMethodBinding : getOverriddenMethods(methodBinding)) { if (isOrOverridesJsFunctionMethod(overriddenMethodBinding)) { return true; } } return false; }
Example 4
Source File: SrcTreeGenerator.java From sahagin-java with Apache License 2.0 | 5 votes |
private List<String> getArgClassQualifiedNames(IMethodBinding method) { ITypeBinding[] paramTypes; if (method.isParameterizedMethod()) { // Use generic type to get argument class types // instead of the actual type resolved by JDT. IMethodBinding originalMethod = method.getMethodDeclaration(); paramTypes = originalMethod.getParameterTypes(); } else { paramTypes = method.getParameterTypes(); } List<String> result = new ArrayList<>(paramTypes.length); for (ITypeBinding param : paramTypes) { // AdditionalTestDoc's argClassQualifiedNames are defined by type erasure. // TODO is this generic handling logic always work well?? ITypeBinding erasure = param.getErasure(); if (erasure.isPrimitive() || erasure.isArray()) { // "int", "boolean", etc result.add(erasure.getQualifiedName()); } else { // getBinaryName and getQualifiedName are not the same. // For example, getBinaryName returns parent$child for inner class, // but getQualifiedName returns parent.child result.add(erasure.getBinaryName()); } } return result; }
Example 5
Source File: VarargsWarningsSubProcessor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public static void addAddSafeVarargsToDeclarationProposals(IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) { if (!JavaModelUtil.is17OrHigher(context.getCompilationUnit().getJavaProject())) return; ASTNode coveringNode= problem.getCoveringNode(context.getASTRoot()); IMethodBinding methodBinding; if (coveringNode instanceof MethodInvocation) { methodBinding= ((MethodInvocation) coveringNode).resolveMethodBinding(); } else if (coveringNode instanceof ClassInstanceCreation) { methodBinding= ((ClassInstanceCreation) coveringNode).resolveConstructorBinding(); } else { return; } if (methodBinding == null) return; String label= Messages.format(CorrectionMessages.VarargsWarningsSubProcessor_add_safevarargs_to_method_label, methodBinding.getName()); ITypeBinding declaringType= methodBinding.getDeclaringClass(); CompilationUnit astRoot= (CompilationUnit) coveringNode.getRoot(); if (declaringType != null && declaringType.isFromSource()) { try { ICompilationUnit targetCu= ASTResolving.findCompilationUnitForBinding(context.getCompilationUnit(), astRoot, declaringType); if (targetCu != null) { AddSafeVarargsProposal proposal= new AddSafeVarargsProposal(label, targetCu, null, methodBinding.getMethodDeclaration(), IProposalRelevance.ADD_SAFEVARARGS); proposals.add(proposal); } } catch (JavaModelException e) { return; } } }
Example 6
Source File: LinkedNodeFinder.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private static IBinding getDeclaration(IBinding binding) { if (binding instanceof ITypeBinding) { return ((ITypeBinding) binding).getTypeDeclaration(); } else if (binding instanceof IMethodBinding) { IMethodBinding methodBinding= (IMethodBinding) binding; if (methodBinding.isConstructor()) { // link all constructors with their type return methodBinding.getDeclaringClass().getTypeDeclaration(); } else { return methodBinding.getMethodDeclaration(); } } else if (binding instanceof IVariableBinding) { return ((IVariableBinding) binding).getVariableDeclaration(); } return binding; }
Example 7
Source File: Bindings.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Finds a method for the given <code>IMethodBinding</code>. Returns * <code>null</code> if the type doesn't contain a corresponding method. * @param method the method to find * @param type the type to look in * @return the corresponding IMethod or <code>null</code> * @throws JavaModelException if an error occurs in the Java model * @deprecated Use {@link #findMethodInHierarchy(ITypeBinding, String, String[])} or {@link JavaModelUtil} */ public static IMethod findMethod(IMethodBinding method, IType type) throws JavaModelException { method= method.getMethodDeclaration(); IMethod[] candidates= type.getMethods(); for (int i= 0; i < candidates.length; i++) { IMethod candidate= candidates[i]; if (candidate.getElementName().equals(method.getName()) && sameParameters(method, candidate)) { return candidate; } } return null; }
Example 8
Source File: SourceAnalyzer.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public boolean visit(MethodInvocation node) { IMethodBinding methodBinding= node.resolveMethodBinding(); if (methodBinding != null) methodBinding.getMethodDeclaration(); if (fBinding != null && methodBinding != null && fBinding.isEqualTo(methodBinding) && !status.hasFatalError()) { status.addFatalError(RefactoringCoreMessages.InlineMethodRefactoring_SourceAnalyzer_recursive_call); return false; } return true; }
Example 9
Source File: ReferenceAnalyzer.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public boolean visit(MethodInvocation node) { IMethodBinding binding= node.resolveMethodBinding(); if (binding != null) { binding= binding.getMethodDeclaration(); if (isMovedMember(binding)) rewrite(node, fTarget); } return super.visit(node); }
Example 10
Source File: SourceAnalyzer.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private IMethodBinding getBinding() { IMethodBinding result= fDeclaration.resolveBinding(); if (result != null) return result.getMethodDeclaration(); return result; }
Example 11
Source File: TargetProvider.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public InvocationFinder(IMethodBinding binding) { Assert.isNotNull(binding); fBinding= binding.getMethodDeclaration(); Assert.isNotNull(fBinding); }
Example 12
Source File: ASTNodes.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public boolean visit(ITypeBinding type) { IMethodBinding[] methods= type.getDeclaredMethods(); for (int i= 0; i < methods.length; i++) { IMethodBinding candidate= methods[i]; if (candidate.getMethodDeclaration() == fOriginalMethod.getMethodDeclaration()) { continue; } ITypeBinding candidateDeclaringType= candidate.getDeclaringClass(); if (fDeclaringType != candidateDeclaringType) { int modifiers= candidate.getModifiers(); if (candidateDeclaringType.isInterface() && Modifier.isStatic(modifiers)) { continue; } if (Modifier.isPrivate(modifiers)) { continue; } } if (fOriginalMethod.getName().equals(candidate.getName()) && !fOriginalMethod.overrides(candidate)) { ITypeBinding[] originalParameterTypes= fOriginalMethod.getParameterTypes(); ITypeBinding[] candidateParameterTypes= candidate.getParameterTypes(); boolean couldBeAmbiguous; if (originalParameterTypes.length == candidateParameterTypes.length) { couldBeAmbiguous= true; } else if (fOriginalMethod.isVarargs() || candidate.isVarargs() ) { int candidateMinArgumentCount= candidateParameterTypes.length; if (candidate.isVarargs()) candidateMinArgumentCount--; couldBeAmbiguous= fArgumentCount >= candidateMinArgumentCount; } else { couldBeAmbiguous= false; } if (couldBeAmbiguous) { ITypeBinding parameterType= ASTResolving.getParameterTypeBinding(candidate, fArgIndex); if (parameterType != null && parameterType.getFunctionalInterfaceMethod() != null) { if (!fExpressionIsExplicitlyTyped) { /* According to JLS8 15.12.2.2, implicitly typed lambda expressions are not "pertinent to applicability" * and hence potentially applicable methods are always "applicable by strict invocation", * regardless of whether argument expressions are compatible with the method's parameter types or not. * If there are multiple such methods, 15.12.2.5 results in an ambiguous method invocation. */ return false; } /* Explicitly typed lambda expressions are pertinent to applicability, and hence * compatibility with the corresponding method parameter type is checked. And since this check * separates functional interface methods by their void-compatibility state, functional interfaces * with a different void compatibility are not applicable any more and hence can't cause * an ambiguous method invocation. */ ITypeBinding origParamType= ASTResolving.getParameterTypeBinding(fOriginalMethod, fArgIndex); boolean originalIsVoidCompatible= Bindings.isVoidType(origParamType.getFunctionalInterfaceMethod().getReturnType()); boolean candidateIsVoidCompatible= Bindings.isVoidType(parameterType.getFunctionalInterfaceMethod().getReturnType()); if (originalIsVoidCompatible == candidateIsVoidCompatible) { return false; } } } } } return true; }
Example 13
Source File: StubUtility2.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public static MethodDeclaration createDelegationStub(ICompilationUnit unit, ASTRewrite rewrite, ImportRewrite imports, ImportRewriteContext context, IMethodBinding delegate, IVariableBinding delegatingField, CodeGenerationSettings settings) throws CoreException { Assert.isNotNull(delegate); Assert.isNotNull(delegatingField); Assert.isNotNull(settings); AST ast= rewrite.getAST(); MethodDeclaration decl= ast.newMethodDeclaration(); decl.modifiers().addAll(ASTNodeFactory.newModifiers(ast, delegate.getModifiers() & ~Modifier.SYNCHRONIZED & ~Modifier.ABSTRACT & ~Modifier.NATIVE)); decl.setName(ast.newSimpleName(delegate.getName())); decl.setConstructor(false); createTypeParameters(imports, context, ast, delegate, decl); decl.setReturnType2(imports.addImport(delegate.getReturnType(), ast, context)); List<SingleVariableDeclaration> params= createParameters(unit.getJavaProject(), imports, context, ast, delegate, null, decl); createThrownExceptions(decl, delegate, imports, context, ast); Block body= ast.newBlock(); decl.setBody(body); String delimiter= StubUtility.getLineDelimiterUsed(unit); Statement statement= null; MethodInvocation invocation= ast.newMethodInvocation(); invocation.setName(ast.newSimpleName(delegate.getName())); List<Expression> arguments= invocation.arguments(); for (int i= 0; i < params.size(); i++) arguments.add(ast.newSimpleName(params.get(i).getName().getIdentifier())); if (settings.useKeywordThis) { FieldAccess access= ast.newFieldAccess(); access.setExpression(ast.newThisExpression()); access.setName(ast.newSimpleName(delegatingField.getName())); invocation.setExpression(access); } else invocation.setExpression(ast.newSimpleName(delegatingField.getName())); if (delegate.getReturnType().isPrimitive() && delegate.getReturnType().getName().equals("void")) {//$NON-NLS-1$ statement= ast.newExpressionStatement(invocation); } else { ReturnStatement returnStatement= ast.newReturnStatement(); returnStatement.setExpression(invocation); statement= returnStatement; } body.statements().add(statement); ITypeBinding declaringType= delegatingField.getDeclaringClass(); if (declaringType == null) { // can be null for return decl; } String qualifiedName= declaringType.getQualifiedName(); IPackageBinding packageBinding= declaringType.getPackage(); if (packageBinding != null) { if (packageBinding.getName().length() > 0 && qualifiedName.startsWith(packageBinding.getName())) qualifiedName= qualifiedName.substring(packageBinding.getName().length()); } if (settings.createComments) { /* * TODO: have API for delegate method comments This is an inlined * version of * {@link CodeGeneration#getMethodComment(ICompilationUnit, String, MethodDeclaration, IMethodBinding, String)} */ delegate= delegate.getMethodDeclaration(); String declaringClassQualifiedName= delegate.getDeclaringClass().getQualifiedName(); String linkToMethodName= delegate.getName(); String[] parameterTypesQualifiedNames= StubUtility.getParameterTypeNamesForSeeTag(delegate); String string= StubUtility.getMethodComment(unit, qualifiedName, decl, delegate.isDeprecated(), linkToMethodName, declaringClassQualifiedName, parameterTypesQualifiedNames, true, delimiter); if (string != null) { Javadoc javadoc= (Javadoc) rewrite.createStringPlaceholder(string, ASTNode.JAVADOC); decl.setJavadoc(javadoc); } } return decl; }
Example 14
Source File: TypeMismatchSubProcessor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public static void addIncompatibleReturnTypeProposals(IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) throws JavaModelException { CompilationUnit astRoot= context.getASTRoot(); ASTNode selectedNode= problem.getCoveringNode(astRoot); if (selectedNode == null) { return; } MethodDeclaration decl= ASTResolving.findParentMethodDeclaration(selectedNode); if (decl == null) { return; } IMethodBinding methodDeclBinding= decl.resolveBinding(); if (methodDeclBinding == null) { return; } ITypeBinding returnType= methodDeclBinding.getReturnType(); IMethodBinding overridden= Bindings.findOverriddenMethod(methodDeclBinding, false); if (overridden == null || overridden.getReturnType() == returnType) { return; } ICompilationUnit cu= context.getCompilationUnit(); IMethodBinding methodDecl= methodDeclBinding.getMethodDeclaration(); ITypeBinding overriddenReturnType= overridden.getReturnType(); if (! JavaModelUtil.is50OrHigher(context.getCompilationUnit().getJavaProject())) { overriddenReturnType= overriddenReturnType.getErasure(); } proposals.add(new TypeChangeCorrectionProposal(cu, methodDecl, astRoot, overriddenReturnType, false, IProposalRelevance.CHANGE_RETURN_TYPE)); ICompilationUnit targetCu= cu; IMethodBinding overriddenDecl= overridden.getMethodDeclaration(); ITypeBinding overridenDeclType= overriddenDecl.getDeclaringClass(); if (overridenDeclType.isFromSource()) { targetCu= ASTResolving.findCompilationUnitForBinding(cu, astRoot, overridenDeclType); if (targetCu != null && ASTResolving.isUseableTypeInContext(returnType, overriddenDecl, false)) { TypeChangeCorrectionProposal proposal= new TypeChangeCorrectionProposal(targetCu, overriddenDecl, astRoot, returnType, false, IProposalRelevance.CHANGE_RETURN_TYPE_OF_OVERRIDDEN); if (overridenDeclType.isInterface()) { proposal.setDisplayName(Messages.format(CorrectionMessages.TypeMismatchSubProcessor_changereturnofimplemented_description, BasicElementLabels.getJavaElementName(overriddenDecl.getName()))); } else { proposal.setDisplayName(Messages.format(CorrectionMessages.TypeMismatchSubProcessor_changereturnofoverridden_description, BasicElementLabels.getJavaElementName(overriddenDecl.getName()))); } proposals.add(proposal); } } }
Example 15
Source File: TypeMismatchSubProcessor.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 4 votes |
public static void addIncompatibleReturnTypeProposals(IInvocationContext context, IProblemLocationCore problem, Collection<ChangeCorrectionProposal> proposals) throws JavaModelException { CompilationUnit astRoot= context.getASTRoot(); ASTNode selectedNode= problem.getCoveringNode(astRoot); if (selectedNode == null) { return; } MethodDeclaration decl= ASTResolving.findParentMethodDeclaration(selectedNode); if (decl == null) { return; } IMethodBinding methodDeclBinding= decl.resolveBinding(); if (methodDeclBinding == null) { return; } ITypeBinding returnType= methodDeclBinding.getReturnType(); IMethodBinding overridden= Bindings.findOverriddenMethod(methodDeclBinding, false); if (overridden == null || overridden.getReturnType() == returnType) { return; } ICompilationUnit cu= context.getCompilationUnit(); IMethodBinding methodDecl= methodDeclBinding.getMethodDeclaration(); ITypeBinding overriddenReturnType= overridden.getReturnType(); if (! JavaModelUtil.is50OrHigher(context.getCompilationUnit().getJavaProject())) { overriddenReturnType= overriddenReturnType.getErasure(); } proposals.add(new TypeChangeCorrectionProposal(cu, methodDecl, astRoot, overriddenReturnType, false, IProposalRelevance.CHANGE_RETURN_TYPE)); ICompilationUnit targetCu= cu; IMethodBinding overriddenDecl= overridden.getMethodDeclaration(); ITypeBinding overridenDeclType= overriddenDecl.getDeclaringClass(); if (overridenDeclType.isFromSource()) { targetCu= ASTResolving.findCompilationUnitForBinding(cu, astRoot, overridenDeclType); if (targetCu != null && ASTResolving.isUseableTypeInContext(returnType, overriddenDecl, false)) { TypeChangeCorrectionProposal proposal= new TypeChangeCorrectionProposal(targetCu, overriddenDecl, astRoot, returnType, false, IProposalRelevance.CHANGE_RETURN_TYPE_OF_OVERRIDDEN); if (overridenDeclType.isInterface()) { proposal.setDisplayName(Messages.format(CorrectionMessages.TypeMismatchSubProcessor_changereturnofimplemented_description, BasicElementLabels.getJavaElementName(overriddenDecl.getName()))); } else { proposal.setDisplayName(Messages.format(CorrectionMessages.TypeMismatchSubProcessor_changereturnofoverridden_description, BasicElementLabels.getJavaElementName(overriddenDecl.getName()))); } proposals.add(proposal); } } }
Example 16
Source File: JdtUtils.java From j2cl with Apache License 2.0 | 4 votes |
/** Create a MethodDescriptor directly based on the given JDT method binding. */ public static MethodDescriptor createMethodDescriptor(IMethodBinding methodBinding) { if (methodBinding == null) { return null; } DeclaredTypeDescriptor enclosingTypeDescriptor = createDeclaredTypeDescriptor(methodBinding.getDeclaringClass()); boolean isStatic = isStatic(methodBinding); Visibility visibility = getVisibility(methodBinding); boolean isDefault = isDefaultMethod(methodBinding); JsInfo jsInfo = computeJsInfo(methodBinding); boolean isNative = Modifier.isNative(methodBinding.getModifiers()) || (!jsInfo.isJsOverlay() && enclosingTypeDescriptor.isNative() && isAbstract(methodBinding)); boolean isConstructor = methodBinding.isConstructor(); String methodName = methodBinding.getName(); TypeDescriptor returnTypeDescriptor = createTypeDescriptorWithNullability( methodBinding.getReturnType(), methodBinding.getAnnotations()); MethodDescriptor declarationMethodDescriptor = null; if (methodBinding.getMethodDeclaration() != methodBinding) { // The declaration for methods in a lambda binding is two hops away. Since the declaration // binding of a declaration is itself, we get the declaration of the declaration here. IMethodBinding declarationBinding = methodBinding.getMethodDeclaration().getMethodDeclaration(); declarationMethodDescriptor = createMethodDescriptor(declarationBinding); } // generate type parameters declared in the method. Iterable<TypeVariable> typeParameterTypeDescriptors = FluentIterable.from(methodBinding.getTypeParameters()) .transform(JdtUtils::createTypeDescriptor) .transform(typeDescriptor -> (TypeVariable) typeDescriptor); ImmutableList.Builder<ParameterDescriptor> parameterDescriptorBuilder = ImmutableList.builder(); for (int i = 0; i < methodBinding.getParameterTypes().length; i++) { parameterDescriptorBuilder.add( ParameterDescriptor.newBuilder() .setTypeDescriptor( createTypeDescriptorWithNullability( methodBinding.getParameterTypes()[i], methodBinding.getParameterAnnotations(i))) .setJsOptional(JsInteropUtils.isJsOptional(methodBinding, i)) .setVarargs( i == methodBinding.getParameterTypes().length - 1 && methodBinding.isVarargs()) .setDoNotAutobox(JsInteropUtils.isDoNotAutobox(methodBinding, i)) .build()); } if (enclosingTypeDescriptor.getTypeDeclaration().isAnonymous() && isConstructor && enclosingTypeDescriptor.getSuperTypeDescriptor().hasJsConstructor()) { jsInfo = JsInfo.Builder.from(jsInfo).setJsMemberType(JsMemberType.CONSTRUCTOR).build(); } return MethodDescriptor.newBuilder() .setEnclosingTypeDescriptor(enclosingTypeDescriptor) .setName(isConstructor ? null : methodName) .setParameterDescriptors(parameterDescriptorBuilder.build()) .setDeclarationDescriptor(declarationMethodDescriptor) .setReturnTypeDescriptor(returnTypeDescriptor) .setTypeParameterTypeDescriptors(typeParameterTypeDescriptors) .setJsInfo(jsInfo) .setJsFunction(isOrOverridesJsFunctionMethod(methodBinding)) .setVisibility(visibility) .setStatic(isStatic) .setConstructor(isConstructor) .setNative(isNative) .setFinal(JdtUtils.isFinal(methodBinding)) .setDefaultMethod(isDefault) .setAbstract(Modifier.isAbstract(methodBinding.getModifiers())) .setSynthetic(methodBinding.isSynthetic()) .setEnumSyntheticMethod(isEnumSyntheticMethod(methodBinding)) .setUnusableByJsSuppressed(JsInteropAnnotationUtils.isUnusableByJsSuppressed(methodBinding)) .setDeprecated(isDeprecated(methodBinding)) .build(); }
Example 17
Source File: CodeGeneration.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 3 votes |
/** * Returns the comment for a method or constructor using the comment code templates (constructor / method / overriding method). * <code>null</code> is returned if the template is empty. * @param cu The compilation unit to which the method belongs. The compilation unit does not need to exist. * @param declaringTypeName Name of the type to which the method belongs. For inner types the name must be qualified and include the outer * types names (dot separated). See {@link org.eclipse.jdt.core.IType#getTypeQualifiedName(char)}. * @param decl The MethodDeclaration AST node that will be added as new * method. The node does not need to exist in an AST (no parent needed) and does not need to resolve. * See {@link org.eclipse.jdt.core.dom.AST#newMethodDeclaration()} for how to create such a node. * @param overridden The binding of the method to which to add an "@see" link or * <code>null</code> if no link should be created. * @param lineDelimiter The line delimiter to be used. * @return Returns the generated method comment or <code>null</code> if the * code template is empty. The returned content is unformatted and not indented (formatting required). * @throws CoreException Thrown when the evaluation of the code template fails. */ public static String getMethodComment(ICompilationUnit cu, String declaringTypeName, MethodDeclaration decl, IMethodBinding overridden, String lineDelimiter) throws CoreException { if (overridden != null) { overridden= overridden.getMethodDeclaration(); String declaringClassQualifiedName= overridden.getDeclaringClass().getQualifiedName(); String linkToMethodName= overridden.getName(); String[] parameterTypesQualifiedNames= StubUtility.getParameterTypeNamesForSeeTag(overridden); return StubUtility.getMethodComment(cu, declaringTypeName, decl, overridden.isDeprecated(), linkToMethodName, declaringClassQualifiedName, parameterTypesQualifiedNames, false, lineDelimiter); } else { return StubUtility.getMethodComment(cu, declaringTypeName, decl, false, null, null, null, false, lineDelimiter); } }