Bug 123476 - [compiler] misleading error message (root cause not reported)
Summary: [compiler] misleading error message (root cause not reported)
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.2 M6   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-11 12:57 EST by Art Dyer CLA
Modified: 2006-03-28 07:58 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 Art Dyer CLA 2006-01-11 12:57:09 EST
Discovered on 3.1, still present as of 3.2M4.

Put the code below into the appropriate files, then compile Foo.java using the batch compiler.  Although the compiler must compile Bar in order to compile Foo, no errors are reported against Bar.java.  Only the following:

  1. ERROR in Foo.java
   (at line 5)
    return new Bar(5);
           ^^^^^^^^^^
  The constructor Bar(int) is undefined

If you compile Bar.java explicitly, you see that the real problem (#3 below) is misuse of the reserved word 'class':

  1. ERROR in Bar.java
   (at line 2)
    {
    ^
  Syntax error, insert "}" to complete ClassBody
  ----------
  2. ERROR in Bar.java
   (at line 3)
    Bar(int class)
            ^^^^^
  Syntax error on token "class", invalid VariableDeclaratorId
  ----------
  3. ERROR in Bar.java
   (at line 3)
    Bar(int class)
    {
    }
            ^^^^^^^^^^^^^^^^
  Syntax error on tokens, delete these tokens
  ----------
  4. ERROR in Bar.java
   (at line 6)
    }
    ^
  Syntax error on token "}", delete this token

// Foo.java
public class Foo
{
  static Object x()
  {
    return new Bar(5);
  }
}

// Bar.java
public class Bar
{
  Bar(int class)
  {
  }
}
Comment 1 Philipe Mulet CLA 2006-03-27 08:23:29 EST
Unless using option "-proceedOnError" on command line, the batch compiler is indeed not surfacing detected errors in files which are queued for compile, as Bar in this scenario.
Comment 2 Philipe Mulet CLA 2006-03-27 09:31:36 EST
Added support to batch compiler.
Added BatchCompilerTest#test052.

Fixed
Comment 3 David Audel CLA 2006-03-28 07:58:31 EST
Verified for 3.2 M6 using build I20060328-0010