本文整理汇总了Java中org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration类的典型用法代码示例。如果您正苦于以下问题:Java AbstractMethodDeclaration类的具体用法?Java AbstractMethodDeclaration怎么用?Java AbstractMethodDeclaration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AbstractMethodDeclaration类属于org.eclipse.jdt.internal.compiler.ast包,在下文中一共展示了AbstractMethodDeclaration类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: buildTree
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; //导入依赖的package包/类
/** {@inheritDoc} */
@Override protected EclipseNode buildTree(ASTNode node, Kind kind) {
switch (kind) {
case COMPILATION_UNIT:
return buildCompilationUnit((CompilationUnitDeclaration) node);
case TYPE:
return buildType((TypeDeclaration) node);
case FIELD:
return buildField((FieldDeclaration) node);
case INITIALIZER:
return buildInitializer((Initializer) node);
case METHOD:
return buildMethod((AbstractMethodDeclaration) node);
case ARGUMENT:
return buildLocal((Argument) node, kind);
case LOCAL:
return buildLocal((LocalDeclaration) node, kind);
case STATEMENT:
return buildStatement((Statement) node);
case ANNOTATION:
return buildAnnotation((Annotation) node, false);
default:
throw new AssertionError("Did not expect to arrive here: " + kind);
}
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:26,代码来源:EclipseAST.java
示例2: constructorExists
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; //导入依赖的package包/类
/**
* Checks if there is a (non-default) constructor. In case of multiple constructors (overloading), only
* the first constructor decides if EXISTS_BY_USER or EXISTS_BY_LOMBOK is returned.
*
* @param node Any node that represents the Type (TypeDeclaration) to look in, or any child node thereof.
*/
public static MemberExistsResult constructorExists(EclipseNode node) {
while (node != null && !(node.get() instanceof TypeDeclaration)) {
node = node.up();
}
if (node != null && node.get() instanceof TypeDeclaration) {
TypeDeclaration typeDecl = (TypeDeclaration)node.get();
if (typeDecl.methods != null) top: for (AbstractMethodDeclaration def : typeDecl.methods) {
if (def instanceof ConstructorDeclaration) {
if ((def.bits & ASTNode.IsDefaultConstructor) != 0) continue;
if (def.annotations != null) for (Annotation anno : def.annotations) {
if (typeMatches(Tolerate.class, node, anno.type)) continue top;
}
return getGeneratedBy(def) == null ? MemberExistsResult.EXISTS_BY_USER : MemberExistsResult.EXISTS_BY_LOMBOK;
}
}
}
return MemberExistsResult.NOT_EXISTS;
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:29,代码来源:EclipseHandlerUtil.java
示例3: makeSimpleSetterMethodForBuilder
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; //导入依赖的package包/类
private void makeSimpleSetterMethodForBuilder(EclipseNode builderType, EclipseNode fieldNode, EclipseNode sourceNode, boolean fluent, boolean chain) {
TypeDeclaration td = (TypeDeclaration) builderType.get();
AbstractMethodDeclaration[] existing = td.methods;
if (existing == null) existing = EMPTY;
int len = existing.length;
FieldDeclaration fd = (FieldDeclaration) fieldNode.get();
char[] name = fd.name;
for (int i = 0; i < len; i++) {
if (!(existing[i] instanceof MethodDeclaration)) continue;
char[] existingName = existing[i].selector;
if (Arrays.equals(name, existingName)) return;
}
String setterName = fluent ? fieldNode.getName() : HandlerUtil.buildAccessorName("set", fieldNode.getName());
MethodDeclaration setter = HandleSetter.createSetter(td, fieldNode, setterName, chain, ClassFileConstants.AccPublic,
sourceNode, Collections.<Annotation>emptyList(), Collections.<Annotation>emptyList());
injectMethod(builderType, setter);
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:21,代码来源:HandleBuilder.java
示例4: makeSimpleSetterMethodForBuilder
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; //导入依赖的package包/类
private void makeSimpleSetterMethodForBuilder(EclipseNode builderType, EclipseNode fieldNode, EclipseNode sourceNode, boolean fluent, boolean chain) {
TypeDeclaration td = (TypeDeclaration) builderType.get();
AbstractMethodDeclaration[] existing = td.methods;
if (existing == null) existing = EMPTY;
int len = existing.length;
FieldDeclaration fd = (FieldDeclaration) fieldNode.get();
char[] name = fd.name;
for (int i = 0; i < len; i++) {
if (!(existing[i] instanceof MethodDeclaration)) continue;
char[] existingName = existing[i].selector;
if (Arrays.equals(name, existingName)) return;
}
String setterName = fluent ? fieldNode.getName() : HandlerUtil.buildAccessorName("set", fieldNode.getName());
MethodDeclaration setter = HandleSetter.createSetter(td, fieldNode, setterName, chain, ClassFileConstants.AccPublic,
sourceNode, Collections.<Annotation>emptyList(), Collections.<Annotation>emptyList());
injectMethod(builderType, setter);
}
开发者ID:mobmead,项目名称:EasyMPermission,代码行数:21,代码来源:HandleBuilder.java
示例5: getEnclosingDeclaration
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; //导入依赖的package包/类
private ASTNode getEnclosingDeclaration() {
int i = this.parentsPtr;
while (i > -1) {
ASTNode parent = this.parents[i];
if (parent instanceof AbstractMethodDeclaration) {
return parent;
} else if (parent instanceof Initializer) {
return parent;
} else if (parent instanceof FieldDeclaration) {
return parent;
} else if (parent instanceof TypeDeclaration) {
return parent;
}
i--;
}
return null;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:UnresolvedReferenceNameFinder.java
示例6: getThrownExceptions
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; //导入依赖的package包/类
protected char[][] getThrownExceptions(AbstractMethodDeclaration methodDeclaration) {
char[][] thrownExceptionTypes = null;
TypeReference[] thrownExceptions = methodDeclaration.thrownExceptions;
if (thrownExceptions != null) {
int thrownExceptionLength = thrownExceptions.length;
int thrownExceptionCount = 0;
thrownExceptionTypes = new char[thrownExceptionLength][];
next : for (int i = 0; i < thrownExceptionLength; i++) {
TypeReference thrownException = thrownExceptions[i];
if (thrownException instanceof CompletionOnKeyword) continue next;
if (CompletionUnitStructureRequestor.hasEmptyName(thrownException, this.assistNode)) continue next;
thrownExceptionTypes[thrownExceptionCount++] =
CharOperation.concatWith(thrownException.getParameterizedTypeName(), '.');
}
if (thrownExceptionCount == 0) return null;
if (thrownExceptionCount < thrownExceptionLength) {
System.arraycopy(thrownExceptionTypes, 0, thrownExceptionTypes = new char[thrownExceptionCount][], 0, thrownExceptionCount);
}
}
return thrownExceptionTypes;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:25,代码来源:CompletionElementNotifier.java
示例7: formatMethodArguments
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; //导入依赖的package包/类
private void formatMethodArguments(
AbstractMethodDeclaration methodDeclaration,
boolean spaceBeforeOpenParen,
boolean spaceBetweenEmptyParameters,
boolean spaceBeforeClosingParen,
boolean spaceBeforeFirstParameter,
boolean spaceBeforeComma,
boolean spaceAfterComma,
int methodDeclarationParametersAlignment) {
formatMethodArguments(
methodDeclaration.receiver,
methodDeclaration.arguments,
methodDeclaration.scope,
spaceBeforeOpenParen,
spaceBetweenEmptyParameters,
spaceBeforeClosingParen,
spaceBeforeFirstParameter,
spaceBeforeComma,
spaceAfterComma,
methodDeclarationParametersAlignment);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:CodeFormatterVisitor.java
示例8: resolveMethod
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; //导入依赖的package包/类
synchronized IMethodBinding resolveMethod(MethodDeclaration method) {
Object oldNode = this.newAstToOldAst.get(method);
if (oldNode instanceof AbstractMethodDeclaration) {
AbstractMethodDeclaration methodDeclaration = (AbstractMethodDeclaration) oldNode;
IMethodBinding methodBinding = getMethodBinding(methodDeclaration.binding);
if (methodBinding == null) {
return null;
}
this.bindingsToAstNodes.put(methodBinding, method);
String key = methodBinding.getKey();
if (key != null) {
this.bindingTables.bindingKeysToBindings.put(key, methodBinding);
}
return methodBinding;
}
return null;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:18,代码来源:DefaultBindingResolver.java
示例9: addDefaultConstructorIfNecessary
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; //导入依赖的package包/类
private void addDefaultConstructorIfNecessary(TypeInfo typeInfo) {
boolean hasConstructor = false;
TypeDeclaration typeDeclaration = typeInfo.node;
AbstractMethodDeclaration[] methods = typeDeclaration.methods;
int methodCounter = methods == null ? 0 : methods.length;
done : for (int i = 0; i < methodCounter; i++) {
AbstractMethodDeclaration method = methods[i];
if (method.isConstructor() && !method.isDefaultConstructor()) {
hasConstructor = true;
break done;
}
}
if (!hasConstructor) {
this.indexer.addDefaultConstructorDeclaration(
typeInfo.name,
this.packageName == null ? CharOperation.NO_CHAR : this.packageName,
typeInfo.modifiers,
getMoreExtraFlags(typeInfo.extraFlags));
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:23,代码来源:SourceIndexerRequestor.java
示例10: convertAndSetReceiver
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; //导入依赖的package包/类
private void convertAndSetReceiver(AbstractMethodDeclaration method, MethodDeclaration methodDecl) {
Receiver receiver = method.receiver;
if (receiver.qualifyingName != null) {
final SimpleName name = new SimpleName(this.ast);
name.internalSetIdentifier(new String(receiver.qualifyingName.getName()[0]));
int start = receiver.qualifyingName.sourceStart;
int nameEnd = receiver.qualifyingName.sourceEnd;
name.setSourceRange(start, nameEnd - start + 1);
methodDecl.setReceiverQualifier(name);
if (this.resolveBindings) {
recordNodes(name, receiver);
}
}
Type type = convertType(receiver.type);
methodDecl.setReceiverType(type);
if (receiver.modifiers != 0) {
methodDecl.setFlags(methodDecl.getFlags() | ASTNode.MALFORMED);
}
if (this.resolveBindings) {
recordNodes(type, receiver);
type.resolveBinding();
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:24,代码来源:ASTConverter.java
示例11: resolveMember
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; //导入依赖的package包/类
IMethodBinding resolveMember(AnnotationTypeMemberDeclaration declaration) {
Object oldNode = this.newAstToOldAst.get(declaration);
if (oldNode instanceof AbstractMethodDeclaration) {
AbstractMethodDeclaration methodDeclaration = (AbstractMethodDeclaration) oldNode;
IMethodBinding methodBinding = getMethodBinding(methodDeclaration.binding);
if (methodBinding == null) {
return null;
}
this.bindingsToAstNodes.put(methodBinding, declaration);
String key = methodBinding.getKey();
if (key != null) {
this.bindingTables.bindingKeysToBindings.put(key, methodBinding);
}
return methodBinding;
}
return null;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:DefaultBindingResolver.java
示例12: illegalReturnRedefinition
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; //导入依赖的package包/类
public void illegalReturnRedefinition(AbstractMethodDeclaration abstractMethodDecl, MethodBinding inheritedMethod, char[][] nonNullAnnotationName) {
MethodDeclaration methodDecl = (MethodDeclaration) abstractMethodDecl;
StringBuffer methodSignature = new StringBuffer();
methodSignature
.append(inheritedMethod.declaringClass.readableName())
.append('.')
.append(inheritedMethod.readableName());
StringBuffer shortSignature = new StringBuffer();
shortSignature
.append(inheritedMethod.declaringClass.shortReadableName())
.append('.')
.append(inheritedMethod.shortReadableName());
int sourceStart = methodDecl.returnType.sourceStart;
Annotation[] annotations = methodDecl.annotations;
Annotation annotation = findAnnotation(annotations, TypeIds.T_ConfiguredAnnotationNullable);
if (annotation != null) {
sourceStart = annotation.sourceStart;
}
this.handle(
IProblem.IllegalReturnNullityRedefinition,
new String[] { methodSignature.toString(), CharOperation.toString(nonNullAnnotationName)},
new String[] { shortSignature.toString(), new String(nonNullAnnotationName[nonNullAnnotationName.length-1])},
sourceStart,
methodDecl.returnType.sourceEnd);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:27,代码来源:ProblemReporter.java
示例13: getDefaultValue
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; //导入依赖的package包/类
/**
* @return the default value for this annotation method or <code>null</code> if there is no default value
*/
public Object getDefaultValue() {
MethodBinding originalMethod = original();
if ((originalMethod.tagBits & TagBits.DefaultValueResolved) == 0) {
//The method has not been resolved nor has its class been resolved.
//It can only be from a source type within compilation units to process.
if (originalMethod.declaringClass instanceof SourceTypeBinding) {
SourceTypeBinding sourceType = (SourceTypeBinding) originalMethod.declaringClass;
if (sourceType.scope != null) {
AbstractMethodDeclaration methodDeclaration = originalMethod.sourceMethod();
if (methodDeclaration != null && methodDeclaration.isAnnotationMethod()) {
methodDeclaration.resolve(sourceType.scope);
}
}
}
originalMethod.tagBits |= TagBits.DefaultValueResolved;
}
AnnotationHolder holder = originalMethod.declaringClass.retrieveAnnotationHolder(originalMethod, true);
return holder == null ? null : holder.getDefaultValue();
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:23,代码来源:MethodBinding.java
示例14: sourceMethod
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; //导入依赖的package包/类
public AbstractMethodDeclaration sourceMethod() {
if (isSynthetic()) {
return null;
}
SourceTypeBinding sourceType;
try {
sourceType = (SourceTypeBinding) this.declaringClass;
} catch (ClassCastException e) {
return null;
}
AbstractMethodDeclaration[] methods = sourceType.scope.referenceContext.methods;
if (methods != null) {
for (int i = methods.length; --i >= 0;)
if (this == methods[i].binding)
return methods[i];
}
return null;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:20,代码来源:MethodBinding.java
示例15: bytecodeExceeds64KLimit
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; //导入依赖的package包/类
public void bytecodeExceeds64KLimit(AbstractMethodDeclaration location) {
MethodBinding method = location.binding;
if (location.isConstructor()) {
this.handle(
IProblem.BytecodeExceeds64KLimitForConstructor,
new String[] {new String(location.selector), typesAsString(method, false)},
new String[] {new String(location.selector), typesAsString(method, true)},
ProblemSeverities.Error | ProblemSeverities.Abort | ProblemSeverities.Fatal,
location.sourceStart,
location.sourceEnd);
} else {
this.handle(
IProblem.BytecodeExceeds64KLimit,
new String[] {new String(location.selector), typesAsString(method, false)},
new String[] {new String(location.selector), typesAsString(method, true)},
ProblemSeverities.Error | ProblemSeverities.Abort | ProblemSeverities.Fatal,
location.sourceStart,
location.sourceEnd);
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:ProblemReporter.java
示例16: enumAbstractMethodMustBeImplemented
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; //导入依赖的package包/类
public void enumAbstractMethodMustBeImplemented(AbstractMethodDeclaration method) {
MethodBinding abstractMethod = method.binding;
this.handle(
// Must implement the inherited abstract method %1
// 8.4.3 - Every non-abstract subclass of an abstract type, A, must provide a concrete implementation of all of A's methods.
IProblem.EnumAbstractMethodMustBeImplemented,
new String[] {
new String(abstractMethod.selector),
typesAsString(abstractMethod, false),
new String(abstractMethod.declaringClass.readableName()),
},
new String[] {
new String(abstractMethod.selector),
typesAsString(abstractMethod, true),
new String(abstractMethod.declaringClass.shortReadableName()),
},
method.sourceStart(),
method.sourceEnd());
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:ProblemReporter.java
示例17: illegalModifierForInterfaceMethod
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; //导入依赖的package包/类
public void illegalModifierForInterfaceMethod(AbstractMethodDeclaration methodDecl, boolean isJDK18orGreater) {
// cannot include parameter types since they are not resolved yet
// and the error message would be too long
this.handle(
isJDK18orGreater
? IProblem.IllegalModifierForInterfaceMethod18
: IProblem.IllegalModifierForInterfaceMethod,
new String[] {
new String(methodDecl.selector)
},
new String[] {
new String(methodDecl.selector)
},
methodDecl.sourceStart,
methodDecl.sourceEnd);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:ProblemReporter.java
示例18: createArgumentBindings
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; //导入依赖的package包/类
private void createArgumentBindings(MethodBinding method, CompilerOptions compilerOptions) {
if (!isPrototype()) throw new IllegalStateException();
if (compilerOptions.isAnnotationBasedNullAnalysisEnabled)
getNullDefault(); // ensure initialized
AbstractMethodDeclaration methodDecl = method.sourceMethod();
if (methodDecl != null) {
// while creating argument bindings we also collect explicit null annotations:
if (method.parameters != Binding.NO_PARAMETERS)
methodDecl.createArgumentBindings();
// add implicit annotations (inherited(?) & default):
if (compilerOptions.isAnnotationBasedNullAnalysisEnabled) {
new ImplicitNullAnnotationVerifier(this.scope.environment()).checkImplicitNullAnnotations(method, methodDecl, true, this.scope);
}
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:SourceTypeBinding.java
示例19: sourceMethod
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; //导入依赖的package包/类
public AbstractMethodDeclaration sourceMethod() {
if (isSynthetic()) {
return null;
}
SourceTypeBinding sourceType;
try {
sourceType = (SourceTypeBinding) this.declaringClass;
} catch (ClassCastException e) {
return null;
}
AbstractMethodDeclaration[] methods = sourceType.scope != null ? sourceType.scope.referenceContext.methods : null;
if (methods != null) {
for (int i = methods.length; --i >= 0;)
if (this == methods[i].binding)
return methods[i];
}
return null;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:MethodBinding.java
示例20: visit
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; //导入依赖的package包/类
@Override
public boolean visit(Argument argument, BlockScope scope) {
Annotation[] annotations = argument.annotations;
ReferenceContext referenceContext = scope.referenceContext();
if (referenceContext instanceof AbstractMethodDeclaration) {
MethodBinding binding = ((AbstractMethodDeclaration) referenceContext).binding;
if (binding != null) {
TypeDeclaration typeDeclaration = scope.referenceType();
typeDeclaration.binding.resolveTypesFor(binding);
if (argument.binding != null) {
argument.binding = new AptSourceLocalVariableBinding(argument.binding, binding);
}
}
if (annotations != null) {
this.resolveAnnotations(
scope,
annotations,
argument.binding);
}
}
return false;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:23,代码来源:AnnotationDiscoveryVisitor.java
注:本文中的org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论