Skip to content

I20220623-1800

@jjohnstn jjohnstn tagged this 23 Jun 03:04
* Replace commit 09838b5f91b1869cd with better logic

    Forloopbug (#115)

    - Fix for loop to enhanced for loop conversion

        * Fix EntrySet issue 109 with for loops with multiple get()
calls

          https://github.com/eclipse-jdt/eclipse.jdt.ui/issues/109

        public void sample() {
                List<String> list1 = List.of(""); //$NON-NLS-1$
                for (int i = 0; i < list1.size(); i++) {
                        String s1 = list1.get(i);
                        String s2 = list1.get(i);
                        System.out.println(s1 + "," + s2); //$NON-NLS-1$
                }
        }

  - cleanup should remove String s1 = get(i); statement but
    change String s2 = get(i); -> String s2 = s1;
  - previous fix blocked the cleanup
Assets 2
Loading