Bug 277606 - [ErrorHandling] Misleading error
Summary: [ErrorHandling] Misleading error
Status: VERIFIED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4.2   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: 3.6 M1   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-24 08:43 EDT by Jonathan Camilleri CLA
Modified: 2009-08-03 10:05 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Camilleri CLA 2009-05-24 08:43:48 EDT
Build ID: Build id: M20090211-1700

Steps To Reproduce:
Consider the following:

package homenetwork.bkr.training;

import java.awt.Color;
import javax.swing.*; 
/*see http://java.sun.com/javase/6/docs/api/javax/swing/InputMap.html */

@SuppressWarnings("serial")
public class ActionFrame extends JFrame {
	
	public ActionFrame()
	{
		setTitle("ActionTest");
		setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
		
		JPanel buttonPanel = new JPanel();
		
		//define actions
		Action yellowAction = new ColorAction("Yellow", new ImageIcon("C:\\pictures\\yellow-ball.gif", Color.YELLOW);
		Action blueAction = new ColorAction("Blue", new ImageIcon("C:\\pictures\\blue-ball.jpg", Color.BLUE);
		Action redAction = new ColorAction("Red", new ImageIcon("C:\\pictures\\red-ball.jpg", Color.RED);
		
		
		//Add buttons for these actions
		buttonPanel.add(new JButton(yellowAction));
		buttonPanel.add(new JButton(blueAction));
		buttonPanel.add(new JButton(redAction));
		
		//Add panel to frame
		add(buttonPanel);
		
		//Associate the Y, B and R keys with names
		InputMap 
//An error is displayed: InputMap cannot be resolved. Why?
	}
	
	public static final int DEFAULT_WIDTH = 300;
	public static final int DEFAULT_HEIGHT = 200;

}



More information:
NOTE 1: 
Microsoft Windows [Version 6.0.6001]
Copyright (c) 2006 Microsoft Corporation.  All rights reserved.

C:\Users\Administrator>java -version
java version "1.6.0_13"
Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
Java HotSpot(TM) Client VM (build 11.3-b02, mixed mode, sharing)
Comment 1 Benjamin Cabé CLA 2009-05-24 09:05:28 EDT
If you don't write correct Java, I don't really know what you are expecting from the IDE.
If your line only contains "InputMap", the most accurate guess that JDT can do is "oh, one token which is not a Java keyword, Jon must probably mean that 'InputMap' is a variable, but not declared yet"...

It would certainly help if you told us what *you* would expect from the IDE? Perhaps only a "syntax error, insert ; to complete the statement", and no error related to unresolved variable until the line is actually complete?
Comment 2 Jonathan Camilleri CLA 2009-05-24 09:14:08 EDT
If you say so.
Comment 3 Olivier Thomann CLA 2009-05-26 13:59:24 EDT
Please describe what you expect the IDE to do in your case.
Comment 4 Jonathan Camilleri CLA 2009-05-26 14:04:34 EDT
Well I would like the IDE just to surround the statement with try/catch block and do nothing else.
Comment 5 Olivier Thomann CLA 2009-07-22 14:02:01 EDT
Closing as INVALID.
The error is reported by the reconciler because the statement is not complete yet.
No plan to change this.
Comment 6 Frederic Fusier CLA 2009-08-03 10:05:45 EDT
Verified for 3.6M1