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

uniform error diagnostics for inconsistent inherited method signatures

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P3 P3
    • 11
    • 9
    • tools
    • None
    • b01

        During work on JDK-8055075 for creation of golden files for negative tests, it was suggested to update error diagnostics to have an additional sub-diagnostic with more information. The suggestion came based on the golden file seen for test: langtools/test/tools/javac/InconsistentInheritedSignature.java. Golden file for this test will need updates once this issue is fixed.

        Current diagnostic key:
        langtools/test/tools/javac/InconsistentInheritedSignature.java:40: error: types I2 and I1 are incompatible

        Quoting Maurizio's initial analysis from email:

        There are 3 diagnostics of that kind:
        # 0: type, 1: type, 2: string
        compiler.err.types.incompatible.diff.ret=\
            types {0} and {1} are incompatible; both define {2}, but with unrelated return types

        # 0: kind, 1: type, 2: name, 3: list of type, 4: symbol, 5: symbol
        compiler.err.types.incompatible.unrelated.defaults=\
            {0} {1} inherits unrelated defaults for {2}({3}) from types {4} and {5}

        # 0: kind, 1: type, 2: name, 3: list of type, 4: symbol, 5: symbol
        compiler.err.types.incompatible.abstract.default=\
            {0} {1} inherits abstract and default for {2}({3}) from types {4} and {5}


        They are inconsistent - as they should all say: 'types ... are incompatible ; reason'. All 3 diagnostics need to made more uniform - perhaps by structuring them using a common header:

        # 0: type, 1: type, 2: fragment
        compiler.err.types.incompatible=\
            types {0} and {1} are incompatible;
            {2}

        And then multiple subdiagnostics - once for each 'reason' (passed as argument #2):

        # 0: string
        compiler.misc.diff.ret=
            both define {2}, but with unrelated return types

        # 0: kind, 1: type, 2: name, 3: list of type, 4: symbol, 5: symbol
        compiler.misc.incompatible.unrelated.defaults=
            {0} {1} inherits unrelated defaults for {2}({3}) from types {4} and {5}

        # 0: kind, 1: type, 2: name, 3: list of type, 4: symbol, 5: symbol
        compiler.misc.incompatible.abstract.default=\
            {0} {1} inherits abstract and default for {2}({3}) from types {4} and {5}

              mcimadamore Maurizio Cimadamore
              sogoel Sonali Goel (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: