| Summary: | extract method: problems with bracketed expressions | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Adam Kiezun <akiezun> |
| Component: | UI | Assignee: | Dirk Baeumer <dirk_baeumer> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P4 | CC: | Olivier_Thomann |
| Version: | 2.0 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 2000 | ||
| Whiteboard: | |||
|
Description
Adam Kiezun
don't know if it is related but you can't extract the following neither: int u= new A[/*[*/1+ 3/*[*/].length; however, eveything is fine here: Object y= new A[/*[*/1+ 3/*]*/]; very weird Regarding int f= (2); The problem is that the AST node representing the initializtion is an IntLiteral including the brackets (meaning spawns the text (2)). Therefore if you only select 2, the analyzer doesn't notice that this is actual the int literal. Olivier, can you please comment on this and explain what the new AST will provide in this situation. Fixed the array problem reported by implementing a workaround for bug 8452. In fact it would be better to tell me what you want to be able to do and I can try to see if this is doable. I would say that the number literal will include the parenthesis as well. Then selecting only the number should lead to the same problem. What solution do you suggest? I checked what the new AST nodes do in this case. The initializer is still (2). Then the number '2' doesn't mean anything. It is not a node. Do you have a proposal to solve this problem? This problem is gone with the new AST. (2) would be a parenthesized expression containing the int literal. Then you will be able to ask for the resolveTypeBinding() of either the parenthesized expression or the inner expression (in this case a number literal) and you will get the same binding. So you will have the fined-grained in this case as long as you select a matching number of parenthesis. '(2' and '2)' will fail, but '(2)' or '2' should work. See ASTConverterTests.test0202/test0203/test0204. Using a lot of (((((((( can cause a StackOverFlowError in theory. Is this fine for you? Yes this is absolutely fine with me. Case now work correctly if no comments are specified. Opened another PR for the comment case. See http://dev.eclipse.org/bugs/show_bug.cgi?id=11104. Fixed in build > 20020307. |