Details

    • Type: Improvement Improvement
    • Status: Reopened
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Build System
    • Labels:

      Description

      I'm using 1.4M1+GAE+GORM-JPA,
      I got some problem of GORM-JPA plugin where it use some deprecated methods,
      Grails can't compile it,and ask me to compile with arg -Xlint:unchecked,
      But I can't find anywhere to add this arg.

      so plz add some config to BuildConfig.groovy or _Event.groovy to provide this feature.
      and more,better if compile arg is only add to some plugin.

        Activity

        Hide
        Bobby Warner added a comment -

        Closing as "won't fix" as you can use any JVM option with Grails. The commands will use JVM options provided via the command line. You can also specify a specific environment variable too, GRAILS_OPTS, if you don't want to specify them on the command line.

        So, for your specific example, you should be able to just use this: grails compile -Xlint:unchecked

        Thanks,
        Bobby

        Show
        Bobby Warner added a comment - Closing as "won't fix" as you can use any JVM option with Grails. The commands will use JVM options provided via the command line. You can also specify a specific environment variable too, GRAILS_OPTS, if you don't want to specify them on the command line. So, for your specific example, you should be able to just use this: grails compile -Xlint:unchecked Thanks, Bobby
        Hide
        Igor E. Poteryaev added a comment -

        Options from command line does not works. When I tried this on my Grails 2.0.3 project I got this:

        $ grails compile -Xlint:unchecked
        | Compiling 113 source files
        Note: Some input files use or override a deprecated API.
        Note: Recompile with -Xlint:deprecation for details.
        | Compiling 40 source files
        
        | Compiling 40 source files..
        

        GRAILS_OPTS doesn't works for me too.

        $ export  GRAILS_OPTS="-Xlint:unchecked"
        $ grails compile
        Unrecognized option: -Xlint:unchecked
        Error: Could not create the Java Virtual Machine.
        Error: A fatal exception has occurred. Program will exit.
        

        My environment, if relevant:

        $ java -version
        java version "1.7.0_03"
        Java(TM) SE Runtime Environment (build 1.7.0_03-b04)
        Java HotSpot(TM) 64-Bit Server VM (build 22.1-b02, mixed mode)
        
        $ uname -a
        Linux poteryaev 3.3.1-gentoo #1 SMP PREEMPT Thu Apr 5 11:55:15 YEKT 2012 x86_64 Intel(R) Core(TM)2 Quad CPU Q9400 @ 2.66GHz GenuineIntel GNU/Linux
        
        Show
        Igor E. Poteryaev added a comment - Options from command line does not works. When I tried this on my Grails 2.0.3 project I got this: $ grails compile -Xlint:unchecked | Compiling 113 source files Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. | Compiling 40 source files | Compiling 40 source files.. GRAILS_OPTS doesn't works for me too. $ export GRAILS_OPTS="-Xlint:unchecked" $ grails compile Unrecognized option: -Xlint:unchecked Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. My environment, if relevant: $ java -version java version "1.7.0_03" Java(TM) SE Runtime Environment (build 1.7.0_03-b04) Java HotSpot(TM) 64-Bit Server VM (build 22.1-b02, mixed mode) $ uname -a Linux poteryaev 3.3.1-gentoo #1 SMP PREEMPT Thu Apr 5 11:55:15 YEKT 2012 x86_64 Intel(R) Core(TM)2 Quad CPU Q9400 @ 2.66GHz GenuineIntel GNU/Linux
        Hide
        Bobby Warner added a comment -

        lint is just a tool which shows details of potential errors or vulnerabilities recognized by the compiler. So, it's telling you that you are using a deprecated API, but looks like it's still compiling just fine actually. What do you see when you use the next one (-Xlint:deprecation)?

        Show
        Bobby Warner added a comment - lint is just a tool which shows details of potential errors or vulnerabilities recognized by the compiler. So, it's telling you that you are using a deprecated API, but looks like it's still compiling just fine actually. What do you see when you use the next one (-Xlint:deprecation)?
        Hide
        Igor E. Poteryaev added a comment -

        I think that problem is located in GrailsProjectCompiler compile method.
        javac compilerarg get only hard wired value of "-Xlint:-options" and command line values is ignored.

        org.codehaus.groovy.grails.compiler.GrailsProjectCompiler (from 245 line):

            void compile(targetDir) {
        
                def compilerPaths = { String classpathId ->
                    for (srcPath in srcDirectories) {
                       if (new File(srcPath).exists()) {
                           src(path:srcPath)
                       }
                    }
                    javac(javaOptions) {
                        compilerarg value:"-Xlint:-options"
                    }
                }
        
        Show
        Igor E. Poteryaev added a comment - I think that problem is located in GrailsProjectCompiler compile method. javac compilerarg get only hard wired value of "-Xlint:-options" and command line values is ignored. org.codehaus.groovy.grails.compiler.GrailsProjectCompiler (from 245 line): void compile(targetDir) { def compilerPaths = { String classpathId -> for (srcPath in srcDirectories) { if (new File(srcPath).exists()) { src(path:srcPath) } } javac(javaOptions) { compilerarg value:"-Xlint:-options" } }
        Hide
        Igor E. Poteryaev added a comment -

        What do you see when you use the next one (-Xlint:deprecation)

        I see the same as with "-Xlint:unchecked"

        $ grails compile -Xlint:deprecation
        | Compiling 113 source files
        Note: Some input files use or override a deprecated API.
        Note: Recompile with -Xlint:deprecation for details.
        | Compiling 40 source files
        
        | Compiling 40 source files..
        
        Show
        Igor E. Poteryaev added a comment - What do you see when you use the next one (-Xlint:deprecation) I see the same as with "-Xlint:unchecked" $ grails compile -Xlint:deprecation | Compiling 113 source files Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. | Compiling 40 source files | Compiling 40 source files..
        Hide
        Igor E. Poteryaev added a comment -

        So, it's telling you that you are using a deprecated API, but looks like it's still compiling just fine actually.

        Yes, compilation is ok.
        But I really want to see which deprecated API my code (or some plugin code) have.

        Show
        Igor E. Poteryaev added a comment - So, it's telling you that you are using a deprecated API, but looks like it's still compiling just fine actually. Yes, compilation is ok. But I really want to see which deprecated API my code (or some plugin code) have.
        Hide
        Bobby Warner added a comment -

        Ah, I see. I will reopen the issue if these compile arguments are not working as per your comment about GrailsProjectCompiler.

        Show
        Bobby Warner added a comment - Ah, I see. I will reopen the issue if these compile arguments are not working as per your comment about GrailsProjectCompiler.

          People

          • Assignee:
            Unassigned
            Reporter:
            tz
          • Votes:
            5 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Last Reviewed:

              Development