Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8344148

Add an explicit compiler phase for warning generation

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P5 P5
    • 25
    • None
    • tools
    • None
    • master
    • generic
    • generic

      The compiler generates warnings in a somewhat ad hoc way at whatever point in the process happens to be convenient.

      This can create an issue in cases where some existing warning calculation wants to use information that is not available until some later phase in the pipeline.

      Also, it's not clear where to add code for new warnings. As a result, new warnings end up being stuck somewhere "random". For example, the "this-escape" analyzer is invoked from inside Flow.java after flow analysis completes, but the "this-escape" calculation has nothing to do with flow analysis.

      It would be cleaner if there was a dedicated WARN compiler phase that could serve as the official home for warning calculations (at least, newly added ones). This phase would come after attribution and flow analysis.

      In the future, if new warnings required information generated in later phases, there could be more than one WARN phase. The point is to have one or more well-defined places in the compilation pipeline for warning logic to live.

            acobbs Archie Cobbs
            acobbs Archie Cobbs
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: