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 104652 Details for
Bug 236445
NPE in content assist
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix and regression test
236445.txt (text/plain), 4.67 KB, created by
Jerome Lanneluc
on 2008-06-12 07:15:45 EDT
(
hide
)
Description:
Proposed fix and regression test
Filename:
MIME Type:
Creator:
Jerome Lanneluc
Created:
2008-06-12 07:15:45 EDT
Size:
4.67 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/dom/BatchASTCreationTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/BatchASTCreationTests.java,v >retrieving revision 1.79 >diff -u -r1.79 BatchASTCreationTests.java >--- src/org/eclipse/jdt/core/tests/dom/BatchASTCreationTests.java 24 Oct 2007 13:50:40 -0000 1.79 >+++ src/org/eclipse/jdt/core/tests/dom/BatchASTCreationTests.java 12 Jun 2008 11:15:11 -0000 >@@ -2150,4 +2150,34 @@ > "Lp1/X;.foo()V@Lp1/MyAnnot;"); > } > >+ /* >+ * Ensures that a parameterized type with 2 arguments referring to the same cu that contains an anonymous type with a non-default constructor >+ * can be created using its key in ASTRequestor#createBindings >+ * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=236445 ) >+ */ >+ public void test088() throws CoreException { >+ assertBindingCreated( >+ new String[] { >+ "/P/A.java", >+ "public class A {\n" + >+ " public void foo(C c) {\n" + >+ " c.bar(B //|<---Ctrl+Space after B\n" + >+ " }\n" + >+ "}\n" + >+ "class B<V, E> {\n" + >+ "}", >+ "/P/C.java", >+ "public class C {\n" + >+ " public <V, E> void bar(B<V, E> code) {\n" + >+ " new D(null) {}; \n" + >+ " }\n" + >+ "}\n" + >+ "class D {\n" + >+ " D(Object o) {}\n" + >+ "}" >+ }, >+ "LA~B<LC;:1TV;LC;:1TE;>;"); >+ } >+ >+ > } >#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.51 >diff -u -r1.51 BindingKeyResolver.java >--- model/org/eclipse/jdt/internal/core/util/BindingKeyResolver.java 27 May 2008 23:40:19 -0000 1.51 >+++ model/org/eclipse/jdt/internal/core/util/BindingKeyResolver.java 12 Jun 2008 11:15:12 -0000 >@@ -45,6 +45,7 @@ > import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding; > import org.eclipse.jdt.internal.compiler.lookup.VariableBinding; > import org.eclipse.jdt.internal.compiler.lookup.WildcardBinding; >+import org.eclipse.jdt.internal.compiler.util.HashtableOfObject; > > public class BindingKeyResolver extends BindingKeyParser { > Compiler compiler; >@@ -69,22 +70,25 @@ > > CompilationUnitDeclaration outerMostParsedUnit; > >- private BindingKeyResolver(BindingKeyParser parser, Compiler compiler, LookupEnvironment environment, int wildcardRank, CompilationUnitDeclaration outerMostParsedUnit) { >+ /* >+ * A hash set of the file names of already resolved units >+ */ >+ HashtableOfObject resolvedUnits; >+ >+ private BindingKeyResolver(BindingKeyParser parser, Compiler compiler, LookupEnvironment environment, int wildcardRank, CompilationUnitDeclaration outerMostParsedUnit, HashtableOfObject parsedUnits) { > super(parser); > this.compiler = compiler; > this.environment = environment; > this.wildcardRank = wildcardRank; > this.outerMostParsedUnit = outerMostParsedUnit; >+ this.resolvedUnits = parsedUnits; > } > >- public BindingKeyResolver(String key) { >- this(key, null, null); >- } >- > public BindingKeyResolver(String key, Compiler compiler, LookupEnvironment environment) { > super(key); > this.compiler = compiler; > this.environment = environment; >+ this.resolvedUnits = new HashtableOfObject(); > } > > /* >@@ -373,9 +377,11 @@ > } > > public void consumeTopLevelType() { >+ char[] fileName; > this.parsedUnit = getCompilationUnitDeclaration(); >- if (this.parsedUnit != null && this.compiler != null) { >- this.compiler.process(this.parsedUnit, this.compiler.totalUnits+1); // noop if unit has already been resolved >+ if (this.parsedUnit != null && this.compiler != null && !this.resolvedUnits.containsKey(fileName = this.parsedUnit.getFileName())) { >+ this.compiler.process(this.parsedUnit, this.compiler.totalUnits+1); // unit is resolved only once thanks to the resolvedUnits protection >+ this.resolvedUnits.put(fileName, fileName); > } > if (this.parsedUnit == null) { > this.typeBinding = getBinaryBinding(); >@@ -570,7 +576,7 @@ > } > > public BindingKeyParser newParser() { >- return new BindingKeyResolver(this, this.compiler, this.environment, this.rank, this.outerMostParsedUnit == null ? this.parsedUnit : this.outerMostParsedUnit); >+ return new BindingKeyResolver(this, this.compiler, this.environment, this.rank, this.outerMostParsedUnit == null ? this.parsedUnit : this.outerMostParsedUnit, this.resolvedUnits); > } > > public String toString() {
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 236445
: 104652