Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 251882

Summary: [compiler] Eclipse compiler reports syntax error as class that cannot be resolved
Product: [Eclipse Project] JDT Reporter: Heath Borders <heath.borders>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: minor    
Priority: P3 CC: Olivier_Thomann, philippe_mulet, stephan.herrmann
Version: 3.4   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description Heath Borders CLA 2008-10-23 13:49:01 EDT
Build ID: M20080911-1700

Steps To Reproduce:
File foo:

public class Foo {
  public static void main(String[] args) {
    (Boolean)args.getClass();
  }
}

javac reports the following errors:
1. ERROR in Test.java (at line 5)
        (Boolean)args.getClass();
                ^
Syntax error, insert "AssignmentOperator Expression" to complete Assignment
----------
2. ERROR in Test.java (at line 5)
        (Boolean)args.getClass();
                ^
Syntax error, insert ";" to complete BlockStatements

Eclipse reports the following error:
Boolean cannot be resolved 


More information:
Comment 1 Olivier Thomann CLA 2008-10-23 13:56:38 EDT
The third error is reported when the statement recovery is on.
Comment 2 Philipe Mulet CLA 2008-10-24 05:06:28 EDT
Eclipse errors are:

----------
1. ERROR in X.java (at line 3)
	(Boolean)args.getClass();
	^^^^^^^^^
Boolean cannot be resolved
----------
2. ERROR in X.java (at line 3)
	(Boolean)args.getClass();
	        ^
Syntax error, insert "AssignmentOperator Expression" to complete Assignment
----------
3. ERROR in X.java (at line 3)
	(Boolean)args.getClass();
	        ^
Syntax error, insert ";" to complete BlockStatements
----------



Note: batch compiler statement recovery is not enabled by default. Why is that so ?
Comment 3 Heath Borders CLA 2010-04-26 11:55:30 EDT
Any chance for 3.6?
Comment 4 Olivier Thomann CLA 2010-04-26 11:57:42 EDT
What are you expecting for 3.6?
Comment 5 Heath Borders CLA 2010-04-26 12:04:12 EDT
I just tested 3.6M6 and I still get the message "Boolean cannot be resolved".  javac's error message is better.  If this is too esoteric, I don't care if its marked wontfix or if it is delayed.
Comment 6 Stephan Herrmann CLA 2015-11-23 17:46:14 EST
ASTView shows recovered AST like this


    (Boolean) = $missing$;
    args.getClass();

i.e, we end up with assignment whose LHS is a parethesized expression. Surely that structure is not anticipated during resolveType().
Comment 7 Eclipse Genie CLA 2020-03-15 13:26:50 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. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. 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.