I assume that you are considering only local variables.
To do this, you will need areas and solutions.
The scope will be the scope of Java variables. It will contain information about which variables are declared in this area. You will need to create it when you enter the Java scope (block start, method, ...) and get rid of it by leaving the scope. You will keep a stack of scopes for representing nested blocks / scopes (Java doesn't allow you to hide a local variable in a nested scope, but you still need to keep track of when the variable goes out of scope at the end of the nested scope).
, , - , ( ). , ( .), ( .
Parser , , :
private static class A {
B out = new B();
}
private static class B {
void println(String foo) {
System.out.println("ha");
}
}
public static void main(String[] args) {
{
A System = new A();
System.out.println("a");
}
System.out.println("b");
}
, , , , .., , .