Skip to content

Commit

Permalink
fixed for JDK 8
Browse files Browse the repository at this point in the history
  • Loading branch information
musketyr committed Nov 21, 2015
1 parent b994a2b commit e97f037
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
language: java
jdk:
- oraclejdk8
- oraclejdk7
- openjdk6
script:
- "./gradlew test"
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ apply plugin: 'java'
group = 'org.duckapter'
version = '0.8.0'

sourceCompatibility=1.6
targetCompatibility=1.6

repositories {
mavenCentral()
Expand Down
26 changes: 10 additions & 16 deletions src/main/java/org/duckapter/adapted/AdaptedClassImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ final class AdaptedClassImpl<O, D> extends AbstractAdaptedClass<O, D> implements
}

private AdaptedClass<O, D> getDetailedClass() {
if (detailed == true) {
if (detailed) {
return this;
}
if (detailedClass == null) {
Expand Down Expand Up @@ -168,33 +168,27 @@ private D createProxyFor(InvocationHandler handler) {
try {
return (D) proxyClassConstructor.newInstance(handler);
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
throw new IllegalStateException("Cannot create proxy!", e);
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
throw new IllegalStateException("Cannot create proxy!", e);
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
throw new IllegalStateException("Cannot create proxy!", e);
} catch (InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
throw new IllegalStateException("Cannot create proxy!", e);
}
throw new IllegalStateException("Cannot create proxy!");

}

private void initProxyConstructor() {
Class<?> proxyClass = Proxy.getProxyClass(AdaptedClassImpl.class
.getClassLoader(), getDuckInterface());
try {
proxyClassConstructor = proxyClass
.getConstructor(InvocationHandler.class);
proxyClassConstructor = proxyClass.getConstructor(InvocationHandler.class);
proxyClassConstructor.setAccessible(true);
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
throw new IllegalStateException("Cannot init proxy constructor!", e);
} catch (NoSuchMethodException e) {
// TODO Auto-generated catch block
e.printStackTrace();
throw new IllegalStateException("Cannot init proxy constructor!", e);
}
}

Expand Down

0 comments on commit e97f037

Please sign in to comment.