本文整理了Java中org.eclipse.jdt.internal.compiler.ast.Annotation
类的一些代码示例,展示了Annotation
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Annotation
类的具体详情如下:
包路径:org.eclipse.jdt.internal.compiler.ast.Annotation
类名称:Annotation
[英]Annotation
[中]注释
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core
public void checkRepeatableMetaAnnotation(BlockScope scope) {
// `this' is the @Repeatable meta annotation, its recipient is the *repeatable* annotation type - we are at the declaration site, not the repeating use site.
ReferenceBinding repeatableAnnotationType = (ReferenceBinding) this.recipient; // know it to be an annotation type. On target miss we don't get here
MemberValuePair[] valuePairs = this.memberValuePairs();
if (valuePairs == null || valuePairs.length != 1)
return;
Object value = valuePairs[0].compilerElementPair.value;
if (!(value instanceof ReferenceBinding))
return; // Has deeper problems, will bark elsewhere.
ReferenceBinding containerAnnotationType = (ReferenceBinding) value;
if (!containerAnnotationType.isAnnotationType())
return; // Has deeper problems, will bark elsewhere.
repeatableAnnotationType.setContainerAnnotationType(containerAnnotationType); // For now. May be reset later to PRB in case of problems.
checkContainerAnnotationType(valuePairs[0], scope, containerAnnotationType, repeatableAnnotationType, false); // false => not use site, i.e declaration site error reporting requested.
}
代码示例来源:origin: org.eclipse.scout.sdk/org.eclipse.scout.sdk.core
private boolean internalVisit(Annotation annotation) {
if (annotation.getCompilerAnnotation() == m_binding) {
m_result = annotation;
}
return m_result == null;
}
}
代码示例来源:origin: INRIA/spoon
for (Annotation annotation : type.annotations[position]) {
if (scope instanceof ClassScope) {
annotation.traverse(this.jdtTreeBuilder, (ClassScope) scope);
} else if (scope instanceof BlockScope) {
annotation.traverse(this.jdtTreeBuilder, (BlockScope) scope);
} else {
annotation.traverse(this.jdtTreeBuilder, (BlockScope) null);
代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core
MethodBinding[] methods = annotationType.methods();
MemberValuePair[] originalValuePairs = memberValuePairs();
this.compilerAnnotation = scope.environment().createAnnotation((ReferenceBinding) this.resolvedType, computeElementValuePairs());
long tagBits = detectStandardAnnotation(scope, annotationType, valueAttribute);
start = typeDeclaration.declarationSourceStart;
recordSuppressWarnings(scope, start, typeDeclaration.declarationSourceEnd, scope.compilerOptions().suppressWarnings);
sourceType = (SourceTypeBinding) sourceMethod.declaringClass;
AbstractMethodDeclaration methodDeclaration = sourceType.scope.referenceContext.declarationOf(sourceMethod);
recordSuppressWarnings(scope, methodDeclaration.declarationSourceStart, methodDeclaration.declarationSourceEnd, scope.compilerOptions().suppressWarnings);
sourceType = (SourceTypeBinding) sourceField.declaringClass;
FieldDeclaration fieldDeclaration = sourceType.scope.referenceContext.declarationOf(sourceField);
recordSuppressWarnings(scope, fieldDeclaration.declarationSourceStart, fieldDeclaration.declarationSourceEnd, scope.compilerOptions().suppressWarnings);
if ((tagBits & TagBits.AnnotationSuppressWarnings) != 0) {
LocalDeclaration localDeclaration = variable.declaration;
recordSuppressWarnings(scope, localDeclaration.declarationSourceStart, localDeclaration.declarationSourceEnd, scope.compilerOptions().suppressWarnings);
代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion
annotations[j] = sourceAnnotations[j].getCompilerAnnotation();
annotations[j] = annot.getCompilerAnnotation();
for (int j = 0; j < length; j++) {
Annotation annot = sourceAnnotations[j];
annotations[j] = annot.getCompilerAnnotation();
AnnotationBinding annotationBinding = annot.getCompilerAnnotation();
annotations[j] = annotationBinding;
if (annotationBinding != null) {
final ReferenceBinding annotationType = annotationBinding.getAnnotationType();
if (annotationType != null && annotationType.id == TypeIds.T_JavaLangSuppressWarnings) {
annot.recordSuppressWarnings(scope, declarationSourceStart, declarationSourceEnd, scope.compilerOptions().suppressWarnings);
} else {
annotation.recipient = recipient;
annotation.resolveType(scope);
annotations[i] = annotation.getCompilerAnnotation();
ReferenceBinding annotationType = annotations[i] != null ? annotations[i].getAnnotationType() : null;
if (annotationType != null && annotationType.id == TypeIds.T_JavaLangAnnotationRepeatable)
annotation.checkRepeatableMetaAnnotation(scope);
Annotation persistibleAnnotation = sourceAnnotations[i].getPersistibleAnnotation();
if (persistibleAnnotation instanceof ContainerAnnotation)
container = (ContainerAnnotation) persistibleAnnotation;
代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core
annotations[j] = annot.getCompilerAnnotation();
for (int j = 0; j < length; j++) {
Annotation annot = sourceAnnotations[j];
annotations[j] = annot.getCompilerAnnotation();
AnnotationBinding annotationBinding = annot.getCompilerAnnotation();
annotations[j] = annotationBinding;
if (annotationBinding != null) {
final ReferenceBinding annotationType = annotationBinding.getAnnotationType();
if (annotationType != null && annotationType.id == TypeIds.T_JavaLangSuppressWarnings) {
annot.recordSuppressWarnings(scope, declarationSourceStart, declarationSourceEnd, scope.compilerOptions().suppressWarnings);
} else {
annotation.recipient = recipient;
annotation.resolveType(scope);
annotations[i] = annotation.getCompilerAnnotation();
代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7
annotations[0] = annotation.getCompilerAnnotation();
for (int j = 1; j < length; j++) {
Annotation annot = sourceAnnotations[j];
annotations[j] = annot.getCompilerAnnotation();
} else {
annotation.recipient = recipient;
annotation.resolveType(scope);
annotations[i] = annotation.getCompilerAnnotation();
代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core
public int match(Annotation node, MatchingNodeSet nodeSet) {
if (!this.pattern.findReferences) return IMPOSSIBLE_MATCH;
MemberValuePair[] pairs = node.memberValuePairs();
if (pairs == null || pairs.length == 0) return IMPOSSIBLE_MATCH;
int length = pairs.length;
MemberValuePair pair = null;
for (int i=0; i<length; i++) {
pair = node.memberValuePairs()[i];
if (matchesName(this.pattern.selector, pair.name)) {
ASTNode possibleNode = (node instanceof SingleMemberAnnotation) ? (ASTNode) node : pair;
return nodeSet.addMatch(possibleNode, this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH);
}
}
return IMPOSSIBLE_MATCH;
}
//public int match(TypeDeclaration node, MatchingNodeSet nodeSet) - SKIP IT
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core
@Override
public StringBuffer printExpression(int indent, StringBuffer output) {
super.printExpression(indent, output);
output.append('(');
this.memberValue.printExpression(indent, output);
return output.append(')');
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core
@Override
public StringBuffer print(int indent, StringBuffer output) {
return this.annotations[0].print(indent, output);
}
}
代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core
AnnotationBinding(Annotation astAnnotation) {
this((ReferenceBinding) astAnnotation.resolvedType, astAnnotation.computeElementValuePairs());
}
代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core
utf8Offset = this.constantPoolOffsets[u2At(currentOffset)] - this.structOffset;
char[] constName = utf8At(utf8Offset + 3, u2At(utf8Offset + 1));
this.standardAnnotationTagBits |= Annotation.getRetentionPolicy(constName);
代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core
utf8Offset = this.constantPoolOffsets[u2At(currentOffset)] - this.structOffset;
char[] constName = utf8At(utf8Offset + 3, u2At(utf8Offset + 1));
this.standardAnnotationTagBits |= Annotation.getTargetElementType(constName);
代码示例来源:origin: org.eclipse.scout.sdk.deps/ecj
MethodBinding[] methods = annotationType.methods();
MemberValuePair[] originalValuePairs = memberValuePairs();
this.compilerAnnotation = scope.environment().createAnnotation((ReferenceBinding) this.resolvedType, computeElementValuePairs());
long tagBits = detectStandardAnnotation(scope, annotationType, valueAttribute);
int defaultNullness = (int)(tagBits & Binding.NullnessDefaultMASK);
tagBits &= ~Binding.NullnessDefaultMASK;
start = typeDeclaration.declarationSourceStart;
recordSuppressWarnings(scope, start, typeDeclaration.declarationSourceEnd, scope.compilerOptions().suppressWarnings);
sourceType = (SourceTypeBinding) sourceMethod.declaringClass;
AbstractMethodDeclaration methodDeclaration = sourceType.scope.referenceContext.declarationOf(sourceMethod);
recordSuppressWarnings(scope, methodDeclaration.declarationSourceStart, methodDeclaration.declarationSourceEnd, scope.compilerOptions().suppressWarnings);
sourceType = (SourceTypeBinding) sourceField.declaringClass;
FieldDeclaration fieldDeclaration = sourceType.scope.referenceContext.declarationOf(sourceField);
recordSuppressWarnings(scope, fieldDeclaration.declarationSourceStart, fieldDeclaration.declarationSourceEnd, scope.compilerOptions().suppressWarnings);
recordSuppressWarnings(scope, localDeclaration.declarationSourceStart, localDeclaration.declarationSourceEnd, scope.compilerOptions().suppressWarnings);
kind = Binding.PACKAGE;
checkAnnotationTarget(this, scope, annotationType, kind, this.recipient, tagBits & TagBits.AnnotationNullMASK);
代码示例来源:origin: org.eclipse.jdt.core.compiler/ecj
annotations[j] = sourceAnnotations[j].getCompilerAnnotation();
annotations[j] = annot.getCompilerAnnotation();
for (int j = 0; j < length; j++) {
Annotation annot = sourceAnnotations[j];
annotations[j] = annot.getCompilerAnnotation();
AnnotationBinding annotationBinding = annot.getCompilerAnnotation();
annotations[j] = annotationBinding;
if (annotationBinding != null) {
final ReferenceBinding annotationType = annotationBinding.getAnnotationType();
if (annotationType != null && annotationType.id == TypeIds.T_JavaLangSuppressWarnings) {
annot.recordSuppressWarnings(scope, declarationSourceStart, declarationSourceEnd, scope.compilerOptions().suppressWarnings);
} else {
annotation.recipient = recipient;
annotation.resolveType(scope);
annotations[i] = annotation.getCompilerAnnotation();
ReferenceBinding annotationType = annotations[i] != null ? annotations[i].getAnnotationType() : null;
if (annotationType != null && annotationType.id == TypeIds.T_JavaLangAnnotationRepeatable)
annotation.checkRepeatableMetaAnnotation(scope);
Annotation persistibleAnnotation = sourceAnnotations[i].getPersistibleAnnotation();
if (persistibleAnnotation instanceof ContainerAnnotation)
container = (ContainerAnnotation) persistibleAnnotation;
代码示例来源:origin: org.eclipse.jetty.orbit/org.eclipse.jdt.core
annotations[j] = annot.getCompilerAnnotation();
for (int j = 0; j < length; j++) {
Annotation annot = sourceAnnotations[j];
annotations[j] = annot.getCompilerAnnotation();
AnnotationBinding annotationBinding = annot.getCompilerAnnotation();
annotations[j] = annotationBinding;
if (annotationBinding != null) {
final ReferenceBinding annotationType = annotationBinding.getAnnotationType();
if (annotationType != null && annotationType.id == TypeIds.T_JavaLangSuppressWarnings) {
annot.recordSuppressWarnings(scope, declarationSourceStart, declarationSourceEnd, scope.compilerOptions().suppressWarnings);
} else {
annotation.recipient = recipient;
annotation.resolveType(scope);
annotations[i] = annotation.getCompilerAnnotation();
代码示例来源:origin: org.eclipse.scout.sdk/org.eclipse.scout.sdk.core
AnnotationBinding compilerAnnotation = annotation.getCompilerAnnotation();
if (compilerAnnotation == null) {
annotation.resolveType(scopeForTypeLookup.referenceContext.staticInitializerScope);
return annotation.getCompilerAnnotation();
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core
public int match(Annotation node, MatchingNodeSet nodeSet) {
if (!this.pattern.findReferences) return IMPOSSIBLE_MATCH;
MemberValuePair[] pairs = node.memberValuePairs();
if (pairs == null || pairs.length == 0) return IMPOSSIBLE_MATCH;
int length = pairs.length;
MemberValuePair pair = null;
for (int i=0; i<length; i++) {
pair = node.memberValuePairs()[i];
if (matchesName(this.pattern.selector, pair.name)) {
ASTNode possibleNode = (node instanceof SingleMemberAnnotation) ? (ASTNode) node : pair;
return nodeSet.addMatch(possibleNode, this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH);
}
}
return IMPOSSIBLE_MATCH;
}
//public int match(TypeDeclaration node, MatchingNodeSet nodeSet) - SKIP IT
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core
public StringBuffer printExpression(int indent, StringBuffer output) {
super.printExpression(indent, output);
output.append('(');
this.memberValue.printExpression(indent, output);
return output.append(')');
}
代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core
public StringBuffer print(int indent, StringBuffer output) {
return this.annotations[0].print(indent, output);
}
}
内容来源于网络,如有侵权,请联系作者删除!