Java, typeres: move method typeresolution methods into a helper class

This commit is contained in:
Bendegúz Nagy
2017-07-11 10:35:15 +02:00
parent 2a7fbc1d43
commit 4728eff5d6
3 changed files with 515 additions and 472 deletions

View File

@ -5,6 +5,7 @@
package net.sourceforge.pmd.lang.java.typeresolution;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Collections;
import java.util.List;
@ -37,7 +38,19 @@ public class MethodType {
return method;
}
public boolean isVararg() {
return method.isVarArgs();
}
public JavaTypeDefinition getVarargComponentType() {
if (!isVararg()) {
throw new IllegalStateException("Method is not vararg: " + method.toString() + "!");
}
return argTypes.get(argTypes.size() - 1).getComponentType();
}
public boolean isAbstract() {
return Modifier.isAbstract(method.getModifiers());
}
}