Community
Participate
Working Groups
BETA_JAVA7 Extract Local Variable must expand the diamond type argument here: List<Integer> m() { return new ArrayList<>(); } Extract Method correctly uses ArrayList<Integer> as return type but Extract Local Variable produces an erroneous variable type: ArrayList<> arrayList = new ArrayList<>(); return arrayList;
Created attachment 197940 [details] Patch Proposed fix. Markus, could you pls review? I will add the tests if the fix is ok.
The fix is at the right spot, but the typeBinding could theoretically be null (though I couldn't come up with an example that actually fails). Nevertheless, the added check would better be this, so that in weird situations with non-compiling code, the user just gets the type from the CIC node: && (typeBinding == null || typeBinding.getTypeArguments().length == 0) If you agree with this, please go ahead and release with the test(s) in ExtractTempTests17.
Created attachment 198693 [details] Patch + tests Patch with the null check + tests.
(In reply to comment #3) > Created attachment 198693 [details] [diff] > Patch + tests > > Patch with the null check + tests. Committed to HEAD.
> Committed to HEAD. Oops, I mean to BETA_JAVA7 branch.
Verified.