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

Single wrongly placed modifier causes multiple error messages

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • None
    • tools
    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      Ubuntu 22.04.2 LTS
      openjdk version "20-internal" 2023-03-21
      OpenJDK Runtime Environment (build 20-internal-adhoc.admin1.jdk-jdk-20-34)
      OpenJDK 64-Bit Server VM (build 20-internal-adhoc.admin1.jdk-jdk-20-34, mixed mode)

      A DESCRIPTION OF THE PROBLEM :
      When a static (or also private/public...) modifier is wrongly used within a function, then multiple error
      messages occur instead of a single error. For example, there were 6 errors for the wrongly placed static
      modifier in the attached example (and even more unnecessary error messages occur if the code is longer).
      It is obvious that the static modifier should not be placed there, but the numerous unnecessary error
      messages make it much harder to find the issue. This behavior can also make automatic error handling or
      automatic repair approaches more difficult. Moreover, the behavior seems to be inconsistent since a wrongly
      placed abstract modifier in the same position causes only a single error message.

      class Test{
          public static void main(String args[]){
      static double d = 1.0;
      final double d1 = 2.0;
      System.out.println(d);
      System.out.println(d1);
          }
       }


            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: