本文整理汇总了Java中org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference类的典型用法代码示例。如果您正苦于以下问题:Java QualifiedTypeReference类的具体用法?Java QualifiedTypeReference怎么用?Java QualifiedTypeReference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
QualifiedTypeReference类属于org.eclipse.jdt.internal.compiler.ast包,在下文中一共展示了QualifiedTypeReference类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: handleValForForEach
import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference; //导入依赖的package包/类
public static boolean handleValForForEach(ForeachStatement forEach, BlockScope scope) {
if (forEach.elementVariable == null) return false;
if (!isVal(forEach.elementVariable.type, scope)) return false;
TypeBinding component = getForEachComponentType(forEach.collection, scope);
if (component == null) return false;
TypeReference replacement = makeType(component, forEach.elementVariable.type, false);
forEach.elementVariable.modifiers |= ClassFileConstants.AccFinal;
forEach.elementVariable.annotations = addValAnnotation(forEach.elementVariable.annotations, forEach.elementVariable.type, scope);
forEach.elementVariable.type = replacement != null ? replacement :
new QualifiedTypeReference(TypeConstants.JAVA_LANG_OBJECT, poss(forEach.elementVariable.type, 3));
return false;
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:17,代码来源:PatchVal.java
示例2: generateDeprecatedAnnotation
import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference; //导入依赖的package包/类
public static MarkerAnnotation generateDeprecatedAnnotation(ASTNode source) {
QualifiedTypeReference qtr = new QualifiedTypeReference(new char[][] {
{'j', 'a', 'v', 'a'}, {'l', 'a', 'n', 'g'}, {'D', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd'}}, poss(source, 3));
setGeneratedBy(qtr, source);
MarkerAnnotation ma = new MarkerAnnotation(qtr, source.sourceStart);
// No matter what value you input for sourceEnd, the AST->DOM converter of eclipse will reparse to find the end, and will fail as
// it can't find code that isn't really there. This results in the end position being set to 2 or 0 or some weird magic value, and thus,
// length, as calculated by end-start, is all screwed up, resulting in IllegalArgumentException during a setSourceRange call MUCH later in the process.
// We solve it by going with a voodoo magic source start value such that the calculated length so happens to exactly be 0. 0 lengths are accepted
// by eclipse. For some reason.
// TL;DR: Don't change 1. 1 is sacred. Trust the 1.
// issue: #408.
ma.sourceStart = 1;
setGeneratedBy(ma, source);
return ma;
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:17,代码来源:EclipseHandlerUtil.java
示例3: createTypeReference
import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference; //导入依赖的package包/类
public TypeReference createTypeReference(EclipseNode type, long p) {
List<String> list = new ArrayList<String>();
list.add(type.getName());
EclipseNode tNode = type.up();
while (tNode != null && tNode.getKind() == Kind.TYPE) {
list.add(tNode.getName());
tNode = tNode.up();
}
Collections.reverse(list);
if (list.size() == 1) return new SingleTypeReference(list.get(0).toCharArray(), p);
long[] ps = new long[list.size()];
char[][] tokens = new char[list.size()][];
for (int i = 0; i < list.size(); i++) {
ps[i] = p;
tokens[i] = list.get(i).toCharArray();
}
return new QualifiedTypeReference(tokens, ps);
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:21,代码来源:HandleEqualsAndHashCode.java
示例4: cloneParamType
import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference; //导入依赖的package包/类
protected TypeReference cloneParamType(int index, List<TypeReference> typeArgs, EclipseNode builderType) {
if (typeArgs != null && typeArgs.size() > index) {
TypeReference originalType = typeArgs.get(index);
if (originalType instanceof Wildcard) {
Wildcard wOriginalType = (Wildcard) originalType;
if (wOriginalType.kind == Wildcard.EXTENDS) {
try {
return copyType(wOriginalType.bound);
} catch (Exception e) {
// fallthrough
}
}
} else {
return copyType(originalType);
}
}
return new QualifiedTypeReference(TypeConstants.JAVA_LANG_OBJECT, NULL_POSS);
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:20,代码来源:EclipseSingularsRecipes.java
示例5: generateFields
import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference; //导入依赖的package包/类
@Override public List<EclipseNode> generateFields(SingularData data, EclipseNode builderType) {
if (useGuavaInstead(builderType)) {
return guavaListSetSingularizer.generateFields(data, builderType);
}
TypeReference type = new QualifiedTypeReference(JAVA_UTIL_ARRAYLIST, NULL_POSS);
type = addTypeArgs(1, false, builderType, type, data.getTypeArgs());
FieldDeclaration buildField = new FieldDeclaration(data.getPluralName(), 0, -1);
buildField.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG;
buildField.modifiers = ClassFileConstants.AccPrivate;
buildField.declarationSourceEnd = -1;
buildField.type = type;
data.setGeneratedByRecursive(buildField);
return Collections.singletonList(injectFieldAndMarkGenerated(builderType, buildField));
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:17,代码来源:EclipseJavaUtilListSetSingularizer.java
示例6: visit
import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference; //导入依赖的package包/类
/**
* @see org.eclipse.jdt.internal.compiler.ASTVisitor#visit(org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference, org.eclipse.jdt.internal.compiler.lookup.ClassScope)
*/
public boolean visit(
QualifiedTypeReference qualifiedTypeReference,
ClassScope scope) {
final int numberOfParens = (qualifiedTypeReference.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT;
if (numberOfParens > 0) {
manageOpeningParenthesizedExpression(qualifiedTypeReference, numberOfParens);
}
formatQualifiedTypeReference(qualifiedTypeReference);
if (numberOfParens > 0) {
manageClosingParenthesizedExpression(qualifiedTypeReference, numberOfParens);
}
return false;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:CodeFormatterVisitor.java
示例7: convert
import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference; //导入依赖的package包/类
public Name convert(org.eclipse.jdt.internal.compiler.ast.TypeReference typeReference) {
char[][] typeName = typeReference.getTypeName();
int length = typeName.length;
if (length > 1) {
// QualifiedName
org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference qualifiedTypeReference = (org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference) typeReference;
final long[] positions = qualifiedTypeReference.sourcePositions;
return setQualifiedNameNameAndSourceRanges(typeName, positions, typeReference);
} else {
final SimpleName name = new SimpleName(this.ast);
name.internalSetIdentifier(new String(typeName[0]));
name.setSourceRange(typeReference.sourceStart, typeReference.sourceEnd - typeReference.sourceStart + 1);
name.index = 1;
if (this.resolveBindings) {
recordNodes(name, typeReference);
}
return name;
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:ASTConverter.java
示例8: setTypeNameForAnnotation
import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference; //导入依赖的package包/类
protected void setTypeNameForAnnotation(org.eclipse.jdt.internal.compiler.ast.Annotation compilerAnnotation, Annotation annotation) {
TypeReference typeReference = compilerAnnotation.type;
if (typeReference instanceof QualifiedTypeReference) {
QualifiedTypeReference qualifiedTypeReference = (QualifiedTypeReference) typeReference;
char[][] tokens = qualifiedTypeReference.tokens;
long[] positions = qualifiedTypeReference.sourcePositions;
// QualifiedName
annotation.setTypeName(setQualifiedNameNameAndSourceRanges(tokens, positions, typeReference));
} else {
SingleTypeReference singleTypeReference = (SingleTypeReference) typeReference;
final SimpleName name = new SimpleName(this.ast);
name.internalSetIdentifier(new String(singleTypeReference.token));
int start = singleTypeReference.sourceStart;
int end = singleTypeReference.sourceEnd;
name.setSourceRange(start, end - start + 1);
name.index = 1;
annotation.setTypeName(name);
if (this.resolveBindings) {
recordNodes(name, typeReference);
}
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:23,代码来源:ASTConverter.java
示例9: getAnnotationType
import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference; //导入依赖的package包/类
protected TypeReference getAnnotationType() {
int length = this.identifierLengthStack[this.identifierLengthPtr--];
if (length == 1) {
return new SingleTypeReference(
this.identifierStack[this.identifierPtr],
this.identifierPositionStack[this.identifierPtr--]);
} else {
char[][] tokens = new char[length][];
this.identifierPtr -= length;
long[] positions = new long[length];
System.arraycopy(this.identifierStack, this.identifierPtr + 1, tokens, 0, length);
System.arraycopy(
this.identifierPositionStack,
this.identifierPtr + 1,
positions,
0,
length);
return new QualifiedTypeReference(tokens, positions);
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:Parser.java
示例10: deprecatedType
import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference; //导入依赖的package包/类
public void deprecatedType(TypeBinding type, ASTNode location, int index) {
if (location == null) return; // 1G828DN - no type ref for synthetic arguments
int severity = computeSeverity(IProblem.UsingDeprecatedType);
if (severity == ProblemSeverities.Ignore) return;
type = type.leafComponentType();
int sourceStart = -1;
if (location instanceof QualifiedTypeReference) { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=300031
QualifiedTypeReference ref = (QualifiedTypeReference) location;
if (index < Integer.MAX_VALUE) {
sourceStart = (int) (ref.sourcePositions[index] >> 32);
}
}
this.handle(
IProblem.UsingDeprecatedType,
new String[] {new String(type.readableName())},
new String[] {new String(type.shortReadableName())},
severity,
(sourceStart == -1) ? location.sourceStart : sourceStart,
nodeSourceEnd(null, location, index));
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:ProblemReporter.java
示例11: redundantSpecificationOfTypeArguments
import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference; //导入依赖的package包/类
public void redundantSpecificationOfTypeArguments(ASTNode location, TypeBinding[] argumentTypes) {
int severity = computeSeverity(IProblem.RedundantSpecificationOfTypeArguments);
if (severity != ProblemSeverities.Ignore) {
int sourceStart = -1;
if (location instanceof QualifiedTypeReference) {
QualifiedTypeReference ref = (QualifiedTypeReference)location;
sourceStart = (int) (ref.sourcePositions[ref.sourcePositions.length - 1] >> 32);
} else {
sourceStart = location.sourceStart;
}
this.handle(
IProblem.RedundantSpecificationOfTypeArguments,
new String[] {typesAsString(argumentTypes, false)},
new String[] {typesAsString(argumentTypes, true)},
severity,
sourceStart,
location.sourceEnd);
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:ProblemReporter.java
示例12: visit
import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference; //导入依赖的package包/类
/**
* @see org.eclipse.jdt.internal.compiler.ASTVisitor#visit(org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference, org.eclipse.jdt.internal.compiler.lookup.BlockScope)
*/
public boolean visit(
QualifiedTypeReference qualifiedTypeReference,
BlockScope scope) {
final int numberOfParens = (qualifiedTypeReference.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT;
if (numberOfParens > 0) {
manageOpeningParenthesizedExpression(qualifiedTypeReference, numberOfParens);
}
this.scribe.printQualifiedReference(qualifiedTypeReference.sourceEnd, numberOfParens>=0/*expect parenthesis*/);
if (numberOfParens > 0) {
manageClosingParenthesizedExpression(qualifiedTypeReference, numberOfParens);
}
return false;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:19,代码来源:CodeFormatterVisitor.java
示例13: createSuppressWarningsAll
import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference; //导入依赖的package包/类
public static Annotation[] createSuppressWarningsAll(ASTNode source, Annotation[] originalAnnotationArray) {
int pS = source.sourceStart, pE = source.sourceEnd;
long p = (long)pS << 32 | pE;
long[] poss = new long[3];
Arrays.fill(poss, p);
QualifiedTypeReference suppressWarningsType = new QualifiedTypeReference(TypeConstants.JAVA_LANG_SUPPRESSWARNINGS, poss);
setGeneratedBy(suppressWarningsType, source);
SingleMemberAnnotation ann = new SingleMemberAnnotation(suppressWarningsType, pS);
ann.declarationSourceEnd = pE;
ann.memberValue = new StringLiteral(ALL, pS, pE, 0);
setGeneratedBy(ann, source);
setGeneratedBy(ann.memberValue, source);
if (originalAnnotationArray == null) return new Annotation[] { ann };
Annotation[] newAnnotationArray = new Annotation[originalAnnotationArray.length + 1];
System.arraycopy(originalAnnotationArray, 0, newAnnotationArray, 0, originalAnnotationArray.length);
newAnnotationArray[originalAnnotationArray.length] = ann;
return newAnnotationArray;
}
开发者ID:redundent,项目名称:lombok,代码行数:19,代码来源:EclipseHandlerUtil.java
示例14: generateNullCheck
import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference; //导入依赖的package包/类
/**
* Generates a new statement that checks if the given variable is null, and if so, throws a {@code NullPointerException} with the
* variable name as message.
*/
public static Statement generateNullCheck(AbstractVariableDeclaration variable, ASTNode source) {
int pS = source.sourceStart, pE = source.sourceEnd;
long p = (long)pS << 32 | pE;
if (isPrimitive(variable.type)) return null;
AllocationExpression exception = new AllocationExpression();
setGeneratedBy(exception, source);
exception.type = new QualifiedTypeReference(fromQualifiedName("java.lang.NullPointerException"), new long[]{p, p, p});
setGeneratedBy(exception.type, source);
exception.arguments = new Expression[] { new StringLiteral(variable.name, pS, pE, 0)};
setGeneratedBy(exception.arguments[0], source);
ThrowStatement throwStatement = new ThrowStatement(exception, pS, pE);
setGeneratedBy(throwStatement, source);
SingleNameReference varName = new SingleNameReference(variable.name, p);
setGeneratedBy(varName, source);
NullLiteral nullLiteral = new NullLiteral(pS, pE);
setGeneratedBy(nullLiteral, source);
EqualExpression equalExpression = new EqualExpression(varName, nullLiteral, OperatorIds.EQUAL_EQUAL);
equalExpression.sourceStart = pS; equalExpression.statementEnd = equalExpression.sourceEnd = pE;
setGeneratedBy(equalExpression, source);
IfStatement ifStatement = new IfStatement(equalExpression, throwStatement, 0, 0);
setGeneratedBy(ifStatement, source);
return ifStatement;
}
开发者ID:redundent,项目名称:lombok,代码行数:30,代码来源:EclipseHandlerUtil.java
示例15: createTypeReference
import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference; //导入依赖的package包/类
private TypeReference createTypeReference(EclipseNode type, long p) {
List<String> list = new ArrayList<String>();
list.add(type.getName());
EclipseNode tNode = type.up();
while (tNode != null && tNode.getKind() == Kind.TYPE) {
list.add(tNode.getName());
tNode = tNode.up();
}
Collections.reverse(list);
if (list.size() == 1) return new SingleTypeReference(list.get(0).toCharArray(), p);
long[] ps = new long[list.size()];
char[][] tokens = new char[list.size()][];
for (int i = 0; i < list.size(); i++) {
ps[i] = p;
tokens[i] = list.get(i).toCharArray();
}
return new QualifiedTypeReference(tokens, ps);
}
开发者ID:redundent,项目名称:lombok,代码行数:21,代码来源:HandleEqualsAndHashCode.java
示例16: couldBeVal
import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference; //导入依赖的package包/类
public static boolean couldBeVal(TypeReference ref) {
if (ref instanceof SingleTypeReference) {
char[] token = ((SingleTypeReference)ref).token;
return matches("val", token);
}
if (ref instanceof QualifiedTypeReference) {
char[][] tokens = ((QualifiedTypeReference)ref).tokens;
if (tokens == null || tokens.length != 2) return false;
return matches("lombok", tokens[0]) && matches("val", tokens[1]);
}
return false;
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:15,代码来源:PatchVal.java
示例17: createConstructorProperties
import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference; //导入依赖的package包/类
public static Annotation[] createConstructorProperties(ASTNode source, Collection<EclipseNode> fields) {
if (fields.isEmpty()) return null;
int pS = source.sourceStart, pE = source.sourceEnd;
long p = (long) pS << 32 | pE;
long[] poss = new long[3];
Arrays.fill(poss, p);
QualifiedTypeReference constructorPropertiesType = new QualifiedTypeReference(JAVA_BEANS_CONSTRUCTORPROPERTIES, poss);
setGeneratedBy(constructorPropertiesType, source);
SingleMemberAnnotation ann = new SingleMemberAnnotation(constructorPropertiesType, pS);
ann.declarationSourceEnd = pE;
ArrayInitializer fieldNames = new ArrayInitializer();
fieldNames.sourceStart = pS;
fieldNames.sourceEnd = pE;
fieldNames.expressions = new Expression[fields.size()];
int ctr = 0;
for (EclipseNode field : fields) {
char[] fieldName = removePrefixFromField(field);
fieldNames.expressions[ctr] = new StringLiteral(fieldName, pS, pE, 0);
setGeneratedBy(fieldNames.expressions[ctr], source);
ctr++;
}
ann.memberValue = fieldNames;
setGeneratedBy(ann, source);
setGeneratedBy(ann.memberValue, source);
return new Annotation[] { ann };
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:31,代码来源:HandleConstructor.java
示例18: createPrivateDefaultConstructor
import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference; //导入依赖的package包/类
private void createPrivateDefaultConstructor(EclipseNode typeNode, EclipseNode sourceNode) {
ASTNode source = sourceNode.get();
TypeDeclaration typeDeclaration = ((TypeDeclaration) typeNode.get());
long p = (long) source.sourceStart << 32 | source.sourceEnd;
ConstructorDeclaration constructor = new ConstructorDeclaration(((CompilationUnitDeclaration) typeNode.top().get()).compilationResult);
constructor.modifiers = ClassFileConstants.AccPrivate;
constructor.selector = typeDeclaration.name;
constructor.constructorCall = new ExplicitConstructorCall(ExplicitConstructorCall.ImplicitSuper);
constructor.constructorCall.sourceStart = source.sourceStart;
constructor.constructorCall.sourceEnd = source.sourceEnd;
constructor.thrownExceptions = null;
constructor.typeParameters = null;
constructor.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG;
constructor.bodyStart = constructor.declarationSourceStart = constructor.sourceStart = source.sourceStart;
constructor.bodyEnd = constructor.declarationSourceEnd = constructor.sourceEnd = source.sourceEnd;
constructor.arguments = null;
AllocationExpression exception = new AllocationExpression();
setGeneratedBy(exception, source);
long[] ps = new long[JAVA_LANG_UNSUPPORTED_OPERATION_EXCEPTION.length];
Arrays.fill(ps, p);
exception.type = new QualifiedTypeReference(JAVA_LANG_UNSUPPORTED_OPERATION_EXCEPTION, ps);
setGeneratedBy(exception.type, source);
exception.arguments = new Expression[] {
new StringLiteral(UNSUPPORTED_MESSAGE, source.sourceStart, source.sourceEnd, 0)
};
setGeneratedBy(exception.arguments[0], source);
ThrowStatement throwStatement = new ThrowStatement(exception, source.sourceStart, source.sourceEnd);
setGeneratedBy(throwStatement, source);
constructor.statements = new Statement[] {throwStatement};
injectMethod(typeNode, constructor);
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:38,代码来源:HandleUtilityClass.java
示例19: makeMarkerAnnotation
import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference; //导入依赖的package包/类
/**
* Create an annotation of the given name, and is marked as being generated by the given source.
*/
public static MarkerAnnotation makeMarkerAnnotation(char[][] name, ASTNode source) {
long pos = (long)source.sourceStart << 32 | source.sourceEnd;
TypeReference typeRef = new QualifiedTypeReference(name, new long[] {pos, pos, pos});
setGeneratedBy(typeRef, source);
MarkerAnnotation ann = new MarkerAnnotation(typeRef, (int)(pos >> 32));
ann.declarationSourceEnd = ann.sourceEnd = ann.statementEnd = (int)pos;
setGeneratedBy(ann, source);
return ann;
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:13,代码来源:EclipseHandlerUtil.java
示例20: fixPositions
import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference; //导入依赖的package包/类
private void fixPositions(QualifiedTypeReference node) {
node.sourceEnd = sourceEnd;
node.sourceStart = sourceStart;
node.statementEnd = sourceEnd;
if (node.sourcePositions == null || node.sourcePositions.length != node.tokens.length) node.sourcePositions = new long[node.tokens.length];
Arrays.fill(node.sourcePositions, sourcePos);
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:8,代码来源:SetGeneratedByVisitor.java
注:本文中的org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论