Bug 562914 - Java Build Process reports missing classes, when they are actually there and resolvable.
Summary: Java Build Process reports missing classes, when they are actually there and ...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.15   Edit
Hardware: PC Linux
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2020-05-07 04:31 EDT by Peter Damen CLA
Modified: 2024-04-18 07:17 EDT (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 Peter Damen CLA 2020-05-07 04:31:39 EDT
The Java compiler is reporting that some classes are missing, and is causing compilation to fail. This is generating about 150 errors in a project of 1 million lines of code.

Errors are highlighted on the import statement at the top of the java file, for the classes that are "missing". Although only the package component is underlined in red.

So I have an import:

import com.hof.mi.widgetcanvas.widgettemplate.ImageTemplate;

and only the com.hof.mi.widgetcanvas.widgettemplate component of the import is highlighted with an error. The error is "The import com.hof.mi.widgetcanvas.widgettemplate cannot be resolved"

If I highlight the class name on the import line, and, from the popup menu select: Open Definition, then Eclipse will open the definition.

Throughout the java file there are other errors highlighted where that imported class is used, with the error "ImageTemplate cannot be resolved to a type"

If I remove the import manually from the top of the file, and then hover over the error where that class is used, and from the helper/fix menu choose:

- Import 'ImageTemplate' (com.hof.mi.widgetcanvas.widgettemplate)

The import will reappear at the top of the file, without an error. The errors on references to this class will also disappear.

However, on a full re-build of the project in Eclipse, the same errors will return, on the same classes.



This only happens in 4.15. I recreated the project in both 4.15 and 4.14 using the same procedure (git checkout, create new java project, assign same build libraries), and the errors occur in 4.15, but not in 4.14.

I use Eclipse from the Arch Linux package management system, but I also downloaded 4.15 directly, installed, setup the project, and that had the same problem.

It is interesting to note that this occurs on the latest branch (and similar branches) of our project. Older branches of our our software do not display these errors. There are more source files in the latest branches of our software.

Currently I have had to revert to using 4.14 to continue development .
Comment 1 Stephan Herrmann CLA 2020-05-07 08:16:08 EDT
Thanks for the detailed description.

Unfortunately, this doesn't yet give any hint on how we could investigate.

Ideally you would create and attach a minimal project (or set of projects).

Some minimal bits of information needed:
- what is the relation between the location of the import and the imported class?
  - same project?
  - otherwise: how is the dependency declared?
    - is smth like maven used to declare dependencies?
- java versions:
  - what are the project's compliance settings?
    - if greater or equal 9:
      - are any module-info in the picture?
      - are dependencies on the classpath or modulepath?
  - which JRE is configured as the System Library?
- kind of error
  - is the error shown only in the editor or also in the Problems view?
Comment 2 Eclipse Genie CLA 2022-04-28 08:42:34 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 3 Eclipse Genie CLA 2024-04-18 07:17:17 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.