Bug 35396 - Compiler error in RC2
Summary: Compiler error in RC2
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows XP
: P3 critical (vote)
Target Milestone: 2.1 RC4   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-03-20 14:56 EST by Randy Hudson CLA
Modified: 2003-03-21 04:59 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Randy Hudson CLA 2003-03-20 14:56:44 EST
The following code compiles cleanly in RC2, but should fail:

static {
	Display display = Display.getCurrent();
	PaletteData pData = new PaletteData(0xFF, 0xFF00, 0xFF0000);
	RGB rgb = ColorConstants.button.getRGB();
	int fillColor = pData.getPixel(rgb);
	ImageData iData = new ImageData(1, 1, 24, pData);
	iData.setPixel(0, 0, fillColor);
	iData.setAlpha(0, 0, 200);
	TRANSPARENCY = new Image(display, iData);
}

private static final Image TRANSPARENCY;

This is a regression (or maybe some preference I don't know about).  Eclipse 
2.0.2 recognizes the error correctly.
Comment 1 Randy Hudson CLA 2003-03-20 15:02:43 EST
The compilation error, according to however releng is building GEF, is:
1. ERROR 
in /builds/gefbuilder/eclipse/plugins/org.eclipse.gef/src/org/eclipse/gef/intern
al/ui/palette/editparts/PaletteScrollBar.java (at line 52)
	TRANSPARENCY = new Image(display, iData);
	^^^^^^^^^^^^
Cannot reference a field before it is defined
Comment 2 Philipe Mulet CLA 2003-03-20 15:09:50 EST
We fixed the compiler since 2.0 to match the spec. Please see bug 26604.
Comment 3 Philipe Mulet CLA 2003-03-20 15:15:41 EST
Closing