This content has been marked as final.
Show 7 replies
-
1. Re: SHRINKWRAP-106: Inner Classes
alrubinger Dec 12, 2009 1:31 AM (in response to alrubinger)Another workaround to the visibility problem is to "addPackage".
-
2. Re: SHRINKWRAP-106: Inner Classes
dan.j.allen Dec 12, 2009 2:16 AM (in response to alrubinger)Just to throw some suggestions out there:
1. Is it possible to do addClasses(TopLevelClass.class, TopLevelClass.InnerClass.class) ?
2. How about a type that could represent a star import for class and it's decendants: addClasses(new ClassAndDependentsLiteral() {}); -
3. Re: SHRINKWRAP-106: Inner Classes
dan.j.allen Dec 12, 2009 2:17 AM (in response to alrubinger)My generics code cut off:
addClasses(new ClassAndDependentsLiteral<TopLevelClass>() {});
-
4. Re: SHRINKWRAP-106: Inner Classes
alrubinger Dec 12, 2009 3:28 AM (in response to alrubinger)"dan.j.allen" wrote:
1. Is it possible to do addClasses(TopLevelClass.class, TopLevelClass.InnerClass.class) ?
Yup, but if InnerClass is private or otherwise isn't visible to the calling code...then... :)"dan.j.allen" wrote:
2. How about a type that could represent a star import for class and it's decendants:addClasses(new ClassAndDependentsLiteral<TopLevelClass>() {});
We could to a star import for class and all *parents*. Feel free to open a JIRA enhancement request for that one. But of course the generics wouldn't matter to the runtime as they'd be lost after compilation.
Maybe like:addClassAndParents(Class<?> clazz)
?
S,
ALR -
5. Re: SHRINKWRAP-106: Inner Classes
alrubinger Dec 12, 2009 3:29 AM (in response to alrubinger)"@maxandersen" wrote:
@ALRubinger inner classes should Per definition be included when its owning class is added
S,
ALR -
6. Re: SHRINKWRAP-106: Inner Classes
aslak Dec 15, 2009 8:17 AM (in response to alrubinger)addPackage with filters should work for the Inner class problem.
{code}
addClass(Class<?> clazz)
{
Asset resource = new ClassAsset(clazz); Path location = new BasicPath(getClassesPath(), AssetUtil.getFullPathForClassResource(clazz)); add(resource, location); addPackage(clazz.getPackage(), Filters.include(clazz.getSimpleName() + "$.*"));
}
{code}
-
7. Re: SHRINKWRAP-106: Inner Classes
alrubinger Dec 15, 2009 11:51 AM (in response to aslak)We'll ignore hierarchy, as this goes outside the expected domain. Probably a user won't be anticipating adding any classes (inner) of parents when they add a child. So the logic is now:
// Get all inner classes and add them final Class<?>[] innerClasses = clazz.getDeclaredClasses(); for (final Class<?> innerClass : innerClasses) { this.addClass(innerClass); }
S,
ALR