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 112752 Details for
Bug 247292
[compiler] Compiler should avoid allocating method bindings for receiver type change
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Additional patch for (2)
247292a.txt (text/plain), 25.41 KB, created by
Philipe Mulet
on 2008-09-17 07:11:49 EDT
(
hide
)
Description:
Additional patch for (2)
Filename:
MIME Type:
Creator:
Philipe Mulet
Created:
2008-09-17 07:11:49 EDT
Size:
25.41 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java,v >retrieving revision 1.90 >diff -u -r1.90 QualifiedAllocationExpression.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java 17 Sep 2008 09:08:38 -0000 1.90 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java 17 Sep 2008 11:10:59 -0000 >@@ -99,13 +99,10 @@ > return this.enclosingInstance; > } > >- public void generateCode( >- BlockScope currentScope, >- CodeStream codeStream, >- boolean valueRequired) { >- >+ public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) { > int pc = codeStream.position; >- ReferenceBinding allocatedType = this.codegenBinding.declaringClass; >+ MethodBinding codegenBinding = this.binding.original(); >+ ReferenceBinding allocatedType = codegenBinding.declaringClass; > codeStream.new_(allocatedType); > boolean isUnboxing = (this.implicitConversion & TypeIds.UNBOXING) != 0; > if (valueRequired || isUnboxing) { >@@ -139,11 +136,11 @@ > > // invoke constructor > if (this.syntheticAccessor == null) { >- codeStream.invoke(Opcodes.OPC_invokespecial, this.codegenBinding, null /* default declaringClass */); >+ codeStream.invoke(Opcodes.OPC_invokespecial, codegenBinding, null /* default declaringClass */); > } else { > // synthetic accessor got some extra arguments appended to its signature, which need values > for (int i = 0, >- max = this.syntheticAccessor.parameters.length - this.codegenBinding.parameters.length; >+ max = this.syntheticAccessor.parameters.length - codegenBinding.parameters.length; > i < max; > i++) { > codeStream.aconst_null(); >Index: compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java,v >retrieving revision 1.75 >diff -u -r1.75 AllocationExpression.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java 17 Sep 2008 09:08:38 -0000 1.75 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java 17 Sep 2008 11:10:59 -0000 >@@ -22,7 +22,6 @@ > public TypeReference type; > public Expression[] arguments; > public MethodBinding binding; // exact binding resulting from lookup >- protected MethodBinding codegenBinding; // actual binding used for code generation (if no synthetic accessor) > MethodBinding syntheticAccessor; // synthetic accessor for inner-emulation > public TypeReference[] typeArguments; > public TypeBinding[] genericTypeArguments; >@@ -80,7 +79,8 @@ > > public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) { > int pc = codeStream.position; >- ReferenceBinding allocatedType = this.codegenBinding.declaringClass; >+ MethodBinding codegenBinding = this.binding.original(); >+ ReferenceBinding allocatedType = codegenBinding.declaringClass; > > codeStream.new_(allocatedType); > boolean isUnboxing = (this.implicitConversion & TypeIds.UNBOXING) != 0; >@@ -115,11 +115,11 @@ > } > // invoke constructor > if (this.syntheticAccessor == null) { >- codeStream.invoke(Opcodes.OPC_invokespecial, this.codegenBinding, null /* default declaringClass */); >+ codeStream.invoke(Opcodes.OPC_invokespecial, codegenBinding, null /* default declaringClass */); > } else { > // synthetic accessor got some extra arguments appended to its signature, which need values > for (int i = 0, >- max = this.syntheticAccessor.parameters.length - this.codegenBinding.parameters.length; >+ max = this.syntheticAccessor.parameters.length - codegenBinding.parameters.length; > i < max; > i++) { > codeStream.aconst_null(); >@@ -187,18 +187,18 @@ > public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) { > if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) != 0) return; > // if constructor from parameterized type got found, use the original constructor at codegen time >- this.codegenBinding = this.binding.original(); >+ MethodBinding codegenBinding = this.binding.original(); > > ReferenceBinding declaringClass; >- if (this.codegenBinding.isPrivate() && currentScope.enclosingSourceType() != (declaringClass = this.codegenBinding.declaringClass)) { >+ if (codegenBinding.isPrivate() && currentScope.enclosingSourceType() != (declaringClass = codegenBinding.declaringClass)) { > > // from 1.4 on, local type constructor can lose their private flag to ease emulation > if ((declaringClass.tagBits & TagBits.IsLocalType) != 0 && currentScope.compilerOptions().complianceLevel >= ClassFileConstants.JDK1_4) { > // constructor will not be dumped as private, no emulation required thus >- this.codegenBinding.tagBits |= TagBits.ClearPrivateModifier; >+ codegenBinding.tagBits |= TagBits.ClearPrivateModifier; > } else { >- this.syntheticAccessor = ((SourceTypeBinding) declaringClass).addSyntheticMethod(this.codegenBinding, isSuperAccess()); >- currentScope.problemReporter().needToEmulateMethodAccess(this.codegenBinding, this); >+ this.syntheticAccessor = ((SourceTypeBinding) declaringClass).addSyntheticMethod(codegenBinding, isSuperAccess()); >+ currentScope.problemReporter().needToEmulateMethodAccess(codegenBinding, this); > } > } > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java,v >retrieving revision 1.133 >diff -u -r1.133 MessageSend.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java 17 Sep 2008 09:08:38 -0000 1.133 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java 17 Sep 2008 11:10:59 -0000 >@@ -44,7 +44,6 @@ > public char[] selector; > public Expression[] arguments; > public MethodBinding binding; // exact binding resulting from lookup >- public MethodBinding codegenBinding; // actual binding used for code generation (if no synthetic accessor) > public MethodBinding syntheticAccessor; // synthetic accessor for inner-emulation > public TypeBinding expectedType; // for generic method invocation (return type inference) > >@@ -128,7 +127,8 @@ > int pc = codeStream.position; > > // generate receiver/enclosing instance access >- boolean isStatic = this.codegenBinding.isStatic(); >+ MethodBinding codegenBinding = this.binding.original(); >+ boolean isStatic = codegenBinding.isStatic(); > if (isStatic) { > this.receiver.generateCode(currentScope, codeStream, false); > codeStream.recordPositionsFrom(pc, this.sourceStart); >@@ -151,14 +151,14 @@ > if (this.syntheticAccessor == null){ > TypeBinding constantPoolDeclaringClass = getConstantPoolDeclaringClass(currentScope); > if (isStatic){ >- codeStream.invoke(Opcodes.OPC_invokestatic, this.codegenBinding, constantPoolDeclaringClass); >- } else if( (this.receiver.isSuper()) || this.codegenBinding.isPrivate()){ >- codeStream.invoke(Opcodes.OPC_invokespecial, this.codegenBinding, constantPoolDeclaringClass); >+ codeStream.invoke(Opcodes.OPC_invokestatic, codegenBinding, constantPoolDeclaringClass); >+ } else if( (this.receiver.isSuper()) || codegenBinding.isPrivate()){ >+ codeStream.invoke(Opcodes.OPC_invokespecial, codegenBinding, constantPoolDeclaringClass); > } else { > if (constantPoolDeclaringClass.isInterface()) { // interface or annotation type >- codeStream.invoke(Opcodes.OPC_invokeinterface, this.codegenBinding, constantPoolDeclaringClass); >+ codeStream.invoke(Opcodes.OPC_invokeinterface, codegenBinding, constantPoolDeclaringClass); > } else { >- codeStream.invoke(Opcodes.OPC_invokevirtual, this.codegenBinding, constantPoolDeclaringClass); >+ codeStream.invoke(Opcodes.OPC_invokevirtual, codegenBinding, constantPoolDeclaringClass); > } > } > } else { >@@ -173,7 +173,7 @@ > boolean isUnboxing = (this.implicitConversion & TypeIds.UNBOXING) != 0; > // conversion only generated if unboxing > if (isUnboxing) codeStream.generateImplicitConversion(this.implicitConversion); >- switch (isUnboxing ? postConversionType(currentScope).id : this.codegenBinding.returnType.id) { >+ switch (isUnboxing ? postConversionType(currentScope).id : codegenBinding.returnType.id) { > case T_long : > case T_double : > codeStream.pop2(); >@@ -195,10 +195,11 @@ > > protected TypeBinding getConstantPoolDeclaringClass(BlockScope currentScope) { > // constantpool declaringClass >- TypeBinding constantPoolDeclaringClass = this.codegenBinding.declaringClass; >+ MethodBinding codegenBinding = this.binding.original(); >+ TypeBinding constantPoolDeclaringClass = codegenBinding.declaringClass; > // Post 1.4.0 target, array clone() invocations are qualified with array type > // This is handled in array type #clone method binding resolution (see Scope and UpdatedMethodBinding) >- if (this.codegenBinding == currentScope.environment().arrayClone) { >+ if (codegenBinding == currentScope.environment().arrayClone) { > CompilerOptions options = currentScope.compilerOptions(); > if (options.sourceLevel > ClassFileConstants.JDK1_4 ) { > constantPoolDeclaringClass = this.actualReceiverType.erasure(); >@@ -211,7 +212,7 @@ > if (constantPoolDeclaringClass != this.actualReceiverType && this.receiverGenericCast == null && !this.actualReceiverType.isArrayType()) { > CompilerOptions options = currentScope.compilerOptions(); > if ((options.targetJDK >= ClassFileConstants.JDK1_2 >- && (options.complianceLevel >= ClassFileConstants.JDK1_4 || !(this.receiver.isImplicitThis() && this.codegenBinding.isStatic())) >+ && (options.complianceLevel >= ClassFileConstants.JDK1_4 || !(this.receiver.isImplicitThis() && codegenBinding.isStatic())) > && this.binding.declaringClass.id != TypeIds.T_JavaLangObject) // no change for Object methods > || !this.binding.declaringClass.canBeSeenBy(currentScope)) { > constantPoolDeclaringClass = this.actualReceiverType.erasure(); >@@ -232,14 +233,14 @@ > if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) != 0) return; > > // if method from parameterized type got found, use the original method at codegen time >- this.codegenBinding = this.binding.original(); >+ MethodBinding codegenBinding = this.binding.original(); > if (this.binding.isPrivate()){ > > // depth is set for both implicit and explicit access (see MethodBinding#canBeSeenBy) >- if (currentScope.enclosingSourceType() != this.codegenBinding.declaringClass){ >+ if (currentScope.enclosingSourceType() != codegenBinding.declaringClass){ > >- this.syntheticAccessor = ((SourceTypeBinding)this.codegenBinding.declaringClass).addSyntheticMethod(this.codegenBinding, isSuperAccess()); >- currentScope.problemReporter().needToEmulateMethodAccess(this.codegenBinding, this); >+ this.syntheticAccessor = ((SourceTypeBinding)codegenBinding.declaringClass).addSyntheticMethod(codegenBinding, isSuperAccess()); >+ currentScope.problemReporter().needToEmulateMethodAccess(codegenBinding, this); > return; > } > >@@ -247,20 +248,20 @@ > > // qualified super need emulation always > SourceTypeBinding destinationType = (SourceTypeBinding)(((QualifiedSuperReference)this.receiver).currentCompatibleType); >- this.syntheticAccessor = destinationType.addSyntheticMethod(this.codegenBinding, isSuperAccess()); >- currentScope.problemReporter().needToEmulateMethodAccess(this.codegenBinding, this); >+ this.syntheticAccessor = destinationType.addSyntheticMethod(codegenBinding, isSuperAccess()); >+ currentScope.problemReporter().needToEmulateMethodAccess(codegenBinding, this); > return; > > } else if (this.binding.isProtected()){ > > SourceTypeBinding enclosingSourceType; > if (((this.bits & ASTNode.DepthMASK) != 0) >- && this.codegenBinding.declaringClass.getPackage() >+ && codegenBinding.declaringClass.getPackage() > != (enclosingSourceType = currentScope.enclosingSourceType()).getPackage()){ > > SourceTypeBinding currentCompatibleType = (SourceTypeBinding)enclosingSourceType.enclosingTypeAt((this.bits & ASTNode.DepthMASK) >> ASTNode.DepthSHIFT); >- this.syntheticAccessor = currentCompatibleType.addSyntheticMethod(this.codegenBinding, isSuperAccess()); >- currentScope.problemReporter().needToEmulateMethodAccess(this.codegenBinding, this); >+ this.syntheticAccessor = currentCompatibleType.addSyntheticMethod(codegenBinding, isSuperAccess()); >+ currentScope.problemReporter().needToEmulateMethodAccess(codegenBinding, this); > return; > } > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java,v >retrieving revision 1.66 >diff -u -r1.66 ExplicitConstructorCall.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java 17 Sep 2008 09:08:38 -0000 1.66 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java 17 Sep 2008 11:10:59 -0000 >@@ -38,7 +38,6 @@ > public Expression[] arguments; > public Expression qualification; > public MethodBinding binding; // exact binding resulting from lookup >- protected MethodBinding codegenBinding; // actual binding used for code generation (if no synthetic accessor) > MethodBinding syntheticAccessor; // synthetic accessor for inner-emulation > public int accessMode; > public TypeReference[] typeArguments; >@@ -115,7 +114,8 @@ > int pc = codeStream.position; > codeStream.aload_0(); > >- ReferenceBinding targetType = this.codegenBinding.declaringClass; >+ MethodBinding codegenBinding = this.binding.original(); >+ ReferenceBinding targetType = codegenBinding.declaringClass; > > // special name&ordinal argument generation for enum constructors > if (targetType.erasure().id == TypeIds.T_JavaLangEnum || targetType.isEnum()) { >@@ -144,14 +144,14 @@ > if (this.syntheticAccessor != null) { > // synthetic accessor got some extra arguments appended to its signature, which need values > for (int i = 0, >- max = this.syntheticAccessor.parameters.length - this.codegenBinding.parameters.length; >+ max = this.syntheticAccessor.parameters.length - codegenBinding.parameters.length; > i < max; > i++) { > codeStream.aconst_null(); > } > codeStream.invoke(Opcodes.OPC_invokespecial, this.syntheticAccessor, null /* default declaringClass */); > } else { >- codeStream.invoke(Opcodes.OPC_invokespecial, this.codegenBinding, null /* default declaringClass */); >+ codeStream.invoke(Opcodes.OPC_invokespecial, codegenBinding, null /* default declaringClass */); > } > codeStream.recordPositionsFrom(pc, this.sourceStart); > } finally { >@@ -206,18 +206,18 @@ > public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) { > if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0) { > // if constructor from parameterized type got found, use the original constructor at codegen time >- this.codegenBinding = this.binding.original(); >+ MethodBinding codegenBinding = this.binding.original(); > > // perform some emulation work in case there is some and we are inside a local type only > if (this.binding.isPrivate() && this.accessMode != ExplicitConstructorCall.This) { >- ReferenceBinding declaringClass = this.codegenBinding.declaringClass; >+ ReferenceBinding declaringClass = codegenBinding.declaringClass; > // from 1.4 on, local type constructor can lose their private flag to ease emulation > if ((declaringClass.tagBits & TagBits.IsLocalType) != 0 && currentScope.compilerOptions().complianceLevel >= ClassFileConstants.JDK1_4) { > // constructor will not be dumped as private, no emulation required thus >- this.codegenBinding.tagBits |= TagBits.ClearPrivateModifier; >+ codegenBinding.tagBits |= TagBits.ClearPrivateModifier; > } else { >- this.syntheticAccessor = ((SourceTypeBinding) declaringClass).addSyntheticMethod(this.codegenBinding, isSuperAccess()); >- currentScope.problemReporter().needToEmulateMethodAccess(this.codegenBinding, this); >+ this.syntheticAccessor = ((SourceTypeBinding) declaringClass).addSyntheticMethod(codegenBinding, isSuperAccess()); >+ currentScope.problemReporter().needToEmulateMethodAccess(codegenBinding, this); > } > } > } >Index: eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java,v >retrieving revision 1.57 >diff -u -r1.57 CodeSnippetMessageSend.java >--- eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java 17 Sep 2008 09:08:40 -0000 1.57 >+++ eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java 17 Sep 2008 11:10:59 -0000 >@@ -48,16 +48,12 @@ > * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream > * @param valueRequired boolean > */ >-public void generateCode( >- BlockScope currentScope, >- CodeStream codeStream, >- boolean valueRequired) { >- >+public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) { > int pc = codeStream.position; >- >- if (this.codegenBinding.canBeSeenBy(this.actualReceiverType, this, currentScope)) { >+ MethodBinding codegenBinding = this.binding.original(); >+ if (codegenBinding.canBeSeenBy(this.actualReceiverType, this, currentScope)) { > // generate receiver/enclosing instance access >- boolean isStatic = this.codegenBinding.isStatic(); >+ boolean isStatic = codegenBinding.isStatic(); > // outer access ? > if (!isStatic && ((this.bits & DepthMASK) != 0)) { > // outer method can be reached through emulation >@@ -80,20 +76,20 @@ > // actual message invocation > TypeBinding constantPoolDeclaringClass = getConstantPoolDeclaringClass(currentScope); > if (isStatic) { >- codeStream.invoke(Opcodes.OPC_invokestatic, this.codegenBinding, constantPoolDeclaringClass); >- } else if( (this.receiver.isSuper()) || this.codegenBinding.isPrivate()){ >- codeStream.invoke(Opcodes.OPC_invokespecial, this.codegenBinding, constantPoolDeclaringClass); >+ codeStream.invoke(Opcodes.OPC_invokestatic, codegenBinding, constantPoolDeclaringClass); >+ } else if( (this.receiver.isSuper()) || codegenBinding.isPrivate()){ >+ codeStream.invoke(Opcodes.OPC_invokespecial, codegenBinding, constantPoolDeclaringClass); > } else { > if (constantPoolDeclaringClass.isInterface()) { // interface or annotation type >- codeStream.invoke(Opcodes.OPC_invokeinterface, this.codegenBinding, constantPoolDeclaringClass); >+ codeStream.invoke(Opcodes.OPC_invokeinterface, codegenBinding, constantPoolDeclaringClass); > } else { >- codeStream.invoke(Opcodes.OPC_invokevirtual, this.codegenBinding, constantPoolDeclaringClass); >+ codeStream.invoke(Opcodes.OPC_invokevirtual, codegenBinding, constantPoolDeclaringClass); > } > } > } else { >- codeStream.generateEmulationForMethod(currentScope, this.codegenBinding); >+ codeStream.generateEmulationForMethod(currentScope, codegenBinding); > // generate receiver/enclosing instance access >- boolean isStatic = this.codegenBinding.isStatic(); >+ boolean isStatic = codegenBinding.isStatic(); > // outer access ? > if (!isStatic && ((this.bits & DepthMASK) != 0)) { > // not supported yet >@@ -117,9 +113,9 @@ > for (int i = 0; i < argsLength; i++) { > codeStream.generateInlinedValue(i); > this.arguments[i].generateCode(currentScope, codeStream, true); >- TypeBinding parameterBinding = this.codegenBinding.parameters[i]; >+ TypeBinding parameterBinding = codegenBinding.parameters[i]; > if (parameterBinding.isBaseType() && parameterBinding != TypeBinding.NULL) { >- codeStream.generateBoxingConversion(this.codegenBinding.parameters[i].id); >+ codeStream.generateBoxingConversion(codegenBinding.parameters[i].id); > } > codeStream.aastore(); > if (i < argsLength - 1) { >@@ -133,8 +129,8 @@ > codeStream.invokeJavaLangReflectMethodInvoke(); > > // convert the return value to the appropriate type for primitive types >- if (this.codegenBinding.returnType.isBaseType()) { >- int typeID = this.codegenBinding.returnType.id; >+ if (codegenBinding.returnType.isBaseType()) { >+ int typeID = codegenBinding.returnType.id; > if (typeID == T_void) { > // remove the null from the stack > codeStream.pop(); >@@ -142,7 +138,7 @@ > codeStream.checkcast(typeID); > codeStream.getBaseTypeValue(typeID); > } else { >- codeStream.checkcast(this.codegenBinding.returnType); >+ codeStream.checkcast(codegenBinding.returnType); > } > } > // required cast must occur even if no value is required >@@ -154,7 +150,7 @@ > boolean isUnboxing = (this.implicitConversion & TypeIds.UNBOXING) != 0; > // conversion only generated if unboxing > if (isUnboxing) codeStream.generateImplicitConversion(this.implicitConversion); >- switch (isUnboxing ? postConversionType(currentScope).id : this.codegenBinding.returnType.id) { >+ switch (isUnboxing ? postConversionType(currentScope).id : codegenBinding.returnType.id) { > case T_long : > case T_double : > codeStream.pop2(); >@@ -171,11 +167,11 @@ > > if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0) { > // if method from parameterized type got found, use the original method at codegen time >- this.codegenBinding = this.binding.original(); >- if (this.codegenBinding != this.binding) { >+ MethodBinding codegenBinding = this.binding.original(); >+ if (codegenBinding != this.binding) { > // extra cast needed if method return type was type variable >- if (this.codegenBinding.returnType.isTypeVariable()) { >- TypeVariableBinding variableReturnType = (TypeVariableBinding) this.codegenBinding.returnType; >+ if (codegenBinding.returnType.isTypeVariable()) { >+ TypeVariableBinding variableReturnType = (TypeVariableBinding) codegenBinding.returnType; > if (variableReturnType.firstBound != this.binding.returnType) { // no need for extra cast if same as first bound anyway > this.valueCast = this.binding.returnType; > } >Index: eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java,v >retrieving revision 1.39 >diff -u -r1.39 CodeSnippetAllocationExpression.java >--- eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java 17 Sep 2008 09:08:39 -0000 1.39 >+++ eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java 17 Sep 2008 11:10:59 -0000 >@@ -36,15 +36,12 @@ > public CodeSnippetAllocationExpression(EvaluationContext evaluationContext) { > this.evaluationContext = evaluationContext; > } >-public void generateCode( >- BlockScope currentScope, >- CodeStream codeStream, >- boolean valueRequired) { >- >+public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) { > int pc = codeStream.position; >- ReferenceBinding allocatedType = this.codegenBinding.declaringClass; >+ MethodBinding codegenBinding = this.binding.original(); >+ ReferenceBinding allocatedType = codegenBinding.declaringClass; > >- if (this.codegenBinding.canBeSeenBy(allocatedType, this, currentScope)) { >+ if (codegenBinding.canBeSeenBy(allocatedType, this, currentScope)) { > codeStream.new_(allocatedType); > if (valueRequired) { > codeStream.dup(); >@@ -74,10 +71,10 @@ > this); > } > // invoke constructor >- codeStream.invoke(Opcodes.OPC_invokespecial, this.codegenBinding, null /* default declaringClass */); >+ codeStream.invoke(Opcodes.OPC_invokespecial, codegenBinding, null /* default declaringClass */); > } else { > // private emulation using reflect >- codeStream.generateEmulationForConstructor(currentScope, this.codegenBinding); >+ codeStream.generateEmulationForConstructor(currentScope, codegenBinding); > // generate arguments > if (this.arguments != null) { > int argsLength = this.arguments.length; >@@ -87,9 +84,9 @@ > for (int i = 0; i < argsLength; i++) { > codeStream.generateInlinedValue(i); > this.arguments[i].generateCode(currentScope, codeStream, true); >- TypeBinding parameterBinding = this.codegenBinding.parameters[i]; >+ TypeBinding parameterBinding = codegenBinding.parameters[i]; > if (parameterBinding.isBaseType() && parameterBinding != TypeBinding.NULL) { >- codeStream.generateBoxingConversion(this.codegenBinding.parameters[i].id); >+ codeStream.generateBoxingConversion(codegenBinding.parameters[i].id); > } > codeStream.aastore(); > if (i < argsLength - 1) { >@@ -116,11 +113,7 @@ > // not supported yet > } > public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) { >- if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0) { >- >- // if constructor from parameterized type got found, use the original constructor at codegen time >- this.codegenBinding = this.binding.original(); >- } >+ // do nothing > } > public TypeBinding resolveType(BlockScope scope) { > // Propagate the type checking to the arguments, and check if the constructor is defined.
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 247292
:
112545
|
112568
|
112600
|
112663
|
112713
| 112752