Bug 541472 - [model] typehierarchy initially empty - populated after creating a class
Summary: [model] typehierarchy initially empty - populated after creating a class
Status: CLOSED DUPLICATE of bug 541217
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.10   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.11 M3   Edit
Assignee: Stephan Herrmann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-22 13:51 EST by Stephan Herrmann CLA
Modified: 2019-02-12 08:35 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Herrmann CLA 2018-11-22 13:51:49 EST
Observed while testing https://git.eclipse.org/r/#/c/131471/

(1) The type hierarchy for java.io.Serializable initially contained no subtypes.

(2) I created "public class C1 implements Serializable" and now 8 subtypes (including C1) were found.

(3) Delete C1.java, and now 7 subtypes are found.

(4) Close the project then re-open

(5) = (1)

In all this the workspace only contained one modular project: module-info.java plus one interface.

It didn't matter whether newTypeHierarchy() passed the current IJavaProject or not.
Comment 1 Stephan Herrmann CLA 2018-11-22 17:26:13 EST
While debugging a different issue I observed that HierarchyResolver.setFocusType() has a problem:
   this.lookupEnvironment.getCachedType(compoundName)
may return null because that method is not module-aware, then
   this.lookupEnvironment.askForType(..)
may trip into reporting
   ProblemReporter.duplicateTypes()
because the sought type did already exist.

In that particular situation this didn't cause any harm (askForType did answer a valid binding), but perhaps there's still a connection to this bug?
Comment 2 Stephan Herrmann CLA 2018-12-04 17:56:10 EST
(In reply to Stephan Herrmann from comment #0)
> Observed while testing https://git.eclipse.org/r/#/c/131471/
> 
> (1) The type hierarchy for java.io.Serializable initially contained no
> subtypes.
> 
> (2) I created "public class C1 implements Serializable" and now 8 subtypes
> (including C1) were found.
> 
> (3) Delete C1.java, and now 7 subtypes are found.
> 
> (4) Close the project then re-open
> 
> (5) = (1)

This could probably be explained by one observation in bug 541217 comment 6: types are associated to a module only when they were present as working copies. Creating C1 perhaps pulled in some more types as working copies, which were only discarded when the project was closed.

Perhaps its all the same bug, but I'm not yet 100% sure.
Comment 3 Manoj N Palat CLA 2019-02-11 04:16:11 EST
Bulk move out of 4.11
Comment 4 Stephan Herrmann CLA 2019-02-12 08:35:07 EST
I could no longer reproduce on HEAD, so assuming that bug 541217 indeed fixed it.

*** This bug has been marked as a duplicate of bug 541217 ***