| Summary: | [1.8][compiler] Annotation preceding the first dimension in array creation expression is added to the type | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Jay Arthanareeswaran <jarthana> | ||||
| Component: | Core | Assignee: | Jay Arthanareeswaran <jarthana> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | srikanth_sankaran | ||||
| Version: | 3.8 | Flags: | srikanth_sankaran:
review+
|
||||
| Target Milestone: | BETA J8 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows 7 | ||||||
| Whiteboard: | |||||||
| Bug Depends on: | |||||||
| Bug Blocks: | 391894 | ||||||
| Attachments: |
|
||||||
|
Description
Jay Arthanareeswaran
At first glance, looks like the method invocation node bar() is inserting an empty annotation via consumeZeroTypeAnnotations(). Need to figure out what is the best way out. The type annotation + length stacks are incorrect. We have a problem with
message sends.
See that this program is silently accepted by eclipse, while javac rejects it.
public class X {
public void foo() {
int x = @Marker bar();
}
public int bar() {
return 2;
}
}
Problem appears to be in consumeMethodInvocationName(). If you change the call
to X.bar() and change bar() to static things work ok.
The else {} blocks diagnoses misplaced annotations while if doesn't.
When you fix this, see if the variants of consumeMethodInvocationName also
need a fix and add suitable test cases, both good and bad.
Created attachment 226328 [details]
Proposed fix
Patch with regression tests.
Patch looks good. I would simply inline the new method rejectTypeAnnotationsOnMethodInvocation at the call site and get rid of it. Thanks. (In reply to comment #4) > Patch looks good. I would simply inline the new method > rejectTypeAnnotationsOnMethodInvocation at the call site and get rid of it. > Thanks. I have made this change and released the fix. |