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 190845 Details for
Bug 339478
[1.7][compiler] support for diamond case
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]
fix v1.0
patch339478.txt (text/plain), 6.50 KB, created by
Ayushman Jain
on 2011-03-10 07:28:05 EST
(
hide
)
Description:
fix v1.0
Filename:
MIME Type:
Creator:
Ayushman Jain
Created:
2011-03-10 07:28:05 EST
Size:
6.50 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java,v >retrieving revision 1.77.2.3 >diff -u -r1.77.2.3 LocalDeclaration.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java 8 Mar 2011 17:20:09 -0000 1.77.2.3 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java 10 Mar 2011 12:26:08 -0000 >@@ -207,12 +207,18 @@ > } > } else { > this.initialization.setExpectedType(variableType); >+ boolean isCompliant17 = scope.compilerOptions().originalSourceLevel >= ClassFileConstants.JDK1_7; >+ boolean isDiamond = false; > TypeBinding initializationType = this.initialization.resolveType(scope); >+ if (this.initialization instanceof AllocationExpression) { >+ if (isCompliant17 && (((AllocationExpression) this.initialization).type.bits & ASTNode.IsDiamond) != 0) >+ isDiamond = true; >+ } > if (initializationType != null) { > if (variableType != initializationType) // must call before computeConversion() and typeMismatchError() > scope.compilationUnitScope().recordTypeConversion(variableType, initializationType); > if (this.initialization.isConstantValueOfTypeAssignableToType(initializationType, variableType) >- || initializationType.isCompatibleWith(variableType)) { >+ || initializationType.isCompatibleWith(variableType, isDiamond)) { > this.initialization.computeConversion(scope, variableType, initializationType); > if (initializationType.needsUncheckedConversion(variableType)) { > scope.problemReporter().unsafeTypeConversion(this.initialization, initializationType, variableType); >Index: compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java,v >retrieving revision 1.54.2.1 >diff -u -r1.54.2.1 ParameterizedSingleTypeReference.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java 25 Jan 2011 20:33:00 -0000 1.54.2.1 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java 10 Mar 2011 12:26:08 -0000 >@@ -90,6 +90,7 @@ > * No need to check for reference to raw type per construction > */ > private TypeBinding internalResolveType(Scope scope, ReferenceBinding enclosingType, boolean checkBounds) { >+ boolean isCompliant17 = scope.compilerOptions().originalSourceLevel >= ClassFileConstants.JDK1_7; > // handle the error here > this.constant = Constant.NotAConstant; > if ((this.bits & ASTNode.DidResolve) != 0) { // is a shared type reference which was already resolved >@@ -222,8 +223,18 @@ > } > // if missing generic type, and compliance >= 1.5, then will rebuild a parameterized binding > } else if (argLength != typeVariables.length) { // check arity >- scope.problemReporter().incorrectArityForParameterizedType(this, currentType, argTypes); >- return null; >+ if(isCompliant17 && argLength == 0) { >+ if ((this.bits & ASTNode.IsDiamond) ==0) { >+ scope.problemReporter().incorrectArityForParameterizedType(this, currentType, argTypes); >+ return null; >+ } >+ // argLength = 0 ok if its the diamond case for compliance >= 1.7 >+ // also no need to check bounds for such a case >+ checkBounds = false; >+ } else { >+ scope.problemReporter().incorrectArityForParameterizedType(this, currentType, argTypes); >+ return null; >+ } > } else if (!currentType.isStatic()) { > ReferenceBinding actualEnclosing = currentType.enclosingType(); > if (actualEnclosing != null && actualEnclosing.isRawType()){ >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java,v >retrieving revision 1.140.2.4 >diff -u -r1.140.2.4 ReferenceBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java 14 Feb 2011 06:33:10 -0000 1.140.2.4 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java 10 Mar 2011 12:26:08 -0000 >@@ -999,7 +999,18 @@ > public boolean isClass() { > return (this.modifiers & (ClassFileConstants.AccInterface | ClassFileConstants.AccAnnotation | ClassFileConstants.AccEnum)) == 0; > } >- >+/** >+ * Answer true if the receiver type can be assigned to the argument type (right) >+ * In addition to improving performance, caching also ensures there is no infinite regression >+ * since per nature, the compatibility check is recursive through parameterized type arguments (122775) >+ */ >+public boolean isCompatibleWith(TypeBinding otherType, boolean isDiamondCase) { >+ if (isDiamondCase) { >+ if (this.erasure() == otherType.erasure()) >+ return true; >+ } >+ return isCompatibleWith(otherType); >+} > /** > * Answer true if the receiver type can be assigned to the argument type (right) > * In addition to improving performance, caching also ensures there is no infinite regression >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java,v >retrieving revision 1.113 >diff -u -r1.113 TypeBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java 24 Nov 2010 04:51:11 -0000 1.113 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java 10 Mar 2011 12:26:08 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -1183,4 +1183,8 @@ > public TypeVariableBinding[] typeVariables() { > return Binding.NO_TYPE_VARIABLES; > } >+ >+public boolean isCompatibleWith(TypeBinding variableType, boolean isDiamond){ >+ return isCompatibleWith(variableType); >+} > }
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 339478
:
190845
|
191332
|
191458
|
191707
|
191785
|
191891
|
191902
|
191946
|
191947
|
191984
|
192058
|
193887
|
193901
|
193918
|
193951
|
193962
|
193963