@Override public Void visitLiteral(LiteralTree tree, AnnotatedTypeMirror type) { if (!type.isAnnotatedInHierarchy(LOCALIZED)) { if (tree.getKind() == Tree.Kind.STRING_LITERAL && tree.getValue().equals("")) { type.addAnnotation(LOCALIZED); } } return super.visitLiteral(tree, type); }
@Override public Void visitLiteral(LiteralTree tree, AnnotatedTypeMirror type) { if (!type.isAnnotatedInHierarchy(theAnnot) && tree.getKind() == Tree.Kind.STRING_LITERAL && strContains(lookupKeys, tree.getValue().toString())) { type.addAnnotation(theAnnot); } // A possible extension is to record all the keys that have been used and // in the end output a list of keys that were not used in the program, // possibly pointing to the opposite problem, keys that were supposed to // be used somewhere, but have not been, maybe because of copy-and-paste errors. return super.visitLiteral(tree, type); }
protected static void abortIfTypeIsExecutable( final AnnotatedTypeFactory typeFactory, final Tree tree, final AnnotatedTypeMirror type) { if (type.getKind() == TypeKind.EXECUTABLE) { ErrorReporter.errorAbort( "Unexpected Executable typekind:\n" + summarize(typeFactory, tree, type)); } }
protected static void ifExecutableCheckElement( final AnnotatedTypeFactory typeFactory, final Tree tree, final AnnotatedTypeMirror type) { if (type.getKind() == TypeKind.EXECUTABLE) { if (((AnnotatedExecutableType) type).getElement() == null) { ErrorReporter.errorAbort( "Executable has no element:\n" + summarize(typeFactory, tree, type)); } } }
@Override public Void visitCompoundAssignment(CompoundAssignmentTree node, AnnotatedTypeMirror type) { type.removeAnnotation(LOCALIZED); return null; }
@Override public Void visitBinary(BinaryTree tree, AnnotatedTypeMirror type) { type.removeAnnotation(LOCALIZED); return null; }
// Result of unary op might not be a property key. @Override public Void visitCompoundAssignment(CompoundAssignmentTree node, AnnotatedTypeMirror type) { type.removeAnnotation(theAnnot); return null; // super.visitCompoundAssignment(node, type); }
// Result of binary op might not be a property key. @Override public Void visitBinary(BinaryTree node, AnnotatedTypeMirror type) { type.removeAnnotation(theAnnot); return null; // super.visitBinary(node, type); }