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 167664 Details for
Bug 157847
NPE in WildcardBinding.computeUniqueKey during code assist
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Revised patch
patch.txt (text/plain), 5.45 KB, created by
Srikanth Sankaran
on 2010-05-10 04:12:10 EDT
(
hide
)
Description:
Revised patch
Filename:
MIME Type:
Creator:
Srikanth Sankaran
Created:
2010-05-10 04:12:10 EDT
Size:
5.45 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/util/BindingKeyResolver.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/BindingKeyResolver.java,v >retrieving revision 1.55 >diff -u -r1.55 BindingKeyResolver.java >--- model/org/eclipse/jdt/internal/core/util/BindingKeyResolver.java 7 Mar 2009 00:58:54 -0000 1.55 >+++ model/org/eclipse/jdt/internal/core/util/BindingKeyResolver.java 10 May 2010 08:09:55 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2009 IBM Corporation and others. >+ * Copyright (c) 2005, 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 >@@ -435,7 +435,9 @@ > case Wildcard.EXTENDS: > case Wildcard.SUPER: > BindingKeyResolver boundResolver = (BindingKeyResolver) this.types.get(0); >- this.typeBinding = this.environment.createWildcard((ReferenceBinding) this.typeBinding, this.wildcardRank, (TypeBinding) boundResolver.compilerBinding, null /*no extra bound*/, kind); >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=157847, do not allow creation of >+ // internally inconsistent wildcards of the form '? super <null>' or '? extends <null>' >+ this.typeBinding = boundResolver.compilerBinding == null ? null : this.environment.createWildcard((ReferenceBinding) this.typeBinding, this.wildcardRank, (TypeBinding) boundResolver.compilerBinding, null /*no extra bound*/, kind); > break; > case Wildcard.UNBOUND: > this.typeBinding = this.environment.createWildcard((ReferenceBinding) this.typeBinding, this.wildcardRank, null/*no bound*/, null /*no extra bound*/, kind); >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/dom/ASTModelBridgeTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTModelBridgeTests.java,v >retrieving revision 1.63 >diff -u -r1.63 ASTModelBridgeTests.java >--- src/org/eclipse/jdt/core/tests/dom/ASTModelBridgeTests.java 14 Dec 2009 18:46:07 -0000 1.63 >+++ src/org/eclipse/jdt/core/tests/dom/ASTModelBridgeTests.java 10 May 2010 08:10:28 -0000 >@@ -2133,5 +2133,94 @@ > element > ); > } >+ /** >+ * Test behavior when the binding key denotes a non existent type. >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=157847" >+ */ >+ public void test157847a() throws CoreException { >+ String filePath = "/P/src/Bug157847A.java"; >+ try { >+ String contents = >+ "public class Bug157847A<T> {\n" + >+ " void add(Y<? extends T> l) {}\n" + >+ "}\n"+ >+ "interface Y<T> {}\n"; >+ createFile(filePath, contents); >+ >+ BindingRequestor requestor = new BindingRequestor(); >+ String[] bindingKeys = new String[] {"LBug157847A~ThisTypeDoesNotExist;"}; >+ resolveASTs( >+ new ICompilationUnit[] {}, >+ bindingKeys, >+ requestor, >+ getJavaProject("P"), >+ this.workingCopy.getOwner() >+ ); >+ IBinding[] bindings = requestor.getBindings(bindingKeys); >+ assertTrue("Constructed non existing type", bindings.length == 0); >+ } finally { >+ deleteFile(filePath); >+ } >+ } >+ /** >+ * Ensures that we don't create internally inconsistent wildcard >+ * bindings of the form '? extends <null>' or '? super <null>' >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=157847" >+ */ >+ public void test157847b() throws CoreException { >+ String filePath = "/P/src/Bug157847B.java"; >+ try { >+ String contents = >+ "public class Bug157847B<T> {\n" + >+ " void add(Y<? super T> l) {}\n" + >+ "}\n"+ >+ "interface Y<T> {}\n"; >+ createFile(filePath, contents); >+ >+ BindingRequestor requestor = new BindingRequestor(); >+ String[] bindingKeys = new String[] {"LBug157847B~Y<LBug157847B~Y;{0}-!LBug157847B;{0}*54;>;"}; >+ resolveASTs( >+ new ICompilationUnit[] {}, >+ bindingKeys, >+ requestor, >+ getJavaProject("P"), >+ this.workingCopy.getOwner() >+ ); >+ IBinding[] bindings = requestor.getBindings(bindingKeys); >+ assertTrue("Constructed bogus wildcard", bindings.length == 0); >+ } finally { >+ deleteFile(filePath); >+ } >+ } >+ /** >+ * Ensures that we don't create internally inconsistent wildcard >+ * bindings of the form '? extends <null>' or '? super <null>' >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=157847" >+ */ >+ public void test157847c() throws CoreException { >+ String filePath = "/P/src/Bug157847C.java"; >+ try { >+ String contents = >+ "public class Bug157847C<T> {\n" + >+ " void add(Y<? extends T> l) {}\n" + >+ "}\n"+ >+ "interface Y<T> {}\n"; >+ createFile(filePath, contents); >+ >+ BindingRequestor requestor = new BindingRequestor(); >+ String[] bindingKeys = new String[] {"LBug157847C~Y<LBug157847C~Y;{0}+!LBug157847C;{0}*54;>;"}; >+ resolveASTs( >+ new ICompilationUnit[] {}, >+ bindingKeys, >+ requestor, >+ getJavaProject("P"), >+ this.workingCopy.getOwner() >+ ); >+ IBinding[] bindings = requestor.getBindings(bindingKeys); >+ assertTrue("Constructed bogus wildcard", bindings.length == 0); >+ } finally { >+ deleteFile(filePath); >+ } >+ } > > }
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 157847
:
167470
|
167664
|
167718