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 144556 Details for
Bug 254738
NPE in HierarchyResolver.setFocusType
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]
Modified Patch
patch_254738_1.txt (text/plain), 5.79 KB, created by
Jay Arthanareeswaran
on 2009-08-14 12:56:41 EDT
(
hide
)
Description:
Modified Patch
Filename:
MIME Type:
Creator:
Jay Arthanareeswaran
Created:
2009-08-14 12:56:41 EDT
Size:
5.79 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java,v >retrieving revision 1.64 >diff -u -r1.64 SourceTypeConverter.java >--- model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java 28 Apr 2009 16:53:03 -0000 1.64 >+++ model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java 14 Aug 2009 16:58:53 -0000 >@@ -113,8 +113,11 @@ > this.cu = (ICompilationUnit) cuHandle; > > if (this.has1_5Compliance && ((CompilationUnitElementInfo) ((JavaElement) this.cu).getElementInfo()).annotationNumber > 10) { // experimental value >- // if more than 10 annotations, diet parse as this is faster >- return new Parser(this.problemReporter, true).dietParse(this.cu, compilationResult); >+ // If more than 10 annotations, diet parse as this is faster, but not if >+ // the client wants local and anonymous types to be converted (https://bugs.eclipse.org/bugs/show_bug.cgi?id=254738) >+ if ((this.flags & LOCAL_TYPE) == 0) { >+ return new Parser(this.problemReporter, true).dietParse(this.cu, compilationResult); >+ } > } > > /* only positions available */ >Index: model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java,v >retrieving revision 1.89 >diff -u -r1.89 HierarchyResolver.java >--- model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java 28 Apr 2009 16:53:03 -0000 1.89 >+++ model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java 14 Aug 2009 16:58:54 -0000 >@@ -645,7 +645,12 @@ > CompilationUnitDeclaration parsedUnit = null; > if (cu.isOpen()) { > // create parsed unit from source element infos >- CompilationResult result = new CompilationResult(((ICompilationUnit)cu).getFileName(), i, openablesLength, this.options.maxProblemsPerUnit); >+ // As part of fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=254738 >+ // Since we have the handle to the ICompilationUnit, instead of the name pass the ICompilationUnit, which is required if we were >+ // to get through Parser.getMethodBodies(), which is invoked later in this method. Note that as part of this fix, >+ // ASTNode.HasAllMethodBodies flag - which was being set earlier - has been removed. As a design feature, only the Parser >+ // is supposed to handle this particular bit. >+ CompilationResult result = new CompilationResult((ICompilationUnit)cu, i, openablesLength, this.options.maxProblemsPerUnit); > SourceTypeElementInfo[] typeInfos = null; > try { > IType[] topLevelTypes = cu.getTypes(); >@@ -668,7 +673,6 @@ > flags, > this.lookupEnvironment.problemReporter, > result); >- if (containsLocalType) parsedUnit.bits |= ASTNode.HasAllMethodBodies; > } else { > // create parsed unit from file > IFile file = (IFile) cu.getResource(); >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java,v >retrieving revision 1.91 >diff -u -r1.91 TypeHierarchyTests.java >--- src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java 21 Aug 2008 16:54:51 -0000 1.91 >+++ src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java 14 Aug 2009 16:59:00 -0000 >@@ -2351,4 +2351,57 @@ > project.setRawClasspath(originalClasspath, null); > } > } >+/** >+ * @bug 254738: NPE in HierarchyResolver.setFocusType >+ * @test that a nested method/anonymous sub type is included in the hierarchy when the number of annotations > 10 >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=254738" >+ */ >+public void testBug254738() throws CoreException { >+ try { >+ createJavaProject("P", new String[] {"src"}, new String[] {}, "bin", "1.5"); >+ createFolder("/P/src/abc"); >+ createFile( >+ "/P/src/abc/Parent.java", >+ "package abc;\n" + >+ "public class Parent {\n" + >+ " public void parentmethod() {\n" + >+ " new Object() {\n" + >+ " void nestedonemethod() {\n" + >+ " new Object(){\n" + >+ " public int hashCode() {\n" + >+ " return 0; \n" + >+ " } \n" + >+ " }; \n" + >+ " }\n" + >+ " };\n" + >+ " }\n" + >+ "}\n" + >+ "@Deprecated\n" + >+ "class Dep {\n" + >+ " @Deprecated void a() {}\n" + >+ " @Deprecated void b() {}\n" + >+ " @Deprecated void c() {}\n" + >+ " @Deprecated void d() {}\n" + >+ " @Deprecated void e() {}\n" + >+ " @Deprecated void f() {}\n" + >+ " @Deprecated void g() {}\n" + >+ " @Deprecated void h() {}\n" + >+ " @Deprecated void i() {}\n" + >+ " @Deprecated void j() {}\n" + >+ " @Deprecated void k() {}\n" + >+ "}" >+ ); >+ IType focus = getCompilationUnit("/P/src/abc/Parent.java").getType("Parent"); >+ focus = focus.getMethod("parentmethod", new String[]{}).getType("", 1).getMethod("nestedonemethod", new String[]{}). >+ getType("", 1); >+ ITypeHierarchy hierarchy = focus.newTypeHierarchy(null); >+ assertHierarchyEquals( >+ "Focus: <anonymous #1> [in nestedonemethod() [in <anonymous #1> [in parentmethod() [in Parent [in Parent.java [in abc [in src [in P]]]]]]]]\n" + >+ "Super types:\n" + >+ "Sub types:\n", >+ hierarchy); >+ } finally { >+ deleteProjects(new String[] {"P"}); >+ } >+} > }
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 254738
:
127580
|
144345
| 144556