Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 228927 - [compiler] Unhelpful errormessage when extending a class that has superclasses in an invisible bundle
Summary: [compiler] Unhelpful errormessage when extending a class that has superclasse...
Status: CLOSED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT Core Triaged CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-25 14:18 EDT by Martin Oberhuber CLA
Modified: 2018-11-02 12:56 EDT (History)
1 user (show)

See Also:


Attachments
testcase (3.54 KB, text/plain)
2010-01-27 07:51 EST, Ayushman Jain CLA
no flags Details
plug-in projects Foo, bar and client (10.29 KB, application/x-zip-compressed)
2010-02-17 05:19 EST, Ayushman Jain CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Oberhuber CLA 2008-04-25 14:18:16 EDT
Consider following setup:

foo.bundle:
   class Invisible {
   }

bar.bundle: requires foo.bundle (WITHOUT reexport)
   class Visible extends Invisible {
   }

client.bundle: requires bar.bundle (but NOT foo.bundle)
  class Client extends Visible {
  }

In this case, JDT shows the following problem marker:

"The type bar.bundle.Visible cannot be resolved. It is indirectly referenced
 from required .class files."

I think this is indirect, because class Visible is visible and can be resolved -- this can be proven by writing 
   Visible v = new Visible();
which works perfectly well. The problem is really, that a superclass of Visible can not be resolved. I think the error message should be like:

"The type bar.bundle.Visible cannot be resolved. A required superclass is
 not on the classpath."
Comment 1 Jerome Lanneluc CLA 2008-05-05 05:03:40 EDT
Can you please specify the build id you're using?
Comment 2 Martin Oberhuber CLA 2008-05-05 06:15:45 EDT
Build ID: I20080422-0800
Comment 3 Olivier Thomann CLA 2010-01-05 10:00:47 EST
Srikanth, please investigate if we can make the distinction when not being able to resolve the superclass.
Comment 4 Ayushman Jain CLA 2010-01-27 07:51:57 EST
Created attachment 157387 [details]
testcase

Here's a testcase to reproduce the problem.
Comment 5 Srikanth Sankaran CLA 2010-02-09 00:41:22 EST
(In reply to comment #4)
> Created an attachment (id=157387) [details]
> testcase
> 
> Here's a testcase to reproduce the problem.

Ayush, this doesn't quite "reproduce" the problem.
This test case elicits the error message:

"The type p1.Invisible cannot be resolved. It is indirectly referenced from required .class file"

which in itself is reasonable cf the message in comment# 0.

Could you closely align the test with what is described
in comment#0 and attach a test ? If you are unable to
reproduce the exact message, perhaps this issue is already
fixed by another bug, post a patch with what you tried
anyways -- Thanks.
Comment 6 Ayushman Jain CLA 2010-02-17 05:19:59 EST
Created attachment 159282 [details]
plug-in projects Foo, bar and client

Actually, even if i try to reproduce this using plugin projcts, i get the same error - The type foo.Invisible cannot be resolved. It is indirectly referenced from required .class files.

I agree that it doesnt reproduce the problem as stated. The bug seems invalid in the wake of these observations.
Comment 7 Martin Oberhuber CLA 2010-02-17 06:06:13 EST
(In reply to comment #6)
I do think that at least one aspect of the bug is still valid, and I do think that your test cases correctly exhibit that problem aspect.

From the original description, it was incorrect that the error said
   "cannot resolve class Visible"
now it seems to say
   "cannot resolve class Invisible"
which is correct, probably due to some other bug fix.

But even with this issue fixed (so the message is technically correct), it remains a source of confusion is that the error message is not helpful. I'm changing the bug summary to indicate this.

When I, as a Programmer, write code 
   class Foo extends Visible {
and see the error
   "cannot resolve class Invisible. It is indirectly referenced
    from required .class files"
I neither know where or what class Invisible is, nor who references it and where. I also do not know how to resolve the issue (not checking whether a
quickfix is available here).

The error message would be more helpful if it said:

   "cannot resolve class Invisible. It is indirectly referenced
    from .class files required by superclasses of Visible."

since the "extends Visible" is the location of the problem marker, it makes sense to have the error message specify how the error relates to Visible.


> Created an attachment (id=159282) [details]
> plug-in projects Foo, bar and client
> 
> Actually, even if i try to reproduce this using plugin projcts, i get the same
> error - The type foo.Invisible cannot be resolved. It is indirectly referenced
> from required .class files.
> 
> I agree that it doesnt reproduce the problem as stated. The bug seems invalid
> in the wake of these observations.
Comment 8 Eclipse Genie CLA 2018-11-02 12:56:44 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.