@Override
    public boolean visitStringLiteral(StringLiteral node) {
      String s = node.astValue();
      // Other potential String prefixes to check for:
      //    /mnt/sdcard/
      //    /system/media/sdcard
      //    file://sdcard
      //    file:///sdcard
      if (s.startsWith("/sdcard")) { // $NON-NLS-1$
        String message =
            "Do not hardcode \"/sdcard/\"; "
                + "use Environment.getExternalStorageDirectory().getPath() instead";
        Location location = mContext.getLocation(node);
        mContext.report(ISSUE, node, location, message, s);
      }

      return false;
    }
Ejemplo n.º 2
0
 @Override
 public JCTree visitStringLiteral(final lombok.ast.StringLiteral node, final Void p) {
   final JCLiteral literal = setGeneratedBy(M(node).Literal(node.getString()), source);
   return literal;
 }