Bug 531582 - Investigate "CoreException: Unable to resolve superclass" from API tools
Summary: Investigate "CoreException: Unable to resolve superclass" from API tools
Status: NEW
Alias: None
Product: PDE
Classification: Eclipse Project
Component: API Tools (show other bugs)
Version: 4.8   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Vikas Chandra CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: investigate
Depends on:
Blocks:
 
Reported: 2018-02-23 06:05 EST by Vikas Chandra CLA
Modified: 2023-04-26 12:20 EDT (History)
2 users (show)

See Also:


Attachments
patch used to recreate this bug (650 bytes, patch)
2018-02-23 06:05 EST, Vikas Chandra CLA
no flags Details | Diff
Added debug code for logging and in launch version, I get this error. (182.68 KB, image/jpeg)
2018-05-02 05:20 EDT, Vikas Chandra CLA
no flags Details
Just temporary code to back up my last comment (1.65 KB, patch)
2018-05-21 05:57 EDT, Vikas Chandra CLA
no flags Details | Diff
log file with gazillions of API errors (3.56 MB, application/octet-stream)
2018-11-14 16:35 EST, Andrey Loskutov CLA
no flags Details
Repos used (35.15 KB, image/jpeg)
2018-11-16 02:38 EST, Vikas Chandra CLA
no flags Details
extra bundles in my SDK (11.93 KB, application/octet-stream)
2018-11-16 07:59 EST, Andrey Loskutov CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vikas Chandra CLA 2018-02-23 06:05:29 EST
Created attachment 272850 [details]
patch used to recreate this bug

1) Use debug code attached in the bug
2) Run API tools analysis  ( keep relevant baseline - use default options)

Lots of exceptions like below come with any API tool analysis 


!ENTRY org.eclipse.pde.api.tools 4 120 2018-02-22 16:17:13.780
!MESSAGE Error logged from API Tools Core: 
!STACK 1
org.eclipse.core.runtime.CoreException: Unable to resolve superclass org.eclipse.jface.dialogs.Dialog for org.eclipse.jdt.debug.ui.JavaSourceLookupDialog
	at org.eclipse.pde.api.tools.internal.model.ApiType.getSuperclass(ApiType.java:276)
	at org.eclipse.pde.api.tools.internal.comparator.ClassFileComparator.collectAllInterfaces(ClassFileComparator.java:771)
	at org.eclipse.pde.api.tools.internal.comparator.ClassFileComparator.getInterfacesSet(ClassFileComparator.java:1891)
	at org.eclipse.pde.api.tools.internal.comparator.ClassFileComparator.checkSuperInterfaces(ClassFileComparator.java:272)
	at org.eclipse.pde.api.tools.internal.comparator.ClassFileComparator.getDelta(ClassFileComparator.java:1023)
	at org.eclipse.pde.api.tools.internal.provisional.comparator.ApiComparator$2.visit(ApiComparator.java:771)
	at org.eclipse.pde.api.tools.internal.model.ArchiveApiTypeContainer.accept(ArchiveApiTypeContainer.java:201)
	at org.eclipse.pde.api.tools.internal.provisional.comparator.ApiComparator.internalCompare(ApiComparator.java:656)
	at org.eclipse.pde.api.tools.internal.provisional.comparator.ApiComparator.compare(ApiComparator.java:286)
	at org.eclipse.pde.api.tools.internal.provisional.comparator.ApiComparator.compare(ApiComparator.java:312)
	at org.eclipse.pde.api.tools.internal.builder.BaseApiAnalyzer.checkCompatibility(BaseApiAnalyzer.java:1442)
	at org.eclipse.pde.api.tools.internal.builder.BaseApiAnalyzer.analyzeComponent(BaseApiAnalyzer.java:255)
	at org.eclipse.pde.api.tools.internal.builder.ApiAnalysisBuilder.buildAll(ApiAnalysisBuilder.java:757)
	at org.eclipse.pde.api.tools.internal.builder.ApiAnalysisBuilder.build(ApiAnalysisBuilder.java:361)
Comment 1 Vikas Chandra CLA 2018-04-18 05:21:20 EDT
Bulk move out of 4.8 target milestone.
Comment 2 Dani Megert CLA 2018-04-18 10:58:15 EDT
This needs to be looked at. Could also be a performance issue.
Comment 3 Dani Megert CLA 2018-04-18 11:09:44 EDT
(In reply to Dani Megert from comment #2)
> This needs to be looked at. Could also be a performance issue.

See also bug 533091.
Comment 4 Eclipse Genie CLA 2018-04-27 13:26:43 EDT
New Gerrit change created: https://git.eclipse.org/r/121896
Comment 6 Vikas Chandra CLA 2018-04-27 13:40:51 EDT
I am unable to recreate this in Build id: I20180425-1705.

I have committed the error logging code.

Dani, can you please check if you still see these exceptions in the "Error Log" view on I20180427-2000 or later.
Comment 7 Vikas Chandra CLA 2018-04-28 02:39:20 EDT
I am able to get

org.eclipse.core.runtime.CoreException: Unable to resolve superclass org.eclipse.core.commands.AbstractHandler for test67.handlers.SampleHandler
	at org.eclipse.pde.api.tools.internal.model.ApiType.getSuperclass(ApiType.java:275)
	at org.eclipse.pde.api.tools.internal.comparator.ClassFileComparator.collectAllInterfaces(ClassFileComparator.java:774)
	at org.eclipse.pde.api.tools.internal.comparator.ClassFileComparator.getInterfacesSet(ClassFileComparator.java:1894)
	at org.eclipse.pde.api.tools.internal.comparator.ClassFileComparator.checkSuperInterfaces(ClassFileComparator.java:272)
	at org.eclipse.pde.api.tools.internal.comparator.ClassFileComparator.getDelta(ClassFileComparator.java:1026

on Build id: I20180427-2000 after I put in the error logging code. I will investigate this.
Comment 8 Vikas Chandra CLA 2018-04-28 02:41:52 EDT
It recreates with Java 1.8 as well as Java 10.

Simplest steps to recreate this

1) Create a plugin project with at least 1 api
2) Export and set the same as baseline
3) Clean-> Build All
Comment 9 Eclipse Genie CLA 2018-04-29 11:46:09 EDT
New Gerrit change created: https://git.eclipse.org/r/121912
Comment 11 Dani Megert CLA 2018-04-30 11:33:32 EDT
(In reply to Vikas Chandra from comment #8)
> It recreates with Java 1.8 as well as Java 10.
> 
> Simplest steps to recreate this
> 
> 1) Create a plugin project with at least 1 api
> 2) Export and set the same as baseline
> 3) Clean-> Build All

So, what's the conclusion?
Comment 12 Vikas Chandra CLA 2018-05-02 01:13:15 EDT
>So, what's the conclusion?

yet to investigate, Dani !  

Since I was able to recreate it , I disabled the logging since the I build will have too many logging of "Unable to resolve".
Comment 13 Dani Megert CLA 2018-05-02 03:21:48 EDT
(In reply to Vikas Chandra from comment #12)
> >So, what's the conclusion?
> 
> yet to investigate, Dani !  
> 
> Since I was able to recreate it , I disabled the logging since the I build
> will have too many logging of "Unable to resolve".

That's good. I suggest you check whether this is a regression compared to 4.7. If not, I'm fine moving to 4.9.
Comment 14 Vikas Chandra CLA 2018-05-02 05:20:32 EDT
Created attachment 273880 [details]
Added debug code for logging and in launch version, I get this error.

So this is not a regression.
Comment 15 Vikas Chandra CLA 2018-05-02 05:23:35 EDT
However

CoreException: Unable to resolve superclass" 

can be outputted from different locations and there could be multiple issues at hand.

With comment#8, I have found 1 variation of this problem. Comment#0 could be same or different. Also bug 533091 could be because of same reason as comment#8 or different.

I will update my findings regarding comment#8
Comment 16 Vikas Chandra CLA 2018-05-21 05:56:23 EDT
>>I will update my findings regarding comment#8

Finally, I got around investigating comment#8.

The reason for this particular problem was that there was a plugin test -  lets say PluginA,  in baseline which uses eclipse APIs. In the the workspace we have the same plugin Plugin A as source.

During API analysis, API tools tries to fetch API classes of eclipse used in PluginA from the API baseline which just has PluginA ( + the system library). API tools is  unable to get those eclipse API from the baseline and hence outputs this problem. Keeping a baseline which has eclipse plugins+PluginA solves this problem.
Apart from the "Unable to resolve", other symptom of this will be API tool related analysis will be not reported for cases involving eclipse API. Keeping all the components involved in API analysis should be kept in baseline for proper analysis. This behavior is same since long and can be considered as work as designed.

I do actually have a bad workaround ( see next comment) wherein I look for those APIs in workspace baseline and that solves this particular problem ( but I don't recommend this). May be adding dependent components in baseline can be an option ( but I don't recommend putting that either especially in RC2 since that would be design change and can have unexpected repercussion).

A mid-way approach could be just giving a better message to the user that "eclipse.API is not found in the API baseline. Consider adding a baseline that contains eclipse.API as well"
 

All said and done, this is the investigation for scenario of comment#8 and other scenarios may or may not be similar and may require separate investigation.
Comment 17 Vikas Chandra CLA 2018-05-21 05:57:05 EDT
Created attachment 274114 [details]
Just temporary code to back up my last comment
Comment 18 Dani Megert CLA 2018-05-21 10:09:16 EDT
(In reply to Vikas Chandra from comment #16)
> A mid-way approach could be just giving a better message to the user that
> "eclipse.API is not found in the API baseline. Consider adding a baseline
> that contains eclipse.API as well"

I think currently we don't report an error anyway.

Suggest to move to 4.9.
Comment 19 Vikas Chandra CLA 2018-05-21 10:39:53 EDT
>> we don't report an error anyway.

Yes, this exception is muted.
Comment 20 Eclipse Genie CLA 2018-11-12 08:30:20 EST
New Gerrit change created: https://git.eclipse.org/r/132282
Comment 22 Vikas Chandra CLA 2018-11-12 08:36:22 EST
I believe there are at least 2 variations to this

comment#7
Explained in comment#16 and comment#17 . Not a regression and probably nothing needs to be done here.

comment#0
I am unable to recreate this and this looks more problematic ( since all dependent plugins are there in baseline). I have put the logging code so see if I can reproduce in the next I build on-wards.
Comment 23 Andrey Loskutov CLA 2018-11-14 16:32:27 EST
(In reply to Eclipse Genie from comment #21)
> Gerrit change https://git.eclipse.org/r/132282 was merged to [master].
> Commit:
> http://git.eclipse.org/c/pde/eclipse.pde.ui.git/commit/
> ?id=046df7e2d790cda4537d0870d283418bf636cc2d

Vikas, I have 1216 errors reported by this patch on  a full build of the workspace and my log overflows (3.7 MB now), so I had to increase log size.

If we want this, we should have it a tracing option, disabled by default.
Comment 24 Andrey Loskutov CLA 2018-11-14 16:35:25 EST
Created attachment 276580 [details]
log file with gazillions of API errors
Comment 25 Eclipse Genie CLA 2018-11-14 16:47:05 EST
New Gerrit change created: https://git.eclipse.org/r/132458
Comment 27 Vikas Chandra CLA 2018-11-15 06:41:47 EST
>>Vikas, I have 1216 errors reported by this patch on  a full build of the work

Exactly what I wanted !

Can you please give a list of plugins in your workspace ( with exact baseline you are using)?
Comment 28 Vikas Chandra CLA 2018-11-15 06:43:15 EST
Meanwhile I will try to load as many repos as possible and try it myself.
Comment 29 Vikas Chandra CLA 2018-11-16 02:38:49 EST
Created attachment 276586 [details]
Repos used

I used all plugins in repos attached and still couldnt get this in error log in 
Version: 2018-12 (4.10)
Build id: I20181114-1345


Andrey, any tips to recreate this on build I20181114-1345?
Comment 30 Andrey Loskutov CLA 2018-11-16 07:59:55 EST
Created attachment 276594 [details]
extra bundles in my SDK

(In reply to Vikas Chandra from comment #29)
> Created attachment 276586 [details]
> Repos used
> 
> I used all plugins in repos attached and still couldnt get this in error log
> in 
> Version: 2018-12 (4.10)
> Build id: I20181114-1345
> 
> 
> Andrey, any tips to recreate this on build I20181114-1345?

I will try to do this over the weekend (I see it on my private Windows notebook only).

Just to be sure: I'm still using Java 8 as my runtime JDK, if this is important to reproduce. May be some installed plugins are guilty (I have SDK + few selected, see attached file which you can import into your SDK).

But this can be really dependent on the opened workspace projects - I have different workspaces on Windows/Linux workstations, and I see this only on Windows one.
Comment 31 Andrey Loskutov CLA 2018-11-18 14:49:41 EST
So tried the latest nightly build, still the same issue (tons of errors like that) :

null
org.eclipse.pde.api.tools
Error
Sun Nov 18 20:45:55 CET 2018
Error logged from API Tools Core:

org.eclipse.core.runtime.CoreException: Unable to resolve superclass org.eclipse.core.runtime.CoreException for org.eclipse.debug.core.DebugException
	at org.eclipse.pde.api.tools.internal.model.ApiType.getSuperclass(ApiType.java:278)
	at org.eclipse.pde.api.tools.internal.comparator.ClassFileComparator.collectAllInterfaces(ClassFileComparator.java:886)
	at org.eclipse.pde.api.tools.internal.comparator.ClassFileComparator.getInterfacesSet(ClassFileComparator.java:2008)
	at org.eclipse.pde.api.tools.internal.comparator.ClassFileComparator.checkSuperInterfaces(ClassFileComparator.java:300)
	at org.eclipse.pde.api.tools.internal.comparator.ClassFileComparator.getDelta(ClassFileComparator.java:1140)
	at org.eclipse.pde.api.tools.internal.provisional.comparator.ApiComparator$2.visit(ApiComparator.java:774)
	at org.eclipse.pde.api.tools.internal.model.ArchiveApiTypeContainer.accept(ArchiveApiTypeContainer.java:204)
	at org.eclipse.pde.api.tools.internal.provisional.comparator.ApiComparator.internalCompare(ApiComparator.java:659)
	at org.eclipse.pde.api.tools.internal.provisional.comparator.ApiComparator.compare(ApiComparator.java:289)
	at org.eclipse.pde.api.tools.internal.provisional.comparator.ApiComparator.compare(ApiComparator.java:315)
	at org.eclipse.pde.api.tools.internal.builder.BaseApiAnalyzer.checkCompatibility(BaseApiAnalyzer.java:1446)
	at org.eclipse.pde.api.tools.internal.builder.BaseApiAnalyzer.analyzeComponent(BaseApiAnalyzer.java:258)
	at org.eclipse.pde.api.tools.internal.builder.ApiAnalysisBuilder.buildAll(ApiAnalysisBuilder.java:787)
	at org.eclipse.pde.api.tools.internal.builder.ApiAnalysisBuilder.build(ApiAnalysisBuilder.java:372)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:833)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:220)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:263)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:316)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:319)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:371)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:392)
	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:154)
	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:244)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

I've closed all projects except 

org.eclipse.jdt.debug
org.eclipse.jdt.debug.ui
org.eclipse.debug.core
org.eclipse.debug.ui

I assumed something with the 4.9 baseline I have doesn't work, so I've re-created it using 4.10 PDE from 4.9 Windows SDK, with no success, still errors.
Comment 32 Vikas Chandra CLA 2018-11-20 01:26:02 EST
Unable to recreate with


org.eclipse.jdt.debug
org.eclipse.jdt.debug.ui
org.eclipse.debug.core
org.eclipse.debug.ui

on 
Version: 2018-12 (4.10)
Build id: I20181114-1345

I used both IBM 1.8 and oracle 1.8 JRE.


Are you consistently able to recreate or does it happen once in a while ( on I20181114-1345 which has logging enabled)
Comment 33 Andrey Loskutov CLA 2018-11-20 01:52:55 EST
(In reply to Vikas Chandra from comment #32)
> Unable to recreate with
> 
> 
> org.eclipse.jdt.debug
> org.eclipse.jdt.debug.ui
> org.eclipse.debug.core
> org.eclipse.debug.ui
> 
> on 
> Version: 2018-12 (4.10)
> Build id: I20181114-1345
> 
> I used both IBM 1.8 and oracle 1.8 JRE.
> 
> 
> Are you consistently able to recreate or does it happen once in a while ( on
> I20181114-1345 which has logging enabled)

Yes, I consistently see it with Build id: I20181117-0600 (I've enabled tracing).
I've already recreated JDT index few times and re-built the API baseline from scratch, so it must be something else. The workspace I use is pretty old one, where I usually do all the SDK work.

While writing this, I've realized that one thing is always workspace related is "External Plugin Libraries Project" which I've now deleted and everything seem to work now. Can it be, that some "old" bundles were found in that project? If yes, how they are cleaned up, if they are cleaned up at all?
Comment 34 Vikas Chandra CLA 2018-11-27 08:34:48 EST
I tried with that 4 plugins
and "External Plugin Libraries Project" 
and still I was unable to recreate this.

Can you try with a fresh workspace ( with tracing enabled) and find a way to consistently recreate it. That should help me fix this.
Comment 35 Vikas Chandra CLA 2018-11-30 06:02:46 EST
Tried again. Still unable to recreate it !
Comment 36 Vikas Chandra CLA 2019-02-19 03:37:06 EST
I tried to put a breakpoint on CoreException ( caught and uncaught) and ran API analysis and I was unable to recreate this.
Comment 37 Eclipse Genie CLA 2019-03-16 10:06:35 EDT
New Gerrit change created: https://git.eclipse.org/r/138877
Comment 39 Andrey Loskutov CLA 2019-03-31 11:27:06 EDT
(In reply to Eclipse Genie from comment #38)
> Gerrit change https://git.eclipse.org/r/138877 was merged to [master].
> Commit:
> http://git.eclipse.org/c/pde/eclipse.pde.ui.git/commit/
> ?id=f9eab08330d86c6afcf11c37b3b0a49a97c9c664

After this patch (still observing tons of errors) my stack shows that the PDE always fails here (for all "Problems encountered comparing class file" errors it reports during API build):

IApiComponent[] components = getApiComponent().getBaseline().resolvePackage(getApiComponent(), packageName);
if (components == null || components.length == 0) {
	throw new CoreException(createUnresolvedSuperClassStatus(qName));
}

So why should the baseline not have the packages like org.eclipse.jface.viewers or org.eclipse.core.runtime or other gazillion of packages?

org.eclipse.core.runtime.CoreException: Unable to resolve superclass org.eclipse.jface.viewers.ISelectionProvider for org.eclipse.compare.CompareViewerPane
	at org.eclipse.pde.api.tools.internal.model.ApiType.resolveSuperType(ApiType.java:293)
	at org.eclipse.pde.api.tools.internal.model.ApiType.getSuperInterfaces(ApiType.java:259)
	at org.eclipse.pde.api.tools.internal.comparator.ClassFileComparator.collectAllInterfaces(ClassFileComparator.java:867)
	at org.eclipse.pde.api.tools.internal.comparator.ClassFileComparator.collectAllInterfaces(ClassFileComparator.java:887)
	at org.eclipse.pde.api.tools.internal.comparator.ClassFileComparator.getInterfacesSet(ClassFileComparator.java:2021)
	at org.eclipse.pde.api.tools.internal.comparator.ClassFileComparator.checkSuperInterfaces(ClassFileComparator.java:300)
	at org.eclipse.pde.api.tools.internal.comparator.ClassFileComparator.getDelta(ClassFileComparator.java:1153)
	at org.eclipse.pde.api.tools.internal.provisional.comparator.ApiComparator.compare(ApiComparator.java:430)
Comment 40 Vikas Chandra CLA 2019-04-01 00:05:35 EDT
>> why should the baseline not have the packages like org.eclipse.jface.viewers >>or org.eclipse.core.runtime or other gazillion of packages?


The baseline also has the dependent plugins/packages for API tool analysis .
Comment 41 Andrey Loskutov CLA 2019-04-02 03:16:14 EDT
(In reply to Vikas Chandra from comment #40)
> >> why should the baseline not have the packages like org.eclipse.jface.viewers >>or org.eclipse.core.runtime or other gazillion of packages?
> 
> 
> The baseline also has the dependent plugins/packages for API tool analysis .

If it was a question: I *hope*. I've created baseline from an extracted Eclipse SDK zip. Whatever tooling got from that SDK build should be in the baseline, and I assume such basic things like org.eclipse.core.runtime should be available.
Comment 42 Vikas Chandra CLA 2019-04-02 06:45:29 EDT
I thought I had answered the question but looks like I misunderstood your question.

Can you give steps for comment#39. I will investigate and let you know.
Comment 43 Eclipse Genie CLA 2021-05-04 16:27:10 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 44 Eclipse Genie CLA 2023-04-26 12:20:23 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.