Skip to content

Commit

Permalink
switched from com.sun.tools to javax for openjdk compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
buremba committed Apr 1, 2015
1 parent 30d2eeb commit 39f0de7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/java/org/rakam/server/http/HttpServiceProcessor.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.rakam.server.http;

import com.sun.tools.javac.code.Type;
import org.rakam.server.http.annotations.JsonRequest;

import javax.annotation.processing.AbstractProcessor;
Expand All @@ -10,6 +9,7 @@
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.type.TypeKind;
import javax.tools.Diagnostic;
Expand Down Expand Up @@ -48,12 +48,14 @@ public boolean process(Set<? extends TypeElement> typeElements, RoundEnvironment
JsonRequest.class.getCanonicalName(),
Path.class.getCanonicalName()));
}
if(((Type.MethodType) element.asType()).getReturnType().getKind() == TypeKind.VOID) {

// we know that JsonRequest can only be used in method declarations so the Type must be ExecutableElement
if(((ExecutableElement) element.asType()).getReturnType().getKind() == TypeKind.VOID) {
messager.printMessage(Diagnostic.Kind.ERROR, format("%s method can't have void return type because it has %s annotation",
element.toString(),
JsonRequest.class.getCanonicalName()));
}
if(((Type.MethodType) element.asType()).getParameterTypes().size() != 1) {
if(((ExecutableElement) element.asType()).getParameters().size() != 1) {
messager.printMessage(Diagnostic.Kind.ERROR, format("%s method must have exactly one parameter because it has %s annotation",
element.toString(),
JsonRequest.class.getCanonicalName()));
Expand Down

0 comments on commit 39f0de7

Please sign in to comment.