Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 81679 - The type org.eclipse.swt.internal.gtk.GdkEventKey cannot be resolved when using Java 5.0
Summary: The type org.eclipse.swt.internal.gtk.GdkEventKey cannot be resolved when usi...
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Linux-GTK
: P3 major with 6 votes (vote)
Target Milestone: ---   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-20 15:35 EST by Jason M. Fox CLA
Modified: 2005-09-23 12:52 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 Jason M. Fox CLA 2004-12-20 15:35:17 EST
System Configuration:

 RedHat Linux
 Eclipse M4 (linux, gtk)


Summary:

The class org.eclipse.swt.internal.gtk.GdkEventKey in the swt-pi.jar (in the
org.eclipse.swt.gtk fragment) cannot be resolved when the compiler compliance
level is set to 5.0.  If the compliance level is set to 1.4 the compiler does
not issue any warnings or errors.


To Reproduce:

Using a fresh installation of eclipse M4 (linux, gtk) in a fresh workspace, the
problem can be reproduced by doing the following:
1. Create a plug-in project
2. Create a java class file in the plug-in project with the contents:

package your.package.name.here;

import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;

public class MyCanvas extends Canvas {
	public MyCanvas(Composite parent, int style) {
		super(parent, style);
		
		addPaintListener(new PaintListener() {
			public void paintControl(PaintEvent e) {
			}
		});
	}
}

3. MyCanvas should compile using the default compiler compliance level of 1.4. 
If you change the compliance level to 5.0 and re-compile, the following error is
reported:

"The type org.eclipse.swt.internal.gtk.GdkEventKey cannot be resolved. It is
indirectly referenced from required .class files"

4. The "workaround" when using compliance level 5.0 is to add the swt-pi.jar to
the build path as an external jar.  However, there should be no need to do this
step since everything works when using compliance level 1.4.
Comment 1 Jason M. Fox CLA 2004-12-20 15:38:41 EST
One small addition to the "System Configuration" section of my original post:

 We are using version 9.0 of Redhat Linux
Comment 2 Wassim Melhem CLA 2005-01-06 14:56:48 EST
PDE does/must not put JARs from fragments of swt onto the classpath of clients 
of swt (see bug 45767 for the long discussion as to why).

Not sure why the difference between the two compiler levels.  Moving to 
jdt/core to address this issue alone.  
Comment 3 Jerome Lanneluc CLA 2005-01-11 07:45:35 EST
I cannot reproduce neither using 3.1 M4 neither HEAD. Do you have more details ?
Comment 4 Jason M. Fox CLA 2005-01-11 12:45:00 EST
I really do not have many more details since I don't know exactly what is
causing the problem.  I can say that I am using the download
"eclipse-SDK-3.1M4-linux-gtk.zip".

I have tried this on both a linux RH9 machine as well as a core-3 machine.

Before running the example, I do a 'rm -rf ~/.eclipse' and always use a fresh
workspace (hopefully preventing any cross contamination from other eclipse
installations).

The other detail I can provide is that on each machine used to reproduce the
bug, there is also an installation of eclipse 3.1M3 that I have previously used
(but as stated above, I have tried to eliminate any remnants of).
Comment 5 Olivier Thomann CLA 2005-02-10 14:30:02 EST
Can you reproduce with latest integration build?
Comment 6 Jason M. Fox CLA 2005-02-10 15:07:19 EST
(In reply to comment #5)
> Can you reproduce with latest integration build?

I'll give it a try and post the results.
Comment 7 Jason M. Fox CLA 2005-02-10 15:32:34 EST
(In reply to comment #5)
> Can you reproduce with latest integration build?

YES ... I just downloaded the latest integration build (Integration Build:
I20050209-0800) and tried this on a system running RH9.

Once again, the problem exists only when the java compiler compliance level is
set to 5.0.

Are you able to reproduce the problem on your end on a linux machine running gtk?
Comment 8 Philipe Mulet CLA 2005-02-10 16:20:28 EST
Looks like some compiler algorithm in 1.5 mode is requiring more resolution than
in 1.4 mode, and thus asking to resolve a missing type (which isn't requested in
1.4 mode). 

To be investigated during testpass for M5 (no commitment)
Comment 9 Marshall Culpepper CLA 2005-03-15 18:58:20 EST
I am receiving this same compile error (w/ 1.5 compliance switched to on in
GTK/Linux) in Eclipse 3.1m5a. Is there any plan to resolve this issue? It is a
major show stopper for us.
Comment 10 Billy Biggs CLA 2005-03-15 19:01:36 EST
Note if you're trying to reproduce this that the win32 fragment only has one
.jar (swt.jar) while the GTK+ fragment has multiple jar files.
Comment 11 Jason M. Fox CLA 2005-04-21 19:55:43 EDT
FYI -- after upgrading to eclipse 3.1 M6, we are no longer experiencing this bug.
Comment 12 Billy Biggs CLA 2005-04-21 20:00:39 EDT
It could just be because the SWT fragments are now all single .jar files as we
moved to the plugin-as-jar format.
Comment 13 Kent Johnson CLA 2005-09-23 12:52:43 EDT
Please reopen if this is still a problem