RFR: 8286573: Remove the unnecessary method Attr#attribTopLevel and its usage

Vicente Romero vromero at openjdk.java.net
Wed May 11 20:50:49 UTC 2022

On Wed, 11 May 2022 08:49:46 GMT, Guoxiong Li <gli at openjdk.org> wrote:

> Hi all,
> The original patch [1] added the method `Attr#attribTopLevel` to validate the annotations of the package. Then the annotation validation was moved to the annotation pipeline [2] and the TopLevel tree node was refactored (added JCPackageDecl) [3]. So now the `Attr#attribTopLevel` is replaced by method `attribPackage` and actually is not used by any code. It is good to remove it.
> And there are only 3 places (shown below) that add the `Env` instance to the `Todo` list which the `Attr` uses as input. They add the `Env` of module, package, class seperately to the todo list . So the `Attr` doesn't need to handle the situation about TopLevel JCCompilationUnit.
> 1. Enter::visitTopLevel  `todo.append(packageEnv)`
> 2. Enter::visitModuleDef `todo.append(moduleEnv)`
> 3. ImportsPhase::runPhase `todo.append(env)`
> Thanks for taking the time to review.
> Best Regards,
> -- Guoxiong
> [1]https://github.com/openjdk/jdk/commit/13d31713dc6ac7134d81abeb11a659df2104d71f
> [2]https://github.com/openjdk/jdk/commit/da21af58f4811285f7050691d51fe32600c0e5f8
> [3]https://github.com/openjdk/jdk/commit/9783b65028eba41796c3e05ebb545b1a722f56b0



Marked as reviewed by vromero (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/8648

More information about the compiler-dev mailing list