Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency on guava #40

Open
dkandalov opened this issue Feb 5, 2015 · 4 comments
Open

Dependency on guava #40

dkandalov opened this issue Feb 5, 2015 · 4 comments

Comments

@dkandalov
Copy link

Thanks a lot for the library.
Surprisingly there aren't many java CLI libraries designed for usage for commands with parameters. IMHO this is the best one.

The only disadvantage I found is dependency on guava:

  • for tiny projects it fills wrong to add 2Mb guava jar just for CLI
  • "enterprise" projects will usually have dependency on guava already, but not necessarily the same version as airline

Do you think it makes sense to copy into project only those guava bits which are used?
I could do this myself, just wanted to ask your opinion.

@Novanic
Copy link
Contributor

Novanic commented Aug 29, 2015

Hi,

I tried out your library and I think it is very smart. I need it also to support various commands in combination with parameters/arguments.

I just tried to get rid off guava and the most of it can be replaced with methods of the JDK or a few, small, simple util methods. I think it is also not notable less efficient. There are some lambda-style functional method usages remaining which could get replaced with Lambdas of Java 8. What is your plan to upgrade to Java 8?

@Novanic
Copy link
Contributor

Novanic commented Aug 29, 2015

I think it would be good to replace guava with an upgrade to Java 8. The upgrade to Java 8 is definitely useful in the future (Java 7 will reach end of life). The point in time is just unclear, regarding the airline library. :-)

Here an example of a replacement of guava with Lambdas of Java 8. I'm just preparing a patch without guava.

Before (guava):
options = CollectionUtils.asList(transform(metadataIndex.values(), new Function<Collection, OptionMetadata>()
{
@OverRide
public OptionMetadata apply(@nullable Collection options) {
return new OptionMetadata(options);
}
}));

After (Java 8, Lambda);
options = metadataIndex.values().stream().map(OptionMetadata::new).collect(Collectors.toList());

@martint
Copy link
Member

martint commented Aug 29, 2015

We've started migrating other airlift-related projects to Java 8 already, but haven't got to this one, yet. We're moving in that direction, though, so thanks for working on that patch.

@Novanic
Copy link
Contributor

Novanic commented Aug 29, 2015

Ok, sounds good. I have now created a fork/branch which is working with Java 8 and without guava. The fork can be found here: https://github.com/Novanic/airline

I would be happy, when it could get integrated/pushed to the master. :-) There is one optimization/refactoring within the Parser class left. There is still a very intransparent iterator handling within this class. I try to get this optimized tomorrow or by next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants