Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 174374 Details for
Bug 277574
JDI thread evaluations (Error: Exception processing async thread queue)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch backported to 3.4 stream
patch-debug34.txt (text/plain), 33.62 KB, created by
Krzysztof Daniel
on 2010-07-15 04:57:36 EDT
(
hide
)
Description:
Patch backported to 3.4 stream
Filename:
MIME Type:
Creator:
Krzysztof Daniel
Created:
2010-07-15 04:57:36 EDT
Size:
33.62 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.debug >Index: eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationEngineMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationEngineMessages.java,v >retrieving revision 1.13 >diff -u -r1.13 EvaluationEngineMessages.java >--- eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationEngineMessages.java 29 May 2008 15:47:44 -0000 1.13 >+++ eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationEngineMessages.java 15 Jul 2010 08:47:44 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2007 IBM Corporation and others. >+ * Copyright (c) 2000, 2010 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -28,7 +28,6 @@ > > public static String ASTInstructionCompiler_unrecognized_postfix_operator____15; > public static String ASTInstructionCompiler_unrecognized_prefix_operator____16; >- public static String ASTInstructionCompiler_binding_null_for__17; > > public static String ASTInstructionCompiler_super_constructor_invocation_cannot_be_used_in_an_evaluation_expression_19; > public static String ASTInstructionCompiler_Try_statement_cannot_be_used_in_an_evaluation_expression_23; >@@ -48,8 +47,12 @@ > public static String ASTEvaluationEngine_AST_evaluation_engine_cannot_evaluate_expression; > public static String ASTEvaluationEngine_An_unknown_error_occurred_during_evaluation; > public static String ASTEvaluationEngine_Cannot_perform_nested_evaluations; >+ public static String ASTInstructionCompiler_3; > public static String ASTInstructionCompiler_36; > public static String ASTInstructionCompiler_0; >+ public static String ASTInstructionCompiler_1; >+ public static String ASTInstructionCompiler_2; >+ public static String ASTInstructionCompiler_5; > > static { > // load message values from bundle file >Index: eval/org/eclipse/jdt/internal/debug/eval/ast/engine/ASTInstructionCompiler.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/ASTInstructionCompiler.java,v >retrieving revision 1.78 >diff -u -r1.78 ASTInstructionCompiler.java >--- eval/org/eclipse/jdt/internal/debug/eval/ast/engine/ASTInstructionCompiler.java 4 Jun 2008 17:28:14 -0000 1.78 >+++ eval/org/eclipse/jdt/internal/debug/eval/ast/engine/ASTInstructionCompiler.java 15 Jul 2010 08:47:44 -0000 >@@ -187,7 +187,7 @@ > import org.eclipse.jdt.internal.debug.eval.ast.instructions.Value; > import org.eclipse.jdt.internal.debug.eval.ast.instructions.XorAssignmentOperator; > import org.eclipse.jdt.internal.debug.eval.ast.instructions.XorOperator; >- >+import com.ibm.icu.text.MessageFormat; > /** > * The AST instruction compiler generates a sequence > * of instructions (InstructionSequence) from a >@@ -441,12 +441,12 @@ > > if (expression instanceof MethodInvocation) { > IMethodBinding methodBinding= (IMethodBinding)((MethodInvocation)expression).getName().resolveBinding(); >- if ("void".equals(methodBinding.getReturnType().getName())) { //$NON-NLS-1$ >+ if (methodBinding != null && "void".equals(methodBinding.getReturnType().getName())) { //$NON-NLS-1$ > pop= false; > } > } else if (expression instanceof SuperMethodInvocation) { > IMethodBinding methodBinding= (IMethodBinding)((SuperMethodInvocation)expression).getName().resolveBinding(); >- if ("void".equals(methodBinding.getReturnType().getName())) { //$NON-NLS-1$ >+ if (methodBinding != null && "void".equals(methodBinding.getReturnType().getName())) { //$NON-NLS-1$ > pop= false; > } > } else if (expression instanceof VariableDeclarationExpression) { >@@ -590,7 +590,10 @@ > public void endVisit(ArrayAccess node) { > if (!isActive() || hasErrors()) > return; >- storeInstruction(); >+ ITypeBinding typeBinding = node.getIndex().resolveTypeBinding(); >+ if (typeBinding != null) { >+ storeInstruction(); >+ } > } > > /** >@@ -1515,10 +1518,11 @@ > > ArrayType arrayType= node.getType(); > >- if (isALocalType(arrayType.resolveBinding().getElementType())) { >+ ITypeBinding binding = resolveTypeBinding(arrayType); >+ if (binding != null && isALocalType(arrayType.resolveBinding().getElementType())) { > addErrorMessage(EvaluationEngineMessages.ASTInstructionCompiler_Local_type_array_instance_creation_cannot_be_used_in_an_evaluation_expression_29); > setHasError(true); >- return true; >+ return false; > } > > push(new ArrayAllocation(arrayType.getDimensions(), node.dimensions().size(), node.getInitializer() != null, fCounter)); >@@ -1534,12 +1538,14 @@ > return false; > } > >- ITypeBinding typeBinding= node.resolveTypeBinding(); >- int dimension= typeBinding.getDimensions(); >- String signature= getTypeSignature(typeBinding.getElementType()); >- >- push(new ArrayInitializerInstruction(signature, node.expressions().size(), dimension, fCounter)); >+ ITypeBinding typeBinding= resolveTypeBinding(node); >+ if (typeBinding != null) { >+ int dimension = typeBinding.getDimensions(); >+ String signature = getTypeSignature(typeBinding.getElementType()); > >+ push(new ArrayInitializerInstruction(signature, node.expressions() >+ .size(), dimension, fCounter)); >+ } > return true; > } > >@@ -1550,12 +1556,14 @@ > if (!isActive()) { > return false; > } >- ITypeBinding arrayTypeBinding= node.resolveBinding(); >- int dimension= arrayTypeBinding.getDimensions(); >- String signature= getTypeSignature(arrayTypeBinding.getElementType()); >- >- push(new PushArrayType(signature, dimension, fCounter)); >+ ITypeBinding arrayTypeBinding= resolveTypeBinding(node); >+ if (arrayTypeBinding != null) { >+ int dimension = arrayTypeBinding.getDimensions(); >+ String signature = getTypeSignature(arrayTypeBinding >+ .getElementType()); > >+ push(new PushArrayType(signature, dimension, fCounter)); >+ } > return false; > } > >@@ -1568,7 +1576,7 @@ > } > setHasError(true); > addErrorMessage(EvaluationEngineMessages.ASTInstructionCompiler_Assert_statement_cannot_be_used_in_an_evaluation_expression_3); >- return true; >+ return false; > } > > /** >@@ -1591,6 +1599,14 @@ > char2 = opToken.charAt(2); > } > >+ ITypeBinding rightBinding = resolveTypeBinding(rightHandSide); >+ if (rightBinding == null) { >+ return false; >+ } >+ ITypeBinding leftBinding = resolveTypeBinding(leftHandSide); >+ if (leftBinding == null) { >+ return false; >+ } > if (variableTypeId == Instruction.T_Object) { > // If the variable is an object, the value may need to be boxed for > // the simple assignment. >@@ -1609,8 +1625,8 @@ > if (char0 == '=') { > > boolean storeRequired= false; >- if (rightHandSide.resolveTypeBinding().isPrimitive()) { >- boxing(leftHandSide.resolveTypeBinding(), rightHandSide.resolveTypeBinding()); >+ if (rightBinding.isPrimitive()) { >+ boxing(leftBinding, rightBinding); > storeRequired= true; > } > rightHandSide.accept(this); >@@ -1622,7 +1638,7 @@ > boolean unrecognized = false; > > >- boxing(leftHandSide.resolveTypeBinding(), rightHandSide.resolveTypeBinding()); >+ boxing(leftBinding, rightBinding); > > switch (char0) { > case '=': // equal >@@ -1678,12 +1694,12 @@ > return false; > } > >- unBoxing(leftHandSide.resolveTypeBinding()); >+ unBoxing(leftBinding); > push(new Dup()); > storeInstruction(); // dupe > storeInstruction(); // un-boxing > >- boolean storeRequired= unBoxing(rightHandSide.resolveTypeBinding()); >+ boolean storeRequired= unBoxing(rightBinding); > rightHandSide.accept(this); > if (storeRequired) { > storeInstruction(); // un-boxing >@@ -1753,7 +1769,7 @@ > } > > leftHandSide.accept(this); >- boolean storeRequired= unBoxing(rightHandSide.resolveTypeBinding()); >+ boolean storeRequired= unBoxing(rightBinding); > rightHandSide.accept(this); > if (storeRequired) { > storeInstruction(); >@@ -1833,20 +1849,21 @@ > > Type type= node.getType(); > int typeId= getTypeId(type); >- ITypeBinding typeBinding= type.resolveBinding(); >- >- String baseTypeSignature; >- int dimension= typeBinding.getDimensions(); >- >- if (typeBinding.isArray()) { >- typeBinding= typeBinding.getElementType(); >- } > >- baseTypeSignature= getTypeName(typeBinding); >+ ITypeBinding typeBinding= resolveTypeBinding(type); > >- push(new Cast(typeId, baseTypeSignature, dimension, fCounter)); >+ if (typeBinding != null) { > >- node.getExpression().accept(this); >+ String baseTypeSignature; >+ int dimension = typeBinding.getDimensions(); >+ >+ if (typeBinding.isArray()) { >+ typeBinding = typeBinding.getElementType(); >+ } >+ baseTypeSignature = getTypeName(typeBinding); >+ push(new Cast(typeId, baseTypeSignature, dimension, fCounter)); >+ node.getExpression().accept(this); >+ } > > return false; > } >@@ -1860,7 +1877,7 @@ > } > setHasError(true); > addErrorMessage(EvaluationEngineMessages.ASTInstructionCompiler_Catch_clause_cannot_be_used_in_an_evaluation_expression_6); >- return true; >+ return false; > } > > /** >@@ -1891,8 +1908,14 @@ > } > > IMethodBinding methodBinding= node.resolveConstructorBinding(); >+ if (methodBinding == null) { >+ setHasError(true); >+ addErrorMessage(MessageFormat.format( >+ EvaluationEngineMessages.ASTInstructionCompiler_1, >+ new String[] { node.toString() })); >+ return false; >+ } > ITypeBinding typeBinding= methodBinding.getDeclaringClass(); >- ITypeBinding enclosingTypeBinding= typeBinding.getDeclaringClass(); > > boolean isInstanceMemberType= typeBinding.isMember() && ! Modifier.isStatic(typeBinding.getModifiers()); > >@@ -1908,13 +1931,21 @@ > > > if (hasErrors()) { >- return true; >+ return false; > } > > int argCount= methodBinding.getParameterTypes().length; >- >+ ITypeBinding enclosingTypeBinding= null; > String enclosingTypeSignature= null; > if (isInstanceMemberType) { >+ enclosingTypeBinding = typeBinding.getDeclaringClass(); >+ if (enclosingTypeBinding == null) { >+ setHasError(true); >+ addErrorMessage(MessageFormat.format( >+ EvaluationEngineMessages.ASTInstructionCompiler_2, >+ new String[] { typeBinding.getQualifiedName() })); >+ return false; >+ } > enclosingTypeSignature= getTypeSignature(enclosingTypeBinding); > argCount++; > } >@@ -1939,7 +1970,7 @@ > if (Modifier.isStatic(((MethodDeclaration)parent).getModifiers())) { > setHasError(true); > addErrorMessage(EvaluationEngineMessages.ASTInstructionCompiler_Must_explicitly_qualify_the_allocation_with_an_instance_of_the_enclosing_type_33); >- return true; >+ return false; > } > > push(new PushThis(getEnclosingLevel(node, enclosingTypeBinding))); >@@ -2043,9 +2074,15 @@ > push(new NoOp(fCounter)); > > >- ITypeBinding typeBinding= node.getExpression().resolveTypeBinding(); >- Type paramType= node.getParameter().getType(); >- ITypeBinding paramBinding = paramType.resolveBinding(); >+ ITypeBinding typeBinding = resolveTypeBinding(node.getExpression()); >+ if (typeBinding == null) { >+ return false; >+ } >+ Type paramType = node.getParameter().getType(); >+ ITypeBinding paramBinding = resolveTypeBinding(paramType); >+ if (paramBinding == null) { >+ return false; >+ } > String typeSignature= getTypeSignature(paramBinding); > int paramTypeId= getTypeId(paramType); > boolean isParamPrimitiveType= paramTypeId != Instruction.T_Object && paramTypeId != Instruction.T_String; >@@ -2309,8 +2346,16 @@ > Expression rightOperand= node.getRightOperand(); > int leftTypeId; > int rightTypeId; >+ ITypeBinding leftBinding = resolveTypeBinding(leftOperand); >+ if (leftBinding == null) { >+ return false; >+ } >+ ITypeBinding rightBinding = resolveTypeBinding(rightOperand); >+ if (rightBinding == null) { >+ return false; >+ } > // == case, do not un-box, if the two operands are objects >- boolean unbox= char0 != '=' || leftOperand.resolveTypeBinding().isPrimitive() || rightOperand.resolveTypeBinding().isPrimitive(); >+ boolean unbox= char0 != '=' || leftBinding.isPrimitive() || rightBinding.isPrimitive(); > if (unbox) { > leftTypeId= getUnBoxedTypeId(leftOperand); > rightTypeId = getUnBoxedTypeId(rightOperand); >@@ -2475,7 +2520,7 @@ > } > > if (hasErrors()) { >- return true; >+ return false; > } > > iterator = extendedOperands.iterator(); >@@ -2487,7 +2532,7 @@ > ConditionalJump[] conditionalJumps= new ConditionalJump[operatorNumber]; > int[] conditionalJumpAddresses = new int[operatorNumber]; > >- boolean storeRequired= unBoxing(leftOperand.resolveTypeBinding()); >+ boolean storeRequired= unBoxing(leftBinding); > leftOperand.accept(this); > if (storeRequired) { > storeInstruction(); >@@ -2499,7 +2544,7 @@ > push(conditionalJump); > storeInstruction(); > >- storeRequired= unBoxing(rightOperand.resolveTypeBinding()); >+ storeRequired= unBoxing(rightBinding); > rightOperand.accept(this); > if (storeRequired) { > storeInstruction(); >@@ -2512,7 +2557,11 @@ > push(conditionalJump); > storeInstruction(); > Expression operand= (Expression) iterator.next(); >- storeRequired= unBoxing(operand.resolveTypeBinding()); >+ ITypeBinding typeBinding = resolveTypeBinding(operand); >+ if (typeBinding == null) { >+ return false; >+ } >+ storeRequired = unBoxing(typeBinding); > operand.accept(this); > if (storeRequired) { > storeInstruction(); >@@ -2538,14 +2587,14 @@ > > boolean storeRequired= false; > if (unbox) { >- storeRequired= unBoxing(leftOperand.resolveTypeBinding()); >+ storeRequired= unBoxing(leftBinding); > } > leftOperand.accept(this); > if (storeRequired) { > storeInstruction(); > } > if (unbox) { >- storeRequired= unBoxing(rightOperand.resolveTypeBinding()); >+ storeRequired= unBoxing(rightBinding); > } > rightOperand.accept(this); > if (storeRequired) { >@@ -2556,7 +2605,11 @@ > for (int i= 1; i < operatorNumber; i ++) { > Expression operand= (Expression) iterator.next(); > if (unbox) { >- storeRequired= unBoxing(operand.resolveTypeBinding()); >+ ITypeBinding typeBinding = resolveTypeBinding(operand); >+ if (typeBinding == null) { >+ return false; >+ } >+ storeRequired= unBoxing(typeBinding); > } > operand.accept(this); > if (storeRequired) { >@@ -2672,16 +2725,13 @@ > } > > if (hasErrors()) { >- return true; >+ return false; > } > > if (containsALocalType(methodBinding)) { > setHasError(true); >- addErrorMessage(EvaluationEngineMessages.ASTInstructionCompiler_Method_which_contains_a_local_type_as_parameter_cannot_be_used_in_an_evaluation_expression_32); >- } >- >- if (hasErrors()) { >- return true; >+ addErrorMessage(EvaluationEngineMessages.ASTInstructionCompiler_Method_which_contains_a_local_type_as_parameter_cannot_be_used_in_an_evaluation_expression_32); >+ return false; > } > > ITypeBinding[] parameterTypes = methodBinding.getParameterTypes(); >@@ -2712,10 +2762,21 @@ > > List arguments = node.arguments(); > int argCount = arguments.size(); >- if (methodBinding.isVarargs() && !(paramCount == argCount && parameterTypes[paramCount - 1].getDimensions() == ((Expression)arguments.get(argCount - 1)).resolveTypeBinding().getDimensions())) { >- // if this method is a varargs, and if the method is invoked using the varargs syntax >+ ITypeBinding lastArgBinding = null; >+ if (methodBinding.isVarargs()) { >+ Expression lastArg = (Expression) arguments.get(argCount - 1); >+ lastArgBinding = resolveTypeBinding(lastArg); >+ if (lastArgBinding == null) { >+ return false; >+ } >+ } >+ if (methodBinding.isVarargs() >+ && !(paramCount == argCount && parameterTypes[paramCount - 1] >+ .getDimensions() == lastArgBinding.getDimensions())) { >+ // if this method is a varargs, and if the method is invoked using >+ // the varargs syntax > // (multiple arguments) and not an array >- Iterator iterator= arguments.iterator(); >+ Iterator iterator = arguments.iterator(); > // process the first arguments (no part of the variable argument) > for (int i= 0; i < paramCount - 1; i++) { > Expression argument= (Expression)iterator.next(); >@@ -2908,8 +2969,10 @@ > if (!isActive()) { > return false; > } >- ITypeBinding typeBinding = node.resolveBinding(); >- push(new PushType(getTypeName(typeBinding))); >+ ITypeBinding typeBinding = resolveTypeBinding(node); >+ if (typeBinding != null) { >+ push(new PushType(getTypeName(typeBinding))); >+ } > return false; > } > >@@ -2954,7 +3017,7 @@ > default: > setHasError(true); > addErrorMessage(EvaluationEngineMessages.ASTInstructionCompiler_unrecognized_postfix_operator____15 + opToken); >- break; >+ return false; > } > push(new Value(fCounter)); > push(new Dup()); >@@ -2962,12 +3025,16 @@ > storeInstruction(); // value > push(new DupX1()); > storeInstruction(); // dup_x1 >- unBoxing(operand.resolveTypeBinding()); >+ ITypeBinding typeBinding = resolveTypeBinding(operand); >+ if (typeBinding == null) { >+ return false; >+ } >+ unBoxing(typeBinding); > storeInstruction(); // un-boxing > push(new PushInt(1)); > storeInstruction(); // push 1 > storeInstruction(); // operator >- boxing(operand.resolveTypeBinding(), null); >+ boxing(typeBinding, null); > storeInstruction(); // boxing > storeInstruction(); // assignment > push(new Pop(assignmentInstruction.getSize() + 1)); >@@ -2986,7 +3053,7 @@ > default: > setHasError(true); > addErrorMessage(EvaluationEngineMessages.ASTInstructionCompiler_unrecognized_postfix_operator____15 + opToken); >- break; >+ return false; > } > > return true; >@@ -3017,6 +3084,11 @@ > > int expressionUnBoxedTypeId= getUnBoxedTypeId(operand); > >+ ITypeBinding typeBinding = resolveTypeBinding(operand); >+ if (typeBinding == null) { >+ return false; >+ } >+ > if (char1 == '\0') { > switch (char0) { > case '+': // unary plus >@@ -3034,10 +3106,10 @@ > default: > setHasError(true); > addErrorMessage(EvaluationEngineMessages.ASTInstructionCompiler_unrecognized_prefix_operator____16 + opToken); >- break; >+ return false; > } > >- unBoxing(operand.resolveTypeBinding()); >+ unBoxing(typeBinding); > operand.accept(this); > storeInstruction(); // un-boxing > >@@ -3048,7 +3120,7 @@ > > operand.accept(this); > >- boxing(operand.resolveTypeBinding(), null); >+ boxing(typeBinding, null); > > switch (char1) { > case '+': >@@ -3060,10 +3132,10 @@ > default: > setHasError(true); > addErrorMessage(EvaluationEngineMessages.ASTInstructionCompiler_unrecognized_prefix_operator____16 + opToken); >- break; >+ unBoxing(typeBinding); > } > >- unBoxing(operand.resolveTypeBinding()); >+ unBoxing(typeBinding); > push(new Dup()); > storeInstruction(); // dupe > storeInstruction(); // un-boxing >@@ -3119,7 +3191,8 @@ > > if (unrecognized) { > setHasError(true); >- addErrorMessage(EvaluationEngineMessages.ASTInstructionCompiler_unrecognized_prefix_operator____16 + opToken); >+ addErrorMessage(EvaluationEngineMessages.ASTInstructionCompiler_unrecognized_prefix_operator____16 + opToken); >+ return false; > } > > return true; >@@ -3132,8 +3205,10 @@ > if (!isActive()) { > return false; > } >- ITypeBinding typeBinding = node.resolveBinding(); >- push(new PushPrimitiveType(getTypeName(typeBinding))); >+ ITypeBinding typeBinding = resolveTypeBinding(node); >+ if (typeBinding != null) { >+ push(new PushPrimitiveType(getTypeName(typeBinding))); >+ } > return false; > } > >@@ -3149,14 +3224,20 @@ > return true; > } > >- IBinding binding = node.resolveBinding(); >+ IBinding binding = resolveBinding(node); >+ if (binding == null) { >+ return false; >+ } > switch (binding.getKind()) { > case IBinding.TYPE: > node.getName().accept(this); > break; > case IBinding.VARIABLE: > SimpleName fieldName= node.getName(); >- IVariableBinding fieldBinding= (IVariableBinding) fieldName.resolveBinding(); >+ IVariableBinding fieldBinding = (IVariableBinding) resolveBinding(fieldName); >+ if (fieldBinding == null) { >+ return false; >+ } > ITypeBinding declaringTypeBinding= fieldBinding.getDeclaringClass(); > String fieldId = fieldName.getIdentifier(); > >@@ -3184,8 +3265,10 @@ > if (!isActive()) { > return false; > } >- ITypeBinding typeBinding = node.resolveBinding(); >- push(new PushType(getTypeName(typeBinding))); >+ ITypeBinding typeBinding = resolveTypeBinding(node); >+ if (typeBinding != null) { >+ push(new PushType(getTypeName(typeBinding))); >+ } > return false; > } > >@@ -3212,14 +3295,13 @@ > return true; > } > >- IBinding binding = node.resolveBinding(); >+ IBinding binding = resolveBinding(node); > >- String variableId = node.getIdentifier(); > if (binding == null) { >- setHasError(true); >- addErrorMessage(EvaluationEngineMessages.ASTInstructionCompiler_binding_null_for__17 + variableId); > return true; > } >+ >+ String variableId = node.getIdentifier(); > > switch (binding.getKind()) { > case IBinding.TYPE: >@@ -3260,9 +3342,10 @@ > return false; > } > >- ITypeBinding typeBinding = node.resolveBinding(); >- push(new PushType(getTypeName(typeBinding))); >- >+ ITypeBinding typeBinding = resolveTypeBinding(node); >+ if (typeBinding != null) { >+ push(new PushType(getTypeName(typeBinding))); >+ } > return false; > } > >@@ -3281,15 +3364,19 @@ > if (!isActive()) { > return false; > } >- ITypeBinding typeBinding= node.getType().resolveBinding(); >- int typeDimension= typeBinding.getDimensions(); >- if (typeDimension != 0) { >- typeBinding= typeBinding.getElementType(); >- } >- Expression initializer= node.getInitializer(); >- push(new LocalVariableCreation(node.getName().getIdentifier(), getTypeSignature(typeBinding), typeDimension, typeBinding.isPrimitive(), initializer != null, fCounter)); >- if (initializer != null) { >- initializer.accept(this); >+ ITypeBinding typeBinding = resolveTypeBinding(node.getType()); >+ if (typeBinding != null) { >+ int typeDimension = typeBinding.getDimensions(); >+ if (typeDimension != 0) { >+ typeBinding = typeBinding.getElementType(); >+ } >+ Expression initializer = node.getInitializer(); >+ push(new LocalVariableCreation(node.getName().getIdentifier(), >+ getTypeSignature(typeBinding), typeDimension, typeBinding >+ .isPrimitive(), initializer != null, fCounter)); >+ if (initializer != null) { >+ initializer.accept(this); >+ } > } > return false; > } >@@ -3328,7 +3415,10 @@ > } > > SimpleName fieldName= node.getName(); >- IVariableBinding fieldBinding= (IVariableBinding) fieldName.resolveBinding(); >+ IVariableBinding fieldBinding = (IVariableBinding) resolveBinding(fieldName); >+ if (fieldBinding == null) { >+ return false; >+ } > ITypeBinding declaringTypeBinding= fieldBinding.getDeclaringClass(); > String fieldId = fieldName.getIdentifier(); > >@@ -3339,8 +3429,16 @@ > int superLevel= 1; > int enclosingLevel= 0; > if (qualifier != null) { >- superLevel= getSuperLevel(qualifier.resolveTypeBinding(), declaringTypeBinding); >- enclosingLevel= getEnclosingLevel(node, (ITypeBinding)qualifier.resolveBinding()); >+ ITypeBinding typeBinding = resolveTypeBinding(qualifier); >+ if (typeBinding == null) { >+ return false; >+ } >+ superLevel = getSuperLevel(typeBinding, declaringTypeBinding); >+ ITypeBinding binding = (ITypeBinding) resolveBinding(qualifier); >+ if (binding == null) { >+ return false; >+ } >+ enclosingLevel = getEnclosingLevel(node, binding); > } > push(new PushFieldVariable(fieldId, superLevel, fCounter)); > push(new PushThis(enclosingLevel)); >@@ -3360,15 +3458,16 @@ > return false; > } > >- IMethodBinding methodBinding = (IMethodBinding) node.getName().resolveBinding(); >+ IMethodBinding methodBinding = (IMethodBinding) resolveBinding(node >+ .getName()); >+ if (methodBinding == null) { >+ return false; >+ } > > if (containsALocalType(methodBinding)) { > setHasError(true); >- addErrorMessage(EvaluationEngineMessages.ASTInstructionCompiler_Method_which_contains_a_local_type_as_parameter_cannot_be_used_in_an_evaluation_expression_32); >- } >- >- if (hasErrors()) { >- return true; >+ addErrorMessage(EvaluationEngineMessages.ASTInstructionCompiler_Method_which_contains_a_local_type_as_parameter_cannot_be_used_in_an_evaluation_expression_32); >+ return false; > } > > ITypeBinding[] parameterTypes = methodBinding.getParameterTypes(); >@@ -3383,7 +3482,11 @@ > push(new SendMessage(selector, signature, paramCount, getTypeSignature(methodBinding.getDeclaringClass()), fCounter)); > int enclosingLevel= 0; > if (qualifier != null) { >- enclosingLevel= getEnclosingLevel(node, (ITypeBinding)qualifier.resolveBinding()); >+ ITypeBinding typeBinding = (ITypeBinding) resolveBinding(qualifier); >+ if (typeBinding == null) { >+ return false; >+ } >+ enclosingLevel= getEnclosingLevel(node, typeBinding); > } > push(new PushThis(enclosingLevel)); > storeInstruction(); >@@ -3391,7 +3494,19 @@ > > List arguments = node.arguments(); > int argCount = arguments.size(); >- if (methodBinding.isVarargs() && !(paramCount == argCount && parameterTypes[paramCount - 1].getDimensions() == ((Expression)arguments.get(argCount - 1)).resolveTypeBinding().getDimensions())) { >+ >+ ITypeBinding lastArgBinding = null; >+ >+ if (methodBinding.isVarargs()) { >+ lastArgBinding = resolveTypeBinding((Expression) arguments >+ .get(argCount - 1)); >+ if (lastArgBinding == null) { >+ return false; >+ } >+ } >+ if (methodBinding.isVarargs() >+ && !(paramCount == argCount && parameterTypes[paramCount - 1] >+ .getDimensions() == lastArgBinding.getDimensions())) { > // if this method is a varargs, and if the method is invoked using the varargs syntax > // (multiple arguments) and not an array > Iterator iterator= arguments.iterator(); >@@ -3584,7 +3699,11 @@ > Name qualifier= node.getQualifier(); > int enclosingLevel= 0; > if (qualifier != null) { >- enclosingLevel= getEnclosingLevel(node, (ITypeBinding)qualifier.resolveBinding()); >+ ITypeBinding binding = (ITypeBinding) resolveBinding(qualifier); >+ if (binding == null) { >+ return false; >+ } >+ enclosingLevel = getEnclosingLevel(node, binding); > } > push(new PushThis(enclosingLevel)); > >@@ -3611,7 +3730,7 @@ > } > setHasError(true); > addErrorMessage(EvaluationEngineMessages.ASTInstructionCompiler_Try_statement_cannot_be_used_in_an_evaluation_expression_23); >- return true; >+ return false; > } > > /** >@@ -3693,16 +3812,19 @@ > ASTNode parent= node.getParent(); > switch (parent.getNodeType()) { > case ASTNode.VARIABLE_DECLARATION_EXPRESSION: >- varTypeBinding= ((VariableDeclarationExpression)parent).getType().resolveBinding(); >+ varTypeBinding= resolveTypeBinding(((VariableDeclarationExpression)parent).getType()); > break; > case ASTNode.VARIABLE_DECLARATION_STATEMENT: >- varTypeBinding= ((VariableDeclarationStatement)parent).getType().resolveBinding(); >+ varTypeBinding= resolveTypeBinding(((VariableDeclarationStatement)parent).getType()); > break; > default: > setHasError(true); > addErrorMessage(EvaluationEngineMessages.ASTInstructionCompiler_Error_in_type_declaration_statement); > return false; > } >+ if (varTypeBinding == null) { >+ return false; >+ } > int typeDimension= varTypeBinding.getDimensions(); > ITypeBinding elementBinding = varTypeBinding; > if (typeDimension != 0) { >@@ -3766,6 +3888,9 @@ > > private int getTypeId(Expression expression) { > ITypeBinding typeBinding = expression.resolveTypeBinding(); >+ if (typeBinding == null) { >+ return Instruction.T_undefined; >+ } > String typeName = typeBinding.getQualifiedName(); > if (typeBinding.isPrimitive()) { > return getPrimitiveTypeId(typeName); >@@ -3778,6 +3903,9 @@ > > private int getUnBoxedTypeId(Expression expression) { > ITypeBinding typeBinding = expression.resolveTypeBinding(); >+ if (typeBinding == null) { >+ return Instruction.T_undefined; >+ } > String typeName = typeBinding.getQualifiedName(); > if (typeBinding.isPrimitive()) { > return getPrimitiveTypeId(typeName); >@@ -3880,4 +4008,69 @@ > } > return Instruction.T_undefined; > } >+ >+ >+ /** >+ * Resolves and returns the type binding from the given expression reporting an error >+ * if the binding is <code>null</code>. >+ * >+ * @param expression expression to resolve type binding for >+ * @return type binding or <code>null</code> if not available >+ */ >+ private ITypeBinding resolveTypeBinding(Expression expression) { >+ ITypeBinding typeBinding = expression.resolveTypeBinding(); >+ if (typeBinding == null) { >+ setHasError(true); >+ addErrorMessage(MessageFormat.format(EvaluationEngineMessages.ASTInstructionCompiler_3, new String[]{expression.toString()})); >+ } >+ return typeBinding; >+ } >+ >+ /** >+ * Resolves and returns the type binding for the give type reporting an error >+ * if the binding is <code>null</code>. >+ * >+ * @param type type to resolve binding for >+ * @return type binding or <code>null</code> if not available >+ */ >+ private ITypeBinding resolveTypeBinding(Type type) { >+ ITypeBinding typeBinding = type.resolveBinding(); >+ if (typeBinding == null) { >+ setHasError(true); >+ addErrorMessage(MessageFormat.format(EvaluationEngineMessages.ASTInstructionCompiler_3, new String[]{type.toString()})); >+ } >+ return typeBinding; >+ } >+ >+ /** >+ * Resolves and returns the binding for the given name reporting an error >+ * if the binding is <code>null</code>. >+ * >+ * @param name name to resolve binding for >+ * @return binding or <code>null</code> if not available >+ */ >+ private IBinding resolveBinding(Name name) { >+ IBinding binding = name.resolveBinding(); >+ if (binding == null) { >+ setHasError(true); >+ addErrorMessage(MessageFormat.format(EvaluationEngineMessages.ASTInstructionCompiler_5, new String[]{name.getFullyQualifiedName()})); >+ } >+ return binding; >+ } >+ >+ /** >+ * Resolves and returns the type binding for the given name reporting an error >+ * if the binding is <code>null</code>. >+ * >+ * @param name name to resolve type binding for >+ * @return type binding or <code>null</code> if not available >+ */ >+ private ITypeBinding resolveTypeBinding(Name name) { >+ ITypeBinding typeBinding = name.resolveTypeBinding(); >+ if (typeBinding == null) { >+ setHasError(true); >+ addErrorMessage(MessageFormat.format(EvaluationEngineMessages.ASTInstructionCompiler_3, new String[]{name.getFullyQualifiedName()})); >+ } >+ return typeBinding; >+ } > } >Index: eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationEngineMessages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationEngineMessages.properties,v >retrieving revision 1.26 >diff -u -r1.26 EvaluationEngineMessages.properties >--- eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationEngineMessages.properties 29 May 2008 15:47:44 -0000 1.26 >+++ eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationEngineMessages.properties 15 Jul 2010 08:47:44 -0000 >@@ -1,5 +1,5 @@ > ############################################################################### >-# Copyright (c) 2000, 2007 IBM Corporation and others. >+# Copyright (c) 2000, 2010 IBM Corporation and others. > # All rights reserved. This program and the accompanying materials > # are made available under the terms of the Eclipse Public License v1.0 > # which accompanies this distribution, and is available at >@@ -22,7 +22,6 @@ > > ASTInstructionCompiler_unrecognized_postfix_operator____15=unrecognized postfix operator : > ASTInstructionCompiler_unrecognized_prefix_operator____16=unrecognized prefix operator : >-ASTInstructionCompiler_binding_null_for__17=binding == null for > > ASTInstructionCompiler_super_constructor_invocation_cannot_be_used_in_an_evaluation_expression_19=super constructor invocation cannot be used in an evaluation expression > ASTInstructionCompiler_Try_statement_cannot_be_used_in_an_evaluation_expression_23=Try statement cannot be used in an evaluation expression >@@ -43,8 +42,12 @@ > ASTEvaluationEngine_An_unknown_error_occurred_during_evaluation=An unknown error occurred during evaluation > ASTEvaluationEngine_Cannot_perform_nested_evaluations=Cannot perform nested evaluations. > >+ASTInstructionCompiler_3=Unable to resolve type binding for: {0} > ASTInstructionCompiler_36=Local type field access cannot be used in an evaluation expression > ASTInstructionCompiler_0=Enum declaration cannot be used in an evaluation expression >+ASTInstructionCompiler_1=Unable to resolve type binding of constructor: {0} >+ASTInstructionCompiler_2=Unable to resolve type binding of declaring type of: {0} >+ASTInstructionCompiler_5=Unable to resolve binding for: {0} > ASTEvaluationEngine_0=Unable to evaluate expressions in the context of an interface > ASTEvaluationEngine_1=Unable to retrieve type for java.lang.Object > ArrayRuntimeContext_0=Unable to retrieve type for java.lang.Object
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 277574
:
173636
|
174366
|
174367
| 174374 |
174414