You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2018/04/24 13:22:42 UTC
groovy git commit: Trivial refactoring for `getLocation`
Repository: groovy
Updated Branches:
refs/heads/master 66857c572 -> 9bcdd74df
Trivial refactoring for `getLocation`
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/9bcdd74d
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/9bcdd74d
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/9bcdd74d
Branch: refs/heads/master
Commit: 9bcdd74df31e0a0701040d44718a8345a83b4c1e
Parents: 66857c5
Author: sunlan <su...@apache.org>
Authored: Tue Apr 24 21:22:34 2018 +0800
Committer: sunlan <su...@apache.org>
Committed: Tue Apr 24 21:22:34 2018 +0800
----------------------------------------------------------------------
.../groovy/runtime/DefaultGroovyMethods.java | 30 +++++++++-----------
1 file changed, 13 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/9bcdd74d/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java b/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
index 78ed2ca..e6d5765 100644
--- a/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
+++ b/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
@@ -600,23 +600,6 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
}
/**
- * Gets the url of the jar containing the specified class
- *
- * @param self the class
- * @return the url of the jar, {@code null} if the specified class is from JDK
- * @since 2.5.0
- */
- public static URL getLocation(Class self) {
- CodeSource codeSource = self.getProtectionDomain().getCodeSource();
-
- if (null == codeSource) {
- return null;
- }
-
- return codeSource.getLocation();
- }
-
- /**
* Extend class globally with category methods.
*
* @param self any Class
@@ -639,6 +622,19 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
}
/**
+ * Gets the url of the jar file/source file containing the specified class
+ *
+ * @param self the class
+ * @return the url of the jar, {@code null} if the specified class is from JDK
+ * @since 2.5.0
+ */
+ public static URL getLocation(Class self) {
+ CodeSource codeSource = self.getProtectionDomain().getCodeSource();
+
+ return null == codeSource ? null : codeSource.getLocation();
+ }
+
+ /**
* Scoped use method with list of categories.
*
* @param self any Object