File tree Expand file tree Collapse file tree 4 files changed +26
-2
lines changed
Expand file tree Collapse file tree 4 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ notifications:
88 on_failure : always # options: [always|never|change] default: always
99 on_start : false # default: false
1010jdk :
11- - oraclejdk7
11+ - oraclejdk8
1212install : ./installViaTravis.sh
1313script : ./buildViaTravis.sh
1414cache :
Original file line number Diff line number Diff line change @@ -10,3 +10,8 @@ dependencies {
1010 testCompile ' com.google.code.gson:gson:2.5' // for example
1111 testCompile ' org.springframework:spring-context:4.2.5.RELEASE' // for example
1212}
13+
14+ configure(compileTestJava) {
15+ sourceCompatibility = 1.8
16+ targetCompatibility = 1.8
17+ }
Original file line number Diff line number Diff line change 1717
1818import java .lang .annotation .Annotation ;
1919import java .lang .reflect .Method ;
20+ import java .lang .reflect .Modifier ;
2021import java .net .URI ;
2122import java .util .ArrayList ;
2223import java .util .Collection ;
@@ -55,7 +56,8 @@ public List<MethodMetadata> parseAndValidatateMetadata(Class<?> targetType) {
5556 }
5657 Map <String , MethodMetadata > result = new LinkedHashMap <String , MethodMetadata >();
5758 for (Method method : targetType .getMethods ()) {
58- if (method .getDeclaringClass () == Object .class ) {
59+ if (method .getDeclaringClass () == Object .class ||
60+ (method .getModifiers () & Modifier .STATIC ) != 0 ) {
5961 continue ;
6062 }
6163 MethodMetadata metadata = parseAndValidateMetadata (targetType , method );
Original file line number Diff line number Diff line change @@ -693,4 +693,21 @@ public void missingMethod() throws Exception {
693693
694694 contract .parseAndValidatateMetadata (MissingMethod .class );
695695 }
696+
697+ interface StaticMethodOnInterface {
698+ @ RequestLine ("GET /api/{key}" )
699+ String get (@ Param ("key" ) String key );
700+
701+ static String staticMethod () {
702+ return "value" ;
703+ }
704+ }
705+
706+ @ Test
707+ public void staticMethodsOnInterfaceIgnored () throws Exception {
708+ List <MethodMetadata > mds = contract .parseAndValidatateMetadata (StaticMethodOnInterface .class );
709+ assertThat (mds ).hasSize (1 );
710+ MethodMetadata md = mds .get (0 );
711+ assertThat (md .configKey ()).isEqualTo ("StaticMethodOnInterface#get(String)" );
712+ }
696713}
You can’t perform that action at this time.
0 commit comments