| Summary: | [inline] inlining RHS of assignment which is not statement results in compile error | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Vladislav Kuzkokov <vladislav.kuzkokov> |
| Component: | UI | Assignee: | JDT-UI-Inbox <jdt-ui-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | daniel_megert, deepakazad |
| Version: | 3.7 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | stalebug | ||
---------------------------------------------------
public class Test {
public static int doSth(String s) {
int res = s.length();
return res;
}
public static void main(String[] args) {
String s;
System.out.printf(s = "%d", doSth(s));
}
}
---------------------------------------------------
Inlining in the above snippet results in the following error -
"Inlining is only possible on simple functions (consisting of a single return statement), or functions used in an assignment."
This is inconsistent behavior, if inline is allowed in snippet from comment 0, it should also be allowed in the above snippet.
One solution could be to allow inlining in case of assignment only when the assignment is the complete statement.
Another could be to fix Bug 99477 (though that would still leave the compile error issue)
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. If you have further information on the current state of the bug, please add it. 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. |
Build Identifier: M20100909-0800 Inlining of "complex" functions returning a value is allowed iff it's either initializer or a right-hand side of assignment. In the latter case it might be also needed to check if this assignment is a part of a more complex statement. Reproducible: Always Steps to Reproduce: 1. Input java source public class Test { public static int doSth(String s) { int res = s.length(); return res; } public static void main(String[] args) { String s; int t; System.out.printf(s = "%d", t = doSth(s)); } } 2. Use "Inline..." on method "doSth" 3. Get uncompilable code