Variable shadowing is incorrectly allowed for the parameter of an enhanced-for loop

Issue #303 resolved
Jesper Öqvist
created an issue

ExtendJ 8.1.1-26-gba7e55f Java SE 8

This program compiles when it should fail to compile:

public class Test {
  public static void main(String[] args) {
    String p;
    for (String p : args)

For reference, this is the error reported by javac: error: variable p is already defined in method main(String[])
    for (String p : args)
1 error

Comments (1)

  1. Log in to comment