[shrinkwrap-issues] [JBoss JIRA] (SHRINKWRAP-436) Support recursive Class addition

Michal Matloka (JIRA) jira-events at lists.jboss.org
Sat Nov 24 08:22:21 EST 2012


     [ https://issues.jboss.org/browse/SHRINKWRAP-436?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michal Matloka updated SHRINKWRAP-436:
--------------------------------------

    Description: 
I'd like propose to add e.g the following methods to the API: 

// gets clazz and classed directly used by this clazz
addClass(boolean recursive, Class<?> clazz)

// gets clazz and recursivly classes in given depth 
// addClass(boolean recursive, Class<?> clazz) runs addClass(boolean recursive, 1, Class<?> clazz)
addClass(boolean recursive, int depth, Class<?> clazz)

They would add to the archive, given clazz, and all other classes mentioned in clazz, e.g

For the following class strcture
{noformat}
public class DummyDependentA {

       private DummyDependentB dummyDependentB;
}

public class DummyDependentB {

       private DummyDependentC dummyDependentC ;
}

public class DummyDependentC {

}
{noformat}

operation .addClass(true, DummyDependentA .class) would result in adding both DummyDependentA and DummyDependentB to the archive (but not DummyDependentC ). In order to add also DummyDependentC user would have to use at least .addClass(true, 2, DummyDependentA .class).

It is possible to achieve, e.g. using ASM library - as described in answer of the following topic http://stackoverflow.com/questions/3734825/find-out-which-classes-of-a-given-api-are-used

I've locally prepared proof of concept, after some refactorings I will present the pull request.

It's worth to discuss what API methods would be the most useful. Recursion might get really big number of classes. Obligatory is filtering out "java.*" classes. Maybe it would be useful to apply additional package filtering for this, so that recursion would work only on current project classes.

  was:
I'd like propose to add e.g the following methods to the API: 

// gets clazz and classed directly used by this clazz
addClass(boolean recursive, Class<?> clazz)

// gets clazz and recursivly classes in given depth 
// addClass(boolean recursive, Class<?> clazz) runs addClass(boolean recursive, 1, Class<?> clazz)
addClass(boolean recursive, int depth, Class<?> clazz)

They would add to the archive, given clazz, and all other classes mentioned in clazz, e.g

For the following class strcture
{noformat}
public class DummyDependentA {

       private DummyRecursiveB dummyRecursiveB;
}

public class DummyDependentB {

}
{noformat}

operation .addClass(true, DummyRecursiveA.class) would result in adding both DummyRecursiveA and DummyRecursiveB  to the archive.

It is possible to achieve, e.g. using ASM library - as described in answer of the following topic http://stackoverflow.com/questions/3734825/find-out-which-classes-of-a-given-api-are-used

I've locally prepared proof of concept, after some refactorings I will present the pull request.

It's worth to discuss what API methods would be the most useful.


    
> Support recursive Class addition
> --------------------------------
>
>                 Key: SHRINKWRAP-436
>                 URL: https://issues.jboss.org/browse/SHRINKWRAP-436
>             Project: ShrinkWrap
>          Issue Type: Feature Request
>          Components: api, impl-base
>            Reporter: Michal Matloka
>            Assignee: Michal Matloka
>
> I'd like propose to add e.g the following methods to the API: 
> // gets clazz and classed directly used by this clazz
> addClass(boolean recursive, Class<?> clazz)
> // gets clazz and recursivly classes in given depth 
> // addClass(boolean recursive, Class<?> clazz) runs addClass(boolean recursive, 1, Class<?> clazz)
> addClass(boolean recursive, int depth, Class<?> clazz)
> They would add to the archive, given clazz, and all other classes mentioned in clazz, e.g
> For the following class strcture
> {noformat}
> public class DummyDependentA {
>        private DummyDependentB dummyDependentB;
> }
> public class DummyDependentB {
>        private DummyDependentC dummyDependentC ;
> }
> public class DummyDependentC {
> }
> {noformat}
> operation .addClass(true, DummyDependentA .class) would result in adding both DummyDependentA and DummyDependentB to the archive (but not DummyDependentC ). In order to add also DummyDependentC user would have to use at least .addClass(true, 2, DummyDependentA .class).
> It is possible to achieve, e.g. using ASM library - as described in answer of the following topic http://stackoverflow.com/questions/3734825/find-out-which-classes-of-a-given-api-are-used
> I've locally prepared proof of concept, after some refactorings I will present the pull request.
> It's worth to discuss what API methods would be the most useful. Recursion might get really big number of classes. Obligatory is filtering out "java.*" classes. Maybe it would be useful to apply additional package filtering for this, so that recursion would work only on current project classes.

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


More information about the shrinkwrap-issues mailing list