Uploaded image for project: 'Maven Compiler Plugin'
  1. Maven Compiler Plugin
  2. MCOMPILER-158

Symbol name should be displayed during compiler error using Java 7

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3.2
    • 3.1
    • None

    Description

      Got to install Java 7. Tried it out on some of our source code which uses maven. Worked fine till there was a compilation error.

      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project my-app: Compilation failure
      [ERROR] \work\my-app\src\main\java\com\mycompany\app\App.java:[11,45] error: cannot find symbol
      [ERROR] -> [Help 1]
      

      I am ok with the error, but which symbol does it fail to find? Tried the same thing with Java 6.

      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project my-app: Compilation failure
      [ERROR] \work\my-app\src\main\java\com\mycompany\app\App.java:[11,45] cannot find symbol
      [ERROR] symbol  : variable Dummy
      [ERROR] location: class com.mycompany.app.App
      [ERROR] -> [Help 1]
      

      I can clearly see which variable is not found. So what has changed?

      Tried javac on the class. Output with java 7.

      javac App.java
      App.java:11: error: cannot find symbol
              System.out.println( "Hello World!" + Dummy);
                                                   ^
        symbol:   variable Dummy
        location: class App
        1 error
      

      Output with java 6.

      javac App.java
          App.java:11: cannot find symbol
          symbol  : variable Dummy
          location: class com.mycompany.app.App
                  System.out.println( "Hello World!" + Dummy);
                                                       ^
          1 error
      

      We can see a couple of differences with Java 7 compiler compared to Java 6.

      • Location does not show complete package, just the class
      • Symbol and location now come after the line which has the error, instead of before.
      • An additional "error" word comes before the error message

      Essentially there is a change in compiler output in case of errors, which I guess needs a corresponding maven compiler change.

      Attachments

        Activity

          People

            rfscholte Robert Scholte
            maruhgar Raghuram
            Votes:
            10 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: