本文整理汇总了Java中org.eclipse.jdt.internal.compiler.lookup.ProblemFieldBinding类的典型用法代码示例。如果您正苦于以下问题:Java ProblemFieldBinding类的具体用法?Java ProblemFieldBinding怎么用?Java ProblemFieldBinding使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ProblemFieldBinding类属于org.eclipse.jdt.internal.compiler.lookup包,在下文中一共展示了ProblemFieldBinding类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolveType
import org.eclipse.jdt.internal.compiler.lookup.ProblemFieldBinding; //导入依赖的package包/类
public TypeBinding resolveType(BlockScope scope) {
// it can be a package, type, member type, local variable or field
this.binding = scope.getBinding(this.tokens, this);
if (!this.binding.isValidBinding()) {
if (this.binding instanceof ProblemFieldBinding) {
// tolerate some error cases
if (this.binding.problemId() == ProblemReasons.NotVisible
|| this.binding.problemId() == ProblemReasons.InheritedNameHidesEnclosingName
|| this.binding.problemId() == ProblemReasons.NonStaticReferenceInConstructorInvocation
|| this.binding.problemId() == ProblemReasons.NonStaticReferenceInStaticContext) {
throw new SelectionNodeFound(this.binding);
}
scope.problemReporter().invalidField(this, (FieldBinding) this.binding);
} else if (this.binding instanceof ProblemReferenceBinding || this.binding instanceof MissingTypeBinding) {
// tolerate some error cases
if (this.binding.problemId() == ProblemReasons.NotVisible){
throw new SelectionNodeFound(this.binding);
}
scope.problemReporter().invalidType(this, (TypeBinding) this.binding);
} else {
scope.problemReporter().unresolvableReference(this, this.binding);
}
throw new SelectionNodeFound();
}
throw new SelectionNodeFound(this.binding);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:27,代码来源:SelectionOnQualifiedNameReference.java
示例2: resolve
import org.eclipse.jdt.internal.compiler.lookup.ProblemFieldBinding; //导入依赖的package包/类
private ResolvedNode resolve(@Nullable Binding binding) {
if (binding == null || binding instanceof ProblemBinding) {
return null;
}
if (binding instanceof TypeBinding) {
TypeBinding tb = (TypeBinding) binding;
return new EcjResolvedClass(tb);
} else if (binding instanceof MethodBinding) {
MethodBinding mb = (MethodBinding) binding;
if (mb instanceof ProblemMethodBinding) {
return null;
}
//noinspection VariableNotUsedInsideIf
if (mb.declaringClass != null) {
return new EcjResolvedMethod(mb);
}
} else if (binding instanceof LocalVariableBinding) {
LocalVariableBinding lvb = (LocalVariableBinding) binding;
//noinspection VariableNotUsedInsideIf
if (lvb.type != null) {
return new EcjResolvedVariable(lvb);
}
} else if (binding instanceof FieldBinding) {
FieldBinding fb = (FieldBinding) binding;
if (fb instanceof ProblemFieldBinding) {
return null;
}
if (fb.type != null && fb.declaringClass != null) {
return new EcjResolvedField(fb);
}
}
return null;
}
示例3: resolveType
import org.eclipse.jdt.internal.compiler.lookup.ProblemFieldBinding; //导入依赖的package包/类
public TypeBinding resolveType(BlockScope scope) {
if (this.actualReceiverType != null) {
this.binding = scope.getField(this.actualReceiverType, this.token, this);
if (this.binding != null && this.binding.isValidBinding()) {
throw new SelectionNodeFound(this.binding);
}
}
// it can be a package, type, member type, local variable or field
this.binding = scope.getBinding(this.token, Binding.VARIABLE | Binding.TYPE | Binding.PACKAGE, this, true /*resolve*/);
if (!this.binding.isValidBinding()) {
if (this.binding instanceof ProblemFieldBinding) {
// tolerate some error cases
if (this.binding.problemId() == ProblemReasons.NotVisible
|| this.binding.problemId() == ProblemReasons.InheritedNameHidesEnclosingName
|| this.binding.problemId() == ProblemReasons.NonStaticReferenceInConstructorInvocation
|| this.binding.problemId() == ProblemReasons.NonStaticReferenceInStaticContext){
throw new SelectionNodeFound(this.binding);
}
scope.problemReporter().invalidField(this, (FieldBinding) this.binding);
} else if (this.binding instanceof ProblemReferenceBinding || this.binding instanceof MissingTypeBinding) {
// tolerate some error cases
if (this.binding.problemId() == ProblemReasons.NotVisible){
throw new SelectionNodeFound(this.binding);
}
scope.problemReporter().invalidType(this, (TypeBinding) this.binding);
} else {
scope.problemReporter().unresolvableReference(this, this.binding);
}
throw new SelectionNodeFound();
}
throw new SelectionNodeFound(this.binding);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:34,代码来源:SelectionOnSingleNameReference.java
示例4: getFieldForCodeSnippet
import org.eclipse.jdt.internal.compiler.lookup.ProblemFieldBinding; //导入依赖的package包/类
public FieldBinding getFieldForCodeSnippet(TypeBinding receiverType, char[] fieldName, InvocationSite invocationSite) {
FieldBinding field = findFieldForCodeSnippet(receiverType, fieldName, invocationSite);
if (field == null)
return new ProblemFieldBinding(receiverType instanceof ReferenceBinding ? (ReferenceBinding) receiverType : null, fieldName, ProblemReasons.NotFound);
else
return field;
}
示例5: reportError
import org.eclipse.jdt.internal.compiler.lookup.ProblemFieldBinding; //导入依赖的package包/类
public TypeBinding reportError(BlockScope scope) {
//=====error cases=======
this.constant = Constant.NotAConstant;
if (this.binding instanceof ProblemFieldBinding) {
scope.problemReporter().invalidField(this, (FieldBinding) this.binding);
} else if (this.binding instanceof ProblemReferenceBinding || this.binding instanceof MissingTypeBinding) {
scope.problemReporter().invalidType(this, (TypeBinding) this.binding);
} else {
scope.problemReporter().unresolvableReference(this, this.binding);
}
return null;
}
示例6: reportError
import org.eclipse.jdt.internal.compiler.lookup.ProblemFieldBinding; //导入依赖的package包/类
/**
* Normal field binding did not work, try to bind to a field of the delegate receiver.
*/
public TypeBinding reportError(BlockScope scope) {
if (this.binding instanceof ProblemFieldBinding) {
scope.problemReporter().invalidField(this, (FieldBinding) this.binding);
} else if (this.binding instanceof ProblemReferenceBinding || this.binding instanceof MissingTypeBinding) {
scope.problemReporter().invalidType(this, (TypeBinding) this.binding);
} else {
scope.problemReporter().unresolvableReference(this, this.binding);
}
return null;
}
示例7: resolveType
import org.eclipse.jdt.internal.compiler.lookup.ProblemFieldBinding; //导入依赖的package包/类
public TypeBinding resolveType(BlockScope scope) {
// Answer the signature type of the field.
// constants are propaged when the field is final
// and initialized with a (compile time) constant
// regular receiver reference
this.actualReceiverType = this.receiver.resolveType(scope);
if (this.actualReceiverType == null){
this.constant = Constant.NotAConstant;
return null;
}
// the case receiverType.isArrayType and token = 'length' is handled by the scope API
this.binding = scope.getField(this.actualReceiverType, this.token, this);
FieldBinding firstAttempt = this.binding;
boolean isNotVisible = false;
if (!this.binding.isValidBinding()) {
if (this.binding instanceof ProblemFieldBinding
&& ((ProblemFieldBinding) this.binding).problemId() == NotVisible) {
isNotVisible = true;
if (this.evaluationContext.declaringTypeName != null) {
this.delegateThis = scope.getField(scope.enclosingSourceType(), DELEGATE_THIS, this);
if (this.delegateThis == null){ // if not found then internal error, field should have been found
this.constant = Constant.NotAConstant;
scope.problemReporter().invalidField(this, this.actualReceiverType);
return null;
}
this.actualReceiverType = this.delegateThis.type;
} else {
this.constant = Constant.NotAConstant;
scope.problemReporter().invalidField(this, this.actualReceiverType);
return null;
}
CodeSnippetScope localScope = new CodeSnippetScope(scope);
this.binding = localScope.getFieldForCodeSnippet(this.delegateThis.type, this.token, this);
}
}
if (!this.binding.isValidBinding()) {
this.constant = Constant.NotAConstant;
if (isNotVisible) {
this.binding = firstAttempt;
}
scope.problemReporter().invalidField(this, this.actualReceiverType);
return null;
}
if (isFieldUseDeprecated(this.binding, scope, this.bits)) {
scope.problemReporter().deprecatedField(this.binding, this);
}
// check for this.x in static is done in the resolution of the receiver
this.constant = this.receiver.isImplicitThis() ? this.binding.constant() : Constant.NotAConstant;
if (!this.receiver.isThis()) { // TODO need to check if shouldn't be isImplicitThis check (and then removed)
this.constant = Constant.NotAConstant;
}
return this.resolvedType = this.binding.type;
}
示例8: reportError
import org.eclipse.jdt.internal.compiler.lookup.ProblemFieldBinding; //导入依赖的package包/类
/**
* Normal field binding did not work, try to bind to a field of the delegate receiver.
*/
public TypeBinding reportError(BlockScope scope) {
this.constant = Constant.NotAConstant;
if (this.binding instanceof ProblemFieldBinding && ((ProblemFieldBinding) this.binding).problemId() == NotFound){
if (this.evaluationContext.declaringTypeName != null) {
this.delegateThis = scope.getField(scope.enclosingSourceType(), DELEGATE_THIS, this);
if (this.delegateThis != null){ // if not found then internal error, field should have been found
this.actualReceiverType = this.delegateThis.type;
// will not support innerclass emulation inside delegate
this.binding = scope.getField(this.delegateThis.type, this.token, this);
if (!this.binding.isValidBinding()) {
return super.reportError(scope);
}
return checkFieldAccess(scope);
}
}
}
if (this.binding instanceof ProblemBinding && ((ProblemBinding) this.binding).problemId() == NotFound){
if (this.evaluationContext.declaringTypeName != null) {
this.delegateThis = scope.getField(scope.enclosingSourceType(), DELEGATE_THIS, this);
if (this.delegateThis != null){ // if not found then internal error, field should have been found
this.actualReceiverType = this.delegateThis.type;
// will not support innerclass emulation inside delegate
FieldBinding fieldBinding = scope.getField(this.delegateThis.type, this.token, this);
if (!fieldBinding.isValidBinding()) {
if (((ProblemFieldBinding) fieldBinding).problemId() == NotVisible) {
// manage the access to a private field of the enclosing type
CodeSnippetScope localScope = new CodeSnippetScope(scope);
this.binding = localScope.getFieldForCodeSnippet(this.delegateThis.type, this.token, this);
return checkFieldAccess(scope);
} else {
return super.reportError(scope);
}
}
this.binding = fieldBinding;
return checkFieldAccess(scope);
}
}
}
return super.reportError(scope);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:45,代码来源:CodeSnippetSingleNameReference.java
示例9: getVariableBinding
import org.eclipse.jdt.internal.compiler.lookup.ProblemFieldBinding; //导入依赖的package包/类
synchronized IVariableBinding getVariableBinding(org.eclipse.jdt.internal.compiler.lookup.VariableBinding variableBinding, VariableDeclaration variableDeclaration) {
if (this.isRecoveringBindings) {
if (variableBinding != null) {
if (variableBinding.isValidBinding()) {
IVariableBinding binding = (IVariableBinding) this.bindingTables.compilerBindingsToASTBindings.get(variableBinding);
if (binding != null) {
return binding;
}
if (variableBinding.type != null) {
binding = new VariableBinding(this, variableBinding);
} else {
binding = new RecoveredVariableBinding(this, variableDeclaration);
}
this.bindingTables.compilerBindingsToASTBindings.put(variableBinding, binding);
return binding;
} else {
/*
* http://dev.eclipse.org/bugs/show_bug.cgi?id=24449
*/
if (variableBinding instanceof ProblemFieldBinding) {
ProblemFieldBinding problemFieldBinding = (ProblemFieldBinding) variableBinding;
switch(problemFieldBinding.problemId()) {
case ProblemReasons.NotVisible :
case ProblemReasons.NonStaticReferenceInStaticContext :
case ProblemReasons.NonStaticReferenceInConstructorInvocation :
ReferenceBinding declaringClass = problemFieldBinding.declaringClass;
FieldBinding exactBinding = declaringClass.getField(problemFieldBinding.name, true /*resolve*/);
if (exactBinding != null) {
IVariableBinding variableBinding2 = (IVariableBinding) this.bindingTables.compilerBindingsToASTBindings.get(exactBinding);
if (variableBinding2 != null) {
return variableBinding2;
}
variableBinding2 = new VariableBinding(this, exactBinding);
this.bindingTables.compilerBindingsToASTBindings.put(exactBinding, variableBinding2);
return variableBinding2;
}
break;
}
}
}
}
return null;
}
return this.getVariableBinding(variableBinding);
}