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 77101 Details for
Bug 152841
[model] IJavaProject.findType(name, monitor) doesn't find secondary type
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
v00.txt (text/plain), 4.64 KB, created by
Frederic Fusier
on 2007-08-28 04:53:41 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2007-08-28 04:53:41 EDT
Size:
4.64 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/ClassNameTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClassNameTests.java,v >retrieving revision 1.15 >diff -u -r1.15 ClassNameTests.java >--- src/org/eclipse/jdt/core/tests/model/ClassNameTests.java 29 Mar 2006 04:03:07 -0000 1.15 >+++ src/org/eclipse/jdt/core/tests/model/ClassNameTests.java 28 Aug 2007 08:54:01 -0000 >@@ -14,8 +14,18 @@ > > import org.eclipse.core.resources.IFile; > import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.core.runtime.NullProgressMonitor; >-import org.eclipse.jdt.core.*; >+import org.eclipse.jdt.core.IClasspathEntry; >+import org.eclipse.jdt.core.ICompilationUnit; >+import org.eclipse.jdt.core.IJavaProject; >+import org.eclipse.jdt.core.IPackageFragment; >+import org.eclipse.jdt.core.IPackageFragmentRoot; >+import org.eclipse.jdt.core.IType; >+import org.eclipse.jdt.core.JavaCore; >+import org.eclipse.jdt.core.JavaModelException; >+import org.eclipse.jdt.core.dom.AST; >+import org.eclipse.jdt.core.dom.ASTParser; > import org.eclipse.jdt.internal.core.SourceType; > > /** >@@ -1166,4 +1176,72 @@ > public void testFindSecondaryType_Unknown03() throws JavaModelException, CoreException { > assertTypeUnknown("org.eclipse.jdt.core.test.Unknown"); > } >+ >+/** >+ * @bug 152841: [model] IJavaProject.findType(name, monitor) doesn't find secondary type >+ * @test Ensure that secondary type is found just after having created the compilation unit >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=152841" >+ */ >+public void testBug152841() throws Exception{ >+ try { >+ IJavaProject project= createJavaProject("P", new String[] { "src" }, new String[] { "JCL_LIB" }, "bin"); >+ IPackageFragmentRoot root = (IPackageFragmentRoot) project.getChildren()[0]; >+ IPackageFragment pack= root.createPackageFragment("p", true, null); >+ >+ String source= "package p;\n" + >+ "//use Object\n" + >+ "class A {\n" + >+ " public void foo(){};\n" + >+ "}"; >+ pack.createCompilationUnit("A.java", source, true, null); >+ >+ source= "package p;\n" + >+ "\n" + >+ "class Test{\n" + >+ " void test(){\n" + >+ " A a= new A();\n" + >+ " test(a);\n" + >+ " }\n" + >+ " void test(Object o){\n" + >+ " o.hashCode();\n" + >+ " }\n" + >+ "}"; >+ ICompilationUnit cu= pack.createCompilationUnit("Test.java", source, true, null); >+ >+ ASTParser parser= ASTParser.newParser(AST.JLS3); >+ parser.setSource(cu); >+ parser.setResolveBindings(true); >+ parser.createAST(null); >+ >+ source= "package p;\n" + >+ "//use C\n" + >+ "interface I{}\n" + >+ "class C implements I{\n" + >+ "}\n" + >+ "class B extends C{\n" + >+ "}\n" + >+ "class A extends B{" + >+ "}\n" + >+ "class Test{\n" + >+ " void f(){\n" + >+ " A c= new A();\n" + >+ " c.toString();\n" + >+ " }\n" + >+ "}"; >+ >+ ICompilationUnit unit= pack.createCompilationUnit("I.java", source, true, null); >+ IType type= project.findType("p.I", (IProgressMonitor) null); >+ assertNotNull(type); >+ >+ // C exists >+ assertTrue(unit.getType("C").exists()); >+ >+ // but can't be found >+ type= project.findType("p.C", (IProgressMonitor) null); >+ assertNotNull(type); >+ } >+ finally { >+ deleteProject("P"); >+ } >+} > } >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/JavaModelManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java,v >retrieving revision 1.375 >diff -u -r1.375 JavaModelManager.java >--- model/org/eclipse/jdt/internal/core/JavaModelManager.java 24 Aug 2007 13:02:31 -0000 1.375 >+++ model/org/eclipse/jdt/internal/core/JavaModelManager.java 28 Aug 2007 08:54:05 -0000 >@@ -3918,8 +3918,15 @@ > secondaryTypesRemoving(projectInfo.secondaryTypes, file); > > // Clean indexing cache if necessary >- if (!cleanIndexCache) return; > HashMap indexingCache = (HashMap) projectInfo.secondaryTypes.get(INDEXED_SECONDARY_TYPES); >+ if (!cleanIndexCache) { >+ if (indexingCache == null) { >+ // Need to signify that secondary types indexing will happen before any request happens >+ // see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=152841 >+ projectInfo.secondaryTypes.put(INDEXED_SECONDARY_TYPES, new HashMap()); >+ } >+ return; >+ } > if (indexingCache != null) { > Set keys = indexingCache.keySet(); > int filesSize = keys.size(), filesCount = 0;
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 152841
:
47395
|
47399
| 77101