Skip to content

Conversation

@oshai
Copy link
Contributor

@oshai oshai commented Aug 19, 2018

No description provided.

emptyList()
} else {
includes.add(includeURL)
includeLines.add(includeURL.path)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just

if(includes.contains(includeURL)) emptyList<String>()

// or depending how clever URL.equals is implemented
if(includes.map{it.path}.contains(includeURL.path)) emptyList<String>()

?
The logic seems the same but it's much simpler and works without another list for url-bookkeeping?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can do that, but note that equals and hashcode of URL are very weird methods, that includes accessing network to resolve names, see this for more details: http://errorprone.info/bugpattern/URLEqualsHashCode

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All right, let's compare via url.path instead then, although URI.equals seems to be more popular (see https://stackoverflow.com/questions/5402485/how-to-compare-two-urls-in-java)

@holgerbrandl holgerbrandl merged commit 62ba6fb into kscripting:master Aug 20, 2018
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

Successfully merging this pull request may close these issues.

2 participants