Skip to content

Commit

Permalink
Releasing version 1.1.3, fixed bug which made methods with primitive …
Browse files Browse the repository at this point in the history
…parameters unfindable
  • Loading branch information
jmartinesp committed Oct 31, 2014
1 parent 502687b commit 09187cf
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog:

### Versions:
* **1.1.3** - Fixed minor bug where methods with primitive parameters weren't found on method search.
* **1.1.2** - Fixed BIG bug when SwissKnife couldn't find the method.
* **1.1.1** - @OnBackground and @OnUIThread now can be used with static methods. Solved several method search problems, too.
* **1.1.0** - New @SaveInstance annotation to automatically save and restore variables on configuration changes.
Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,19 @@ Once your project App Module is configured to use Groovy you can add this librar
```groovy
dependencies {
...
compile 'com.arasthel:swissknife:1.1.2'
compile 'com.arasthel:swissknife:1.1.3'
...
}
```

If you want *SwissKnife* to update automatically, you could just type:

```groovy
dependencies {
...
compile 'com.arasthel:swissknife:+'
...
}
```

Also, [there is an IntelliJ IDEA plugin](https://github.com/Arasthel/SwissKnife/wiki/SwissKnife-IDEA-Plugin) *compatible with Android Studio* that lets you auto-generate the annotations and compatible method declarations.
Expand Down
4 changes: 3 additions & 1 deletion SwissKnife/SwissKnife.iml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="com.arasthel" external.system.module.version="1.1.1" type="JAVA_MODULE" version="4">
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="com.arasthel" external.system.module.version="1.1.3" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
Expand Down Expand Up @@ -79,7 +79,9 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/libs" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/poms" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 21 Platform (1)" jdkType="Android SDK" />
Expand Down
2 changes: 1 addition & 1 deletion SwissKnife/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ android {
minSdkVersion 8
targetSdkVersion 21
versionCode 1
versionName "1.1.1"
versionName "1.1.3"
}
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ import com.arasthel.swissknife.utils.AnnotationUtils
import com.arasthel.swissknife.annotations.OnPageChanged
import com.arasthel.swissknife.annotations.OnTextChanged
import groovy.transform.CompileStatic
import org.codehaus.groovy.ast.ClassHelper
import org.codehaus.groovy.ast.Parameter
import org.codehaus.groovy.runtime.wrappers.GroovyObjectWrapper
import org.codehaus.groovy.runtime.wrappers.Wrapper

import java.lang.reflect.Method
import java.lang.reflect.Modifier
Expand Down Expand Up @@ -432,6 +435,11 @@ public class SwissKnife {
boolean found = true
for(int i = 0; i < m.getParameterTypes().length; i++) {
Class parameter = m.getParameterTypes()[i]

// If parameter is a primitive, we have to get its wrapper class so we can check for inheritance
if(parameter.isPrimitive()) {
parameter = getWrapperForPrimitive(parameter)
}
if(!parameter.isAssignableFrom(parameters[i])) {
found = false
}
Expand All @@ -452,6 +460,10 @@ public class SwissKnife {
return method;
}

private static Class getWrapperForPrimitive(Class primitive) {
return ClassHelper.getWrapper(ClassHelper.make(primitive)).getTypeClass();
}

public static void restoreState(Object target, Bundle state) {

if(state != null){
Expand All @@ -470,6 +482,4 @@ public class SwissKnife {


}


}
2 changes: 1 addition & 1 deletion SwissKnifeProject.iml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="com.arasthel" external.system.module.version="1.1.1" type="JAVA_MODULE" version="4">
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="com.arasthel" external.system.module.version="1.1.3" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

VERSION_NAME=1.1.2
VERSION_CODE=8
VERSION_NAME=1.1.3
VERSION_CODE=9
GROUP=com.arasthel

POM_DESCRIPTION=Android library for View Injection and Async processing
Expand Down
2 changes: 1 addition & 1 deletion sample/sample.iml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="com.arasthel" external.system.module.version="1.1.1" type="JAVA_MODULE" version="4">
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="com.arasthel" external.system.module.version="1.1.3" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
Expand Down

0 comments on commit 09187cf

Please sign in to comment.