Env < AttrContext > initEnv ( JCVariableDecl tree , Env < AttrContext > env ) { Env < AttrContext > localEnv = env . dupto ( new AttrContextEnv ( tree , env . info . dup ( ) ) ) ; if ( tree . sym . owner . kind == TYP ) { localEnv . info . scope = env . info . scope . dupUnshared ( tree . sym ) ; } if ( ( tree . mods . flags & STATIC ) != 0 || ( ( env . enclClass . sym . flags ( ) & INTERFACE ) != 0 && env . enclMethod == null ) ) localEnv . info . staticLevel ++ ; return localEnv ; }
Create a fresh environment for a variable s initializer . If the variable is a field the owner of the environment s scope is be the variable itself otherwise the owner is the method enclosing the variable definition .