/** @inheritDoc */ @Override public VariableSlot getVariableSlot(final AnnotatedTypeMirror atm) { AnnotationMirror annot = atm.getAnnotationInHierarchy(this.varAnnot); if (annot == null) { annot = atm.getAnnotationInHierarchy(this.unqualified); if (annot == null) { if (InferenceMain.isHackMode()) { return null; } ErrorReporter.errorAbort("Missing VarAnnot annotation: " + atm); } } return (VariableSlot) getSlot(annot); }
/** @inheritDoc */ @Override public Slot getSlot(final AnnotationMirror annotationMirror) { final int id; if (InferenceQualifierHierarchy.isVarAnnot(annotationMirror)) { if (annotationMirror.getElementValues().isEmpty()) { return null; // TODO: should we instead throw an exception? } else { final AnnotationValue annoValue = annotationMirror.getElementValues().values().iterator().next(); id = Integer.valueOf(annoValue.toString()); } return getVariable(id); } else { if (constantStore != null) { return constantStore.get(AnnotationUtils.annotationName(annotationMirror)); } else { for (Class<? extends Annotation> realAnno : realQualifiers) { if (AnnotationUtils.areSameByClass(annotationMirror, realAnno)) { return new ConstantSlot(annotationMirror, nextId()); } } } } if (InferenceMain.isHackMode()) { return new ConstantSlot( InferenceMain.getInstance() .getRealTypeFactory() .getQualifierHierarchy() .getTopAnnotations() .iterator() .next(), nextId()); } ErrorReporter.errorAbort( annotationMirror + " is a type of AnnotationMirror not handled by getVariableSlot."); return null; // Dead }