You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Olivier Dehon (JIRA)" <ji...@codehaus.org> on 2007/12/10 19:05:57 UTC

[jira] Created: (MDEP-124) Dependency incorrectly reported as "Unused declared"

Dependency incorrectly reported as "Unused declared"
----------------------------------------------------

                 Key: MDEP-124
                 URL: http://jira.codehaus.org/browse/MDEP-124
             Project: Maven 2.x Dependency Plugin
          Issue Type: Bug
          Components: analyze
    Affects Versions: 2.0-alpha-6
            Reporter: Olivier Dehon
            Assignee: Brian Fox


When a dependency  is only required for a constant in a JAR, dependency:analyze incorrectly reports the dependency as "Unused declared".
Example:

Constants.jar has 1 class called Constants.java:
{code}
package com.myco.util;

public class Constants 
{
    private Constants() {};

    public static final double PI = 3.14159;
}
{code}


Then App jar has App.java as:
{code}
package com.myco.app;

public class App 
{
    public static void main( String[] args )
    {
        System.out.println( com.myco.util.Constants.PI );
    }
}
{code}

Since the constant gets optimized away in the generated {{App.class}}, the dependency is not detected, even though the project won't compile without it.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MDEP-124) Dependency incorrectly reported as "Unused declared"

Posted by "Christoph Kutzinski (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MDEP-124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=276777#comment-276777 ] 

Christoph Kutzinski commented on MDEP-124:
------------------------------------------

I'm seeing the problem with an annotation with RetentionPolicy.SOURCE, too.


I know this would mean probably a lot of work, but the way to fix it IMHO would be to process the sourcecode, too.
Otherwise what the dependency:analyze goal promises to do (finding unused, declared compile-time (!) dependencies), is severely broken.

> Dependency incorrectly reported as "Unused declared"
> ----------------------------------------------------
>
>                 Key: MDEP-124
>                 URL: https://jira.codehaus.org/browse/MDEP-124
>             Project: Maven 2.x Dependency Plugin
>          Issue Type: Bug
>          Components: analyze
>            Reporter: Olivier Dehon
>            Assignee: Brian Fox
>             Fix For: 2.4
>
>
> When a dependency  is only required for a constant in a JAR, dependency:analyze incorrectly reports the dependency as "Unused declared".
> Example:
> Constants.jar has 1 class called Constants.java:
> {code}
> package com.myco.util;
> public class Constants 
> {
>     private Constants() {};
>     public static final double PI = 3.14159;
> }
> {code}
> Then App jar has App.java as:
> {code}
> package com.myco.app;
> public class App 
> {
>     public static void main( String[] args )
>     {
>         System.out.println( com.myco.util.Constants.PI );
>     }
> }
> {code}
> Since the constant gets optimized away in the generated {{App.class}}, the dependency is not detected, even though the project won't compile without it.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MDEP-124) Dependency incorrectly reported as "Unused declared"

Posted by "Brian Fox (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MDEP-124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=235024#action_235024 ] 

Brian Fox commented on MDEP-124:
--------------------------------

The analyzer walks all classes and collects the list of imports essentially and then tries to mark dependencies when it finds an imported class in that dependency. There is no processing of the annotations or constants in the analyzer since it's looking purely at the bytecode. The best we can do here is allow you to annotate the configuration with a list of artifacts that should be ignored.

> Dependency incorrectly reported as "Unused declared"
> ----------------------------------------------------
>
>                 Key: MDEP-124
>                 URL: http://jira.codehaus.org/browse/MDEP-124
>             Project: Maven 2.x Dependency Plugin
>          Issue Type: Bug
>          Components: analyze
>            Reporter: Olivier Dehon
>            Assignee: Brian Fox
>
> When a dependency  is only required for a constant in a JAR, dependency:analyze incorrectly reports the dependency as "Unused declared".
> Example:
> Constants.jar has 1 class called Constants.java:
> {code}
> package com.myco.util;
> public class Constants 
> {
>     private Constants() {};
>     public static final double PI = 3.14159;
> }
> {code}
> Then App jar has App.java as:
> {code}
> package com.myco.app;
> public class App 
> {
>     public static void main( String[] args )
>     {
>         System.out.println( com.myco.util.Constants.PI );
>     }
> }
> {code}
> Since the constant gets optimized away in the generated {{App.class}}, the dependency is not detected, even though the project won't compile without it.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (MDEP-124) Dependency incorrectly reported as "Unused declared"

Posted by "Stephen Connolly (JIRA)" <ji...@codehaus.org>.
     [ https://jira.codehaus.org/browse/MDEP-124?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stephen Connolly updated MDEP-124:
----------------------------------

    Fix Version/s:     (was: 2.3)
                   2.4

> Dependency incorrectly reported as "Unused declared"
> ----------------------------------------------------
>
>                 Key: MDEP-124
>                 URL: https://jira.codehaus.org/browse/MDEP-124
>             Project: Maven 2.x Dependency Plugin
>          Issue Type: Bug
>          Components: analyze
>            Reporter: Olivier Dehon
>            Assignee: Brian Fox
>             Fix For: 2.4
>
>
> When a dependency  is only required for a constant in a JAR, dependency:analyze incorrectly reports the dependency as "Unused declared".
> Example:
> Constants.jar has 1 class called Constants.java:
> {code}
> package com.myco.util;
> public class Constants 
> {
>     private Constants() {};
>     public static final double PI = 3.14159;
> }
> {code}
> Then App jar has App.java as:
> {code}
> package com.myco.app;
> public class App 
> {
>     public static void main( String[] args )
>     {
>         System.out.println( com.myco.util.Constants.PI );
>     }
> }
> {code}
> Since the constant gets optimized away in the generated {{App.class}}, the dependency is not detected, even though the project won't compile without it.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MDEP-124) Dependency incorrectly reported as "Unused declared"

Posted by "B. Garvelink (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MDEP-124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_127997 ] 

B. Garvelink commented on MDEP-124:
-----------------------------------

Likewise, if you run {{dependency-analyze[Only]}} on a project without any source code in it (the plugin is defined in my root pom, and I'm building an EAR module), all project dependencies are reported as unused declared.

> Dependency incorrectly reported as "Unused declared"
> ----------------------------------------------------
>
>                 Key: MDEP-124
>                 URL: http://jira.codehaus.org/browse/MDEP-124
>             Project: Maven 2.x Dependency Plugin
>          Issue Type: Bug
>          Components: analyze
>            Reporter: Olivier Dehon
>            Assignee: Brian Fox
>
> When a dependency  is only required for a constant in a JAR, dependency:analyze incorrectly reports the dependency as "Unused declared".
> Example:
> Constants.jar has 1 class called Constants.java:
> {code}
> package com.myco.util;
> public class Constants 
> {
>     private Constants() {};
>     public static final double PI = 3.14159;
> }
> {code}
> Then App jar has App.java as:
> {code}
> package com.myco.app;
> public class App 
> {
>     public static void main( String[] args )
>     {
>         System.out.println( com.myco.util.Constants.PI );
>     }
> }
> {code}
> Since the constant gets optimized away in the generated {{App.class}}, the dependency is not detected, even though the project won't compile without it.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (MDEP-124) Dependency incorrectly reported as "Unused declared"

Posted by "Herve Boutemy (JIRA)" <ji...@codehaus.org>.
     [ https://jira.codehaus.org/browse/MDEP-124?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Herve Boutemy updated MDEP-124:
-------------------------------

    Fix Version/s:     (was: 2.5)
                   2.6
    
> Dependency incorrectly reported as "Unused declared"
> ----------------------------------------------------
>
>                 Key: MDEP-124
>                 URL: https://jira.codehaus.org/browse/MDEP-124
>             Project: Maven 2.x Dependency Plugin
>          Issue Type: Bug
>          Components: analyze
>            Reporter: Olivier Dehon
>            Assignee: Brian Fox
>             Fix For: 2.6
>
>
> When a dependency  is only required for a constant in a JAR, dependency:analyze incorrectly reports the dependency as "Unused declared".
> Example:
> Constants.jar has 1 class called Constants.java:
> {code}
> package com.myco.util;
> public class Constants 
> {
>     private Constants() {};
>     public static final double PI = 3.14159;
> }
> {code}
> Then App jar has App.java as:
> {code}
> package com.myco.app;
> public class App 
> {
>     public static void main( String[] args )
>     {
>         System.out.println( com.myco.util.Constants.PI );
>     }
> }
> {code}
> Since the constant gets optimized away in the generated {{App.class}}, the dependency is not detected, even though the project won't compile without it.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (MDEP-124) Dependency incorrectly reported as "Unused declared"

Posted by "Herve Boutemy (JIRA)" <ji...@codehaus.org>.
     [ https://jira.codehaus.org/browse/MDEP-124?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Herve Boutemy closed MDEP-124.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.6
         Assignee: Herve Boutemy  (was: Brian Fox)

FAQ entry added in [r1400733|http://svn.apache.org/viewvc?rev=1400733&view=rev]
                
> Dependency incorrectly reported as "Unused declared"
> ----------------------------------------------------
>
>                 Key: MDEP-124
>                 URL: https://jira.codehaus.org/browse/MDEP-124
>             Project: Maven 2.x Dependency Plugin
>          Issue Type: Bug
>          Components: analyze
>            Reporter: Olivier Dehon
>            Assignee: Herve Boutemy
>             Fix For: 2.6
>
>
> When a dependency  is only required for a constant in a JAR, dependency:analyze incorrectly reports the dependency as "Unused declared".
> Example:
> Constants.jar has 1 class called Constants.java:
> {code}
> package com.myco.util;
> public class Constants 
> {
>     private Constants() {};
>     public static final double PI = 3.14159;
> }
> {code}
> Then App jar has App.java as:
> {code}
> package com.myco.app;
> public class App 
> {
>     public static void main( String[] args )
>     {
>         System.out.println( com.myco.util.Constants.PI );
>     }
> }
> {code}
> Since the constant gets optimized away in the generated {{App.class}}, the dependency is not detected, even though the project won't compile without it.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (MDEP-124) Dependency incorrectly reported as "Unused declared"

Posted by "Herve Boutemy (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MDEP-124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=311750#comment-311750 ] 

Herve Boutemy commented on MDEP-124:
------------------------------------

probably an explanation in the javadoc would be a first step, just to help people understand things the goal is missing (ie eveything that can't be detected at bytecode analysis level)
Then it would be another task (another Jira issue) to enhance the way analysis is done to work on source instead of bytecode
                
> Dependency incorrectly reported as "Unused declared"
> ----------------------------------------------------
>
>                 Key: MDEP-124
>                 URL: https://jira.codehaus.org/browse/MDEP-124
>             Project: Maven 2.x Dependency Plugin
>          Issue Type: Bug
>          Components: analyze
>            Reporter: Olivier Dehon
>            Assignee: Brian Fox
>             Fix For: 2.6
>
>
> When a dependency  is only required for a constant in a JAR, dependency:analyze incorrectly reports the dependency as "Unused declared".
> Example:
> Constants.jar has 1 class called Constants.java:
> {code}
> package com.myco.util;
> public class Constants 
> {
>     private Constants() {};
>     public static final double PI = 3.14159;
> }
> {code}
> Then App jar has App.java as:
> {code}
> package com.myco.app;
> public class App 
> {
>     public static void main( String[] args )
>     {
>         System.out.println( com.myco.util.Constants.PI );
>     }
> }
> {code}
> Since the constant gets optimized away in the generated {{App.class}}, the dependency is not detected, even though the project won't compile without it.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (MDEP-124) Dependency incorrectly reported as "Unused declared"

Posted by "Brian Fox (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MDEP-124?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brian Fox updated MDEP-124:
---------------------------

    Fix Version/s: 2.2

> Dependency incorrectly reported as "Unused declared"
> ----------------------------------------------------
>
>                 Key: MDEP-124
>                 URL: http://jira.codehaus.org/browse/MDEP-124
>             Project: Maven 2.x Dependency Plugin
>          Issue Type: Bug
>          Components: analyze
>            Reporter: Olivier Dehon
>            Assignee: Brian Fox
>             Fix For: 2.2
>
>
> When a dependency  is only required for a constant in a JAR, dependency:analyze incorrectly reports the dependency as "Unused declared".
> Example:
> Constants.jar has 1 class called Constants.java:
> {code}
> package com.myco.util;
> public class Constants 
> {
>     private Constants() {};
>     public static final double PI = 3.14159;
> }
> {code}
> Then App jar has App.java as:
> {code}
> package com.myco.app;
> public class App 
> {
>     public static void main( String[] args )
>     {
>         System.out.println( com.myco.util.Constants.PI );
>     }
> }
> {code}
> Since the constant gets optimized away in the generated {{App.class}}, the dependency is not detected, even though the project won't compile without it.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (MDEP-124) Dependency incorrectly reported as "Unused declared"

Posted by "Brian Fox (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MDEP-124?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brian Fox updated MDEP-124:
---------------------------

    Fix Version/s:     (was: 2.2)
                   2.3

> Dependency incorrectly reported as "Unused declared"
> ----------------------------------------------------
>
>                 Key: MDEP-124
>                 URL: http://jira.codehaus.org/browse/MDEP-124
>             Project: Maven 2.x Dependency Plugin
>          Issue Type: Bug
>          Components: analyze
>            Reporter: Olivier Dehon
>            Assignee: Brian Fox
>             Fix For: 2.3
>
>
> When a dependency  is only required for a constant in a JAR, dependency:analyze incorrectly reports the dependency as "Unused declared".
> Example:
> Constants.jar has 1 class called Constants.java:
> {code}
> package com.myco.util;
> public class Constants 
> {
>     private Constants() {};
>     public static final double PI = 3.14159;
> }
> {code}
> Then App jar has App.java as:
> {code}
> package com.myco.app;
> public class App 
> {
>     public static void main( String[] args )
>     {
>         System.out.println( com.myco.util.Constants.PI );
>     }
> }
> {code}
> Since the constant gets optimized away in the generated {{App.class}}, the dependency is not detected, even though the project won't compile without it.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (MDEP-124) Dependency incorrectly reported as "Unused declared"

Posted by "Paul Gier (JIRA)" <ji...@codehaus.org>.
     [ https://jira.codehaus.org/browse/MDEP-124?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Gier updated MDEP-124:
---------------------------

    Fix Version/s:     (was: 2.6)
    
> Dependency incorrectly reported as "Unused declared"
> ----------------------------------------------------
>
>                 Key: MDEP-124
>                 URL: https://jira.codehaus.org/browse/MDEP-124
>             Project: Maven 2.x Dependency Plugin
>          Issue Type: Bug
>          Components: analyze
>            Reporter: Olivier Dehon
>            Assignee: Brian Fox
>
> When a dependency  is only required for a constant in a JAR, dependency:analyze incorrectly reports the dependency as "Unused declared".
> Example:
> Constants.jar has 1 class called Constants.java:
> {code}
> package com.myco.util;
> public class Constants 
> {
>     private Constants() {};
>     public static final double PI = 3.14159;
> }
> {code}
> Then App jar has App.java as:
> {code}
> package com.myco.app;
> public class App 
> {
>     public static void main( String[] args )
>     {
>         System.out.println( com.myco.util.Constants.PI );
>     }
> }
> {code}
> Since the constant gets optimized away in the generated {{App.class}}, the dependency is not detected, even though the project won't compile without it.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MDEP-124) Dependency incorrectly reported as "Unused declared"

Posted by "Brian Fox (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MDEP-124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_128044 ] 

Brian Fox commented on MDEP-124:
--------------------------------

There's no way to fix the analysis in this instance since it's looking at bytecode. We should be able to safely skip the analysis though when we find no classes to analyze.

> Dependency incorrectly reported as "Unused declared"
> ----------------------------------------------------
>
>                 Key: MDEP-124
>                 URL: http://jira.codehaus.org/browse/MDEP-124
>             Project: Maven 2.x Dependency Plugin
>          Issue Type: Bug
>          Components: analyze
>            Reporter: Olivier Dehon
>            Assignee: Brian Fox
>
> When a dependency  is only required for a constant in a JAR, dependency:analyze incorrectly reports the dependency as "Unused declared".
> Example:
> Constants.jar has 1 class called Constants.java:
> {code}
> package com.myco.util;
> public class Constants 
> {
>     private Constants() {};
>     public static final double PI = 3.14159;
> }
> {code}
> Then App jar has App.java as:
> {code}
> package com.myco.app;
> public class App 
> {
>     public static void main( String[] args )
>     {
>         System.out.println( com.myco.util.Constants.PI );
>     }
> }
> {code}
> Since the constant gets optimized away in the generated {{App.class}}, the dependency is not detected, even though the project won't compile without it.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MDEP-124) Dependency incorrectly reported as "Unused declared"

Posted by "Christian Schulte (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MDEP-124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=188629#action_188629 ] 

Christian Schulte commented on MDEP-124:
----------------------------------------

Same happens with annotations @Retention(value=SOURCE).

{xml}
<dependency>
    <groupId>javax.annotation</groupId>
    <artifactId>jsr250-api</artifactId>
    <scope>compile</scope>
    <optional>true</optional>
</dependency>
{xml}

Using the @Generated annotation compilation fails without the dependency.

+1 for having the ability to configure the plugin to not print a warning in such situations.


> Dependency incorrectly reported as "Unused declared"
> ----------------------------------------------------
>
>                 Key: MDEP-124
>                 URL: http://jira.codehaus.org/browse/MDEP-124
>             Project: Maven 2.x Dependency Plugin
>          Issue Type: Bug
>          Components: analyze
>            Reporter: Olivier Dehon
>            Assignee: Brian Fox
>
> When a dependency  is only required for a constant in a JAR, dependency:analyze incorrectly reports the dependency as "Unused declared".
> Example:
> Constants.jar has 1 class called Constants.java:
> {code}
> package com.myco.util;
> public class Constants 
> {
>     private Constants() {};
>     public static final double PI = 3.14159;
> }
> {code}
> Then App jar has App.java as:
> {code}
> package com.myco.app;
> public class App 
> {
>     public static void main( String[] args )
>     {
>         System.out.println( com.myco.util.Constants.PI );
>     }
> }
> {code}
> Since the constant gets optimized away in the generated {{App.class}}, the dependency is not detected, even though the project won't compile without it.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MDEP-124) Dependency incorrectly reported as "Unused declared"

Posted by "Max Bowsher (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MDEP-124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=133200#action_133200 ] 

Max Bowsher commented on MDEP-124:
----------------------------------

Regarding the "optimized away constant" problem, it would be handy for the plugin to offer a configuration element like:

{code:xml}
<suppressUnusedWarnings>
  <suppressUnusedWarning>com.example.foo:my-constants-artifact</suppressUnusedWarning>
</suppressUnusedWarnings>
{code}

> Dependency incorrectly reported as "Unused declared"
> ----------------------------------------------------
>
>                 Key: MDEP-124
>                 URL: http://jira.codehaus.org/browse/MDEP-124
>             Project: Maven 2.x Dependency Plugin
>          Issue Type: Bug
>          Components: analyze
>            Reporter: Olivier Dehon
>            Assignee: Brian Fox
>
> When a dependency  is only required for a constant in a JAR, dependency:analyze incorrectly reports the dependency as "Unused declared".
> Example:
> Constants.jar has 1 class called Constants.java:
> {code}
> package com.myco.util;
> public class Constants 
> {
>     private Constants() {};
>     public static final double PI = 3.14159;
> }
> {code}
> Then App jar has App.java as:
> {code}
> package com.myco.app;
> public class App 
> {
>     public static void main( String[] args )
>     {
>         System.out.println( com.myco.util.Constants.PI );
>     }
> }
> {code}
> Since the constant gets optimized away in the generated {{App.class}}, the dependency is not detected, even though the project won't compile without it.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (MDEP-124) Dependency incorrectly reported as "Unused declared"

Posted by "Herve Boutemy (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MDEP-124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=311750#comment-311750 ] 

Herve Boutemy edited comment on MDEP-124 at 10/18/12 1:28 AM:
--------------------------------------------------------------

probably an explanation in the javadoc would be a first step, just to help people understand things the goal is missing (ie eveything that can't be detected at bytecode analysis level)

Then it would be another task (another Jira issue) to enhance the way analysis is done to work on source instead of bytecode, which is another (more ambitious) approach than MDEP-122 = manually declare such exceptions
                
      was (Author: hboutemy):
    probably an explanation in the javadoc would be a first step, just to help people understand things the goal is missing (ie eveything that can't be detected at bytecode analysis level)
Then it would be another task (another Jira issue) to enhance the way analysis is done to work on source instead of bytecode
                  
> Dependency incorrectly reported as "Unused declared"
> ----------------------------------------------------
>
>                 Key: MDEP-124
>                 URL: https://jira.codehaus.org/browse/MDEP-124
>             Project: Maven 2.x Dependency Plugin
>          Issue Type: Bug
>          Components: analyze
>            Reporter: Olivier Dehon
>            Assignee: Brian Fox
>             Fix For: 2.6
>
>
> When a dependency  is only required for a constant in a JAR, dependency:analyze incorrectly reports the dependency as "Unused declared".
> Example:
> Constants.jar has 1 class called Constants.java:
> {code}
> package com.myco.util;
> public class Constants 
> {
>     private Constants() {};
>     public static final double PI = 3.14159;
> }
> {code}
> Then App jar has App.java as:
> {code}
> package com.myco.app;
> public class App 
> {
>     public static void main( String[] args )
>     {
>         System.out.println( com.myco.util.Constants.PI );
>     }
> }
> {code}
> Since the constant gets optimized away in the generated {{App.class}}, the dependency is not detected, even though the project won't compile without it.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira