Bug 134476 - [compiler] Compiler can't find methods
Summary: [compiler] Compiler can't find methods
Status: RESOLVED DUPLICATE of bug 134839
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 RC1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-03 05:54 EDT by Aaron Digulla CLA
Modified: 2006-04-27 05:06 EDT (History)
0 users

See Also:


Attachments
Screenshot which shows the problem (19.88 KB, image/jpeg)
2006-04-03 05:56 EDT, Aaron Digulla CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aaron Digulla CLA 2006-04-03 05:54:34 EDT
I've upgraded to 3.0M6 today. When I compile, I get very strange errors (see attached image).

Only a few methods in my project (roughly 1 million lines of code) is affected. The methods can be in the same class (as in the image) or in another one.

My compiler settings:

Compliance level: 1.3
.class file compat: 1.1
Source compat: 1.3
Disallow assert: Warn
Disallow enum: Warn

My first guess would be that there is a problem with the generated method tables. I've read somewhere that the method tables are optimized for Java 1.5 but it seems that this interferes with 1.3.

Building a small test case didn't show the error. But the error could be fixed by adding

protected void waitForMessage2 () {};

just below the definition of the abstract waitForMessage().
Comment 1 Aaron Digulla CLA 2006-04-03 05:56:10 EDT
Created attachment 37496 [details]
Screenshot which shows the problem
Comment 2 Aaron Digulla CLA 2006-04-04 02:56:39 EDT
Just noticed a typo: That should be 3.*2*M6, of course :-)
Comment 3 Philipe Mulet CLA 2006-04-04 03:01:27 EDT
Steps to reproduce are needed to further investigate.
Comment 4 Philipe Mulet CLA 2006-04-04 03:04:50 EDT
Method tables are not specifically optimized for Java5.
Since M6, methods are internally sorted, and binary search is performed. Maybe a bug got introduced in then, but our testing doesn't exhibit it (we do compile way more code during our testing than 1 million lines).

So unless you cannot provide steps to recreate, then there is little we can do, unless someone else reports the same issue with steps.

Couldn't you provide the source in a form or another ?
Comment 5 Aaron Digulla CLA 2006-04-04 11:48:57 EDT
Unfortunately, the code is part of an internal, commercial project which I must not disclose.

Can you please tell me where in the code this sorting happens (plugin, filename, method)?

Also at which place in the Eclipse source code is the squiggle in the text editor generated? I could set a breakpoint there to see what the compiler *thinks* is in the method table.
Comment 6 Philipe Mulet CLA 2006-04-04 13:07:56 EDT
This isn't something easy to find out unfortunately.
Then your best chance is to narrow the problem to something simpler if possible.
Comment 7 Aaron Digulla CLA 2006-04-04 14:22:54 EDT
As I said, it happens at three places in a million lines of code. When I add another method, the error goes away.

Clean all, force rebuild, closing and reopen the project and restarting Eclipse have no effect.

I'm pretty sure it must be somewhere in the new binary sort code.

Tomorrow, I'll play with compiler settings (1.4 and 1.5) plus I'll see what happens when I delete a method.

Maybe I can create a test case which contains only the method names but no code. My boss might accept that I send you the single file, then.
Comment 8 Aaron Digulla CLA 2006-04-05 03:19:58 EDT
After some experiments, I found the following:

- The bug wasn't present in 3.2M5a. It must have something to do with the latest changes to the Java compiler.

- Reordering the methods in the source doesn't affect the bug.

- Adding fields has no effect.

- Adding another method affects the bug.

- When I add xxx(), the bug goes away.

- When I add a(), the bug goes away.

- I experimented with different flags (public, private, static). It seems that only the method name has an effect.

- When I duplicate a() (so I get a "duplicate method name error"), the bug appears again.

- Renaming the method to waitForMessage2() has no effect.

- Renaming the method to aaa() fixes the bug

- Changing the throws clause has no effect

- Changing the class tree (class xxx extends yyy) has an effect

- Changing the class name has no effect

- Setting the generated .class files compatibility from 1.1 to 1.3 fixes it

- 1.2 works as well

- 1.1 doesn't work

Can you create a patched version which doesn't sort the methods when 1.1-mode is selected?
Comment 9 Philipe Mulet CLA 2006-04-05 06:02:42 EDT
Not really. Sorting is expected everywhere now. However, the target difference is an interesting hint.

Will investigate, thanks for the info.
Comment 10 Philipe Mulet CLA 2006-04-05 07:56:38 EDT
We may have a test case, see bug 134839.
Once it gets fixed, Aaron, can you grab the corresponding nightly build and assess if it also addresses your problem ? Will cc'you on bug 134839
Comment 11 Philipe Mulet CLA 2006-04-05 09:57:59 EDT
Fix got released to HEAD, a patch will be posted asap (see bug 134839).
Will assume this is a dup of bug 134476.
Pls consider the patch, and reopen this issue in case the patch doesn't correct your scenario.

*** This bug has been marked as a duplicate of 134839 ***
Comment 12 Aaron Digulla CLA 2006-04-27 04:14:14 EDT
The bug is fixed in 3.2RC1a

I can also confirm that it was related to an abstract class, so the cause seems in fact to be the same as bug 134839.
Comment 13 Philipe Mulet CLA 2006-04-27 05:06:43 EDT
Thanks for confirming