本文整理汇总了Java中org.eclipse.jdt.core.dom.SuperMethodInvocation类的典型用法代码示例。如果您正苦于以下问题:Java SuperMethodInvocation类的具体用法?Java SuperMethodInvocation怎么用?Java SuperMethodInvocation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SuperMethodInvocation类属于org.eclipse.jdt.core.dom包,在下文中一共展示了SuperMethodInvocation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getArgumentsProperty
import org.eclipse.jdt.core.dom.SuperMethodInvocation; //导入依赖的package包/类
public static ChildListPropertyDescriptor getArgumentsProperty(ASTNode invocation) {
switch (invocation.getNodeType()) {
case ASTNode.METHOD_INVOCATION:
return MethodInvocation.ARGUMENTS_PROPERTY;
case ASTNode.SUPER_METHOD_INVOCATION:
return SuperMethodInvocation.ARGUMENTS_PROPERTY;
case ASTNode.CONSTRUCTOR_INVOCATION:
return ConstructorInvocation.ARGUMENTS_PROPERTY;
case ASTNode.SUPER_CONSTRUCTOR_INVOCATION:
return SuperConstructorInvocation.ARGUMENTS_PROPERTY;
case ASTNode.CLASS_INSTANCE_CREATION:
return ClassInstanceCreation.ARGUMENTS_PROPERTY;
case ASTNode.ENUM_CONSTANT_DECLARATION:
return EnumConstantDeclaration.ARGUMENTS_PROPERTY;
default:
throw new IllegalArgumentException(invocation.toString());
}
}
示例2: visit
import org.eclipse.jdt.core.dom.SuperMethodInvocation; //导入依赖的package包/类
public boolean visit(SuperMethodInvocation node) {
IMethodBinding mmtb = node.resolveMethodBinding();
if (mtbStack.isEmpty()) // not part of a method
return true;
// make field access fact
try {
facts.add(Fact.makeCallsFact(getQualifiedName(mtbStack.peek()),
getQualifiedName(mmtb)));
} catch (Exception e) {
System.err.println("Cannot resolve method invocation \""
+ node.getName().toString() + "\"");
}
return true;
}
示例3: createFrom
import org.eclipse.jdt.core.dom.SuperMethodInvocation; //导入依赖的package包/类
public static MethodInvocation createFrom(ASTNode node) {
MethodInvocation retNode = null;
if(node instanceof org.eclipse.jdt.core.dom.MethodInvocation
|| node instanceof SuperMethodInvocation){
Adapter factory = Adapter.getInstance();
AstNode astNode = factory.get(node);
if ( astNode instanceof MethodInvocation ) {
retNode = (MethodInvocation)astNode;
}
else {
retNode = MethodInvocation.create();
ast.MethodDeclaration methDec = TraceabilityFactory.getMethodDeclaration(node);
if(methDec!= null){
retNode.methodDeclaration = methDec;
}
retNode.complexExpression = node.toString();
factory.map(node, retNode);
}
}else{
throw new IllegalArgumentException(node.toString());
}
return retNode;
}
示例4: visit
import org.eclipse.jdt.core.dom.SuperMethodInvocation; //导入依赖的package包/类
public boolean visit(SuperMethodInvocation node)
{
IMethodBinding mmtb = node.resolveMethodBinding();
if (this.mtbStack.isEmpty()) {
return true;
}
try
{
this.facts.add(Fact.makeCallsFact(getQualifiedName((IMethodBinding)this.mtbStack.peek()),
getQualifiedName(mmtb)));
}
catch (Exception e)
{
System.err.println("Cannot resolve method invocation \"" +
node.getName().toString() + "\"");
}
return true;
}
示例5: visit
import org.eclipse.jdt.core.dom.SuperMethodInvocation; //导入依赖的package包/类
public boolean visit(SuperMethodInvocation node)
{
IMethodBinding mmtb = node.resolveMethodBinding();
if (this.mtbStack.isEmpty()) {
return true;
}
try
{
this.facts.add(Fact.makeCallsFact(getQualifiedName((IMethodBinding)this.mtbStack.peek()),
getQualifiedName(mmtb)));
}
catch (Exception localException)
{
System.err.println("Cannot resolve method invocation \"" +
node.getName().toString() + "\"");
}
return true;
}
示例6: getInlineableMethodNode
import org.eclipse.jdt.core.dom.SuperMethodInvocation; //导入依赖的package包/类
private static ASTNode getInlineableMethodNode(ASTNode node, IJavaElement unit) {
if (node == null) return null;
switch (node.getNodeType()) {
case ASTNode.SIMPLE_NAME:
StructuralPropertyDescriptor locationInParent = node.getLocationInParent();
if (locationInParent == MethodDeclaration.NAME_PROPERTY) {
return node.getParent();
} else if (locationInParent == MethodInvocation.NAME_PROPERTY
|| locationInParent == SuperMethodInvocation.NAME_PROPERTY) {
return unit instanceof ICompilationUnit
? node.getParent()
: null; // don't start on invocations in binary
}
return null;
case ASTNode.EXPRESSION_STATEMENT:
node = ((ExpressionStatement) node).getExpression();
}
switch (node.getNodeType()) {
case ASTNode.METHOD_DECLARATION:
return node;
case ASTNode.METHOD_INVOCATION:
case ASTNode.SUPER_METHOD_INVOCATION:
case ASTNode.CONSTRUCTOR_INVOCATION:
return unit instanceof ICompilationUnit
? node
: null; // don't start on invocations in binary
}
return null;
}
示例7: getArguments
import org.eclipse.jdt.core.dom.SuperMethodInvocation; //导入依赖的package包/类
public static List<Expression> getArguments(ASTNode invocation) {
switch (invocation.getNodeType()) {
case ASTNode.METHOD_INVOCATION:
return ((MethodInvocation) invocation).arguments();
case ASTNode.SUPER_METHOD_INVOCATION:
return ((SuperMethodInvocation) invocation).arguments();
case ASTNode.CONSTRUCTOR_INVOCATION:
return ((ConstructorInvocation) invocation).arguments();
case ASTNode.SUPER_CONSTRUCTOR_INVOCATION:
return ((SuperConstructorInvocation) invocation).arguments();
case ASTNode.CLASS_INSTANCE_CREATION:
return ((ClassInstanceCreation) invocation).arguments();
case ASTNode.ENUM_CONSTANT_DECLARATION:
return ((EnumConstantDeclaration) invocation).arguments();
default:
throw new IllegalArgumentException(invocation.toString());
}
}
示例8: resolveBinding
import org.eclipse.jdt.core.dom.SuperMethodInvocation; //导入依赖的package包/类
public static IMethodBinding resolveBinding(ASTNode invocation) {
switch (invocation.getNodeType()) {
case ASTNode.METHOD_INVOCATION:
return ((MethodInvocation) invocation).resolveMethodBinding();
case ASTNode.SUPER_METHOD_INVOCATION:
return ((SuperMethodInvocation) invocation).resolveMethodBinding();
case ASTNode.CONSTRUCTOR_INVOCATION:
return ((ConstructorInvocation) invocation).resolveConstructorBinding();
case ASTNode.SUPER_CONSTRUCTOR_INVOCATION:
return ((SuperConstructorInvocation) invocation).resolveConstructorBinding();
case ASTNode.CLASS_INSTANCE_CREATION:
return ((ClassInstanceCreation) invocation).resolveConstructorBinding();
case ASTNode.ENUM_CONSTANT_DECLARATION:
return ((EnumConstantDeclaration) invocation).resolveConstructorBinding();
default:
throw new IllegalArgumentException(invocation.toString());
}
}
示例9: getInferredTypeArguments
import org.eclipse.jdt.core.dom.SuperMethodInvocation; //导入依赖的package包/类
public static ITypeBinding[] getInferredTypeArguments(Expression invocation) {
IMethodBinding methodBinding;
switch (invocation.getNodeType()) {
case ASTNode.METHOD_INVOCATION:
methodBinding = ((MethodInvocation) invocation).resolveMethodBinding();
return methodBinding == null ? null : methodBinding.getTypeArguments();
case ASTNode.SUPER_METHOD_INVOCATION:
methodBinding = ((SuperMethodInvocation) invocation).resolveMethodBinding();
return methodBinding == null ? null : methodBinding.getTypeArguments();
case ASTNode.CLASS_INSTANCE_CREATION:
Type type = ((ClassInstanceCreation) invocation).getType();
ITypeBinding typeBinding = type.resolveBinding();
return typeBinding == null ? null : typeBinding.getTypeArguments();
default:
throw new IllegalArgumentException(invocation.toString());
}
}
示例10: create
import org.eclipse.jdt.core.dom.SuperMethodInvocation; //导入依赖的package包/类
/**
* Creates a new inline method refactoring
*
* @param unit the compilation unit or class file
* @param node the compilation unit node
* @param selectionStart start
* @param selectionLength length
* @return returns the refactoring
*/
public static InlineMethodRefactoring create(
ITypeRoot unit, CompilationUnit node, int selectionStart, int selectionLength) {
ASTNode target =
RefactoringAvailabilityTester.getInlineableMethodNode(
unit, node, selectionStart, selectionLength);
if (target == null) return null;
if (target.getNodeType() == ASTNode.METHOD_DECLARATION) {
return new InlineMethodRefactoring(
unit, (MethodDeclaration) target, selectionStart, selectionLength);
} else {
ICompilationUnit cu = (ICompilationUnit) unit;
if (target.getNodeType() == ASTNode.METHOD_INVOCATION) {
return new InlineMethodRefactoring(
cu, (MethodInvocation) target, selectionStart, selectionLength);
} else if (target.getNodeType() == ASTNode.SUPER_METHOD_INVOCATION) {
return new InlineMethodRefactoring(
cu, (SuperMethodInvocation) target, selectionStart, selectionLength);
} else if (target.getNodeType() == ASTNode.CONSTRUCTOR_INVOCATION) {
return new InlineMethodRefactoring(
cu, (ConstructorInvocation) target, selectionStart, selectionLength);
}
}
return null;
}
示例11: setCurrentMode
import org.eclipse.jdt.core.dom.SuperMethodInvocation; //导入依赖的package包/类
public RefactoringStatus setCurrentMode(Mode mode) throws JavaModelException {
if (fCurrentMode == mode) return new RefactoringStatus();
Assert.isTrue(getInitialMode() == Mode.INLINE_SINGLE);
fCurrentMode = mode;
if (mode == Mode.INLINE_SINGLE) {
if (fInitialNode instanceof MethodInvocation)
fTargetProvider =
TargetProvider.create(
(ICompilationUnit) fInitialTypeRoot, (MethodInvocation) fInitialNode);
else if (fInitialNode instanceof SuperMethodInvocation)
fTargetProvider =
TargetProvider.create(
(ICompilationUnit) fInitialTypeRoot, (SuperMethodInvocation) fInitialNode);
else if (fInitialNode instanceof ConstructorInvocation)
fTargetProvider =
TargetProvider.create(
(ICompilationUnit) fInitialTypeRoot, (ConstructorInvocation) fInitialNode);
else throw new IllegalStateException(String.valueOf(fInitialNode));
} else {
fTargetProvider = TargetProvider.create(fSourceProvider.getDeclaration());
}
return fTargetProvider.checkActivation();
}
示例12: resolveBinding
import org.eclipse.jdt.core.dom.SuperMethodInvocation; //导入依赖的package包/类
public static IBinding resolveBinding(Expression expression) {
if (expression instanceof Name) return ((Name) expression).resolveBinding();
if (expression instanceof ParenthesizedExpression)
return resolveBinding(((ParenthesizedExpression) expression).getExpression());
else if (expression instanceof Assignment)
return resolveBinding(((Assignment) expression).getLeftHandSide()); // TODO ???
else if (expression instanceof MethodInvocation)
return ((MethodInvocation) expression).resolveMethodBinding();
else if (expression instanceof SuperMethodInvocation)
return ((SuperMethodInvocation) expression).resolveMethodBinding();
else if (expression instanceof FieldAccess)
return ((FieldAccess) expression).resolveFieldBinding();
else if (expression instanceof SuperFieldAccess)
return ((SuperFieldAccess) expression).resolveFieldBinding();
else if (expression instanceof ConditionalExpression)
return resolveBinding(((ConditionalExpression) expression).getThenExpression());
return null;
}
示例13: getNewName
import org.eclipse.jdt.core.dom.SuperMethodInvocation; //导入依赖的package包/类
@Override
protected SimpleName getNewName(ASTRewrite rewrite) {
ASTNode invocationNode = getInvocationNode();
String name;
if (invocationNode instanceof MethodInvocation) {
name = ((MethodInvocation) invocationNode).getName().getIdentifier();
} else if (invocationNode instanceof SuperMethodInvocation) {
name = ((SuperMethodInvocation) invocationNode).getName().getIdentifier();
} else {
name = getSenderBinding().getName(); // name of the class
}
AST ast = rewrite.getAST();
SimpleName newNameNode = ast.newSimpleName(name);
addLinkedPosition(rewrite.track(newNameNode), false, KEY_NAME);
ASTNode invocationName = getInvocationNameNode();
if (invocationName != null && invocationName.getAST() == ast) { // in the same CU
addLinkedPosition(rewrite.track(invocationName), true, KEY_NAME);
}
return newNameNode;
}
示例14: retrieveResultReference
import org.eclipse.jdt.core.dom.SuperMethodInvocation; //导入依赖的package包/类
private VariableReference retrieveResultReference(
SuperMethodInvocation superMethodInvocation) {
// TODO Duplicate code from retrieveResultReference(MethodInvocation)
// too bad they don't have a common matching interface
VariableReference result = calleeResultMap.get(superMethodInvocation.toString());
if (result != null) {
return result;
}
ASTNode parent = superMethodInvocation.getParent();
if (parent instanceof VariableDeclarationFragment) {
return retrieveVariableReference(parent, null);
}
if (parent instanceof Assignment) {
Assignment assignment = (Assignment) parent;
return retrieveVariableReference(assignment.getLeftHandSide(), null);
}
IMethodBinding methodBinding = superMethodInvocation.resolveMethodBinding();
result = retrieveVariableReference(methodBinding.getReturnType(), null);
calleeResultMap.put(superMethodInvocation.toString(), result);
return result;
}
示例15: endVisit
import org.eclipse.jdt.core.dom.SuperMethodInvocation; //导入依赖的package包/类
@Override
public final void endVisit(final SuperMethodInvocation node) {
final IMethodBinding superBinding= node.resolveMethodBinding();
if (superBinding != null) {
endVisit(node.arguments(), superBinding);
final MethodDeclaration declaration= fCurrentMethods.peek();
if (declaration != null) {
final IMethodBinding subBinding= declaration.resolveBinding();
if (subBinding != null) {
final ConstraintVariable2 ancestor= fModel.createReturnTypeVariable(superBinding);
if (ancestor != null) {
node.setProperty(PROPERTY_CONSTRAINT_VARIABLE, ancestor);
final ConstraintVariable2 descendant= fModel.createReturnTypeVariable(subBinding);
if (descendant != null)
fModel.createEqualityConstraint(descendant, ancestor);
}
}
}
}
}