本文整理匯總了Java中org.eclipse.jdt.core.dom.MethodInvocation.getName方法的典型用法代碼示例。如果您正苦於以下問題:Java MethodInvocation.getName方法的具體用法?Java MethodInvocation.getName怎麽用?Java MethodInvocation.getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jdt.core.dom.MethodInvocation
的用法示例。
在下文中一共展示了MethodInvocation.getName方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: visit
import org.eclipse.jdt.core.dom.MethodInvocation; //導入方法依賴的package包/類
@Override
public boolean visit(MethodInvocation node) {
Expression receiver = node.getExpression();
if (receiver == null) {
SimpleName name = node.getName();
if (fIgnoreBinding == null || !Bindings.equals(fIgnoreBinding, name.resolveBinding())) {
node.getName().accept(this);
}
} else {
receiver.accept(this);
}
accept(node.arguments());
return false;
}
示例2: visit
import org.eclipse.jdt.core.dom.MethodInvocation; //導入方法依賴的package包/類
@Override
public boolean visit(MethodInvocation node) {
Expression receiver = node.getExpression();
if (receiver == null) {
SimpleName name = node.getName();
if (fIgnoreBinding == null || !Bindings.equals(fIgnoreBinding, name.resolveBinding()))
node.getName().accept(this);
} else {
receiver.accept(this);
}
accept(node.arguments());
return false;
}
示例3: visit
import org.eclipse.jdt.core.dom.MethodInvocation; //導入方法依賴的package包/類
@Override
public boolean visit(MethodInvocation node) {
visitExpressionIfName(node.getExpression());
if (node.getExpression() != null) {
return true;
}
// node is of the form `methodName(...)`, and not eg., `Foo.methodName()`.
org.eclipse.jdt.core.dom.SimpleName simpleName = node.getName();
if (compilationUnit.findDeclaringNode(simpleName.resolveBinding()) != null) {
// simpleName is defined somewhere in this compilation unit - so no need to import it.
return true;
}
// Do not report methods that appear in inner/anonymous classes that have a superclass:
// Jade doesn't currently fetch inherited symbols for inner/anonymous classes, which
// leads to inherited methods being imported. (b/35660499, b/35727475)
// This isn't perfect because another class might call a same-named method; if this
// becomes a problem, I'll use a blacklist.
AbstractTypeDeclaration containingClass = getContainingClass(node);
if (!(containingClass.getParent() instanceof CompilationUnit)
&& containingClass instanceof TypeDeclaration
&& ((TypeDeclaration) containingClass).getSuperclassType() != null) {
return true;
}
if (isDescendantOfAnonymousClassDeclaration(node)) {
return true;
}
// Work around Eclipse JDT Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=462192,
// where `simpleName.resolveBinding() == null` happens even though 'simpleName' is
// defined in the current compilation unit.
Set<String> methods = methodsOfClass.get(containingClass);
if (methods.isEmpty()) {
methods.addAll(getMethodDeclarations(containingClass));
}
if (!methods.contains(simpleName.getIdentifier())) {
int startPosition = simpleName.getStartPosition();
symbols.put(
simpleName.getIdentifier(),
Metadata.create(
compilationUnit.getLineNumber(startPosition),
compilationUnit.getColumnNumber(startPosition),
true));
}
return true;
}
示例4: visit
import org.eclipse.jdt.core.dom.MethodInvocation; //導入方法依賴的package包/類
public boolean visit(MethodInvocation node) {
try {
SimpleName simpleName = node.getName();
IBinding bding = simpleName.resolveBinding();
if (bding instanceof IMethodBinding) {
IMethodBinding imb = (IMethodBinding) bding;
if (isContext(imb.getReturnType())) {
this.value = imb.getReturnType().getQualifiedName().toString();
}
}
} catch (Throwable e) {
}
return false;
}
示例5: visit
import org.eclipse.jdt.core.dom.MethodInvocation; //導入方法依賴的package包/類
/** {@inheritDoc} */
@Override
public boolean visit(final MethodInvocation node) {
if (!fRemoveMethodQualifiers) return true;
Expression expression = node.getExpression();
if (!(expression instanceof ThisExpression)) return true;
final SimpleName name = node.getName();
if (name.resolveBinding() == null) return true;
if (hasConflict(
expression.getStartPosition(),
name,
ScopeAnalyzer.METHODS | ScopeAnalyzer.CHECK_VISIBILITY)) return true;
Name qualifier = ((ThisExpression) expression).getQualifier();
if (qualifier != null) {
ITypeBinding declaringClass = ((IMethodBinding) name.resolveBinding()).getDeclaringClass();
if (declaringClass == null) return true;
ITypeBinding caller = getDeclaringType(node);
if (caller == null) return true;
ITypeBinding callee = (ITypeBinding) qualifier.resolveBinding();
if (callee == null) return true;
if (callee.isAssignmentCompatible(declaringClass)
&& caller.isAssignmentCompatible(declaringClass)) return true;
}
fOperations.add(
new CompilationUnitRewriteOperation() {
@Override
public void rewriteAST(CompilationUnitRewrite cuRewrite, LinkedProposalModel model)
throws CoreException {
ASTRewrite rewrite = cuRewrite.getASTRewrite();
TextEditGroup group =
createTextEditGroup(
FixMessages.CodeStyleFix_removeThis_groupDescription, cuRewrite);
rewrite.remove(node.getExpression(), group);
}
});
return super.visit(node);
}