Java 类java.lang.Deprecated 实例源码

项目:wava    文件:TestTypeSpec.java   
@Test
public void innerAnnotationInAnnotationDeclaration()
        throws Exception
{
    TypeSpec bar = TypeSpec.annotationBuilder("Bar")
            .addMethod(MethodSpec.methodBuilder("value")
                    .addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT)
                    .defaultValue("@$T", Deprecated.class)
                    .returns(Deprecated.class)
                    .build())
            .build();

    assertThat(toString(bar)).isEqualTo(""
            + "package com.squareup.tacos;\n"
            + "\n"
            + "import java.lang.Deprecated;\n"
            + "\n"
            + "@interface Bar {\n"
            + "  Deprecated value() default @Deprecated;\n"
            + "}\n"
    );
}
项目:wava    文件:TestTypeSpec.java   
@Test
public void multipleAnnotationAddition()
{
    TypeSpec taco = TypeSpec.classBuilder("Taco")
            .addAnnotations(Arrays.asList(
                    AnnotationSpec.builder(SuppressWarnings.class)
                            .addMember("value", "$S", "unchecked")
                            .build(),
                    AnnotationSpec.builder(Deprecated.class).build()))
            .build();
    assertThat(toString(taco)).isEqualTo(""
            + "package com.squareup.tacos;\n"
            + "\n"
            + "import java.lang.Deprecated;\n"
            + "import java.lang.SuppressWarnings;\n"
            + "\n"
            + "@SuppressWarnings(\"unchecked\")\n"
            + "@Deprecated\n"
            + "class Taco {\n"
            + "}\n");
}
项目:javapoet    文件:TypeSpecTest.java   
/** https://github.com/square/javapoet/issues/253 */
@Test public void enumWithAnnotatedValues() throws Exception {
  TypeSpec roshambo = TypeSpec.enumBuilder("Roshambo")
      .addModifiers(Modifier.PUBLIC)
      .addEnumConstant("ROCK", TypeSpec.anonymousClassBuilder("")
          .addAnnotation(Deprecated.class)
          .build())
      .addEnumConstant("PAPER")
      .addEnumConstant("SCISSORS")
      .build();
  assertThat(toString(roshambo)).isEqualTo(""
      + "package com.squareup.tacos;\n"
      + "\n"
      + "import java.lang.Deprecated;\n"
      + "\n"
      + "public enum Roshambo {\n"
      + "  @Deprecated\n"
      + "  ROCK,\n"
      + "\n"
      + "  PAPER,\n"
      + "\n"
      + "  SCISSORS\n"
      + "}\n");
}
项目:javapoet    文件:TypeSpecTest.java   
@Test public void innerAnnotationInAnnotationDeclaration() throws Exception {
  TypeSpec bar = TypeSpec.annotationBuilder("Bar")
      .addMethod(MethodSpec.methodBuilder("value")
          .addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT)
          .defaultValue("@$T", Deprecated.class)
          .returns(Deprecated.class)
          .build())
      .build();

  assertThat(toString(bar)).isEqualTo(""
      + "package com.squareup.tacos;\n"
      + "\n"
      + "import java.lang.Deprecated;\n"
      + "\n"
      + "@interface Bar {\n"
      + "  Deprecated value() default @Deprecated;\n"
      + "}\n"
  );
}
项目:javapoet    文件:TypeSpecTest.java   
@Test public void multipleAnnotationAddition() {
  TypeSpec taco = TypeSpec.classBuilder("Taco")
      .addAnnotations(Arrays.asList(
          AnnotationSpec.builder(SuppressWarnings.class)
              .addMember("value", "$S", "unchecked")
              .build(),
          AnnotationSpec.builder(Deprecated.class).build()))
      .build();
  assertThat(toString(taco)).isEqualTo(""
      + "package com.squareup.tacos;\n"
      + "\n"
      + "import java.lang.Deprecated;\n"
      + "import java.lang.SuppressWarnings;\n"
      + "\n"
      + "@SuppressWarnings(\"unchecked\")\n"
      + "@Deprecated\n"
      + "class Taco {\n"
      + "}\n");
}
项目:GitHub    文件:GlideApp.java   
/**
 * @see Glide#init(Glide)
 */
@Deprecated
@VisibleForTesting
@SuppressLint("VisibleForTests")
public static void init(Glide glide) {
  Glide.init(glide);
}
项目:wava    文件:TestTypeSpec.java   
/**
 * https://github.com/square/javapoet/issues/253
 */
@Test
public void enumWithAnnotatedValues()
        throws Exception
{
    TypeSpec roshambo = TypeSpec.enumBuilder("Roshambo")
            .addModifiers(Modifier.PUBLIC)
            .addEnumConstant("ROCK", TypeSpec.anonymousClassBuilder("")
                    .addAnnotation(Deprecated.class)
                    .build())
            .addEnumConstant("PAPER")
            .addEnumConstant("SCISSORS")
            .build();
    assertThat(toString(roshambo)).isEqualTo(""
            + "package com.squareup.tacos;\n"
            + "\n"
            + "import java.lang.Deprecated;\n"
            + "\n"
            + "public enum Roshambo {\n"
            + "  @Deprecated\n"
            + "  ROCK,\n"
            + "\n"
            + "  PAPER,\n"
            + "\n"
            + "  SCISSORS\n"
            + "}\n");
}
项目:intellij-pants-plugin    文件:HelloWorld.java   
@Deprecated
public static deprecatedMethod() {
  /* bad code to generate warnings and errors */
  int unusedVar;
  if (1 == 2) {
  /* missed bracket: } */
}
项目:GitHub    文件:GlideRequest.java   
@Override
@Deprecated
@CheckResult
public GlideRequest<TranscodeType> load(@Nullable URL arg0) {
  return (GlideRequest<TranscodeType>) super.load(arg0);
}
项目:GitHub    文件:GlideRequest.java   
@Override
@Deprecated
@CheckResult
public GlideRequest<TranscodeType> load(@Nullable URL arg0) {
  return (GlideRequest<TranscodeType>) super.load(arg0);
}
项目:GitHub    文件:GlideRequest.java   
@Override
@Deprecated
@CheckResult
public GlideRequest<TranscodeType> load(@Nullable URL arg0) {
  return (GlideRequest<TranscodeType>) super.load(arg0);
}
项目:GitHub    文件:GlideRequest.java   
@Override
@Deprecated
@CheckResult
public GlideRequest<TranscodeType> load(@Nullable URL arg0) {
  return (GlideRequest<TranscodeType>) super.load(arg0);
}
项目:GitHub    文件:GlideRequest.java   
@Override
@Deprecated
@CheckResult
public GlideRequest<TranscodeType> load(@Nullable URL arg0) {
  return (GlideRequest<TranscodeType>) super.load(arg0);
}
项目:GitHub    文件:GlideRequest.java   
@Override
@Deprecated
@CheckResult
public GlideRequest<TranscodeType> load(@Nullable URL arg0) {
  return (GlideRequest<TranscodeType>) super.load(arg0);
}
项目:GitHub    文件:GlideRequest.java   
@Override
@Deprecated
@CheckResult
public GlideRequest<TranscodeType> load(@Nullable URL arg0) {
  return (GlideRequest<TranscodeType>) super.load(arg0);
}
项目:GitHub    文件:GlideRequest.java   
@Override
@Deprecated
@CheckResult
public GlideRequest<TranscodeType> load(@Nullable URL arg0) {
  return (GlideRequest<TranscodeType>) super.load(arg0);
}
项目:GitHub    文件:GlideRequest.java   
@Override
@Deprecated
@CheckResult
public GlideRequest<TranscodeType> load(@Nullable URL arg0) {
  return (GlideRequest<TranscodeType>) super.load(arg0);
}
项目:GitHub    文件:GlideRequest.java   
@Override
@Deprecated
@CheckResult
public GlideRequest<TranscodeType> load(@Nullable URL arg0) {
  return (GlideRequest<TranscodeType>) super.load(arg0);
}
项目:GitHub    文件:GlideRequest.java   
@Override
@Deprecated
@CheckResult
public GlideRequest<TranscodeType> load(@Nullable URL arg0) {
  return (GlideRequest<TranscodeType>) super.load(arg0);
}
项目:GitHub    文件:GlideRequest.java   
@Override
@Deprecated
@CheckResult
public GlideRequest<TranscodeType> load(@Nullable URL arg0) {
  return (GlideRequest<TranscodeType>) super.load(arg0);
}
项目:GitHub    文件:GlideRequest.java   
@Override
@Deprecated
@CheckResult
public GlideRequest<TranscodeType> load(@Nullable URL arg0) {
  return (GlideRequest<TranscodeType>) super.load(arg0);
}
项目:GitHub    文件:GlideRequest.java   
@Override
@Deprecated
@CheckResult
public GlideRequest<TranscodeType> load(@Nullable URL arg0) {
  return (GlideRequest<TranscodeType>) super.load(arg0);
}
项目:apollo-android    文件:TestQuery.java   
public Friend2(@Nonnull String __typename, @Nonnull String id,
    @Nonnull @Deprecated String deprecated) {
  this.__typename = Utils.checkNotNull(__typename, "__typename == null");
  this.id = Utils.checkNotNull(id, "id == null");
  this.deprecated = Utils.checkNotNull(deprecated, "deprecated == null");
}
项目:apollo-android    文件:TestQuery.java   
public Friend5(@Nonnull String __typename, @Nonnull String id,
    @Nonnull @Deprecated String deprecated) {
  this.__typename = Utils.checkNotNull(__typename, "__typename == null");
  this.id = Utils.checkNotNull(id, "id == null");
  this.deprecated = Utils.checkNotNull(deprecated, "deprecated == null");
}
项目:apollo-android    文件:TestQuery.java   
public Hero(@Nonnull String __typename, @Nonnull String name,
    @Nonnull @Deprecated String deprecated) {
  this.__typename = Utils.checkNotNull(__typename, "__typename == null");
  this.name = Utils.checkNotNull(name, "name == null");
  this.deprecated = Utils.checkNotNull(deprecated, "deprecated == null");
}
项目:thesis-disassembler    文件:EmptyDeprecatedClass.java   
@Deprecated
public void deprecatedMethod() {
    System.out.println("DEPRECATED");
}
项目:apollo-android    文件:TestQuery.java   
/**
 * Test deprecated field
 * @deprecated For test purpose only
 */
public @Nonnull @Deprecated String deprecated() {
  return this.deprecated;
}
项目:apollo-android    文件:TestQuery.java   
/**
 * Test deprecated field
 * @deprecated For test purpose only
 */
public @Nonnull @Deprecated String deprecated() {
  return this.deprecated;
}
项目:apollo-android    文件:TestQuery.java   
/**
 * Test deprecated field
 * @deprecated For test purpose only
 */
public @Nonnull @Deprecated String deprecated() {
  return this.deprecated;
}