Permalink
Browse files

better validation, #38.

  • Loading branch information...
1 parent 15d267c commit fe1f8d8619ef753355289716d8b6fcd5f5970922 @junkdog committed Nov 23, 2013
Showing with 2 additions and 10 deletions.
  1. +1 −0 .gitignore
  2. +1 −10 artemis-validator/src/main/java/com/artemis/ComponentValidatorProcessor.java
View
@@ -10,4 +10,5 @@ target/
.classpath
.project
.settings/
+.factorypath
@@ -9,7 +9,6 @@
import static javax.lang.model.util.ElementFilter.fieldsIn;
import static javax.lang.model.util.ElementFilter.typesIn;
import static javax.tools.Diagnostic.Kind.ERROR;
-import static javax.tools.Diagnostic.Kind.MANDATORY_WARNING;
import java.util.HashSet;
import java.util.Set;
@@ -69,7 +68,7 @@ private void ensureAllFieldsAreOfSameType(TypeElement type) {
if (types.size() > 1) {
Messager messager = processingEnv.getMessager();
- messager.printMessage(ERROR, "All fields must be of same type, found: " + types);
+ messager.printMessage(ERROR, "All fields must be of same type, found: " + types, type);
}
}
@@ -110,21 +109,13 @@ private void ensureAllInstanceFieldsArePrivate(TypeElement component) {
private void pooledComponentCheck(TypeElement component) {
ensureZeroArgConstructor(component);
ensureNoFinalInstanceFields(component);
- checkIfPooledCanBePacked(component);
}
@Override
public SourceVersion getSupportedSourceVersion() {
return SourceVersion.latestSupported();
}
- private void checkIfPooledCanBePacked(TypeElement component) {
- if (fieldsIn(component.getEnclosedElements()).isEmpty()) {
- Messager messager = processingEnv.getMessager();
- messager.printMessage(MANDATORY_WARNING, "Component can safely be converted to PackedComponent.", component);
- }
- }
-
private void ensureZeroArgConstructor(TypeElement component) {
for (ExecutableElement constructor : constructorsIn(component.getEnclosedElements())) {
if (constructor.getParameters().isEmpty())

0 comments on commit fe1f8d8

Please sign in to comment.