Bug 179477 - [compiler] problem in first element of array initializer suppresses further problems
Summary: [compiler] problem in first element of array initializer suppresses further p...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: 3.3 M7   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 156731
  Show dependency tree
 
Reported: 2007-03-27 06:28 EDT by Markus Keller CLA
Modified: 2007-04-27 07:29 EDT (History)
0 users

See Also:


Attachments
Proposed patch (6.98 KB, patch)
2007-03-27 09:38 EDT, Philipe Mulet CLA
no flags Details | Diff
Second part of the patch (for regression induced) (1.16 KB, patch)
2007-03-29 07:54 EDT, Philipe Mulet CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2007-03-27 06:28:09 EDT
N20070327-0010

Problems in the first element of an array initializer suppress problems in subsequent elements:

public class Try {
    String[] m(String arg) {
        System.out.println(argument + argument);
        return new String[] { argument + argument, argument/*no problem*/ };
    }
}

I would expect that the last 'argument' is also flagged as error. This would e.g. allow the 'Rename In File' quick assist to include it when started on the first 'argument'.
Comment 1 Philipe Mulet CLA 2007-03-27 07:14:07 EDT
We could indeed by a little more fault tolerant, and keep trying to report more errors at once (as we usually try to do where it makes sense).
Comment 2 Philipe Mulet CLA 2007-03-27 07:29:43 EDT
Added ArrayTest#test013
Comment 3 Philipe Mulet CLA 2007-03-27 09:38:06 EDT
Created attachment 62086 [details]
Proposed patch
Comment 4 Philipe Mulet CLA 2007-03-27 09:38:32 EDT
Released for 3.3M7.
Fixed
Comment 5 Olivier Thomann CLA 2007-03-28 09:28:43 EDT
Test org.eclipse.jdt.ui.tests.quickfix.UnresolvedVariablesQuickFixTest#testVarInAnnotation3
needs to be updated.
Comment 6 Olivier Thomann CLA 2007-03-28 10:05:02 EDT
The following test case:
public class E {
    public @interface Annot {
        float[] value();
    }
    @Annot(value={x})
    class Inner {
    }
}
now reports two errors instead of one:
x cannot be resolved
The value for annotation attribute E.Annot.value must be a constant expression

Prior to the fix, only the first error was reported. The second error can be seen as a secondary error.
Comment 7 Philipe Mulet CLA 2007-03-29 07:53:38 EDT
Agreed. Fixed the other case as well, added AnnotationTest#test226.
Comment 8 Philipe Mulet CLA 2007-03-29 07:54:17 EDT
Created attachment 62375 [details]
Second part of the patch (for regression induced)
Comment 9 Jerome Lanneluc CLA 2007-04-27 07:29:08 EDT
Verified for 3.3M7 with I20070427-0010