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


Java MethodBinding.sourceMethod方法代码示例

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


在下文中一共展示了MethodBinding.sourceMethod方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: annotationCannotOverrideMethod

import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; //导入方法依赖的package包/类
public void annotationCannotOverrideMethod(MethodBinding overrideMethod, MethodBinding inheritedMethod) {
	ASTNode location = overrideMethod.sourceMethod();
	this.handle(
		IProblem.AnnotationCannotOverrideMethod,
		new String[] {
				new String(overrideMethod.declaringClass.readableName()),
				new String(inheritedMethod.declaringClass.readableName()),
				new String(inheritedMethod.selector),
				typesAsString(inheritedMethod, false)},
		new String[] {
				new String(overrideMethod.declaringClass.shortReadableName()),
				new String(inheritedMethod.declaringClass.shortReadableName()),
				new String(inheritedMethod.selector),
				typesAsString(inheritedMethod, true)},
		location.sourceStart,
		location.sourceEnd);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:ProblemReporter.java

示例2: defaultMethodOverridesObjectMethod

import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; //导入方法依赖的package包/类
public void defaultMethodOverridesObjectMethod(MethodBinding currentMethod) {
	// Java 8 feature
	AbstractMethodDeclaration method = currentMethod.sourceMethod();
	int sourceStart = 0;
	int sourceEnd = 0;
	if (method != null) {
		sourceStart = method.sourceStart;
		sourceEnd = method.sourceEnd;
	}
	this.handle(
		IProblem.DefaultMethodOverridesObjectMethod,
		NoArgument, NoArgument,
		sourceStart, sourceEnd);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:15,代码来源:ProblemReporter.java

示例3: unsafeReturnTypeOverride

import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; //导入方法依赖的package包/类
public void unsafeReturnTypeOverride(MethodBinding currentMethod, MethodBinding inheritedMethod, SourceTypeBinding type) {
	if (this.options.sourceLevel < ClassFileConstants.JDK1_5) {
		return;
	}
	int severity = computeSeverity(IProblem.UnsafeReturnTypeOverride);
	if (severity == ProblemSeverities.Ignore) return;
	int start = type.sourceStart();
	int end = type.sourceEnd();
	if (TypeBinding.equalsEquals(currentMethod.declaringClass, type)) {
		ASTNode location = ((MethodDeclaration) currentMethod.sourceMethod()).returnType;
		start = location.sourceStart();
		end = location.sourceEnd();
	}
	this.handle(
			IProblem.UnsafeReturnTypeOverride,
			new String[] {
				new String(currentMethod.returnType.readableName()),
				new String(currentMethod.selector),
				typesAsString(currentMethod.original(), false),
				new String(currentMethod.declaringClass.readableName()),
				new String(inheritedMethod.returnType.readableName()),
				new String(inheritedMethod.declaringClass.readableName()),
				//new String(inheritedMethod.returnType.erasure().readableName()),
			 },
			new String[] {
				new String(currentMethod.returnType.shortReadableName()),
				new String(currentMethod.selector),
				typesAsString(currentMethod.original(), true),
				new String(currentMethod.declaringClass.shortReadableName()),
				new String(inheritedMethod.returnType.shortReadableName()),
				new String(inheritedMethod.declaringClass.shortReadableName()),
				//new String(inheritedMethod.returnType.erasure().shortReadableName()),
			 },
			severity,
			start,
			end);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:38,代码来源:ProblemReporter.java

示例4: unsafeReturnTypeOverride

import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; //导入方法依赖的package包/类
public void unsafeReturnTypeOverride(MethodBinding currentMethod, MethodBinding inheritedMethod, SourceTypeBinding type) {
	if (this.options.sourceLevel < ClassFileConstants.JDK1_5) {
		return;
	}
	int severity = computeSeverity(IProblem.UnsafeReturnTypeOverride);
	if (severity == ProblemSeverities.Ignore) return;
	int start = type.sourceStart();
	int end = type.sourceEnd();
	if (currentMethod.declaringClass == type) {
		ASTNode location = ((MethodDeclaration) currentMethod.sourceMethod()).returnType;
		start = location.sourceStart();
		end = location.sourceEnd();
	}
	this.handle(
			IProblem.UnsafeReturnTypeOverride,
			new String[] {
				new String(currentMethod.returnType.readableName()),
				new String(currentMethod.selector),
				typesAsString(currentMethod.original(), false),
				new String(currentMethod.declaringClass.readableName()),
				new String(inheritedMethod.returnType.readableName()),
				new String(inheritedMethod.declaringClass.readableName()),
				//new String(inheritedMethod.returnType.erasure().readableName()),
			 },
			new String[] {
				new String(currentMethod.returnType.shortReadableName()),
				new String(currentMethod.selector),
				typesAsString(currentMethod.original(), true),
				new String(currentMethod.declaringClass.shortReadableName()),
				new String(inheritedMethod.returnType.shortReadableName()),
				new String(inheritedMethod.declaringClass.shortReadableName()),
				//new String(inheritedMethod.returnType.erasure().shortReadableName()),
			 },
			severity,
			start,
			end);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:38,代码来源:ProblemReporter.java

示例5: generateMethodInfoAttributes

import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; //导入方法依赖的package包/类
/**
 * INTERNAL USE-ONLY
 * That method generates the attributes of a code attribute.
 * They could be:
 * - an exception attribute for each try/catch found inside the method
 * - a deprecated attribute
 * - a synthetic attribute for synthetic access methods
 *
 * It returns the number of attributes created for the code attribute.
 *
 * @param methodBinding org.eclipse.jdt.internal.compiler.lookup.MethodBinding
 * @return <CODE>int</CODE>
 */
public int generateMethodInfoAttributes(MethodBinding methodBinding) {
	// leave two bytes for the attribute_number
	this.contentsOffset += 2;
	if (this.contentsOffset + 2 >= this.contents.length) {
		resizeContents(2);
	}
	// now we can handle all the attribute for that method info:
	// it could be:
	// - a CodeAttribute
	// - a ExceptionAttribute
	// - a DeprecatedAttribute
	// - a SyntheticAttribute

	// Exception attribute
	ReferenceBinding[] thrownsExceptions;
	int attributesNumber = 0;
	if ((thrownsExceptions = methodBinding.thrownExceptions) != Binding.NO_EXCEPTIONS) {
		// The method has a throw clause. So we need to add an exception attribute
		// check that there is enough space to write all the bytes for the exception attribute
		attributesNumber += generateExceptionsAttribute(thrownsExceptions);
	}
	if (methodBinding.isDeprecated()) {
		// Deprecated attribute
		attributesNumber += generateDeprecatedAttribute();
	}
	if (this.targetJDK < ClassFileConstants.JDK1_5) {
		if (methodBinding.isSynthetic()) {
			attributesNumber += generateSyntheticAttribute();
		}
		if (methodBinding.isVarargs()) {
			attributesNumber += generateVarargsAttribute();
		}
	}
	// add signature attribute
	char[] genericSignature = methodBinding.genericSignature();
	if (genericSignature != null) {
		attributesNumber += generateSignatureAttribute(genericSignature);
	}
	if (this.targetJDK >= ClassFileConstants.JDK1_4) {
		AbstractMethodDeclaration methodDeclaration = methodBinding.sourceMethod();
		if (methodDeclaration != null) {
			Annotation[] annotations = methodDeclaration.annotations;
			if (annotations != null) {
				attributesNumber += generateRuntimeAnnotations(annotations);
			}
			if ((methodBinding.tagBits & TagBits.HasParameterAnnotations) != 0) {
				Argument[] arguments = methodDeclaration.arguments;
				if (arguments != null) {
					attributesNumber += generateRuntimeAnnotationsForParameters(arguments);
				}
			}
		}
	}
	if ((methodBinding.tagBits & TagBits.HasMissingType) != 0) {
		this.missingTypes = methodBinding.collectMissingTypes(this.missingTypes);
	}
	return attributesNumber;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:72,代码来源:ClassFile.java


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