当前位置: 首页>>代码示例>>Java>>正文


Java TypeIds类代码示例

本文整理汇总了Java中org.eclipse.jdt.internal.compiler.lookup.TypeIds的典型用法代码示例。如果您正苦于以下问题:Java TypeIds类的具体用法?Java TypeIds怎么用?Java TypeIds使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TypeIds类属于org.eclipse.jdt.internal.compiler.lookup包,在下文中一共展示了TypeIds类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generateCleanMethod

import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入依赖的package包/类
private MethodDeclaration generateCleanMethod(List<BuilderFieldData> builderFields, EclipseNode builderType, ASTNode source) {
	List<Statement> statements = new ArrayList<Statement>();
	
	for (BuilderFieldData bfd : builderFields) {
		if (bfd.singularData != null && bfd.singularData.getSingularizer() != null) {
			bfd.singularData.getSingularizer().appendCleaningCode(bfd.singularData, builderType, statements);
		}
	}
	
	FieldReference thisUnclean = new FieldReference(CLEAN_FIELD_NAME, 0);
	thisUnclean.receiver = new ThisReference(0, 0);
	statements.add(new Assignment(thisUnclean, new FalseLiteral(0, 0), 0));
	MethodDeclaration decl = new MethodDeclaration(((CompilationUnitDeclaration) builderType.top().get()).compilationResult);
	decl.selector = CLEAN_METHOD_NAME;
	decl.modifiers = ClassFileConstants.AccPrivate;
	decl.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG;
	decl.returnType = TypeReference.baseTypeReference(TypeIds.T_void, 0);
	decl.statements = statements.toArray(new Statement[0]);
	decl.traverse(new SetGeneratedByVisitor(source), (ClassScope) null);
	return decl;
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:22,代码来源:HandleBuilder.java

示例2: longToIntForHashCode

import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入依赖的package包/类
/** Give 2 clones! */
public Expression longToIntForHashCode(Expression ref1, Expression ref2, ASTNode source) {
	int pS = source.sourceStart, pE = source.sourceEnd;
	/* (int)(ref >>> 32 ^ ref) */
	IntLiteral int32 = makeIntLiteral("32".toCharArray(), source);
	BinaryExpression higherBits = new BinaryExpression(ref1, int32, OperatorIds.UNSIGNED_RIGHT_SHIFT);
	setGeneratedBy(higherBits, source);
	BinaryExpression xorParts = new BinaryExpression(ref2, higherBits, OperatorIds.XOR);
	setGeneratedBy(xorParts, source);
	TypeReference intRef = TypeReference.baseTypeReference(TypeIds.T_int, 0);
	intRef.sourceStart = pS; intRef.sourceEnd = pE;
	setGeneratedBy(intRef, source);
	CastExpression expr = makeCastExpression(xorParts, intRef, source);
	expr.sourceStart = pS; expr.sourceEnd = pE;
	return expr;
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:17,代码来源:HandleEqualsAndHashCode.java

示例3: generateMethods

import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入依赖的package包/类
@Override public void generateMethods(SingularData data, EclipseNode builderType, boolean fluent, boolean chain) {
	if (useGuavaInstead(builderType)) {
		guavaListSetSingularizer.generateMethods(data, builderType, fluent, chain);
		return;
	}
	
	TypeReference returnType = chain ? cloneSelfType(builderType) : TypeReference.baseTypeReference(TypeIds.T_void, 0);
	Statement returnStatement = chain ? new ReturnStatement(new ThisReference(0, 0), 0, 0) : null;
	generateSingularMethod(returnType, returnStatement, data, builderType, fluent);
	
	returnType = chain ? cloneSelfType(builderType) : TypeReference.baseTypeReference(TypeIds.T_void, 0);
	returnStatement = chain ? new ReturnStatement(new ThisReference(0, 0), 0, 0) : null;
	generatePluralMethod(returnType, returnStatement, data, builderType, fluent);
	
	returnType = chain ? cloneSelfType(builderType) : TypeReference.baseTypeReference(TypeIds.T_void, 0);
	returnStatement = chain ? new ReturnStatement(new ThisReference(0, 0), 0, 0) : null;
	generateClearMethod(returnType, returnStatement, data, builderType);
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:19,代码来源:EclipseJavaUtilListSetSingularizer.java

示例4: generateMethods

import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入依赖的package包/类
@Override public void generateMethods(SingularData data, EclipseNode builderType, boolean fluent, boolean chain) {
	if (useGuavaInstead(builderType)) {
		guavaMapSingularizer.generateMethods(data, builderType, fluent, chain);
		return;
	}
	
	TypeReference returnType = chain ? cloneSelfType(builderType) : TypeReference.baseTypeReference(TypeIds.T_void, 0);
	Statement returnStatement = chain ? new ReturnStatement(new ThisReference(0, 0), 0, 0) : null;
	generateSingularMethod(returnType, returnStatement, data, builderType, fluent);
	
	returnType = chain ? cloneSelfType(builderType) : TypeReference.baseTypeReference(TypeIds.T_void, 0);
	returnStatement = chain ? new ReturnStatement(new ThisReference(0, 0), 0, 0) : null;
	generatePluralMethod(returnType, returnStatement, data, builderType, fluent);
	
	returnType = chain ? cloneSelfType(builderType) : TypeReference.baseTypeReference(TypeIds.T_void, 0);
	returnStatement = chain ? new ReturnStatement(new ThisReference(0, 0), 0, 0) : null;
	generateClearMethod(returnType, returnStatement, data, builderType);
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:19,代码来源:EclipseJavaUtilMapSingularizer.java

示例5: getNegativeAnnotationMemberValue

import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入依赖的package包/类
public static Object getNegativeAnnotationMemberValue(
    MemberValuePair memberValuePair, Constant constant) {
  if (constant == null) {
    memberValuePair.valueKind = IMemberValuePair.K_UNKNOWN;
    return null;
  }
  switch (constant.typeID()) {
    case TypeIds.T_int:
      memberValuePair.valueKind = IMemberValuePair.K_INT;
      return new Integer(constant.intValue() * -1);
    case TypeIds.T_float:
      memberValuePair.valueKind = IMemberValuePair.K_FLOAT;
      return new Float(constant.floatValue() * -1.0f);
    case TypeIds.T_double:
      memberValuePair.valueKind = IMemberValuePair.K_DOUBLE;
      return new Double(constant.doubleValue() * -1.0);
    case TypeIds.T_long:
      memberValuePair.valueKind = IMemberValuePair.K_LONG;
      return new Long(constant.longValue() * -1L);
    default:
      memberValuePair.valueKind = IMemberValuePair.K_UNKNOWN;
      return null;
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:25,代码来源:Util.java

示例6: getNegativeAnnotationMemberValue

import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入依赖的package包/类
public static Object getNegativeAnnotationMemberValue(MemberValuePair memberValuePair, Constant constant) {
	if (constant == null) {
		memberValuePair.valueKind = IMemberValuePair.K_UNKNOWN;
		return null;
	}
	switch (constant.typeID()) {
		case TypeIds.T_int :
			memberValuePair.valueKind = IMemberValuePair.K_INT;
			return new Integer(constant.intValue() * -1);
		case TypeIds.T_float :
			memberValuePair.valueKind = IMemberValuePair.K_FLOAT;
			return new Float(constant.floatValue() * -1.0f);
		case TypeIds.T_double :
			memberValuePair.valueKind = IMemberValuePair.K_DOUBLE;
			return new Double(constant.doubleValue() * -1.0);
		case TypeIds.T_long :
			memberValuePair.valueKind = IMemberValuePair.K_LONG;
			return new Long(constant.longValue() * -1L);
		default:
			memberValuePair.valueKind = IMemberValuePair.K_UNKNOWN;
			return null;
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:24,代码来源:Util.java

示例7: getConstantValue

import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入依赖的package包/类
public Object getConstantValue() {
	Constant c = this.binding.constant();
	if (c == null || c == Constant.NotAConstant) return null;
	switch (c.typeID()) {
		case TypeIds.T_boolean:
			return Boolean.valueOf(c.booleanValue());
		case TypeIds.T_byte:
			return new Byte(c.byteValue());
		case TypeIds.T_char:
			return new Character(c.charValue());
		case TypeIds.T_double:
			return new Double(c.doubleValue());
		case TypeIds.T_float:
			return new Float(c.floatValue());
		case TypeIds.T_int:
			return new Integer(c.intValue());
		case TypeIds.T_long:
			return new Long(c.longValue());
		case TypeIds.T_short:
			return new Short(c.shortValue());
		case TypeIds.T_JavaLangString:
			return c.stringValue();
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:26,代码来源:VariableBinding.java

示例8: illegalReturnRedefinition

import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入依赖的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

示例9: resolveConstantExpressionValue

import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入依赖的package包/类
Object resolveConstantExpressionValue(Expression expression) {
	org.eclipse.jdt.internal.compiler.ast.ASTNode node = (org.eclipse.jdt.internal.compiler.ast.ASTNode) this.newAstToOldAst.get(expression);
	if (node instanceof org.eclipse.jdt.internal.compiler.ast.Expression) {
		org.eclipse.jdt.internal.compiler.ast.Expression compilerExpression = (org.eclipse.jdt.internal.compiler.ast.Expression) node;
		Constant constant = compilerExpression.constant;
		if (constant != null && constant != Constant.NotAConstant) {
			switch (constant.typeID()) {
				case TypeIds.T_int : return new Integer(constant.intValue());
				case TypeIds.T_byte : return new Byte(constant.byteValue());
				case TypeIds.T_short : return new Short(constant.shortValue());
				case TypeIds.T_char : return new Character(constant.charValue());
				case TypeIds.T_float : return new Float(constant.floatValue());
				case TypeIds.T_double : return new Double(constant.doubleValue());
				case TypeIds.T_boolean : return constant.booleanValue() ? Boolean.TRUE : Boolean.FALSE;
				case TypeIds.T_long : return new Long(constant.longValue());
				case TypeIds.T_JavaLangString : return constant.stringValue();
			}
			return null;
		}
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:23,代码来源:DefaultBindingResolver.java

示例10: nullDefaultAnnotationIsRedundant

import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入依赖的package包/类
public void nullDefaultAnnotationIsRedundant(ASTNode location, Annotation[] annotations, Binding outer) {
	Annotation annotation = findAnnotation(annotations, TypeIds.T_ConfiguredAnnotationNonNullByDefault);
	int start = annotation != null ? annotation.sourceStart : location.sourceStart;
	int end = annotation != null ? annotation.sourceEnd : location.sourceStart;
	String[] args = NoArgument;
	String[] shortArgs = NoArgument;
	if (outer != null) {
		args = new String[] { new String(outer.readableName()) };
		shortArgs = new String[] { new String(outer.shortReadableName()) };
	}
	int problemId = IProblem.RedundantNullDefaultAnnotation;
	if (outer instanceof PackageBinding) {
		problemId = IProblem.RedundantNullDefaultAnnotationPackage;
	} else if (outer instanceof ReferenceBinding) {
		problemId = IProblem.RedundantNullDefaultAnnotationType;
	} else if (outer instanceof MethodBinding) {
		problemId = IProblem.RedundantNullDefaultAnnotationMethod;
	}
	this.handle(problemId, args, shortArgs, start, end);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:21,代码来源:ProblemReporter.java

示例11: findAnnotation

import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入依赖的package包/类
/** Retrieve the null annotation that has been translated to the given nullTagBits. */
public Annotation findAnnotation(long nullTagBits) {
	if (this.annotations != null) {
		Annotation[] innerAnnotations = this.annotations[this.annotations.length-1];
		if (innerAnnotations != null) {
			int annId = nullTagBits == TagBits.AnnotationNonNull ? TypeIds.T_ConfiguredAnnotationNonNull : TypeIds.T_ConfiguredAnnotationNullable;
			for (int i = 0; i < innerAnnotations.length; i++) {
				if (innerAnnotations[i] != null 
						&& innerAnnotations[i].resolvedType != null 
						&& innerAnnotations[i].resolvedType.id == annId)
					return innerAnnotations[i];
			}
		}
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:TypeReference.java

示例12: getMarkerInterfaces

import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入依赖的package包/类
public TypeBinding[] getMarkerInterfaces() {
	if (this.expectedType instanceof IntersectionCastTypeBinding) {
		Set markerBindings = new LinkedHashSet();
		TypeBinding[] intersectionTypes = ((IntersectionCastTypeBinding)this.expectedType).intersectingTypes;
		for (int i = 0,max = intersectionTypes.length; i < max; i++) {
			TypeBinding typeBinding = intersectionTypes[i];
			MethodBinding methodBinding = typeBinding.getSingleAbstractMethod(this.scope, true);
			// Why doesn't getSingleAbstractMethod do as the javadoc says, and return null
			// when it is not a SAM type
			if (!(methodBinding instanceof ProblemMethodBinding && ((ProblemMethodBinding)methodBinding).problemId()==ProblemReasons.NoSuchSingleAbstractMethod)) {
				continue;
			}
			if (typeBinding.id == TypeIds.T_JavaIoSerializable) {
				// Serializable is captured as a bitflag
				continue;
			}
			markerBindings.add(typeBinding);
		}
		if (markerBindings.size() > 0) {
			return (TypeBinding[])markerBindings.toArray(new TypeBinding[markerBindings.size()]);
		}
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:25,代码来源:LambdaExpression.java

示例13: reportOnlyUselesslyReadPrivateField

import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入依赖的package包/类
void reportOnlyUselesslyReadPrivateField(BlockScope currentScope, FieldBinding fieldBinding, boolean valueRequired) {
	if (valueRequired) {
		// access is relevant, turn compound use into real use:
		fieldBinding.compoundUseFlag = 0;
		fieldBinding.modifiers |= ExtraCompilerModifiers.AccLocallyUsed;
	} else {
		if (fieldBinding.isUsedOnlyInCompound()) {
			fieldBinding.compoundUseFlag--; // consume one
			if (fieldBinding.compoundUseFlag == 0					// report only the last usage
					&& fieldBinding.isOrEnclosedByPrivateType() 
					&& (this.implicitConversion & TypeIds.UNBOXING) == 0) // don't report if unboxing is involved (might cause NPE)
			{
				// compoundAssignment/postIncrement is the only usage of this field
				currentScope.problemReporter().unusedPrivateField(fieldBinding.sourceField());
				fieldBinding.modifiers |= ExtraCompilerModifiers.AccLocallyUsed; // don't report again
			}
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:Reference.java

示例14: localVariableNullReference

import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入依赖的package包/类
public void localVariableNullReference(LocalVariableBinding local, ASTNode location) {
	if (location instanceof Expression && (((Expression)location).implicitConversion & TypeIds.UNBOXING) != 0) {
		nullUnboxing(location, local.type);
		return;
	}
	int severity = computeSeverity(IProblem.NullLocalVariableReference);
	if (severity == ProblemSeverities.Ignore) return;
	String[] arguments = new String[] {new String(local.name)  };
	this.handle(
		IProblem.NullLocalVariableReference,
		arguments,
		arguments,
		severity,
		nodeSourceStart(local, location),
		nodeSourceEnd(local, location));
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:ProblemReporter.java

示例15: localVariablePotentialNullReference

import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入依赖的package包/类
public void localVariablePotentialNullReference(LocalVariableBinding local, ASTNode location) {
	if (location instanceof Expression && (((Expression)location).implicitConversion & TypeIds.UNBOXING) != 0) {
		potentialNullUnboxing(location, local.type);
		return;
	}
	if ((local.type.tagBits & TagBits.AnnotationNullable) != 0 && location instanceof Expression) {
		dereferencingNullableExpression((Expression) location);
		return;
	}
	int severity = computeSeverity(IProblem.PotentialNullLocalVariableReference);
	if (severity == ProblemSeverities.Ignore) return;
	String[] arguments = new String[] {new String(local.name)};
	this.handle(
		IProblem.PotentialNullLocalVariableReference,
		arguments,
		arguments,
		severity,
		nodeSourceStart(local, location),
		nodeSourceEnd(local, location));
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:ProblemReporter.java


注:本文中的org.eclipse.jdt.internal.compiler.lookup.TypeIds类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。